/* ヘッダー */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  z-index: 99;
  box-sizing: border-box;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 5.2vw; /* 1920pxの時100px */
  padding: calc(10 / 1920 * 100vw) calc(140 / 4000 * 100vw); /* FVの端に合わせる */
  box-sizing: border-box;
}

.header-image {
  height: 100%;
  margin: 0;

  img {
    height: 100%;
    width: auto;
    margin: 0;
  }
}

.header__btns {
  display: flex;
  align-items: center;
  gap: 2%;
  justify-content: flex-end;
  height: 100%;
}

.btn-h--call {
  display: grid;
  align-items: center;
  justify-content: end;
  justify-items: start;
  grid-template-columns: 1fr 64% 18%;
  grid-template-rows: repeat(3, auto);
  grid-template-areas:
    "icon time free"
    "icon num free"
    "icon year year";
  width: 45%;
  color: #333;
  font-weight: 700;
  line-height: 1;

  &::before {
    grid-area: icon;
    width: 100%;
    height: 80%;
    background-image: url(../images/tel-sp.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    filter: brightness(0) saturate(100%) invert(43%) sepia(44%) saturate(3356%)
      hue-rotate(1deg) brightness(102%) contrast(107%);
    content: "";
  }
}

.btn-h--call__time {
  grid-area: time;
  font-size: calc(20 / 1920 * 100vw);
}

.btn-h--call__num {
  grid-area: num;
  font-size: calc(28 / 1920 * 100vw);
}

.btn-h--call__365 {
  grid-area: year;
  font-size: calc(8 / 1920 * 100vw);
  text-align: start;
}

.btn-h--call__free {
  grid-area: free;
  display: grid;
  place-content: center;
  height: 100%;
  padding-inline: calc(12 / 1920 * 100vw);
  background-color: #ff6600;
  border-radius: 4px;
  color: #fff;
  font-size: calc(18 / 1920 * 100vw);
  white-space: nowrap;
}

/* ヘッダースマホ用 */
@media screen and (max-width: 640px) {
  .header-container {
    display: flex;
    align-items: center;
    gap: 1%;
    justify-content: space-between;
    height: 70px;
    padding-inline: 12px;
  }

  .header__btns {
    flex: 2;
    gap: 3%;
  }

  .header-image {
    width: 100%;
    img {
      height: 100%;
      object-fit: contain;
    }
  }

  .logo {
    flex: 1;
  }

  .btn-h {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    right: 10px;
  }

  .btn-h--call {
    grid-template-columns: auto;
    grid-template-rows: 50px 1fr;
    grid-template-areas:
      "num"
      "year";
    width: 60%;
    height: 100%;

    &::before {
      content: none;
    }

    @media screen and (max-width: 480px) {
      width: 100%;
    }
  }

  .btn-h--call__num {
    img {
      width: auto;
      height: 100%;
      object-fit: contain;
      @media screen and (max-width: 480px) {
        margin-bottom: -6px;
      }
    }
  }

  .btn-h--call__365 {
    font-size: 5px;
  }

  .gnav {
    position: absolute;
    left: 200%;
    width: 100%;
    height: 100vh;
    padding: 0 2% 40px;
    background-color: #fff;
    transition: all 0.4s ease;
    box-sizing: border-box;

    nav {
      height: calc(100% - 170px); /* header+追従CTAの高さ */
    }
  }

  .gnav__menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    column-gap: calc(8 / 375 * 100vw);
    height: 100%;
    text-align: start;

    > li {
      padding: 20px 4px;
      border-bottom: solid 1px #ccc;
      box-sizing: border-box;
    }

    a {
      display: block;
      color: var(--color-main);
      font-size: 15px;
      font-weight: 700;
      text-wrap: nowrap;

      &:hover {
        opacity: 0.7;
      }
    }
  }

  .menu-btn {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background-color: transparent;

    span {
      width: 100%;
      height: 2px;
      background-color: #333;
      transition: all 0.4s ease;
      cursor: pointer;
    }
  }

  /* ハンバーガーメニューが開いているときの設定 */
  body:has(.active) {
    overflow-y: hidden;
  }

  header:has(.active) {
    .menu-btn {
      span {
        &:first-child {
          rotate: 45deg;
          translate: 0 13px; /* (40px - 2px*2) / 3 + 1px */
        }

        &:nth-child(2) {
          opacity: 0;
        }

        &:last-child {
          rotate: -45deg;
          translate: 0 -13px;
        }
      }
    }

    .gnav {
      left: 0;
      right: auto;
    }
  }
}

/* PC用（1281px以上） */
@media screen and (min-width: 640px) {
  .btn-h {
    height: 100%;
  }

  .btn-h img {
    height: 100%;
  }
}

/* フローティングバナー */
.floating-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.9);
  border-top: 3px solid #02a4a5;
  padding-block: 10px 4px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;

  .buttons {
    margin-top: 0;
  }

  .button-tel,
  .button-mail {
    padding: calc(12 / 1920 * 100vw);
  }

  .button-tel__num {
    margin-top: 0;
    line-height: 1.3;
  }

  @media screen and (max-width: 640px) {
    .buttons {
      flex-direction: row;
      gap: calc(16 / 780 * 100vw);
    }

    .button-tel,
    .button-mail {
      height: auto;
      padding-block: calc(20 / 780 * 100vw);
    }

    .button-tel {
      justify-content: center;
      gap: 0;
    }

    .button-tel__txt {
      font-size: calc(24 / 780 * 100vw);
    }

    .button-tel__num {
      font-size: calc(40 / 780 * 100vw);
    }

    .button-mail {
      flex-direction: column-reverse;
      justify-content: center;
      font-size: calc(28 / 780 * 100vw);

      &::after {
        display: none;
      }
    }
  }
}
