@use "sass:list";
@use "sass:map";
@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
　　メディア
------------------------------ */
.media-list {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin-top: 0;
  margin-bottom: 2rem;
  list-style: none;
}

.media-item {
  margin: 0 0 1.5rem;
}

.media-list .media-item:first-child .media-link {
  padding-top: 1rem;
}

.media-link {
  display: block;
  padding: 0 0 1.5rem;
  color: global.$color-text;
  text-decoration: none;
  border-bottom: global.$border-width-sm solid global.$color-gray30;

  &:link,
  &:hover,
  &:active,
  &:visited,
  &:focus {
    color: global.$color-text;
  }

  &:hover {
    .media-img {
      transform: scale(1.2);
    }
  }

  &:hover {
    .media-read-more {
      &::before {
        transform: scaleX(1);
      }
    }
  }
}

.media-list .media-item:first-child .media-link {
  padding-top: 0;
}

.media-time {
  display: inline-block;
  margin: 0 0 0.25rem;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-base;
  color: global.$color-gray90;
}

.media-title {
  margin: 0 0 1.25rem;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: global.$line-height-base;
}

.media-item-img {
  margin: 0 0 1.25rem;
}

.media-img-wrap {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: global.$border-radius-lg;
}

.media-img {
  transition: transform 0.4s ease-in-out;
  will-change: transform;
}

.media-text {
  margin: 0 0 1.25rem;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-base;
  color: global.$color-text-side;
}

.media-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0.5rem 0 0;
  font-size: map.get(global.$font-scales, body-m);
  font-weight: bold;

  &::before {
    position: absolute;
    right: 0;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    content: "";
    background-color: global.$color-secondary;
    transition: transform 0.3s ease;
    transform: scaleX(0);
    transform-origin: left;
  }

  &::after {
    margin: 0 0 0 0.5rem;

    @include global.arrow-circle($size: ss,$color-bg:global.$color-secondary,$color-line:white);

    content: "";
  }
}

.media-tag-wrap {
  margin: 1.25rem 0 0;
}

@include acms.media-breakpoint-up(sm) {
  .media-list {
    display: block;
  }

  .media-link {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr 180px;
    padding: 1.25rem 0;

    &.is-noimage {
      grid-template-columns: auto;
    }
  }

  .media-item {
    margin: 0;
  }

  .media-item-header {
    grid-row: 1;
    grid-column: 1;
    padding: 0 var(--theme-gap-x) 0 0;
  }

  .media-item-body {
    grid-row: 2;
    grid-column: 1;
    padding: 0 var(--theme-gap-x) 0 0;
  }

  .media-item-img {
    grid-row: list.slash(1, 3);
    grid-column: list.slash(2, 3);
    margin: 0;
  }

  .media-time {
    margin: 0 0 0.5rem;
    font-size: map.get(global.$font-scales, body-m);
  }

  .media-title {
    margin: 0 0 1.25rem;
    font-size: map.get(global.$font-scales, heading-ss);

    &::before {
      content: none;
    }
  }

  .media-tag-wrap {
    margin: 2rem 0 0;
  }
}

@include acms.media-breakpoint-up(md) {
  .media-link {
    grid-template-columns: 1fr 280px;
    padding: 1.5rem 0;
  }

  .media-title {
    font-size: map.get(global.$font-scales, heading-s);
  }

  .media-text {
    font-size: map.get(global.$font-scales, body-m);
  }
}

/* 記事情報 */
.media-header-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 0.25rem;
}

.media-time {
  margin: 0;
  font-size: map.get(global.$font-scales, body-s);
}

.media-category {
  position: relative;
  padding: 0 0 0 16px;
  margin: 0 1.5rem 0 16px;
  font-size: map.get(global.$font-scales, body-s);
  color: global.$color-gray90;

  &::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 1em;
    content: "";
    background: global.$color-gray60;
    transform: translateY(-50%);
  }
}

.media-text {
  line-height: 1.7;
}

/* 著者情報 */
.media-user {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

.media-user-icon {
  width: 32px;
  height: 32px;
  margin-right: 1rem;
  overflow: hidden;
  border-radius: 50%;
}

.media-user-name {
  margin: 0;
  color: global.$color-gray90;
}
