/* Nav pill: the one owner of its surface and of the condense-on-scroll behaviour, for every page.
   Loaded after each page's own stylesheets. Pages set the tokens below, never the surface itself.

   Surface: .nav-inner keeps its full box (so layout never changes) and draws nothing; its ::before
   draws the pill (fill, hairline, blur, shadow). The transparent 1px border only reserves the space
   the visible hairline used to take.

   Condense (js/nav-condense.js toggles .nav-condensed past ~24px of scroll): from 1150px wide the
   visible pill narrows to 1080px. ::before scales on X by 1080px / its own width, with its corner
   radius divided by the same factor so the ends stay round, and the logo and actions slide in by the
   gap on each side (the links with the actions where a page has them). Only transforms and the radius change, so no layout and no layout shift (an
   animated width, or left/right on ::before, is reported as layout shift). The factor and the gap are
   plain CSS maths on the container's width (container units, atan2/tan for the ratio); nothing is
   measured in JS. One transition per toggle, never tied to scroll position. */

:root {
  --nav-surface-bg: rgba(255,255,255,.88);
  --nav-surface-bd: rgba(32,40,50,.10);
  --nav-surface-shadow: 0 8px 30px rgba(28,39,48,.07), 0 1px 3px rgba(28,39,48,.03);
  --nav-surface-blur: blur(20px) saturate(150%);
  --nav-surface-radius: 999px;
  --nav-condensed-w: 1080px;
  --nav-ease: cubic-bezier(.22, 1, .36, 1);
}
:root[data-theme="dark"] {
  --nav-surface-bg: rgba(26,28,32,.90);
  --nav-surface-bd: rgba(255,255,255,.086);
  --nav-surface-shadow: 0 8px 28px rgba(0,0,0,.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nav-surface-bg: rgba(26,28,32,.90);
    --nav-surface-bd: rgba(255,255,255,.086);
    --nav-surface-shadow: 0 8px 28px rgba(0,0,0,.2);
  }
}

/* the app-style pages (nav.js) take their surface from the v4 glass tokens; once the page has
   scrolled (script.js adds .nav-solid, also on the homepage) the glass gets denser and lifts */
body.zs26:not(.arc-concept) .nav {
  --nav-surface-bg: var(--glass-v4);
  --nav-surface-bd: var(--glass-v4-bd);
  --nav-surface-shadow: 0 10px 42px rgba(18, 25, 20, .07);
  --nav-surface-radius: var(--r-pill);
}
body.zs26 .nav.nav-solid {
  --nav-surface-bg: var(--glass-bg);
  --nav-surface-shadow: var(--e3);
}

.nav-inner {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  border: 1px solid transparent;
  /* the box is 100cqw + 34px padding + 2px border wide from 1150px up; the pill condenses to --nav-condensed-w */
  --nav-inset: max(0px, calc((100cqw + 36px - var(--nav-condensed-w)) / 2));
  --nav-fit: min(1, tan(atan2(var(--nav-condensed-w), calc(100cqw + 36px))));
}
.nav-inner::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  pointer-events: none;
  box-sizing: border-box;
  background: var(--nav-surface-bg);
  border: 1px solid var(--nav-surface-bd);
  border-radius: var(--nav-surface-radius);
  box-shadow: var(--nav-surface-shadow);
  -webkit-backdrop-filter: var(--nav-surface-blur);
  backdrop-filter: var(--nav-surface-blur);
  transition: scale .4s var(--nav-ease), border-radius .4s var(--nav-ease), box-shadow .3s ease, background .3s ease;
}
.nav-inner .nav-logo, .nav-inner .nav-links, .nav-inner .nav-actions { transition: translate .4s var(--nav-ease); }

@media (min-width: 1150px) {
  @supports (width: calc(tan(atan2(1px, 1px)) * 1px)) {
  .nav.nav-condensed .nav-inner { pointer-events: none; }
  .nav.nav-condensed .nav-inner > * { pointer-events: auto; }
  .nav.nav-condensed .nav-inner::before {
    scale: var(--nav-fit) 1;
    border-radius: calc(var(--nav-surface-radius) / var(--nav-fit)) / var(--nav-surface-radius);
  }
  .nav.nav-condensed .nav-inner .nav-logo { translate: var(--nav-inset) 0; }
  .nav.nav-condensed .nav-inner .nav-links,
  .nav.nav-condensed .nav-inner .nav-actions { translate: calc(-1 * var(--nav-inset)) 0; }
  }
}

.nav.nav-condense-instant .nav-inner::before,
.nav.nav-condense-instant .nav-inner .nav-logo,
.nav.nav-condense-instant .nav-inner .nav-links,
.nav.nav-condense-instant .nav-inner .nav-actions { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .nav-inner::before, .nav-inner .nav-logo, .nav-inner .nav-links, .nav-inner .nav-actions { transition: none; }
}

/* Nav links: the one owner of the link pill (padding, radius, type, hover, press, focus) for every page.
   Blog markup calls them .nav-link, the generated landing nav .nav-docs-link. */
.nav-actions > .nav-link, .nav-actions > .nav-docs-link {
  padding: 6px 10px; border-radius: 16px;
  font-size: 14.5px; font-weight: 500; line-height: 1.6; color: var(--ink, #101210); text-decoration: none;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
@media (min-width: 1150px) { .nav-actions > .nav-link, .nav-actions > .nav-docs-link { margin-right: -6px; } }
@media (hover: hover) {
  .nav-actions > .nav-link:hover, .nav-actions > .nav-docs-link:hover { background: var(--green-tint, var(--accent-tint, #dce8ff)); color: var(--green-deep, var(--accent-deep, #244fae)); }
}
.nav-actions > .nav-link:active, .nav-actions > .nav-docs-link:active { transform: translateY(1px); }
.nav-actions > .nav-link:focus-visible, .nav-actions > .nav-docs-link:focus-visible { outline: 2px solid var(--accent-deep, #244fae); outline-offset: 2px; }
