@layer base, layout, component, utility;

@layer base {
  :root {
    --main-color: #00a95c;
    --text-color: #444460;
  }

  html {
    scroll-padding-top: 100px;
    scroll-behavior: smooth;
  }

  body {
    color: var(--text-color);
    font-size: 1rem;
    font-family: "Noto Sans JP", sans-serif;
    font-optical-sizing: auto;
    overflow-y: scroll;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }
}


@layer layout {
  .l-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .l-section {
    padding-block: clamp(5rem, 3.214rem + 8.93vw, 7.5rem);
    background-color: #ffffff;

    &:nth-of-type(even) {
      background-color: #f5f5f5;
    }
  }

  .l-section--transparent {
    background-color: transparent;
  }

  .l-stack {
    margin-top: clamp(5rem, 1.429rem + 17.86vw, 10rem);

    &:first-of-type {
      margin-top: clamp(2.5rem, 0.714rem + 8.93vw, 5rem);
    }
  }

  .l-container {
    width: 100%;
    max-width: calc(75rem + 32px);
    margin-inline: auto;
    padding-inline: 16px;
  }

  .l-container-sm {
    width: 100%;
    max-width: 60rem;
    margin-inline: auto;
  }

  .l-firstview {
    position: relative;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 70px;
    min-height: 100vh;
  }

  .l-horizontal-card-grid {
    display: grid;
    gap: 32px;
  }

  .l-vertical-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: center;
    gap: 32px 32px;
    grid-auto-rows: auto auto auto auto;

    > li {
      display: contents;
    }

    &.l-vertical-card-grid--cols-2 {
      grid-template-columns: repeat(2, calc((100% - 64px) / 3));
    }

    &.l-vertical-card-grid--cols-3 {
      grid-template-columns: repeat(3, calc((100% - 64px) / 3));
    }

    @media screen and (max-width: 64em) {

      &.l-vertical-card-grid--cols-2,
      &.l-vertical-card-grid--cols-3 {
        grid-template-columns: 1fr;
      }

    }
  }

  .l-box-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;

    > li {
      display: contents;
    }

    @media screen and (max-width: 64em) {
      grid-template-columns: 1fr;
      gap: 32px;
    }
  }

  #message {
    margin-top: 0;
  }
}


@layer component {
  .c-header {
    position: sticky;
    top: 0;
    padding: 8px 16px;
    background-color: #ffffff;
    box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
  }

  .c-header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .c-header__label {
    display: block;
    padding: 4px;
    color: #000;
    border: 1px solid currentColor;
    font-size: 0.875rem;
    line-height: 1;

    @media screen and (max-width: 48em) {
      font-size: 0.75rem;
    }
  }

  .c-header__drawer {
    .c-header__nav {

      ul {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 24px;
        margin: 0;
        padding: 0;
        list-style: none;

        a {
          display: block;
          padding-block: 0.5em;
          color: var(--text-color);
          font-weight: 700;
          text-decoration: none;
          line-height: 1;
          background-image: linear-gradient(currentColor, currentColor);
          background-position: bottom right;
          background-size: 0 3px;
          background-repeat: no-repeat;

          &:hover,
          &:active {
            color: var(--main-color);
            background-size: 100% 3px;
          }
        }
      }
    }

    .c-header__drawer-logo {
      display: none;
    }

    @media screen and (max-width: 64em) {
      position: fixed;
      inset: 0;
      top: 0;
      left: 0;
      display: grid;
      grid-template-rows: 2fr 1fr;
      place-items: center;
      background-color: var(--main-color);
      z-index: 99;
      overflow-y: hidden;
      overscroll-behavior: none;

      @starting-style {
        translate: 0 -100%;
      }

      &.c-header__drawer-animate {
        transition: translate 0.3s ease-out, display 0.3s allow-discrete;
      }

      &[aria-hidden="true"] {
        display: none;
        translate: 0 -100%;
      }

      .c-header__nav {
        ul {
          flex-direction: column;

          a {
            color: #ffffff;

            &:hover,
            &:active {
              color: #ffffff;
              background-size: 100% 3px;
            }
          }
        }
      }

      .c-header__drawer-logo {
        display: block;
      }
    }
  }

  .c-header__button {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    height: 100%;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    color: #fff;
    background-color: var(--main-color);
    border: 0;
    z-index: 999;

    svg,
    rect {
      transform-box: fill-box;
      transform-origin: center;
    }

    @media screen and (max-width: 64em) {
      display: grid;
      place-content: center;

      &.c-header__button-animate {

        svg,
        rect {
          transition: 250ms ease-out;
        }
      }

      &[aria-expanded="true"] {
        svg {
          rotate: 360deg;

          rect:nth-of-type(1) {
            rotate: 45deg;
            translate: 0 6px;
          }

          rect:nth-of-type(2) {
            opacity: 0;
          }

          rect:nth-of-type(3) {
            rotate: -45deg;
            translate: 0 -6px;
          }
        }
      }
    }
  }

  .c-footer {
    padding-block: 40px 16px;
    background-color: #414549;
  }

  .c-footer__brand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
  }

  .c-footer__copy {
    margin: 1em 0 0;
    color: #dddddd;
    font-size: 0.75rem;
    text-align: center;
  }

  .c-firstview__title {
    margin: 0;
    font-size: 2rem;
    line-height: 1;

    .c-firstview__logo {
      max-width: 100%;
      height: auto;
      pointer-events: none;
    }
  }

  .c-firstview__message {
    margin: 0;
    font-size: clamp(1rem, 0.643rem + 1.79vw, 1.5rem);
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    animation: firstviewMessage 400ms cubic-bezier(0.18, 0.89, 0.32, 1.28) 1000ms both;

    span {
      display: inline-block;
    }
  }

  @keyframes firstviewMessage {
    from {
      opacity: 0;
      translate: 0 30%;
    }

    to {
      opacity: 1;
      translate: 0 0;
    }
  }


  .c-firstview__bg {
    --bg-grid-color: #efefef;
    --bg-grid-size: 50px;

    position: fixed;
    inset: 0;
    clip-path: inset(0);
    z-index: -1;

    &::after {
      content: "";
      position: fixed;
      inset: -20vw 0;
      background:
        /* url(../img/firstview-bg.svg) no-repeat center center/cover, */
        url(../img/firstview-bg.png) no-repeat center center/cover,
        linear-gradient(to right, var(--bg-grid-color) 1px, transparent 1px) top/var(--bg-grid-size) var(--bg-grid-size),
        linear-gradient(to bottom, var(--bg-grid-color) 1px, transparent 1px) top/var(--bg-grid-size) var(--bg-grid-size);

      animation: grow-progress linear;
      animation-timeline: scroll();
    }
  }

  @keyframes grow-progress {
    from {
      translate: 0 0;
    }

    to {
      translate: 0 -20vw;
    }
  }

  .c-message {
    display: grid;
    grid-template-columns: 3fr auto;

    .c-message__text {
      padding: 32px 64px;
      padding-right: 88px;
      background-color: #ffffff;
      border-radius: 4px;
    }

    .c-message__title {
      margin: 0;
      font-size: clamp(1rem, 0.821rem + 0.89vw, 1.25rem);
      text-align: center;

      span {
        display: block;
      }
    }

    .c-message__body {
      margin-block: 32px;
      font-size: clamp(1rem, 0.911rem + 0.45vw, 1.125rem);
      font-weight: 400;
      text-align: justify;
      line-height: 1.4;
    }

    .c-message__author {
      display: flex;
      justify-content: flex-end;
      margin: 0;
      font-size: 0.875rem;
    }

    .c-message__img {
      margin-top: 50px;
      margin-left: -50px;

      img {
        border-radius: 4px;
      }
    }

    @media screen and (max-width: 64em) {
      grid-template-columns: 1fr;

      .c-message__text {
        margin-top: -40px;
        margin-inline: clamp(0rem, -2.273rem + 11.36vw, 5rem);
        padding-top: 64px;
        padding-inline: clamp(0.625rem, -0.909rem + 7.67vw, 4rem);
      }

      .c-message__img {
        justify-self: center;
        margin: 0;
        order: -1;
        z-index: 1;

        img {
          aspect-ratio: 1 / 1;
          object-fit: cover;
          object-position: top;
        }
      }
    }
  }

  .c-heading-2 {
    margin: 0 0 1.5em;
    font-size: clamp(1.5rem, 1.143rem + 1.79vw, 2rem);

    &::before {
      content: attr(data-eng);
      display: block;
      color: var(--main-color);
      font-size: 0.5em;
      font-weight: 900;
    }
  }

  .c-heading-3 {
    margin: 1.5em 0;
    font-size: clamp(1.375rem, 1.107rem + 1.34vw, 1.75rem);
  }

  .c-cta {
    margin-top: clamp(2rem, 0.571rem + 7.14vw, 4rem);
  }

  .c-button {
    --btn-color: #ffffff;
    --btn-bg-color: var(--main-color);
    --btn-border-color: var(--main-color);

    display: inline-grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 28rem;
    min-height: 3.625rem;
    padding-block: 0.5rem;
    padding-inline: 1.5rem 0.5rem;
    color: var(--btn-color);
    background-color: var(--btn-bg-color);
    border: 2px solid var(--btn-border-color);
    border-radius: 9999px;
    font-size: clamp(1.125rem, 1.036rem + 0.45vw, 1.25rem);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    line-height: 1.2;

    &::before {
      content: "";
    }

    .c-button__icon {
      justify-self: end;
    }

    &:hover,
    &:active,
    &:focus-within {
      --btn-color: var(--main-color);
      --btn-bg-color: #ffffff;
      outline: none;
    }
  }

  .c-button--outlined {
    --btn-color: var(--main-color);
    --btn-bg-color: #ffffff;
    --btn-border-color: var(--main-color);

    &:hover,
    &:active,
    &:focus-within {
      --btn-color: #ffffff;
      --btn-bg-color: var(--main-color);
      outline: none;
    }
  }

  .c-icon-chevron {
    position: relative;
    display: inline-grid;
    place-content: center;
    width: 2.5rem;
    aspect-ratio: 1;
    background-color: #fff;
    border-radius: 100%;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      background-color: var(--main-color);
      clip-path: polygon(30% 20%, 45% 20%, 75% 50%, 45% 80%, 30% 80%, 60% 50%);
      /* clip-path: polygon(32% 20%, 45% 20%, 75% 50%, 45% 80%, 32% 80%, 62% 50%); */
    }

    &.c-icon-chevron--filled {
      background-color: var(--main-color);

      &::after {
        background-color: #fff;
      }
    }
  }

  .c-horizontal-card {
    --card-padding: 24px;
    --negative-margin: calc(-1 * var(--card-padding));

    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "img body icon";
    gap: 16px 32px;
    padding: var(--card-padding);
    color: inherit;
    background-color: #ffffff;
    align-items: center;
    text-decoration: none;
    box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: translate 200ms ease-out, box-shadow 200ms ease-out;

    .c-horizontal-card__img {
      grid-area: img;
      width: 320px;
      margin: var(--negative-margin) 0 var(--negative-margin) var(--negative-margin);
      overflow: hidden;

      img {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        object-position: center;
        transition: scale 300ms ease-out;
      }
    }

    .c-horizontal-card__body {
      grid-area: body;
    }

    .c-horizontal-card__title {
      margin: 0 0 1em;
      font-size: clamp(1rem, 0.866rem + 0.67vw, 1.188rem);
      font-weight: 700;
    }

    .c-horizontal-card__sub {
      margin: 0;
    }

    .c-horizontal-card__icon {
      grid-area: icon;
    }

    &:hover {
      box-shadow: 3px 3px 6px 1px rgba(0, 0, 0, 0.15);
      translate: -3px -3px;

      .c-horizontal-card__img {
        img {
          scale: 1.1;
        }
      }
    }

    @media screen and (max-width: 48em) {
      --card-padding: 10px;

      grid-template-columns: 1fr auto;
      grid-template-areas:
        "img img"
        "body icon";
      gap: 8px;

      .c-horizontal-card__img {
        width: calc(100% + (var(--card-padding) * 2));
        margin: var(--negative-margin) var(--negative-margin) 0 var(--negative-margin);
      }

      .c-horizontal-card__title {
        margin: 0 0 0.5em;
      }
    }
  }

  .c-vertical-card {
    --card-padding: 24px;
    --negative-margin: calc(-1 * var(--card-padding));

    display: grid;
    grid-row: span 4;
    grid-template-columns: 1fr auto;
    grid-template-rows: subgrid;
    grid-template-areas:
      "img img"
      "title title"
      "sub sub"
      "name icon";
    gap: 8px;
    padding: var(--card-padding);
    color: inherit;
    background-color: #ffffff;
    text-decoration: none;
    box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: translate 200ms ease-out, box-shadow 200ms ease-out;

    .c-vertical-card__img {
      grid-area: img;
      margin: var(--negative-margin) var(--negative-margin) 0px;
      overflow: hidden;

      img {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        object-position: center;
        transition: scale 300ms ease-out;
      }
    }

    .c-vertical-card__title {
      grid-area: title;
      margin: 0;
      font-size: clamp(1rem, 0.866rem + 0.67vw, 1.188rem);
      line-height: 1.2;
    }

    .c-vertical-card__sub {
      grid-area: sub;
      margin: 0;
      font-size: 14px;
    }

    .c-vertical-card__name {
      grid-area: name;
      align-self: center;
      margin: 0;
      font-size: clamp(1rem, 0.911rem + 0.45vw, 1.125rem);
      font-weight: 700;
    }

    .c-vertical-card__icon {
      grid-area: icon;
    }

    &:hover {
      box-shadow: 3px 3px 6px 1px rgba(0, 0, 0, 0.15);
      translate: -3px -3px;

      .c-vertical-card__img {
        img {
          scale: 1.1;
        }
      }
    }

    @media screen and (max-width: 48em) {
      --card-padding: 10px;
    }
  }

  .c-box {
    --border-width: 2px;

    position: relative;
    display: grid;
    grid-row: span 3;
    grid-template-columns: 1fr;
    grid-template-rows: subgrid;
    grid-template-areas:
      "title"
      "img"
      "icon";
    gap: 8px;
    padding: 8px 16px;
    color: inherit;
    text-decoration: none;

    &::before {
      content: "";
      position: absolute;
      top: calc(0px - (var(--border-width) / 2));
      left: calc(0px - (var(--border-width) / 2));
      width: calc(100% + var(--border-width));
      height: calc(100% + var(--border-width));
      border: var(--border-width) solid #888;
    }

    .c-box__title {
      grid-area: title;
      margin: 0;
      font-size: clamp(1rem, 0.866rem + 0.67vw, 1.188rem);
      font-weight: 700;
      text-align: center;

      span {
        display: block;
        font-size: 80%;
      }
    }

    .c-box__img {
      grid-area: img;
      border: 3px solid black;
      overflow: hidden;

      img {
        width: 100%;
        scale: 1.02;
        transition: scale 300ms ease-out;
      }
    }

    .c-box__icon {
      grid-area: icon;
      text-align: center;
    }

    &:hover {
      .c-box__img {
        border-color: black;

        img {
          scale: 1.1;
        }
      }
    }
  }

  .c-tag-external-link {
    position: relative;

    &::after {
      content: "外部サイト";
      position: absolute;
      right: 0;
      bottom: 0;
      display: inline-block;
      padding: 4px 6px;
      color: #ffffff;
      background-color: rgb(from var(--main-color) r g b / 0.8);
      font-size: 14px;
      font-weight: 600;
      border-radius: 4px;
    }
  }
}


@layer utility {
  .u-list-reset {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .u-text-center {
    text-align: center;
  }

  .u-margin-inline-auto {
    margin-inline: auto;
  }

  .u-bordered {
    border: 1px solid #aaaaaa;
  }

  .u-bg--white {
    background-color: #ffffff;
  }

  .u-font-size-md {
    font-size: clamp(1rem, 0.911rem + 0.45vw, 1.125rem);
  }

  .u-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}