/* ══ THE SITE HEADER. ONE COPY, ONE PATTERN. ═════════════════════════════════
   Ruled 18 Aug 2026 (one header on every page); restyled in the premium pass, 29 Sep 2026.

   ONE pattern everywhere: brand, links, and the call to action. A legal page is a destination,
   not a dead end.

   LOAD ORDER. Every page links this file LAST, after tokens.css and site.css, so THIS FILE WINS
   every conflict at equal specificity and a page cannot restyle its own bar without raising
   specificity on purpose. test/nav-css-is-declared-once.test.js fails if any other stylesheet
   declares header rules, and test/nav-geometry.test.js renders all ten pages and fails if their
   bars differ.

   THE BAR'S VERTICAL SPACE is .nav-inner's padding and nothing else. The zero padding on .nav
   (specificity 0,1,0) beats a bare element rule padding "nav" (0,0,1) whoever loads first — the
   leftover that once shipped three pages at 110px against 74px. The padding is longhand and split by axis
   (vertical on .nav-inner, horizontal on .nav .wrap) so neither rule can reach the other's axis. */

/* Opaque paper with a hairline. A translucent bar turned a muddy grey over the ink band at the close; a solid
   surface reads the same over every section. */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--ground);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.nav .nav-inner { padding-top: 14px; padding-bottom: 14px; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }

/* The mark keeps its own colours: the three bars, drawn exactly as the favicon draws them. */
.logo-mark { display: flex; align-items: flex-end; gap: 2.5px; height: 18px; }
.logo-mark span { display: block; width: 4px; border-radius: 1.5px; }
.logo-mark span:nth-child(1) { height: 8px; background: #C7CDF7; }
.logo-mark span:nth-child(2) { height: 13px; background: #8B9AF2; }
.logo-mark span:nth-child(3) { height: 18px; background: #4A5FE8; }

/* The wordmark is one of the serif's three jobs. */
.nav-name { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; font-size: 20px; line-height: 1; color: var(--text-primary); }
.nav-name .q-accent, .nav-name .q { color: var(--text-primary); }

.nav-right { display: flex; align-items: center; gap: 32px; }
.nav-links { display: flex; gap: 28px; }
.nav-link { font-size: 14px; color: var(--text-secondary); text-decoration: none; transition: color 160ms var(--ease); }
.nav-link:hover { color: var(--text-primary); }

/* 0,2,0 and 0,2,1: a bare "a:hover" is 0,1,1 and would otherwise reach into the bar. */
.nav .nav-link, .nav .nav-brand { text-decoration: none; }
.nav .nav-link:hover, .nav .nav-brand:hover { text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text-primary); font-weight: 500; }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--border-strong);
  border-radius: 8px; width: 36px; height: 36px; padding: 0; cursor: pointer; color: var(--text-primary);
  align-items: center; justify-content: center;
}
.nav-toggle svg { display: block; }
.nav-toggle:focus-visible, .nav-link:focus-visible, .nav-brand:focus-visible, .nav .btn-primary:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px;
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--surface-0); border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px; box-shadow: 0 16px 32px -16px rgba(26, 26, 46, 0.18);
  }
  .nav-links.open .nav-link { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
  .nav-links.open .nav-link:last-child { border-bottom: 0; }
  .nav-toggle { display: inline-flex; width: 44px; height: 44px; order: 3; }
  .nav-right { gap: 10px; }
  /* 44 px tap targets on a phone, inside the same 65 px bar: the padding gives up what the targets take
     (the button's own height is raised at the end of this file, after its base rule). */
  .nav .nav-inner { padding-top: 10px; padding-bottom: 10px; }
}

/* THE HEADER OWNS ITS OWN BUTTON AND ITS OWN MEASURE. The bar pins the site's one grid (1,200 px
   of content inside 24 px gutters) whatever a page does with its prose column, and it gives its
   button a text colour of its own, so no page can render it as an empty rectangle. */
.nav .wrap { max-width: 1248px; padding-left: 24px; padding-right: 24px; }
.nav .btn-primary {
  color: #fff;
  background: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease);
}
.nav .btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--blue)); }
@media (max-width: 720px) {
  /* On a phone the hero's own button sits just below, so the header's is the light one: the words stay, the fill goes. */
  .nav .btn-primary { height: 44px; background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); }
  .nav .btn-primary:hover { background: var(--surface-1); }
}
@media (max-width: 380px) {
  .nav .btn-primary { padding: 0 12px; font-size: 13.5px; }
}
