@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-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;

  .js .js-animation-row & {
    opacity: 0;
    will-change: opacity;
  }

  .js .js-animation-row.is-show & {
    opacity: 1;
  }
}

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

  .js .js-animation-row & {
    opacity: 0;
    will-change: transform, opacity;
  }

  .js .js-animation-row.is-show & {
    animation: fade-in 0.2s 0.7s 1 both;
  }
}

.card-date {
  display: inline-block;
  margin: 0 0 0.25rem;
  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 1.5rem;
  font-size: map.get(global.$font-scales, body-m);
  line-height: global.$line-height-lg;

  .js .js-animation-row & {
    opacity: 0;
  }

  .js .js-animation-row.is-show & {
    animation: fade-in 0.2s 1s 1 both;
  }
}

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

  .js .js-animation-row & {
    opacity: 0;
    will-change: transform, opacity;
  }

  .js .js-animation-row.is-show & {
    animation: fade-in 0.2s 1.2s 1 both;
  }
}

.card-footer {
  margin-top: auto;
  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 {
  margin: 0 1rem 0 0;
  border-radius: global.$border-radius-circle;
}

.card-scrollbar {
  position: relative;
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: global.$color-gray40;
  border-radius: 4px;
}

.card-scrollbar-thumb {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  min-width: 50px;
  background-color: global.$color-primary;
}

@media screen and (max-width: acms.$breakpoint-md-max) {
  .card-carousel {
    margin-right: -1rem;
    overflow-x: auto;

    .card-list {
      flex-wrap: nowrap;
      margin-bottom: 0;
    }

    .card-item {
      margin-bottom: 0;
    }

    .card-link {
      width: 200px;
    }
  }
}

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

  .card-scrollbar {
    display: none;
  }
}

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

/* ボーダー付きカード */
.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;

  .js .js-animation-row & {
    opacity: 0;
  }

  .js .js-animation-row.is-show & {
    opacity: 1;
  }
}

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

  .js .js-animation-row & {
    opacity: 0;
    will-change: transform, opacity;
  }

  .js .js-animation-row.is-show & {
    animation: fade-in 0.2s 1.2s 1 both;
  }
}

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