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

/* ------------------------------
　　CTA（コール・トゥ・アクション）
------------------------------ */

/* シンプルなCTA */
.cta {
  margin-top: calc(global.$cta-space-md / -2);
  padding: global.$cta-space-md 0;
  text-align: center;

  &.is-bg {
    margin: 0;
    padding: 1.5rem 0;
    background: global.$color-primary-light;
  }
}

.cta-title {
  margin: 0 0 2rem;
  color: global.$color-text;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: 1.3;
}

.cta-button-wrap {
  font-weight: bold;

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

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

.cta-link-wrap {
  margin: 1.5rem 0;
  font-weight: bold;
  font-size: map.get(global.$font-scales, body-m);
}

.cta-link {
  margin: 0 0 0 -2.5rem;
  color: global.$color-text;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }

  &::before {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin: 0 1rem 0 0;
    vertical-align: middle;
    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;
    transform: rotate(180deg);
    content: "";
  }

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

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

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

.cta-micro-copy {
  margin: 1rem 0 1.25rem;
}

@media screen and (min-width: acms.$breakpoint-md-min) {
  .cta {
    margin-top: calc(global.$cta-space-lg / -2);
    padding: global.$cta-space-lg 0;

    &.is-bg {
      padding: 3rem 0;
    }
  }

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

  .cta-button {
    font-size: map.get(global.$font-scales, heading-ss);
  }

  .cta-link-wrap {
    margin: 2.5rem 0;
    font-size: map.get(global.$font-scales, heading-ss);
  }

  .cta-link {
    margin: 0 0 0 -3rem;

    &::before {
      width: 1.5rem;
      height: 1.5rem;
      margin: 0 1.5rem 0 0;
    }
  }

  .cta-micro-copy {
    margin: 1.5rem 0 1.25rem;
  }
}

/* 背景が角丸 */
.cta-round {
  margin-top: -2.5rem;
  padding: 2.5rem 1.25rem 1rem;
  background: global.$color-gray20;
  border-radius: calc(global.$border-radius-xxl / 2);
}

.cta-round-title {
  margin: 0 0 1.25rem;
  color: global.$color-text;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: 1.3;
}

.cta-round-button-wrap {
  font-weight: bold;

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

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

.cta-round-micro-copy {
  margin: 1.5rem 0 0;
}

@media screen and (min-width: acms.$breakpoint-md-min) {
  .cta-round {
    margin-top: -4rem;
    padding: 5rem 0 4rem;
    border-radius: global.$border-radius-xxl;
  }

  .cta-round-title {
    margin: 0 0 2rem;
    font-size: map.get(global.$font-scales, heading-m);
  }

  .cta-round-button {
    font-size: map.get(global.$font-scales, heading-ss);
  }
}

/* 背景画像付きのCTA */
.cta-visual {
  position: relative;
  z-index: 1;
  padding: 4rem 0 3rem;
  color: global.$color-text-inverse;
  text-align: center;
  background: no-repeat center;
  background-size: cover;

  &.is-cta-margin-top {
    margin-top: global.$footer-margin-top-md;
  }

  &.is-lg {
    padding: 5rem 0 3rem;
  }

  &::before {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 30%);
    content: "";
  }
}

.cta-visual-comment {
  position: relative;
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  color: global.$color-text-primary;
  font-weight: bold;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: global.$line-height-base;
  background: global.$color-white;
  border-radius: global.$border-radius-round;

  &::before {
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -0.5rem;
    border: 0.5rem solid transparent;
    border-top-color: global.$color-white;
    content: "";
  }
}

.cta-visual-title {
  position: relative;
  margin: 0 0 1rem;
  font-size: map.get(global.$font-scales, heading-ss);
  line-height: global.$line-height-base;
}

.cta-visual-text {
  position: relative;
  margin: 0 0 1.5rem;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-base;
}

.cta-visual-read-more {
  position: relative;

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

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

@media screen and (min-width: acms.$breakpoint-md-min) {
  .cta-visual {
    padding: 5rem 0;

    &.is-cta-margin-top {
      margin-top: global.$footer-margin-top-lg;
    }

    &.is-lg {
      padding: 6.5rem 0 5rem;
    }
  }

  .cta-visual-title {
    margin: 0 0 2.5rem;
    font-size: map.get(global.$font-scales, heading-l);
  }

  .cta-visual-text {
    margin: 0 0 2.5rem;
    font-size: map.get(global.$font-scales, body-m);
  }

  .cta-visual-comment {
    margin: 0 0 2rem;
    padding: 0.5rem 3rem;
    font-size: map.get(global.$font-scales, heading-m);
  }
}
