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

/* ------------------------------
　　ボタン
------------------------------ */
.button {
  box-sizing: border-box;
  display: inline-block;
  padding: 0.75rem 2.25rem;
  font-size: map.get(global.$font-scales, body-m);
  font-weight: bold;
  line-height: global.$line-height-base;
  color: global.$color-text-inverse;
  text-align: center;
  background: global.$color-primary;
  border: 0;
  border-radius: global.$border-radius-md;
  transition: background-color 0.2s;

  &:any-link {
    color: global.$color-text-inverse;
    text-decoration: none;
  }

  &:hover {
    background: global.$color-primary-hover;
  }

  &:focus {
    border-color: acms.$acms-form-focus-border-color;
    box-shadow: global.$box-shadow-focus;
  }

  &.is-block {
    width: 100%;
  }

  &.is-sm {
    padding: 0.5rem 1.5rem;
    font-size: map.get(global.$font-scales, body-s);
  }

  &.is-lg {
    display: inline-block;
    padding: 1rem 2.25rem;
    margin: auto;
  }

  &.is-xl {
    width: 18rem;
    max-width: 100%;
  }

  &.is-width-sm {
    padding-right: 1.5rem;
    padding-left: 1.5rem;
  }

  &.is-width-lg {
    width: 18rem;
    max-width: 100%;
  }

  &.is-shadow {
    box-shadow: global.$elevation08;
  }

  &.is-shadow-shallow {
    box-shadow: global.$elevation02;

    &:hover {
      box-shadow: global.$elevation10;
    }
  }

  &.is-inverse {
    color: global.$color-text;
    background: global.$color-white;

    &:any-link {
      color: global.$color-text;
    }

    &:hover {
      background: global.$color-gray10;
    }
  }

  &.is-arrow {
    position: relative;

    &::after {
      position: absolute;
      top: 0;
      right: 16px;
      bottom: 0;
      display: inline-block;
      width: 8px;
      height: 12px;
      padding-right: 8px;
      padding-left: 8px;
      margin: auto;
      content: "";
      background-image: url("#{global.$root-theme-img}arrow-border-white.svg");
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
    }
  }

  &.is-arrow.is-inverse {
    &::after {
      background-image: url("#{global.$root-theme-img}arrow-border-black.svg");
    }
  }

  &.is-danger {
    background: global.$color-error;
  }

  &.is-bordered {
    color: global.$color-text;
    background: transparent;
    border: global.$border-width-sm solid global.$color-gray40;

    &:any-link {
      color: global.$color-text;
    }

    &:hover {
      background: global.$color-gray20;
    }
  }

  &.is-bordered-danger {
    color: global.$color-error;
    background: none;
    border: 1px solid global.$color-error;

    &:hover {
      background: rgb(201 45 45 / 8%);
    }
  }

  &.is-rounded {
    border-radius: global.$border-radius-round;
  }
}

@include acms.media-breakpoint-up(md) {
  .button {
    &.is-send {
      min-width: 17.5rem;
    }

    &.is-xl {
      min-width: 22rem;
      padding: 1rem;
      font-size: map.get(global.$font-scales, heading-ss);
    }
  }
}

.button-read-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: map.get(global.$font-scales, body-m);
  font-weight: bold;
  color: currentcolor;
  text-decoration: none;

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

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

  @media (hover: hover) {
    &:hover {
      &::before {
        transform: scaleX(1);
      }
    }
  }
}

.button-wrap {
  max-width: 17.5rem;
  margin: 2.5rem auto 0;

  .button.is-block + .button.is-block {
    margin-top: 1rem;
  }
}

.icon-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: bold;
  line-height: 1.8;
  color: global.$color-text;
  text-decoration: none;
  appearance: none;
  cursor: pointer;
  background-color: transparent;
  border: none;
  transition: background-color 0.2s;

  > .acms-icon {
    font-size: 20px;
  }

  @media (hover: hover) {
    &:hover {
      background: global.$color-gray10;
    }
  }

  &.is-primary {
    color: global.$color-text-inverse;
    background-color: global.$color-primary;

    @media (hover: hover) {
      &:hover {
        background-color: global.$color-primary-hover;
      }
    }
  }

  &.is-text-primary {
    color: global.$color-text-primary;
    background-color: global.$color-white;

    @media (hover: hover) {
      &:hover {
        background: global.$color-gray10;
      }
    }
  }

  &.is-column {
    flex-flow: column;
    justify-content: center;
    font-size: 0.625rem;
    line-height: 1;

    > .acms-icon {
      padding-right: 0;
      padding-bottom: 8px;
      font-size: 18px;
    }
  }
}
