/* =============================================================================
   nav.css — single source of truth for the site nav.
   Loaded on every page that includes the canonical <header class="site-nav">.
   To change the look of the nav, edit THIS FILE only — do not paste these
   rules back into per-page <style> blocks.
   ============================================================================= */

/* — Skip link — first focusable element on every page (WCAG 2.4.1 Bypass Blocks).
     Visually hidden offscreen until focused; appears top-left on Tab.
     Pages that ship their own .skip-link rules in an inline <style> block
     (currently /index.html and /quiz/index.html) will override these via
     normal cascade order. */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--cta, #D8A45C);
  color: var(--cta-on, #211913);
  border-radius: 0 0 10px 10px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Inter", sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 2px solid var(--cta-on, #211913);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* — Canonical variable scope —
     Pages override --ink-soft / --rule / --max-full in their own :root blocks
     (e.g. audit + data ship with --max-full:1100px and --ink-soft:#3a4148,
     which makes the nav look narrower and darker than on the rest of the site).
     Re-declaring the variables on header.site-nav and its inner .wrap-full
     forces the nav to render identically on every page, regardless of what
     each page's :root says.
     D185.A (2026-05-12): --font-display defensive re-declaration removed — the
     per-page :root font-var drifts it shielded against have been deleted, so
     this line was vestigial. The audit-pattern preflight tool
     (tools/preflight-css-vars.js) now provides standing defense against
     future font-var drift. --ink-soft / --rule remain in scope because the
     non-font drifts are still live (out of D185.A scope). */
header.site-nav {
  /* Rebrand: force the dark-brand nav chrome regardless of any per-page :root drift. */
  --ink-soft: #B8AC9A;
  --rule: #4A3D31;
}
header.site-nav .wrap-full {
  max-width: 1240px;
}

/* — Sticky wrapper — */
header.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(33, 25, 19, 0.82);  /* espresso, translucent */
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}
header.site-nav.scrolled {
  background: rgba(33, 25, 19, 0.94);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.45);
}

/* — Layout row — */
.site-nav .nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  font-family: var(--font-sans);
  position: relative;
  z-index: 50;
}

/* — Brand (mark + name) — */
.site-nav .nav-brand {
  display: inline-flex;
  align-items: center;  /* center the arrow-N SVG with the wordmark (baseline sat the mark too high) */
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}
.site-nav .nav-brand:hover .nav-name {
  /* brass, not var(--accent) — /quiz overrides --accent to teal for its interaction
     accents, which would otherwise turn the brand wordmark teal on hover. */
  color: var(--accent-blue);
}
/* Brand mark — the arrow-N (the "N" right leg becomes an up-arrow = getting
   better). Inline SVG inside .nav-mark uses currentColor (brass). */
.site-nav .nav-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;  /* the arrow-N IS the mark — override the generic .nav-mark box from tokens.css */
  color: var(--accent-blue);  /* brass; svg strokes inherit via currentColor */
  line-height: 1;
}
.site-nav .nav-mark svg {
  display: block;
  width: 30px;
  height: 30px;
}
.site-nav .nav-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* — Inline links (desktop) — */
.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-nav .nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.site-nav .nav-links a:hover {
  color: var(--ink);
}
.site-nav .nav-links a.btn,
.site-nav .nav-links a.btn-nav {
  color: var(--cta-on, #fff);
  padding: 0.55rem 1.05rem;
  font-size: 0.88rem;
}
.site-nav .nav-links a.btn::after,
.site-nav .nav-links a.btn-nav::after {
  display: none;
}

/* — Hamburger toggle — */
.site-nav .nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
}
.site-nav .nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.site-nav .nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-nav .nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.site-nav .nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* — Mobile drawer — */
.site-nav .nav-mobile {
  display: none;
  flex-direction: column;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--rule);
}
.site-nav .nav-mobile a {
  display: block;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav .nav-mobile a:hover {
  color: var(--ink);
}
.site-nav .nav-mobile a.btn {
  margin-top: 1.25rem;
  border-bottom: none !important;
  display: block;
  text-align: center;
  padding: 0.8rem 1.6rem;
  color: var(--cta-on, #fff);
}
.site-nav .nav-mobile a.btn::after {
  display: none;
}
.site-nav .nav-mobile.is-open {
  display: flex;
}

/* — Responsive — */
@media (max-width: 768px) {
  .site-nav .nav-links {
    display: none !important;
  }
  .site-nav .nav-toggle {
    display: flex;
  }
}
