/* =============================================================================
   nav.css — the fixed header

   Stacking order inside the header, from the top down:
       41  .nav__inner while the mobile menu is open (must sit above the overlay)
       40  .nav-overlay--open
        3  .nav__progress bar
        2  .nav__inner
       -1  .nav-overlay while closed (parked under everything, unclickable)

   The bar's height is not animated here: nav.js drives it inline (74px → 62px)
   exactly the way the reference does, so the transition lives on that element.
   ============================================================================= */

/* --- the bar ------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-nav);
  height: 74px;
}

.nav__inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
  padding: 0 max(24px, 3vw);
  background: var(--glass-72);
  border-bottom: 1px solid var(--hairline);
  /* The reference expresses the frosted bar through the -webkit- alias only,
     and Blink keeps the two properties separate, so writing the standard one
     as well would be a real (if invisible) divergence. Matched on purpose. */
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  transition: background .28s;
}

.nav--shrunk .nav__inner {
  background: var(--glass-82);
}

/* --- brand --------------------------------------------------------------- */

.nav__brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav__mark {
  width: 30px;
  height: 30px;
  color: var(--ink);
  transition: width .28s var(--ease-out), height .28s var(--ease-out);
}

.nav--shrunk .nav__mark {
  width: 26px;
  height: 26px;
}

.nav__name {
  font-size: 16.5px;
  font-weight: 620;
  letter-spacing: -.01em;
}

/* --- text links ---------------------------------------------------------- */

.nav__links {
  display: flex;
  gap: 30px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 480;
  letter-spacing: .01em;
  transition: color .18s;
}

.nav__link:hover {
  color: var(--ink);
}

/* the glyph in front of each label, drawn in the same stroke style as the
   controls on the right of the bar */
.nav__icon {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- right-hand actions -------------------------------------------------- */

.nav__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The reference put the two community links (Discord / QQ) here. They are gone
   from the bar by request; the same links still live in the mobile menu and the
   footer. The three controls that replaced them are styled in switcher.css. */

/* hamburger: hidden until the small-screen media query flips it on */
.nav__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: 0 0;
  cursor: pointer;
}

.nav__menu-icon {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 20px;
}

.nav__menu-icon i {
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .28s var(--ease-out), width .28s var(--ease-out);
}

.nav__menu-icon i:last-child {
  width: 13px;
  margin-left: auto;
}

/* the two bars cross into an ✕ once the menu is open */
.nav__menu-btn[aria-expanded="true"] .nav__menu-icon i:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav__menu-btn[aria-expanded="true"] .nav__menu-icon i:last-child {
  width: 20px;
  margin-left: 0;
  transform: translateY(-4px) rotate(-45deg);
}

/* --- scroll progress ----------------------------------------------------- */

.nav__progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  z-index: 3;
  height: 1px;
  background: var(--accent);
  transform-origin: 0;
}

/* --- small-screen menu overlay ------------------------------------------- */

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px 0 28px;
  background: var(--ink-panel);
  clip-path: inset(0 0 100%);
  opacity: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* z-index is only restored after the closing wipe has finished */
  transition: opacity .34s var(--ease-out), clip-path .46s var(--ease-out), z-index 0s .46s;
}

.nav-overlay--open {
  z-index: var(--z-menu);
  clip-path: inset(0 0 0%);
  opacity: 1;
  transition: opacity .34s var(--ease-out) 50ms, clip-path .46s var(--ease-out), z-index 0s;
}

.nav-overlay__menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: auto 0;
  text-align: center;
}

.nav-overlay__link {
  padding: 8px 26px;
  color: var(--page);
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 640;
  letter-spacing: -.02em;
  transition: color .18s;
}

.nav-overlay__link:hover,
.nav-overlay__link:focus-visible {
  color: var(--accent);
}

.nav-overlay__link--cta {
  margin-top: 18px;
  color: var(--accent);
}

/* while the overlay is open the bar itself turns dark */
.nav--menu-open .nav__inner {
  z-index: 41;
  background: var(--ink-panel);
  border-bottom-color: var(--ink-panel-line);
}

.nav--menu-open .nav__brand,
.nav--menu-open .nav__mark {
  color: var(--page);
}

.nav--menu-open .nav__menu-icon i {
  background: var(--page);
}
