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

/* ------------------------------
　　カード
------------------------------ */
.card-list {
  display: flex;
  flex-wrap: wrap;
  margin: 0 math.div(acms.$unit-gutter, -2) 1.25rem;
  padding: 0;
  list-style: none;
}

.card-list.-carousel {
  flex-wrap: nowrap;

  .card-item {
    width: 16rem;
    margin-bottom: 0;
  }
}

.card-item {
  display: flex;
  margin: 0 0 2rem;
}

.card-item-inner {
  display: flex;
}

.card {
  display: flex;
  width: 100%;
}

@media all and (-ms-high-contrast: none) {
  *::-ms-backdrop,
  .card {
    display: block;
  }
}

.card-link {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  text-decoration: none;

  @include global.link-card(global.$color-text);

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

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

.card-img-wrap {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin: 0 0 1.25rem;
  overflow: hidden;
  border-radius: global.$border-radius-lg;
}

.card-img {
  width: 100%;
  transition: 0.4s 0.2s ease-out;
  will-change: transform;
}

.card-title,
.#{acms.$entry-class} .card-title {
  margin: 0 0 1rem;
  color: global.$color-black;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: global.$line-height-base;
}

.card-date {
  display: inline-block;
  margin: 0 1em 0.25rem 0;
  color: global.$color-gray90;
  font-size: map.get(global.$font-scales, body-s);
}

.card-badge-news {
  margin: 0 0 0 0.5rem;
  font-weight: bold;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-ss;
}

.card-text,
.#{acms.$entry-class} .card-text {
  margin: 0 0 1rem;
  font-size: map.get(global.$font-scales, body-m);
  line-height: global.$line-height-lg;
}

.card-text + .card-tag {
  margin-top: -0.5rem;
}

.card-action {
  margin-top: auto;
}

.card-read-more,
.#{acms.$entry-class} .card-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-weight: bold;
  font-size: map.get(global.$font-scales, body-m);

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

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

    display: inline-block;
    margin: 0 0 0 0.5rem;
    content: "";
  }
}

.card-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: global.$border-width-sm solid global.$color-gray30;
}

.card-author {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: map.get(global.$font-scales, body-m);
}

.card-author-img,
.js-carousel-card .card-author-img {
  margin: 0 1rem 0 0;
  border-radius: global.$border-radius-circle;
}

@media screen and (min-width: acms.$breakpoint-md-min) {
  .card-img-wrap {
    margin: 0 0 1rem;

    .card.is-lg & {
      margin: 0 0 2rem;
    }

    .card-read-more,
    .#{acms.$entry-class} .card-read-more {
      font-size: map.get(global.$font-scales, body-m);

      &::before {
        bottom: -0.5rem;
      }
    }
  }

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

    .card.is-lg & {
      font-size: map.get(global.$font-scales, heading-ss);
    }
  }

  .card-text {
    margin: 0 0 1.5rem;
    font-size: map.get(global.$font-scales, body-m);

    .card.is-lg & {
      margin: 0 0 2rem;
    }
  }
}

@media screen and (min-width: acms.$breakpoint-lg-min) {
  .card-list {
    margin-bottom: 2rem;
  }

  .card-list.-carousel {
    flex-wrap: wrap;

    .card-item {
      width: 25%;
    }
  }
}

/* ボーダー付きカード */
.card-bordered-list {
  display: flex;
  flex-wrap: wrap;
  margin: 0 (math.div(global.$col-gutter, -2));
  padding: 0;
  list-style: none;
}

.card-bordered-item {
  display: flex;
  margin: 0 0 2rem;
}

.card-bordered {
  width: 100%;
}

.card-bordered-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-decoration: none;
  border-radius: global.$border-radius-lg;
  box-shadow: global.$elevation02;

  @include global.link-card(global.$color-text);

  @media (hover: hover) {
    &:hover {
      box-shadow: global.$elevation10;

      .card-bordered-img {
        transform: scale(1.2);
      }

      .card-bordered-read-more {
        &::before {
          transform: scaleX(1);
        }
      }
    }
  }
}

.card-bordered-img-wrap {
  margin: 0;
  overflow: hidden;
  border-radius: global.$border-radius-lg global.$border-radius-lg 0 0;
}

.card-bordered-img {
  width: 100%;
  transition: 0.4s 0.2s ease-out;
  will-change: transform;
}

.card-bordered-title,
.#{ acms.$entry-class } .card-bordered-title {
  margin: 0 0 1rem;
  color: global.$color-black;
  font-size: map.get(global.$font-scales, body-m);
  line-height: global.$line-height-sm;
}

.card-bordered-read-more,
.#{acms.$entry-class} .card-bordered-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-weight: bold;
  font-size: map.get(global.$font-scales, body-m);

  &::before {
    position: absolute;
    right: 0;
    bottom: -0.25rem;
    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;
    content: "";

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

.card-bordered-text-inline {
  display: flex;
  align-items: center;
  padding: 1rem;

  .card-bordered-title,
  .#{acms.$entry-class} .card-bordered-title,
  .card-bordered-text,
  .card-bordered-read-more {
    margin: 0;
  }

  .card-bordered-read-more {
    margin-left: auto;
  }
}

@media screen and (min-width: acms.$breakpoint-md-min) {
  .card-bordered-text-inline {
    display: flex;
    padding: 1.5rem;
  }

  .card-bordered-title,
  .#{ acms.$entry-class } .card-bordered-title {
    margin: 0;
    font-size: map.get(global.$font-scales, heading-ss);
  }

  .card-bordered-text {
    margin: 0 0 2rem;
    font-size: map.get(global.$font-scales, body-m);
  }
  .card-bordered-read-more,
  .#{acms.$entry-class} .card-bordered-read-more {
    font-size: map.get(global.$font-scales, body-m);

    &::before {
      bottom: -0.5rem;
    }
  }
}

@media screen and (min-width: acms.$breakpoint-lg-min) {
  .card-bordered-text-inline {
    padding: 2rem;
  }
}
