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

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

  &:any-link {
    color: var(--color-white);
    text-decoration: none;
  }

  &:hover {
    background: var(--color-primary-hover);
  }

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

  &.is-bg-white {
    background: var(--color-white);

    &,
    &:any-link {
      color: var(--color-text);
    }

    &:hover {
      background: var(--color-hover-bg);
    }
  }

  &.is-bg-white-bordered {
    background: var(--color-white);
    border: var(--border-width-sm) solid var(--color-gray30);

    &,
    &:any-link {
      color: var(--color-text);
    }

    &:hover {
      background: var(--color-hover-bg);
    }
  }

  &:focus {
    border-color: acms.$acms-form-focus-border-color;
    box-shadow: var(--box-shadow-focus);
  }
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  color: inherit;

  svg {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    color: inherit;
    object-fit: contain;

    path {
      stroke: currentcolor;
    }
  }
}

/* ------------------------------
　　一覧遷移ボタン
------------------------------ */
.button-view-all-articles {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  height: 1.5rem;
  margin: 0;
  line-height: var(--line-height-base);
  text-decoration: none;

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

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

  @media (hover: hover) {
    &:any-link:hover {
      .button-view-all-articles-icon {
        background-color: var(--color-icon-bg-hover);
      }
    }
  }
}

.button-view-all-articles-text {
  font-weight: bold;
  color: var(--color-text);
}

.button-view-all-articles-icon {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: auto;
  aspect-ratio: 1 / 1;
  background-color: var(--color-icon-bg);
  border-radius: 50%;

  svg {
    width: 0.625rem;
    height: 0.625rem;
    color: var(--color-white);
    object-fit: contain;

    path {
      stroke: currentcolor;
    }
  }

  @media (hover: hover) {
    transition: background-color 0.3s ease;
  }
}
