/* ── NAV OVERLAY — shared across all pages ── */
/*
 * Overlay is always dark (#0a0a08 bg / #f0ede4 fg) regardless of page theme.
 * Requires --nav-px (horizontal padding) to be set in each page's :root.
 * This syncs the ✕ close button position with the ☰ hamburger in the header.
 * Fallback: 40px.
 */

/* ── HAMBURGER BUTTON ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  /* same footprint as close button so right-edge alignment is guaranteed */
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--fg);
  border-radius: 6px;
  flex-shrink: 0;
  transition: opacity 0.15s;
  touch-action: manipulation;
}
.nav-hamburger:hover  { opacity: 0.55; }
.nav-hamburger:active { opacity: 0.35; }

.nav-hamburger__bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* ── OVERLAY CONTAINER — always dark ── */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: #0a0a08;
  color: #f0ede4;
  z-index: 200;
  display: flex;
  flex-direction: column;
  /* Account for iPhone safe areas so the close button stays tappable. */
  padding:
    max(10px, env(safe-area-inset-top))
    calc(var(--nav-px, 40px) + max(10px, env(safe-area-inset-right)))
    calc(60px + env(safe-area-inset-bottom))
    calc(var(--nav-px, 40px) + max(10px, env(safe-area-inset-left)));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── OVERLAY HEADER ROW ── */
/*
 * height ≈ real header height so the ✕ sits at the same Y as ☰.
 * justify-content: flex-end → right edge of ✕ = right edge of ☰ (both at --nav-px).
 */
.nav-overlay__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 72px;
  flex-shrink: 0;
}

/* ── CLOSE BUTTON ── */
.nav-overlay__close {
  /* Slightly larger tap target for iPhone safe-area edge cases. */
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #f0ede4;
  border-radius: 6px;
  transition: opacity 0.15s, transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
}
.nav-overlay__close:hover  { opacity: 0.55; }
.nav-overlay__close:active { transform: scale(0.88); }

/* ── NAV LIST ── */
.nav-overlay__menu {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
}

.nav-overlay__list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.nav-overlay__item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── LINKS — base state (hidden, shifted down) ── */
.nav-overlay__link {
  display: block;
  font-family: var(--font, 'Barlow Condensed', sans-serif);
  font-size: clamp(48px, 14vw, 80px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0ede4;
  text-decoration: none;
  text-align: right;
  padding: 20px 0;
  line-height: 1.05;
  opacity: 0;
  transform: translateY(18px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity   0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    color     0.15s;
}

/* ── ANIMATE IN — staggered per item ── */
.nav-overlay.is-open .nav-overlay__item:nth-child(1) .nav-overlay__link {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.06s;
}
.nav-overlay.is-open .nav-overlay__item:nth-child(2) .nav-overlay__link {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.12s;
}
.nav-overlay.is-open .nav-overlay__item:nth-child(3) .nav-overlay__link {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.18s;
}
.nav-overlay.is-open .nav-overlay__item:nth-child(4) .nav-overlay__link {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.24s;
}

/* ── CURRENT PAGE LINK — override the stagger opacity ── */
/* Specificity equals the stagger rules above; placed after → wins on ties */
.nav-overlay.is-open .nav-overlay__item:nth-child(1) .nav-overlay__link--current,
.nav-overlay.is-open .nav-overlay__item:nth-child(2) .nav-overlay__link--current,
.nav-overlay.is-open .nav-overlay__item:nth-child(3) .nav-overlay__link--current,
.nav-overlay.is-open .nav-overlay__item:nth-child(4) .nav-overlay__link--current {
  opacity: 0.22;
  cursor: default;
  pointer-events: none;
}

.nav-overlay__link:hover { opacity: 0.55; }

/* ── HAMBURGER: always visible / ctrl-about always hidden ── */
.nav-hamburger { display: flex; }
header .ctrl-about { display: none; }

/*
 * ── JP LOGO SIZE CORRECTION ──
 * logojp.svg viewBox height = 300.73px; PASHIRU wordmark ≈ 41.6% of that.
 * logo.svg   viewBox height = 233.01px; PASHIRU wordmark ≈ 53.2% of that.
 * To make the wordmark the same visual size: multiply display height × 1.28.
 * html:lang(ja) is set dynamically by setLang() on TOP, statically on all other pages.
 */
html:lang(ja) .logo-img,
html:lang(ja) .logo img {
  height: 36px;
}

@media (max-width: 375px) {
  .nav-overlay { padding-bottom: 40px; }
}
