/*
 * Shared shell for every generated page (header, footer, collapsible menu) in the 2026-11 look:
 * near-black cockpit ground, Roboto / Roboto Mono, orange focus ring. Content and avionics tokens remain
 * owned by docs (tokens.css). Loaded after each page's own CSS, so equal-specificity rules here win.
 */
:root {
  --font-sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ink: #E2E8F0;          /* body copy on the cockpit ground, 14:1 */
  --ground-deep: #080B12;  /* recessed wells: footer, result box */
  --reg: #475569;          /* decorative registration marks only, never text */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Header ---- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(10,14,23,0.96); border-bottom: 1px solid var(--color-cockpit-border-strong); }
.site-shell { max-width: 1200px; margin: auto; padding: 14px 24px; color: var(--color-text-stencil); font-family: var(--font-sans); }
.site-header .site-shell { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px; }
.site-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--color-text-stencil); text-decoration: none; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.site-brand img { border-radius: var(--radius-sm); }
.site-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 1 1 auto; min-width: 0; }
.site-header .site-nav { position: static; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 22px; padding: 0; background: transparent; border: 0; backdrop-filter: none; }
.site-nav a, .site-languages a, .site-footer-links a { color: var(--color-text-muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; padding: 4px 0; }
.site-nav a { display: inline-flex; align-items: center; gap: 6px; }
.site-nav a:hover, .site-languages a:hover, .site-footer-links a:hover { color: var(--color-flight-orange-light); }
.site-languages { display: flex; flex-wrap: wrap; gap: 4px 18px; width: 100%; }
.site-header .site-languages { justify-content: flex-end; width: auto; font-size: 0.85rem; }
.site-header .site-languages a { font-size: 0.85rem; }
.nav-icon { flex: none; }
.site-header a:focus-visible, .site-footer a:focus-visible, .site-menu-toggle:focus-visible { outline: 2px solid var(--color-flight-orange-light); outline-offset: 3px; border-radius: 3px; }
html { scroll-padding-top: 120px; }

/* Collapsible menu: only when JS has marked the document (the `js` class), so the menu is always reachable without JS. */
.site-menu-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 1px solid var(--color-cockpit-border-strong); border-radius: var(--radius-sm); background: transparent; color: var(--color-text-stencil); cursor: pointer; }
.site-menu-toggle:hover { border-color: var(--color-flight-orange-light); color: var(--color-flight-orange-light); }
.site-menu-toggle[aria-expanded="false"] .menu-x, .site-menu-toggle[aria-expanded="true"] .menu-bars { display: none; }
@media (max-width: 900px) {
  .js .site-menu-toggle { display: inline-flex; }
  .js .site-menu { display: none; flex-basis: 100%; align-items: stretch; padding: 8px 0 12px; border-top: 1px solid var(--color-cockpit-border); }
  .js .menu-open .site-menu { display: flex; }
  .js .site-header .site-nav { flex-direction: column; justify-content: flex-start; gap: 0; }
  .js .site-nav a { min-height: 44px; font-size: 1rem; border-bottom: 1px solid var(--color-cockpit-border); }
  .js .site-header .site-languages { justify-content: flex-start; padding-top: 6px; }
  .js .site-header .site-languages a { min-height: 40px; display: inline-flex; align-items: center; }
  .js .site-header.menu-open { max-height: 100vh; overflow-y: auto; }
  html:not(.js) .site-header { position: relative; }
  html { scroll-padding-top: 72px; }
}
@media (max-width: 600px) { html:not(.js) .site-header .site-menu { align-items: flex-start; } html:not(.js) .site-header .site-nav, html:not(.js) .site-header .site-languages { justify-content: flex-start; } }

/* ---- Footer ---- */
.site-footer { background: var(--ground-deep); border-top: 1px solid var(--color-cockpit-border-strong); margin-top: 48px; padding: 40px 0 32px; }
.site-footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 12px 0 20px; }
.site-footer p { color: var(--color-text-muted); margin: 16px 0 0; font-size: 0.9rem; max-width: 70ch; }
.site-footer .site-brand { color: var(--color-text-stencil); }
.site-footer-title { margin: 32px 0 0; font: 600 0.75rem/1.2 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted); }
.site-footer .site-languages { margin-top: 28px; }

/* ---- Features (markdown) and 404 pages ---- */
body:has(.markdown-body) { font-family: var(--font-sans); background-image: linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px); background-size: 64px 64px; }
.markdown-body { font-family: var(--font-sans); color: var(--ink); }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.01em; color: var(--color-text-stencil); }
.markdown-body h1 { letter-spacing: -0.02em; text-wrap: balance; }
.markdown-body a { color: var(--color-flight-orange-light); text-decoration: underline; text-underline-offset: 3px; }   /* links in running text must not rely on colour alone */
.markdown-body table { display: table; width: 100%; table-layout: auto; }   /* keeps native table semantics in every browser; cells wrap instead of scrolling */
.markdown-body th, .markdown-body td { overflow-wrap: anywhere; }
.markdown-body a:hover { color: var(--color-text-stencil); }
.markdown-body a:focus-visible { outline: 2px solid var(--color-flight-orange-light); outline-offset: 3px; }
.markdown-body code, .markdown-body kbd, .markdown-body pre { font-family: var(--font-mono); }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body p, .markdown-body li { overflow-wrap: anywhere; }

/* Memory simulator: the saved-file estimate is a second reading, set apart from the RAM figure
   (owner request AB-2511-25). A hairline rule and its own label scale, not a nested card. */
.calc-saved { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--color-cockpit-border-strong); }
.calc-saved p { margin: 0; }
.calc-saved-label { color: var(--color-text-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.calc-saved-sizes { margin-top: 8px !important; color: var(--color-text-stencil, #F8FAFC); font-family: var(--font-mono); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.calc-saved-note { margin-top: 10px !important; color: var(--color-text-muted); font-size: 0.8rem; line-height: 1.5; }
.calc-saved-part { white-space: nowrap; }

/* ---- Design prototype (/design/): visual-only fixes, content untouched ---- */
body:has(.simulator-container) { --color-text-dim: #8A99AE; }   /* #64748B was 3.5:1 on the panels; this is 5.6:1 */
body:has(.simulator-container) .code-comment { color: #8A99AE; }
@media (max-width: 1024px) {
  body:has(.simulator-container) .workbench { grid-template-columns: minmax(0, 1fr); }
  body:has(.simulator-container) .workbench > * { min-width: 0; }
}
body:has(.simulator-container) .panel-state-swatch { overflow-x: auto; }
body:has(.simulator-container) code { overflow-wrap: anywhere; }
body:has(.simulator-container) .top-tag { color: var(--color-flight-orange-light); }   /* #FF5722 on the tinted selected-preset tag was 4.0:1 */

/* ---- Legal pages: language switch (the page's own CSS styles `button`, the markup uses `a`) ---- */
.lang-switch { top: 96px; }
@media (max-width: 900px) { .lang-switch { top: 72px; } }
.lang-switch a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border: 1px solid rgba(255,255,255,0.28); border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); color: var(--color-text-muted); font: 700 0.78rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; transition: border-color .18s var(--ease-out), color .18s var(--ease-out); }
.lang-switch a:hover { border-color: var(--color-flight-orange-light); color: var(--color-text-stencil); }
.lang-switch a[aria-current="true"] { background: rgba(255,87,34,0.14); border-color: rgba(255,138,80,0.6); color: var(--color-flight-orange-light); }
.lang-switch a:focus-visible { outline: 2px solid var(--color-flight-orange-light); outline-offset: 3px; }

/* ---- Contrast fix found by the manual checker (visual only): legal meta lines ---- */
.policy-meta, .policy-doc em { color: var(--color-text-muted); }
