/* PC ナビ・ハンバーガー & オーバーレイ */

/* PC nav */
.nav-pc {
  display: flex;
  gap: 20px;
  padding: 12px 16px;
  justify-content: center;
}

.nav-pc a {
  color: var(--fg);
  text-decoration: none;
  opacity: 0.9;
}

.nav-pc a:hover {
  opacity: 1;
  color: var(--accent);
}

/* hamburger icon */
.hamburger-menu {
  position: fixed;
  left: 16px;
  top: 16px;
  width: 30px;
  height: 22px;
  cursor: pointer;
  user-select: none;
  z-index: 10010;
}

.hamburger-menu .line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #fff;
  transition: transform 0.25s, opacity 0.2s;
}

.hamburger-menu .line:nth-of-type(1) {
  top: 0;
}

.hamburger-menu .line:nth-of-type(2) {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-menu .line:nth-of-type(3) {
  bottom: 0;
}

.hamburger-menu.active .line:nth-of-type(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.hamburger-menu.active .line:nth-of-type(2) {
  opacity: 0;
}

.hamburger-menu.active .line:nth-of-type(3) {
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

/* overlay menu */
.nav-menu {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  /* 余白は gap ではなく均等配置で確保して1画面に収める */
  justify-content: space-evenly;
  align-items: center;
  gap: clamp(4px, 1vh, 7px);
  background: rgba(0, 0, 0, 0.9);
  padding: 16px max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  min-height: 100dvh;
  /* 動的ビューポートで1画面にフィット */
  overflow-y: hidden;
  /* 基本はスクロールなし */
  gap: 0;
  /* ← gap は使わない */
  opacity: 0;
  pointer-events: none;
}

/* メニュー開時はHOMEスライダーの操作UIを非表示＆クリック無効 */
.menu-open #home-slider .prev,
.menu-open #home-slider .next,
.menu-open #home-slider .indicator {
  display: none !important;
}
.menu-open #home-slider {
  pointer-events: none;
}

.nav-menu.active {
  display: flex;
  animation: fadeIn 0.25s forwards;
  pointer-events: auto;
}

/* 低い画面だけさらに詰める（SE対策） */
@media (max-height: 700px) {
  .nav-menu a {
    font-size: clamp(10px, 1.5vh, 15px);
    padding: 12px 12px;
    margin: 6px 0;
  }
}

.nav-menu.active {
  display: flex;
  animation: fadeIn 0.25s forwards;
  pointer-events: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* 各リンク：タップ領域は確保しつつ小さめに、サイズは少しだけ抑える */
.nav-menu a {
  color: #fff;
  font-size: clamp(18px, 2.2vh, 28px);
  /* ほんの少しだけ小さく可変 */
  text-decoration: none;

  /* 余白は最小限（大きな縦のスペースは space-evenly が作る） */
  padding: 10px 16px;
  /* タップしやすさは担保 */
  margin: 0;

  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.nav-menu a.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.nav-menu a:hover {
  text-decoration: underline;
}

/* responsive show/hide */
@media (max-width: 960px) {
  .nav-pc {
    display: none;
  }

  .hamburger-wrap {
    display: block;
  }
}

@media (min-width: 961px) {
  .hamburger-wrap {
    display: none;
  }

  .nav-pc {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(6px);
    z-index: 10020;
  }

  body {
    padding-top: var(--nav-h);
  }

  section {
    scroll-margin-top: calc(var(--nav-h) + 8px);
  }
}

/* 画面が低い端末（SE等）はさらにコンパクトに */
@media (max-height: 700px) {
  .nav-menu a {
    font-size: clamp(15px, 1.9vh, 20px);
    padding: 8px 14px;
  }
}
