/* ===========================================================================
   site-nav.css — sticky top navigation (RTL Hebrew)
   ---------------------------------------------------------------------------
   Constitution: §4 (RTL, logical properties only), §5 (single accent —
   --accent-rose reserved for CTA), §8/§9 (reduced-motion, 3px brass focus
   ring), §10.2 (tokens are single-source).

   Redesign 2026-06-01:
   - Single clean breakpoint at 1024px (was a dead-zone at 901–1023px).
       ≥ 1024px → full desktop bar.
       < 1024px → hamburger + overlay.
   - Desktop shows ~6 PRIMARY links; [data-secondary] links are hidden on
     desktop and surface only in the mobile overlay clone.
   - Scroll state: .site-nav.is-scrolled condenses the bar (less padding,
     opaque ivory + shadow, slightly smaller logo). JS adds the class.
   - RTL underline grows from the inline-start (right) edge correctly.
   - CTA: outline by default, fills with --accent-rose on hover/focus.
   ========================================================================= */


.site-nav {
  /* position: fixed (was sticky) — 2026-06-10 bounce fix. A sticky nav
     reserves an 81px box at its document origin (above #hero). The hero
     hover-reveal mode switches the nav to `fixed` (no reserve, hero flush at
     y=0); when the user scrolled ~80% past the hero, hero-mode dropped and the
     nav reverted to `sticky`, RE-INSERTING that 81px reserve above the hero —
     shoving the whole page down 81px mid-scroll (the "bounce" the user saw;
     Playwright confirmed docHeight 21411→21492 + hero.top 0→81 at that exact
     point). Keeping it `fixed` always removes the swap → no reserve ever →
     no bounce. The hero is full-bleed at y=0 (correct), and post-hero the
     fixed bar pins to top:0 exactly as the sticky one did when stuck. */
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: var(--z-sticky);
  background: color-mix(in srgb, var(--ivory) 86%, transparent); /* ivory @ 86% */
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-block-end: 1px solid var(--border);
  transition: background var(--dur-base) var(--ease-out-cinema),
              box-shadow var(--dur-base) var(--ease-out-cinema),
              border-color var(--dur-base) var(--ease-out-cinema);
}

/* Scroll state — condensed, opaque, lifted ------------------------------- */
.site-nav.is-scrolled {
  background: color-mix(in srgb, var(--ivory) 97%, transparent); /* ivory @ 97% — near-solid */
  box-shadow: var(--shadow-soft);
  border-block-end-color: transparent;
}

.site-nav__inner {
  max-inline-size: 1440px;
  margin-inline: auto;
  padding-block: var(--space-6);
  padding-inline: clamp(20px, 3.4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-block-size: 88px;
  transition: padding-block var(--dur-base) var(--ease-out-cinema),
              min-block-size var(--dur-base) var(--ease-out-cinema);
}

.site-nav.is-scrolled .site-nav__inner {
  padding-block: var(--space-3);
  min-block-size: 68px;
}

/* Reveal-grow (2026-06-09 v8) — driven by the JS-toggled
   [data-hero-mode][data-nav-revealed] attributes (NOT CSS :hover). The bar
   arrives at 160px in the SAME transition as the slide-in, so the user sees
   one motion instead of the v7 double-jump (88px slide-in followed by an
   88→160px snap when :hover later fired). 160px guarantees the bar fully
   covers the GAMOS brand mark (top:4%, ~95px tall → ~140px from top).
   The opaque-ivory + box-shadow treatment lives in
   css/components/site-nav-hover.css under the same selector. */
html[data-hero-mode="true"][data-nav-revealed="true"] .site-nav__inner {
  padding-block: var(--space-10);
  min-block-size: 160px;
}

/* Brand -------------------------------------------------------------------- */
.site-nav__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--fg);
  line-height: 0;
}

.site-nav__brand-logo {
  display: block;
  height: 76px;
  width: auto;
  max-inline-size: 340px;
  object-fit: contain;
  transition: opacity var(--dur-base) var(--ease-out-cinema),
              height  var(--dur-base) var(--ease-out-cinema);
}
.site-nav.is-scrolled .site-nav__brand-logo { height: 56px; }

.site-nav__brand:hover .site-nav__brand-logo { opacity: 0.85; }
.site-nav__brand:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* Link list ---------------------------------------------------------------- */
.site-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(20px, 2.4vw, 40px);
  align-items: center;
  flex: 1;
  justify-content: center;
}

.site-nav__links a {
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 1.5vw, 1.5rem);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-normal);
  color: var(--fg);
  text-decoration: none;
  padding-block: var(--space-3);
  white-space: nowrap;
  position: relative;
  transition: color var(--dur-base) var(--ease-out-cinema);
}

/* Underline — grows from the inline-start (right edge in RTL).
   transform-origin keywords are NOT logical, so in an RTL context we want the
   origin pinned to the RIGHT (the reading start). We set it explicitly to
   `right center` for the resting/exit state and keep it RIGHT on enter so the
   wipe always tracks reading direction. */
.site-nav__links a::after {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  block-size: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: right center; /* RTL: grow from reading start */
  transition: transform var(--dur-base) var(--ease-out-cinema);
}

.site-nav__links a:hover,
.site-nav__links a:focus-visible {
  color: var(--brass-deep);
}
.site-nav__links a:hover::after,
.site-nav__links a:focus-visible::after {
  transform: scaleX(1);
}

.site-nav__links a:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* Active link (scroll-spy sets aria-current="true" + .is-active) ----------- */
.site-nav__links a[aria-current="true"],
.site-nav__links a.is-active {
  color: var(--brass-deep);
}
.site-nav__links a[aria-current="true"]::after,
.site-nav__links a.is-active::after {
  transform: scaleX(1);
}

/* Secondary links never show on the desktop bar — they live in the overlay. */
.site-nav__links a[data-secondary],
.site-nav__links li:has(a[data-secondary]) {
  display: none;
}

/* CTA removed 2026-06-02 (per user: "the standalone Book button is too
   aggressive — let the nav bar BE the call to action"). The .site-nav__cta
   selector and all its rules are intentionally absent now; the contact link
   inside .site-nav__links carries the same affordance, gracefully styled. */

/* Hamburger toggle --------------------------------------------------------- */
.site-nav__toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: var(--space-2);
  cursor: pointer;
  position: relative;
  z-index: calc(var(--z-overlay) + 1); /* above mobile overlay backdrop */
  width: 44px;  /* WCAG 2.5.5 target size — ≥ 44×44px */
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.site-nav__toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.site-nav__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transform-origin: 50% 50%;
  transition: transform var(--dur-base) var(--ease-out-cinema),
              opacity   var(--dur-base) var(--ease-out-cinema);
}

/* Hamburger → X morph (CSS-only) ----------------------------------------- */
.site-nav__toggle.is-open .site-nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-nav__toggle.is-open .site-nav__toggle-bar:nth-child(2) {
  opacity: 0;
}
.site-nav__toggle.is-open .site-nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===========================================================================
   Single breakpoint: < 1024px → hamburger + overlay; ≥ 1024px → desktop bar.
   This eliminates the old 901–1023px dead-zone (was two overlapping rules).
   ========================================================================= */
@media (max-width: 1023.98px) {
  .site-nav__links { display: none; }
  .site-nav__toggle { display: inline-flex; }
}

/* On desktop, never show the overlay even if state somehow lingers. */
@media (min-width: 1024px) {
  .site-nav__mobile { display: none !important; }
}

/* ===========================================================================
   Mobile overlay menu (.site-nav__mobile)
   Injected by js/site-nav.js into <body>. Hidden via [hidden] attribute by
   default; .is-open class toggles the visible state with a fade.
   ========================================================================= */

.site-nav__mobile {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: color-mix(in srgb, var(--ivory) 97%, transparent); /* ivory @ 97% — token-mapped */
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out-cinema);
  display: flex;
  justify-content: center;
  /* NOTE: do NOT use `align-items: center` here. With all ~15 links the inner
     list is TALLER than the viewport; flex centering then overflows
     SYMMETRICALLY and pushes the top items ABOVE the scroll origin where they
     can't be reached (the bug: "can't scroll to the top items"). Instead the
     inner block centers via `margin: auto` (see __inner) — it centers when the
     content fits and collapses to 0 when it overflows, keeping the top
     reachable. -webkit-overflow-scrolling gives momentum scroll on iOS. */
  padding-block: var(--space-24) var(--space-16);
  padding-inline: var(--gutter);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.site-nav__mobile[hidden] {
  display: none;
}

.site-nav__mobile.is-open {
  opacity: 1;
}

.site-nav__mobile__inner {
  width: 100%;
  max-width: var(--container-narrow);
  /* margin:auto (not the parent's align-items:center) does the vertical
     centering. When the list fits, the auto top/bottom margins split the slack
     evenly → centered. When it's taller than the scroll area, the auto margins
     collapse to 0 → the list starts at the top and EVERY item is scroll-
     reachable (incl. padding-block on the parent). This is the standard
     overflow-safe centering pattern for a scrollable flex overlay. */
  margin-block: auto;
  margin-inline: auto;
}

.site-nav__mobile__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: center;
}

/* In the overlay, ALL links (primary + secondary) are visible. */
.site-nav__mobile__links a {
  display: block;
  font-family: var(--font-display-he);
  font-size: var(--text-xl);
  font-weight: var(--fw-medium);
  color: var(--fg);
  text-decoration: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transition: color var(--dur-base) var(--ease-out-cinema),
              background var(--dur-base) var(--ease-out-cinema);
}

.site-nav__mobile__links a:hover,
.site-nav__mobile__links a:focus-visible {
  color: var(--brass-deep);
  background: var(--bg-alt);
  outline: none;
}

.site-nav__mobile__links a:focus-visible {
  box-shadow: var(--focus-ring);
}

.site-nav__mobile__links a[aria-current="true"],
.site-nav__mobile__links a.is-active {
  color: var(--brass-deep);
}

/* Body scroll lock while mobile nav is open. */
html.nav-open,
html.nav-open body {
  overflow: hidden;
}

/* ===========================================================================
   Reduced motion — kill the condense/underline/CTA transitions.
   (Token durations already collapse to ~0ms via tokens.css, but we also drop
   the transform translate on the CTA so nothing jumps.)
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .site-nav,
  .site-nav__inner,
  .site-nav__brand-logo,
  .site-nav__links a::after,
  .site-nav__mobile {
    transition: none;
  }
}
