@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) 20px;
  padding: 0;
  list-style: none;
}

.card-item {
  display: flex;
  margin: 0 0 30px;
}

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

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

  &: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 20px;
  overflow: hidden;
  border-radius: global.$border-radius-lg;
}

.card-img {
  transition: .4s .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 15px;
  color: global.$color-black;
  line-height: 1.3;

  @include acms.font-size(18);

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

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

.card-time {
  display: inline-block;
  margin: 0 0 5px;

  @include acms.font-size(16);

  color: global.$color-gray90;
}

.card-badge-news {
  @include acms.font-size(12);

  margin: 0 0 0 10px;
  font-weight: bold;
  line-height: 1;
}

.card-text,
.#{acms.$entry-class} .card-text {
  margin: 0 0 25px;
  line-height: 1.7;

  @include acms.font-size(14);

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

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

.card-read-more,
.#{acms.$entry-class} .card-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;

  @include acms.font-size(16);

  font-weight: bold;

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

  &::after {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0 0 0 10px;
    background: global.$color-secondary no-repeat;
    background-image: url(#{global.$root-theme-img + 'arrow-border-white.svg' });
    background-position: center;
    background-size: 5px 10px;
    border-radius: global.$border-radius-circle;
    content: "";
  }

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

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

.card-footer {
  margin-top: auto;
  padding: 10px 0;
  border-top: global.$border-width-sm solid global.$color-gray30;
}

.card-author {
  display: flex;
  align-items: center;
  margin: 0;

  @include acms.font-size(16);
}

.card-author-img {
  margin: 0 10px 0 0;
  border-radius: global.$border-radius-circle;
}

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

    .card.is-lg & {
      margin: 0 0 30px;
    }
  }

  .card-title {
    margin: 0 0 15px;

    @include acms.font-size(20);

    .card.is-lg & {
      @include acms.font-size(24);
    }
  }

  .card-text {
    margin: 0 0 25px;

    @include acms.font-size(16);

    .card.is-lg & {
      margin: 0 0 35px;
    }
  }

  .card-read-more,
  .#{acms.$entry-class} .card-read-more {
    @include acms.font-size(18);

    &::before {
      bottom: -10px;
    }
  }
}

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


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

.card-bordered {
  width: 100%;
  overflow: hidden;
  border: global.$border-width-sm solid global.$color-gray40;
  border-radius: global.$border-radius-lg;
}

.card-bordered-link {
  display: flex;
  flex-direction: column;
  width: 100%;

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

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

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

.card-bordered-img-wrap {
  margin: 0;
  overflow: hidden;
}


.card-bordered-img {
  transition: .4s .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 15px;
  color: global.$color-black;
  line-height: 1.3;

  @include acms.font-size(18);
}


.card-bordered-read-more,
.#{acms.$entry-class} .card-bordered-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;

  @include acms.font-size(16);

  font-weight: bold;

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

  &::after {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0 0 0 10px;
    background: global.$color-secondary no-repeat;
    background-image: url(#{global.$root-theme-img + 'arrow-border-white.svg' });
    background-position: center;
    background-size: 5px 10px;
    border-radius: global.$border-radius-circle;
    content: "";
  }

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

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

.card-bordered-text-inline {
  display: flex;
  align-items: center;
  padding: 15px;

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

  .card-bordered-title {
    margin: 0 0 20px;

    @include acms.font-size(22);
  }

  .card-bordered-text {
    margin: 0 0 35px;

    @include acms.font-size(16);
  }
  .card-bordered-read-more,
  .#{acms.$entry-class} .card-bordered-read-more {
    @include acms.font-size(18);

    &::before {
      bottom: -10px;
    }
  }
}

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