/* Sonic Ops theme — adapted from DESIGN.md for the field manual. */
@font-face { font-family: Geist; src: url('/fonts/Geist-Variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: Geist; src: url('/fonts/Geist-Italic-Variable.woff2') format('woff2'); font-style: italic; font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
:root {
  color-scheme: dark;
  --canvas: #090b0d;
  --surface: #12161a;
  --surface-low: #1a1c1e;
  --surface-high: #1e2022;
  --surface-hover: #252b31;
  --code-surface: #0c0e10;
  --ink: #f4f5f3;
  --muted: #8b949e;
  --secondary: #c3c7cc;
  --accent: #b6f23a;
  --accent-dim: #9ed81b;
  --accent-text: #c3caaf;
  --accent-soft: #1b2413;
  --line: #252b31;
  --control-line: #505961;
  --nav: #12161a;
  --nav-text: #8b949e;
  --soft: #12161a;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --sidebar-width: 256px;
  --header-height: 72px;
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); scrollbar-color: #43474c var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: .875rem; line-height: 1.6; }
::selection { background: var(--accent); color: var(--canvas); }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-thickness: 2px; }
button, input, select { font: inherit; }
button { cursor: pointer; color: var(--ink); }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: -100px; left: 16px; z-index: 100; background: var(--accent); color: var(--canvas); padding: 12px 16px; border-radius: var(--radius); }
.skip:focus { top: 16px; }
.topbar { height: var(--header-height); position: fixed; inset: 0 0 auto; z-index: 30; display: flex; align-items: center; gap: 24px; padding-right: 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wordmark { width: var(--sidebar-width); flex-shrink: 0; padding-left: 24px; color: var(--ink); font-weight: 600; font-size: .875rem; letter-spacing: .05em; text-decoration: none; line-height: 1.5; }
.wordmark:hover { color: var(--ink); }
.wordmark span { display: block; color: var(--muted); font-weight: 500; font-size: .75rem; letter-spacing: .08em; }
.search-form { position: relative; width: min(620px,100%); margin: 0; }
.search-form input { width: 100%; border: 1px solid var(--line); background: var(--canvas); color: var(--ink); border-radius: var(--radius); padding: 10px 40px 10px 16px; font-size: .875rem; line-height: 20px; }
.search-form input:focus, .catalog-controls input:focus, .catalog-controls select:focus { border-color: var(--accent); }
.search-form input::placeholder, .catalog-controls input::placeholder { color: var(--muted); opacity: 1; }
.search-key { position: absolute; right: 16px; top: 10px; color: var(--muted); font-size: .875rem; }
.menu-button { display: none; }
.sidebar { position: fixed; left: 0; top: var(--header-height); bottom: 0; width: var(--sidebar-width); background: var(--nav); color: var(--nav-text); overflow-y: auto; padding: 8px 16px 24px; z-index: 25; border-right: 1px solid var(--line); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group { margin: 24px 8px 4px; color: var(--muted); font-size: .75rem; line-height: 16px; letter-spacing: .02em; text-transform: uppercase; font-weight: 500; }
.sidebar nav a { font-size: .875rem; text-decoration: none; color: var(--nav-text); padding: 6px 12px; border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; line-height: 20px; }
.sidebar nav a:hover { background: var(--surface-hover); color: var(--ink); }
.sidebar nav a[aria-current] { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.download-all { display: block; font-size: .8125rem; font-weight: 600; color: var(--canvas); background: var(--accent); margin: 24px 0 0; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius); text-decoration: none; text-align: center; line-height: 20px; }
.download-all:hover { color: var(--canvas); background: var(--accent-dim); border-color: var(--accent-dim); }
.reading-layout { margin-left: var(--sidebar-width); padding: var(--header-height) 32px 0; display: flex; justify-content: center; gap: 24px; }
main { width: 100%; max-width: 1060px; min-width: 0; padding: 32px 0 48px; }
.page-tools { font-size: .8125rem; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); margin-bottom: 24px; }
.page-tools div { display: flex; align-items: center; gap: 16px; }
.page-tools button, .close-search, #reset-checks { background: none; border: 0; padding: 0; color: var(--secondary); font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px; }
.page-tools button:hover, .close-search:hover, #reset-checks:hover { color: var(--accent); }
.page-tools a { color: var(--secondary); font-size: .8125rem; }
h1 { font-size: 3rem; font-weight: 600; line-height: 1.167; letter-spacing: -.02em; margin: 0 0 24px; max-width: 950px; overflow-wrap: anywhere; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.333; letter-spacing: -.01em; margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--line); position: relative; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.333; margin: 24px 0 8px; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.5; margin: 24px 0 8px; }
p { margin: 12px 0 16px; }
article > p, article > ul, article > ol { max-width: 92ch; }
li { margin: 4px 0; }
ul, ol { padding-left: 24px; }
strong { font-weight: 600; }
.anchor { margin-left: 8px; text-decoration: none; color: var(--muted); font-size: 1rem; font-weight: 400; opacity: 0; }
h2:hover .anchor, .anchor:focus { opacity: 1; }
.table-wrap { width: 100%; overflow: auto; max-height: 75vh; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--radius); scrollbar-color: #43474c var(--surface); }
.table-wrap > .table-wrap { border: 0; border-radius: 0; margin: 0; max-height: none; overflow: visible; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8125rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
th { background: var(--surface-high); text-align: left; font-weight: 600; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
thead th { position: sticky; top: 0; z-index: 2; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 135px; overflow-wrap: anywhere; color: #d6d9dd; }
tbody th { border-bottom: 1px solid var(--line); }
tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tr:nth-child(even) td { background: #0e1114; }
tr:hover td { background: var(--surface); }
td:first-child { font-weight: 500; }
code, pre { font-family: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace; font-variant-numeric: tabular-nums; }
code { font-size: .9em; padding: 2px 4px; background: var(--surface-high); color: #e2e2e5; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
pre { position: relative; background: var(--code-surface); color: #e2e2e5; overflow: auto; padding: 48px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: .8125rem; line-height: 1.65; margin: 24px 0; tab-size: 4; scrollbar-color: #43474c var(--code-surface); }
pre code { padding: 0; background: none; color: inherit; font-size: inherit; border: 0; white-space: pre; overflow-wrap: normal; }
pre .copy-button { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); color: var(--secondary); background: var(--surface); border-radius: var(--radius); font: 500 .75rem/16px Geist, ui-sans-serif, system-ui, sans-serif; padding: 4px 8px; min-height: 28px; }
pre .copy-button:hover { color: var(--ink); background: var(--surface-hover); }
blockquote { border-left: 2px solid var(--accent-dim); border-radius: 0 var(--radius) var(--radius) 0; padding: 4px 16px; margin: 24px 0; color: var(--secondary); background: var(--surface); }
.toc { position: sticky; top: calc(var(--header-height) + 24px); align-self: flex-start; width: 208px; flex-shrink: 0; max-height: calc(100vh - var(--header-height) - 48px); overflow: auto; margin-top: 32px; font-size: .8125rem; line-height: 1.5; }
.toc p { font-size: .75rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin: 0 0 12px; }
.toc nav { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.toc a { color: var(--muted); text-decoration: none; padding: 4px 0 4px 16px; }
.toc a:hover { color: var(--accent); background: var(--surface); }
.page-pagination { display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); margin-top: 48px; padding-top: 24px; }
.page-pagination a { font-size: .875rem; text-decoration: none; color: var(--ink); }
.page-pagination a:hover { color: var(--accent); }
.page-pagination a:last-child { text-align: right; }
.page-pagination small { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.check-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; background: var(--soft); padding: 12px 16px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: var(--radius); font-size: .8125rem; color: var(--muted); }
#check-count { color: var(--ink); font-weight: 600; }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px; accent-color: var(--accent); cursor: pointer; }
li:has(input[type=checkbox]) { list-style: none; margin-left: -24px; }
.check-done { color: var(--muted); }
.search-panel { position: fixed; top: var(--header-height); left: var(--sidebar-width); right: 0; bottom: 0; z-index: 29; background: var(--surface); overflow: auto; padding: 24px 32px 48px; }
.search-panel[hidden] { display: none; }
.search-heading { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 16px; gap: 16px; }
.search-heading p { font-size: .875rem; color: var(--muted); }
.search-result { max-width: 950px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.search-result small { color: var(--muted); font-size: .75rem; }
.search-result a { display: block; font-size: 1.125rem; line-height: 1.333; font-weight: 600; color: var(--ink); margin-top: 4px; }
.search-result a:hover { color: var(--accent); }
.search-result p { color: var(--secondary); font-size: .875rem; line-height: 1.6; margin: 8px 0 0; overflow-wrap: anywhere; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--surface-high); color: var(--ink); border: 1px solid var(--line); padding: 12px 16px; z-index: 40; border-radius: var(--radius); font-size: .875rem; }
/* Catalogs and shared procedure references. */
.entry-grid, .reference-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin: 24px 0; }
.entry-grid > a { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; background: var(--surface); color: var(--ink); }
.entry-grid > a:hover { background: var(--surface-high); border-color: #43474c; }
.entry-grid strong { font-size: 1.125rem; font-weight: 600; line-height: 24px; }
.entry-grid span { color: var(--muted); font-size: .875rem; margin-top: 8px; }
.reference-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; background: var(--surface); }
.reference-card h3 { font-size: 1.125rem; margin: 8px 0; }
.reference-card h3 a { color: var(--ink); text-decoration: none; }
.reference-card h3 a:hover { color: var(--accent); }
.reference-card p { font-size: .875rem; margin: 8px 0; color: var(--secondary); }
.card-kicker { color: var(--muted) !important; font-size: .75rem !important; line-height: 16px; font-weight: 500; letter-spacing: .02em; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag-list a { background: var(--surface-high); border: 1px solid var(--line); color: var(--secondary); padding: 4px 8px; font-size: .8125rem; line-height: 18px; text-decoration: none; border-radius: var(--radius-sm); }
.tag-list a:hover { color: var(--accent); border-color: #434935; background: var(--accent-soft); }
.mapping-note { color: var(--muted) !important; font-size: .8125rem !important; }
.catalog-controls { display: grid; grid-template-columns: 2fr 1.3fr; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 24px 0 8px; align-items: end; }
.catalog-controls label { display: flex; flex-direction: column; gap: 8px; font-size: .8125rem; font-weight: 500; color: var(--secondary); }
.catalog-controls input, .catalog-controls select { font: inherit; font-size: .875rem; background: var(--canvas); min-width: 0; width: 100%; border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); color: var(--ink); line-height: 20px; }
.catalog-controls button { background: var(--surface); color: var(--ink); border: 1px solid var(--control-line); padding: 10px 16px; width: fit-content; border-radius: var(--radius); font-size: .875rem; line-height: 20px; }
.catalog-controls button:hover { background: var(--surface-hover); }
.catalog-count { font-size: .8125rem; color: var(--muted); }
.catalog-item[hidden], #catalog-empty[hidden] { display: none !important; }
.command-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 24px 0; padding: 16px; }
.command-card h2 { border: 0; margin: 8px 0; font-size: 1.125rem; line-height: 24px; padding: 0; }
.command-card pre { margin-bottom: 8px; }
.inline-procedure { border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; background: var(--surface); }
.inline-procedure summary { list-style: none; cursor: pointer; padding: 16px 48px 16px 16px; border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; position: relative; }
.inline-procedure summary:hover { background: var(--surface-high); }
.inline-procedure[open] > summary { background: var(--surface-high); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.inline-procedure summary::-webkit-details-marker { display: none; }
.inline-procedure summary:after { content: '+'; position: absolute; right: 16px; top: 16px; color: var(--muted); font-size: 1.25rem; }
.inline-procedure[open] > summary:after { content: '−'; color: var(--accent); }
.inline-procedure summary > span { font-weight: 600; font-size: 1rem; line-height: 24px; }
.inline-procedure summary small { color: var(--muted); font-size: .8125rem; line-height: 18px; margin-top: 8px; }
.procedure-body { padding: 0 16px 16px; }
/* Infographics, workflow decisions, and catalog coverage. */
.procedure-flow { background: var(--code-surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin: 24px 0; }
.procedure-flow figcaption { font-size: .8125rem; line-height: 20px; font-weight: 600; color: var(--secondary); margin-bottom: 16px; }
.procedure-flow ol { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.procedure-flow li { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; align-items: flex-start; gap: 12px; padding: 12px; font-size: .875rem; line-height: 20px; }
.stage-number { color: var(--accent-dim); font-weight: 600; min-width: 24px; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.flow-gate { color: var(--muted); font-size: .8125rem; line-height: 18px; margin: 16px 0 0; }
.evidence-map { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin: 24px 0; padding: 24px; }
.evidence-map figcaption { font-weight: 600; font-size: 1rem; margin-bottom: 24px; }
.decision-map { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.map-node, .map-decision { position: relative; max-width: 540px; width: 100%; padding: 12px 16px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-high); font-weight: 500; }
.map-node small, .map-decision small { display: block; font-size: .8125rem; font-weight: 400; line-height: 18px; margin-top: 8px; color: var(--muted); }
.map-decision { border-color: #596932; background: var(--accent-soft); }
.map-decision > small { color: var(--secondary); }
.map-node.accent { border-color: #434935; background: var(--accent-soft); }
.map-node.accent strong { color: var(--accent); }
.map-branch { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; width: 100%; max-width: 730px; }
.decision-map > .map-node:not(:first-child):before, .map-decision:before, .map-branch:before { content: ''; position: absolute; top: -16px; left: 50%; width: 1px; height: 16px; background: #505961; }
.coverage-chart { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 24px; margin: 24px 0; }
.coverage-chart figcaption { font-weight: 600; font-size: 1rem; }
.coverage-chart > p { font-size: .8125rem; color: var(--muted); }
.chart-row { display: grid; grid-template-columns: 170px minmax(50px,1fr) 32px; gap: 16px; align-items: center; text-decoration: none; font-size: .8125rem; color: var(--secondary); margin: 12px 0; }
.bar-track { height: 12px; background: var(--surface-hover); border-radius: 2px; overflow: hidden; }
.bar-track > span { display: block; height: 100%; background: var(--accent-dim); border-radius: 2px; }
.chart-row strong { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-row:hover .bar-track > span { background: var(--accent); }
.reuse-matrix { font-size: .8125rem; }
.reuse-matrix th:first-child { min-width: 210px; }
.reuse-matrix td { min-width: 95px; text-align: center; }
.reuse-matrix .applies { background: var(--accent-soft); }
.reuse-matrix .applies a { color: var(--accent); }
.reuse-matrix .inapplicable { color: var(--muted); background: var(--canvas); }
.technique { padding-top: 8px; }
@media (min-width:1750px) {
  .reading-layout { gap: 32px; padding-left: 48px; padding-right: 48px; }
}
@media (max-width:1390px) {
  .toc { display: none; }
  main { max-width: 1000px; }
}
@media (max-width:1100px) {
  .reference-grid { grid-template-columns: 1fr; }
}
@media (max-width:1024px) {
  :root { --header-height: 64px; }
  .topbar { gap: 16px; padding: 0 16px; }
  .menu-button { display: block; background: var(--surface); border: 1px solid var(--control-line); color: var(--ink); padding: 8px 12px; border-radius: var(--radius); font-size: .8125rem; line-height: 20px; }
  .menu-button:hover { background: var(--surface-hover); }
  .wordmark { width: auto; padding: 0; font-size: .75rem; }
  .wordmark span { font-size: .75rem; }
  .search-form { flex: 1; min-width: 0; }
  .search-form input { padding: 10px 12px; }
  .search-key { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .15s; }
  .sidebar.open { transform: translateX(0); }
  .reading-layout { margin-left: 0; padding-left: 32px; padding-right: 32px; }
  .search-panel { left: 0; padding: 24px 32px; }
  main { padding-top: 24px; }
  h1 { font-size: 2.5rem; line-height: 1.2; }
}
@media (max-width:767px) {
  .reading-layout { padding-left: 16px; padding-right: 16px; }
  .search-panel { padding: 16px; }
  h1 { font-size: 2rem; line-height: 1.25; }
  h2 { font-size: 1.25rem; line-height: 28px; }
  .entry-grid, .catalog-controls, .procedure-flow ol, .map-branch { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 120px minmax(32px,1fr) 28px; gap: 8px; }
  .coverage-chart, .evidence-map { padding: 16px; margin-left: 0; margin-right: 0; }
  .procedure-flow { margin-left: 0; margin-right: 0; }
  .page-tools { margin-bottom: 16px; gap: 8px; }
  .page-tools div { gap: 12px; }
  .table-wrap { max-height: 70vh; }
  .page-pagination { gap: 16px; }
  .toast { bottom: 16px; right: 16px; }
}
@media (max-width:520px) {
  .wordmark { display: none; }
  .topbar { gap: 8px; }
  .search-form input { min-width: 0; }
  .search-form input::placeholder { font-size: .8125rem; }
  .chart-row { grid-template-columns: 100px minmax(32px,1fr) 28px; }
}
@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}
/* Print uses a paper palette while preserving every procedure and code block. */
@media print {
  :root { color-scheme: light; --canvas:#fff; --surface:#fff; --surface-low:#f4f4f4; --surface-high:#f0f0f0; --surface-hover:#eee; --code-surface:#f6f6f6; --ink:#111; --muted:#555; --secondary:#333; --accent:#3b5500; --accent-dim:#496800; --accent-text:#304500; --accent-soft:#eef2e5; --line:#ccc; }
  .topbar, .sidebar, .toc, .page-tools, .check-progress, .page-pagination, .copy-button, .search-panel, .toast, .anchor, .catalog-controls, .catalog-count { display: none !important; }
  .reading-layout { display: block; margin: 0; padding: 0; }
  main { max-width: none; padding: 0; }
  body { background: white; color: #111; font-size: 10pt; line-height: 1.55; }
  h1 { font-size: 24pt; }
  h2 { font-size: 16pt; break-after: avoid; }
  h3 { break-after: avoid; }
  a, .page-tools a { color: #304500; }
  code { color: #111; }
  pre { white-space: pre-wrap; overflow: visible; color: #111; padding: 16px; border: 1px solid #bbb; }
  pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .table-wrap { overflow: visible; border: 0; max-height: none; }
  table { font-size: 9pt; }
  td { min-width: 0; color: #111; }
  thead th { position: static; }
  tr { break-inside: avoid; }
  th, tr:nth-child(even) td { background: #f2f2f2; }
  input[type=checkbox] { width: 9pt; height: 9pt; }
  .reference-grid { display: block; }
  .reference-card, .command-card { break-inside: avoid; margin: 16px 0; }
  .procedure-body { display: block !important; }
  .bar-track > span { print-color-adjust: exact; }
  .entry-grid { grid-template-columns: 1fr 1fr; }
}
