/* The landing build wraps every section in <div data-section="..."> so the
   copy-edit overlay can name the partial a block came from. That wrapper is
   also the sticky containing block, and it is exactly as tall as the nav, so
   the nav had nowhere to travel: scroll down on a phone and the menu button
   scrolled away with the page, with no way back to it short of scrolling to
   the top. `display: contents` takes the wrapper out of the box tree, leaving
   the nav a child of <body> the way it is on every hand-written page, so it
   sticks. The overlay only calls closest("[data-section]") and reads the
   attribute, so an element with no box still answers it. Scoped to div on
   purpose: the shared nav partial puts data-section="nav" on the <nav>
   itself as well, and an unscoped selector took the nav's own box away. */
div[data-section="nav"] { display: contents; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: #FFFFFF;
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
/* Three-column grid so the link list is dead-centred regardless of
 * whether the left logo is visible or faded out. Logo column on the
 * left, links centred, CTAs anchored right. The 1fr/auto/1fr ratio
 * keeps the centre block independent of the side widths. */
.nav__inner {
  /* Three-column balance: brand pinned left, links centred, actions right.
     (Superseded the earlier flush-left layout once "Sign in" was removed and
     the row read crunched-left with an empty right side. Tom 2026-07-27.) */
  display: grid;
  /* Brand on the left; the link and the actions together on the right, as
     Tom's reference has them (14 Nov 2026). */
  grid-template-columns: 1fr auto auto;
  align-items: center;
  min-height: var(--nav-h, calc(72px * var(--s, 1)));
}
.logo {
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}
.logo--v2 { gap: 8px; }
/* Nav-scoped logo size: smaller than the base 64px so the wordmark
   fits inside the nav row comfortably. */
.nav .logo picture { display: contents; }
.nav .logo__mark { height: 32px; }

/* Omnipresent F mark, top-left. Tom 2026-05-22: no fade, no collapse,
 * no scroll-gated visibility — the F is always there. The earlier
 * fade-on-scroll behaviour (the menu items slid left when the logo
 * was hidden, then right when it appeared) is retired. */
.nav .logo {
  margin-right: 24px;
}
/* Brand lockup: the F mark + the Beta status pill. The wrapper carries the
   24px margin so the mark's left edge stays put; the pill sits 8px to its
   right and the nav links begin after the wrapper. Mirrors the app's
   .beta-badge (src/v2/shell/BetaBadge.css). */
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: calc(10px * var(--s, 1));
  justify-self: start;
}
.nav .nav__brand .logo { margin-right: 0; }
.nav__beta {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  color: var(--coral-ink);
  background: var(--coral-soft);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
  /* Fixed width (FANTENNA-2054). On a phone the logo shrinks to whatever
     the nav row leaves it, so its size followed this pill's text width: the
     move from Archivo to Figtree made the pill 0.8px narrower and the logo
     0.8px wider. 45.78125px is the pill's width in Archivo, so the logo keeps
     exactly the size it had. e2e/marketing-logo.spec.ts guards it. */
  box-sizing: border-box;
  width: 45.78125px;
  justify-content: center;
}
.logo__icon { width: 28px; height: 28px; flex-shrink: 0; }
.logo__wordmark {
  font-family: var(--display, var(--sans));
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav__links {
  display: flex; gap: calc(30px * var(--s, 1));
  /* Beside the pill on the right, as Tom's reference has it (14 Nov 2026). */
  justify-self: end; margin-right: calc(28px * var(--s, 1));
  font-size: calc(16px * var(--s, 1)); color: var(--ink-2); font-weight: 500;
  flex-wrap: nowrap;
}
.nav__links a { position: relative; white-space: nowrap; flex-shrink: 0; padding: calc(6px * var(--s, 1)) 0; transition: color 160ms ease; }
.nav__links a:hover { color: var(--ink); }
/* Selected state: the section currently in view (aria-current set by the
   scroll-spy in runtime.js) gets ink colour + a coral underline. */
.nav__links a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.nav__links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; border-radius: 2px; background: var(--coral);
}
/* Push the CTAs to the right edge of the wrap. Logo + links sit at the
   left (under the giant Fantenna headline); margin-left:auto fills the
   gap. */
.nav__cta { display: flex; gap: calc(8px * var(--s, 1)); align-items: center; justify-content: flex-end; justify-self: end; }

.nav__lang { position: relative; margin-left: calc(14px * var(--s, 1)); }
.nav__lang-btn {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: calc(999px * var(--s, 1));
  height: calc(32px * var(--s, 1));
  padding: 0 calc(10px * var(--s, 1));
  font-family: var(--sans);
  font-size: calc(11.5px * var(--s, 1));
  letter-spacing: 0.01em;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--s, 1));
}
.nav__lang-btn:hover { border-color: var(--ink); color: var(--ink); }
.nav__lang-caret { font-size: calc(9px * var(--s, 1)); }
.nav__lang-menu {
  position: absolute;
  top: calc(100% + calc(8px * var(--s, 1)));
  right: 0;
  min-width: calc(140px * var(--s, 1));
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: calc(12px * var(--s, 1));
  list-style: none;
  margin: 0;
  padding: calc(6px * var(--s, 1));
  display: none;
  z-index: 100;
}
.nav__lang.is-open .nav__lang-menu { display: block; }
.nav__lang-menu li { margin: 0; }
.nav__lang-menu a {
  display: block;
  padding: calc(8px * var(--s, 1)) calc(12px * var(--s, 1));
  font-size: calc(13.5px * var(--s, 1));
  color: var(--ink-2);
  border-radius: calc(8px * var(--s, 1));
}
.nav__lang-menu a:hover { background: var(--paper-2); color: var(--ink); }
.nav__lang-menu a[aria-current="true"] { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) {
  .nav__lang-btn { height: calc(30px * var(--s, 1)); padding: 0 calc(8px * var(--s, 1)); font-size: calc(11px * var(--s, 1)); }
}
/* Hide the link list early so the logo + CTAs + language picker all fit
   on tablet-narrow widths without wrapping or clipping. With the brand
   refresh adding more nav links (Agents, Fan Panel, Process, Blog) plus
   two CTAs and the language picker, ~1280px is the safe threshold. */
@media (max-width: 860px) {
  .nav__links { display: none; }
  /* With the links column removed as a grid item, the two remaining items
     (brand, CTAs) auto-place into col1 + col2 - which parked the lang+burger
     group in the CENTRE auto column and left the right 1fr empty (Tom
     2026-07-27). Pin the CTA group to the third track so it stays hard-right. */
  .nav__cta { grid-column: 3; justify-self: end; }
  /* The bar at burger widths reads logo, Request early access, burger. The
     language picker is in the footer on every page, so it gives up its place
     here. */
  .nav__cta .btn--ghost { display: none; }
  .nav__lang { display: none; }
}
@media (max-width: 640px) {
  /* The logo keeps the box it has always had on a phone: 111.22px by 28px,
     which used to be whatever the row left it after the Beta pill. The pill
     makes way for the Request early access button here, so the box is stated.
     e2e/marketing-logo.spec.ts measures it. */
  .nav .logo__mark { height: 28px; width: 111.22px; flex: none; }
  .nav__beta { display: none; }
  .nav__inner { display: flex; justify-content: space-between; gap: calc(8px * var(--s, 1)); min-height: calc(60px * var(--s, 1)); --nav-h: calc(60px * var(--s, 1)); }
  .nav__brand { flex: none; }
  .nav__lang { margin-left: 0; }
  .nav__pill { padding: 0 calc(14px * var(--s, 1)); font-size: calc(14px * var(--s, 1)); }
}
@media (max-width: 380px) {
  .nav .wrap { padding: 0 calc(14px * var(--s, 1)); }
  .nav__pill { padding: 0 calc(11px * var(--s, 1)); font-size: calc(13.5px * var(--s, 1)); }
}

/* Request early access, in the bar: the black pill. 40px tall so it is a fair
   target on a phone as well. */
.nav__pill { height: calc(40px * var(--s, 1)); padding: 0 calc(18px * var(--s, 1)); font-size: calc(15px * var(--s, 1)); color: var(--paper); }

.nav__burger { display: none; }
@media (max-width: 860px) {
  .nav__burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: calc(4px * var(--s, 1));
    width: calc(36px * var(--s, 1));
    height: calc(36px * var(--s, 1));
    flex: none;
    padding: 0;
    background: transparent;
    border: 1px solid var(--ink-7, rgba(0,0,0,0.12));
    border-radius: calc(999px * var(--s, 1));
    cursor: pointer;
  }
  .nav__burger span {
    display: block;
    width: calc(16px * var(--s, 1));
    height: 1.5px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .nav__burger:hover { background: var(--paper-2); }
  .nav__burger[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); }
  .nav__burger[aria-expanded="true"] span { background: var(--paper); }
  /* Morph the 3 bars into an X when expanded. */
  .nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
}

/* Mobile drawer. Visibility driven by `.nav--menu-open` on the parent
   nav (runtime.js toggles the class). The [hidden] attribute is removed
   from the markup at boot so the cascade can't fight us. */
.nav__mobile { display: none; }
@media (max-width: 860px) {
  /* Drawer is now a SIBLING of <nav>, not a child (nav has backdrop-filter
     which traps fixed descendants inside the 61px nav). Use a body-level
     class so the selector finds the drawer wherever it lives. */
  /* While the menu is open the body is pinned with `position: fixed` and
     offset by the scroll position (runtime.js). A `position: sticky` nav
     sticks inside that offset body, so on a page scrolled down it would sit
     above the viewport and take the close button with it. Fixed for the
     duration of the lock keeps the bar, and the X, on screen. */
  body.nav-menu-open .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }
  body.nav-menu-open .nav__mobile {
    display: block;
    position: fixed;
    /* runtime.js publishes --nav-actual-h on the document root from
       nav.offsetHeight so the drawer always sits directly below the
       rendered nav. --nav-h is the CSS-only fallback for the case where
       JS hasn't run yet (matches min-height on .nav__inner). */
    top: var(--nav-actual-h, var(--nav-h, calc(72px * var(--s, 1))));
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--paper, #FAFAF7);
    border-top: 1px solid var(--rule);
    z-index: 49;
    overflow-y: auto;
    /* Stop a scroll gesture that reaches the end of the drawer from chaining
       through to the page behind it. runtime.js pins the body while the menu
       is open; this is the CSS half of the same job. */
    overscroll-behavior: contain;
    animation: nav-mobile-in 0.18s ease;
  }
  .nav__mobile-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: calc(8px * var(--s, 1)) calc(24px * var(--s, 1)) calc(32px * var(--s, 1));
    max-width: calc(720px * var(--s, 1));
    margin: 0 auto;
  }
  .nav__mobile-inner > a:not(.nav__mobile-cta) {
    display: block;
    padding: calc(18px * var(--s, 1)) calc(4px * var(--s, 1));
    font-size: calc(22px * var(--s, 1));
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
  }
  .nav__mobile-inner > a:not(.nav__mobile-cta):last-of-type { border-bottom: 0; }
  .nav__mobile-rule {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: calc(16px * var(--s, 1)) 0 calc(12px * var(--s, 1));
  }
  .nav__mobile-cta {
    display: block;
    padding: calc(14px * var(--s, 1)) calc(18px * var(--s, 1));
    margin-top: calc(8px * var(--s, 1));
    text-align: center;
    font-size: calc(15px * var(--s, 1));
    font-weight: 600;
    border-radius: calc(999px * var(--s, 1));
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    text-decoration: none;
  }
  .nav__mobile-cta--primary {
    background: var(--ink);
    color: var(--paper);
  }
}
@keyframes nav-mobile-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Log in, for beta users: a plain text link beside the pill. */
.nav__login { font-size: calc(15px * var(--s, 1)); font-weight: 600; color: var(--ink); text-decoration: none; padding: calc(8px * var(--s, 1)) calc(4px * var(--s, 1)); white-space: nowrap; }
.nav__login:hover { text-decoration: underline; text-underline-offset: 3px; }
/* No menu button at any width (Tom, 15 Nov 2026): the bar is the logo, Request
   early access and Log in, and the footer carries the rest. */
.nav__burger, .nav__mobile { display: none !important; }
@media (max-width: 640px) { .nav__login { font-size: calc(14px * var(--s, 1)); padding: calc(8px * var(--s, 1)) 2px; } }
@media (max-width: 380px) { .nav__login { font-size: calc(13.5px * var(--s, 1)); } }
/* "Request early access" does not fit beside the logo and Log in on a phone,
   so the button says "Early access" there. */
.nav__pill-short { display: none; }
@media (max-width: 420px) {
  .nav__pill-long { display: none; }
  .nav__pill-short { display: inline; }
}
/* The smallest phones, in the longer languages: tighten so nothing clips. */
@media (max-width: 340px) {
  .nav__inner { gap: calc(6px * var(--s, 1)); }
  .nav__pill { padding: 0 calc(9px * var(--s, 1)); font-size: calc(12.5px * var(--s, 1)); flex-shrink: 0; }
  .nav__login { font-size: calc(12.5px * var(--s, 1)); padding: calc(8px * var(--s, 1)) 0; }
}

/* A finger needs 44px (site review, FANTENNA-2824 follow-up). */
@media (max-width: 640px) {
  .nav .logo { display: inline-flex; align-items: center; min-height: calc(44px * var(--s, 1)); }
  .nav__login { display: inline-flex; align-items: center; justify-content: center; min-height: calc(44px * var(--s, 1)); min-width: calc(44px * var(--s, 1)); box-sizing: border-box; }
}
