/* ============================================================================
   Eyas — 00 Nav (fixed top bar, frost-on-scroll, bilingual, mobile overlay)
   All custom classes prefixed `nav-`. Reuses .container-wide, .btn, .pill.
   ========================================================================== */

.nav {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: var(--z-nav);
  background: transparent;
  border-block-end: 1px solid transparent;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    background var(--dur-slow) var(--ease),
    border-color var(--dur-slow) var(--ease),
    backdrop-filter var(--dur-slow) var(--ease),
    -webkit-backdrop-filter var(--dur-slow) var(--ease);
}

/* Frosted state once the page scrolls (JS toggles .is-scrolled) */
.nav.is-scrolled {
  background: linear-gradient(180deg, rgba(10,14,20,0.72) 0%, rgba(8,12,20,0.58) 100%);
  border-block-end: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 10px 34px -22px rgba(0,0,0,0.7);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 72px;
  padding-block: var(--sp-3);
}

/* ── Brand lockup ──────────────────────────────────────────────────────────── */
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  margin-inline-end: auto;
  min-height: 44px;
  padding-inline-end: var(--sp-2);
}
.nav-brand__mark {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 9px var(--glow-steel));
  transition: filter var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.nav-brand:hover .nav-brand__mark {
  filter: drop-shadow(0 0 14px var(--glow-frost));
  transform: scale(1.04);
}
.nav-brand__word {
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: var(--tracking-snug);
  color: var(--text-hi);
}

/* ── Desktop links + scroll-spy ────────────────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-mid);
  border-radius: var(--r-sm);
  transition: color var(--dur-base) var(--ease);
}
.nav-link::after {
  content: "";
  position: absolute;
  inset-block-end: 6px;
  inset-inline: var(--sp-3);
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow-steel);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
  transition: transform var(--dur-base) var(--ease), opacity var(--dur-base) var(--ease);
}
.nav-link:hover { color: var(--text-hi); }
.nav-link:hover::after { transform: scaleX(0.45); opacity: 0.7; }
.nav-link.is-active { color: var(--text-hi); }
.nav-link.is-active::after { transform: scaleX(1); opacity: 1; }

/* ── Right cluster ─────────────────────────────────────────────────────────── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ── Language toggle (pill, frosted) ───────────────────────────────────────── */
.nav-lang {
  gap: var(--sp-2);
  padding: 7px 13px;
  min-height: 40px;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.nav-lang:hover { background: var(--glass-fill-hi); border-color: var(--glass-border-hi); }
.nav-lang__opt {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-snug);
  color: var(--text-faint);
  transition: color var(--dur-base) var(--ease), text-shadow var(--dur-base) var(--ease);
}
.nav-lang__opt.is-active {
  color: var(--accent);
  text-shadow: 0 0 10px var(--glow-steel);
}
.nav-lang__sep {
  width: 1px;
  height: 12px;
  background: var(--glass-border-hi);
}

/* The nav CTA is THE primary conversion path, so it carries the filled steel
   .btn--primary treatment (same register as the hero CTA). Here we only tune
   its size to sit comfortably in the bar. */
.nav-cta { min-height: 44px; padding: 11px 20px; }

/* ── Hamburger (hidden on desktop) ─────────────────────────────────────────── */
.nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  color: var(--text-hi);
  transition: background var(--dur-base) var(--ease);
}
.nav-burger:hover { background: var(--glass-fill-hi); }
.nav-burger__icon {
  position: absolute;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.nav-burger__icon--close { opacity: 0; transform: rotate(-90deg) scale(0.8); }
html.menu-open .nav-burger__icon--open { opacity: 0; transform: rotate(90deg) scale(0.8); }
html.menu-open .nav-burger__icon--close { opacity: 1; transform: rotate(0) scale(1); }

/* ── Mobile overlay menu ───────────────────────────────────────────────────── */
.nav-menu {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  /* dvh excludes the mobile URL bar so a short menu fits the *visible* viewport
     and never forces a scroll (100vh fallback for older browsers). */
  height: 100vh;
  height: 100dvh;
  z-index: calc(var(--z-nav) - 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--sp-6);
  /* Links top-aligned below the header; the foot pins to the bottom (see
     .nav-menu__foot) so the screen fills without scrolling. Scroll stays only
     as a silent fallback for very short landscape viewports. */
  padding: calc(64px + var(--sp-5)) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--sp-7));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(8,12,20,0.92) 0%, rgba(5,7,13,0.96) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease),
    visibility 0s linear var(--dur-slow);
}
html.menu-open .nav-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease),
    visibility 0s linear 0s;
}

.nav-menu__links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.nav-menu__link {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--text-mid);
  transition: color var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.nav-menu__link:hover,
.nav-menu__link:focus-visible { color: var(--text-hi); transform: translateX(4px); }

.nav-menu__foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-5);
  /* Pin actions to the bottom edge so the overlay fills the screen without a
     scroll — collapses to 0 only when content genuinely overflows. */
  margin-top: auto;
  padding-top: var(--sp-6);
  border-top: 1px solid var(--glass-border);
}
/* Larger, higher-contrast variant for the dark overlay (the faint default
   pill is barely legible on the near-black menu background). */
.nav-lang--menu { min-height: 48px; padding: 11px 20px; gap: var(--sp-3); }
.nav-lang--menu .nav-lang__opt { font-size: var(--fs-sm); color: var(--text-mid); }
.nav-lang--menu .nav-lang__opt.is-active { color: var(--accent); }
.nav-lang--menu .nav-lang__sep { height: 16px; }
.nav-menu__cta { width: 100%; max-width: 360px; }

/* ── Responsive: collapse into overlay at <= 860px ─────────────────────────── */
@media (max-width: 860px) {
  .nav-links,
  .nav-cta,
  .nav-actions > .nav-lang { display: none; }
  /* Lift the burger above the overlay (a child of .nav, so it shares the nav's
     stacking context with .nav-menu at z-nav - 1). Without this the open menu
     covers the X — it stays visible and clickable to close. */
  .nav-burger { display: inline-flex; position: relative; z-index: calc(var(--z-nav) + 1); }
  .nav-inner { min-height: 64px; }
}

@media (min-width: 861px) {
  .nav-menu { display: none; }
}

/* ── Desktop polish (>=1024px) ─────────────────────────────────────────────
   Align the bar to the SAME measure as the hero/content column (.container,
   1320) so the brand sits directly above the hero eyebrow + headline. Give the
   bar a little top breathing room so it reads as a floating frosted rail rather
   than glued to the viewport edge. Balance the link group around an optical
   center between brand and the right action cluster. Mobile rules above are
   untouched. */
@media (min-width: 1024px) {
  /* Override the parent .container-wide measure so the bar's content column
     matches the hero's .container exactly: the brand lands directly above the
     hero eyebrow + headline left edge. (.container-wide already applies the
     gutter; here we just narrow the inner max-width and re-center.) */
  .nav-inner {
    max-width: calc(var(--container) - 2 * var(--gutter));
    margin-inline: auto;
    min-height: 76px;
    gap: var(--sp-7);
    padding-block: var(--sp-4) var(--sp-3);
  }
  /* The links are the optical centerpiece: let them sit in their own balanced
     group, evenly spaced, with the brand pushed left and actions right. */
  .nav-links { gap: var(--sp-1); }
  .nav-link { padding-inline: var(--sp-4); }
  /* Slightly tighter, calmer right cluster so the CTA stays the loudest thing. */
  .nav-actions { gap: var(--sp-4); }
  .nav-cta { padding: 12px 22px; }

  /* A touch more refinement on the scrolled frost: deeper blur + a hairline
     top sheen so the rail reads as a single crisp pane of frosted glass. */
  .nav.is-scrolled {
    background: linear-gradient(180deg, rgba(10,14,20,0.74) 0%, rgba(8,12,20,0.60) 100%);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow:
      inset 0 1px 0 0 rgba(176,214,255,0.08),
      0 14px 40px -26px rgba(0,0,0,0.8);
  }
}

/* Ultra-wide (>=1440px): keep the bar anchored to the readable measure and add
   a hair more vertical room so the rail feels intentional on tall monitors. */
@media (min-width: 1440px) {
  .nav-inner { min-height: 80px; padding-block: var(--sp-5) var(--sp-3); }
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nav,
  .nav-menu,
  .nav-burger__icon,
  .nav-brand__mark,
  .nav-menu__link { transition: opacity var(--dur-base) linear, visibility 0s; }
  .nav-menu__link:hover { transform: none; }
}
