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

/* ------------------------------
　　メディア
------------------------------ */
.media-list {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0;
  margin-bottom: 2rem;
  padding: 0;
  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;
  color: global.$color-gray90;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-base;
}

.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;
  color: global.$color-text-side;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-base;
}

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

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

  &::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;
}

@media screen and (min-width: acms.$breakpoint-sm-min) {
  .media-list {
    display: block;
  }

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

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

  .media-item {
    margin: 0;
  }

  .media-item-header {
    grid-column: 1;
    grid-row: 1;
    padding: 0 global.$col-gutter 0 0;
  }

  .media-item-body {
    grid-column: 1;
    grid-row: 2;
    padding: 0 global.$col-gutter 0 0;
  }

  .media-item-img {
    grid-column: list.slash(2, 3);
    grid-row: list.slash(1, 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;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min) {
  .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;
  margin: 0 1.5rem 0 16px;
  padding: 0 0 0 16px;
  color: global.$color-gray90;
  font-size: map.get(global.$font-scales, body-s);

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

.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;
}
