/* ═══ Antares — one skeleton, two skins ══════════════════════════════
   Light = "Dossier"  · declassified intelligence-file / editorial look
   Dark  = "Signal"   · dark amber threat-intel console look
   All colour comes from custom properties keyed off [data-theme].
   Fonts are system stacks (no third-party request).                    */

/* ── Font stacks ── */
:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --maxw:   1040px;
  --gutter: clamp(18px, 5vw, 40px);
  --measure: 68ch;                 /* long-form reading width */
  --focus:  #7aa2ff;
}

/* ═══ LIGHT — DOSSIER (default) ═══════════════════════════════════════ */
:root,
[data-theme="light"] {
  --bg:        #edefec;
  --panel:     #f5f7f4;
  --band:      #e6e9e5;
  --ink:       #16181a;
  --muted:     #646866;           /* AA on --bg (4.9:1) */
  --faint:     #686c6a;           /* AA on --bg (4.6:1) */
  --line:      #d3d7d3;
  --dash:      #c3c7c3;
  --card-line: #cfd3cf;
  --accent:    #b3271e;            /* classification red */
  --tag:       #686c6a;           /* AA on --bg (4.6:1) */

  --title:     #101215;
  --lead:      #3d413f;
  --nav:       #5c605e;
  --kvtext:    #333735;
  --rowtitle:  #1c1e20;
  --idborder:  #dde1dd;
  --star:      #c2381f;            /* ember, deeper for paper */
  --star-glow: rgba(194,56,31,.30);
  --accent-hi: var(--accent);

  --display:          var(--serif);
  --display-weight:   600;
  --display-tform:    none;
  --brand-tracking:   6px;
  --brand-weight:     500;
  --row-font:         var(--serif);
  --nav-prefix:       "";
  --code-bg:          #f3f5f2;
  --code-line:        #d9ddd8;
}

/* ═══ DARK — SIGNAL ═══════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:        #0b0a08;
  --panel:     #100e0b;
  --band:      #0b0a08;
  --ink:       #e8e2d6;
  --muted:     #8a8377;
  --faint:     #847d6d;           /* AA on --bg (4.8:1) */
  --line:      #221d16;
  --dash:      #1c1812;
  --card-line: #221d16;
  --accent:    #ff8a3d;            /* amber */
  --tag:       #c78a4e;

  --amber:     #ff8a3d;
  --amber2:    #ffb066;
  --ember:     #ff5a3c;
  --up:        #ff6f5a;
  --dn:        #8fb06a;
  --ok:        #8fb06a;
  --pill-bg:   #17120a;
  --pill-line: #3a2f1c;

  --title:     #f6f1e6;
  --lead:      #ccc5b7;
  --nav:       #8a8377;
  --rowtitle:  #ddd6c8;
  --star:      #ff5a3c;
  --star-glow: rgba(255,90,60,.70);
  --accent-hi: var(--amber2);

  --display:          var(--sans);
  --display-weight:   800;
  --display-tform:    uppercase;
  --brand-tracking:   3px;
  --brand-weight:     800;
  --row-font:         var(--sans);
  --nav-prefix:       "//";
  --code-bg:          #100e0b;
  --code-line:        #221d16;
  --focus:            #ffb066;
}

/* ═══ Base ════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
}

.wrap { max-width: var(--maxw); margin: 0 auto; }

a { color: inherit; }

:where(a, button, .theme-toggle):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 50;
  background: var(--panel); color: var(--ink);
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

/* ═══ Masthead ════════════════════════════════════════════════════════ */
.masthead { border-bottom: 1px solid var(--line); }

/* Dossier-only classification band */
.classline {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
  padding: 7px var(--gutter);
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: var(--band);
}
.classline .red { color: var(--accent); }
.classline .mid { opacity: .9; }
[data-theme="dark"] .classline { display: none; }

.mast {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 14px; flex-wrap: wrap; padding: 18px var(--gutter) 0;
}

.brand { text-decoration: none; display: inline-flex; align-items: center; gap: 11px; }
.brand-star {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: var(--star);
  box-shadow: 0 0 10px 2px var(--star-glow), 0 0 22px 6px rgba(255,120,50,.16);
  animation: star-pulse 3.4s ease-in-out infinite;
}
.brand-block { line-height: 1; }
.brand-word {
  font-family: var(--display);
  font-weight: var(--brand-weight);
  font-size: 30px; line-height: 1;
  letter-spacing: var(--brand-tracking);
  text-transform: uppercase;
  color: var(--title);
}
.brand-eye {
  display: block;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--tag); margin-top: 8px;
}

.mast-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Signal-only status pill */
.pill {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--amber2);
  border: 1px solid var(--pill-line); background: var(--pill-bg);
  border-radius: 6px; padding: 5px 11px;
  display: inline-flex; align-items: center; gap: 7px;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
[data-theme="light"] .pill { display: none; }

/* Theme toggle */
.theme-toggle {
  font-family: var(--mono); font-size: 11px; letter-spacing: .5px;
  border-radius: 6px; padding: 6px 11px; cursor: pointer;
  background: transparent; display: inline-flex; align-items: center; gap: 7px;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
[data-theme="light"] .theme-toggle { border: 1px solid var(--card-line); color: #4c504e; background: var(--panel); }
[data-theme="light"] .theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
[data-theme="dark"]  .theme-toggle { border: 1px solid var(--pill-line); color: var(--amber2); background: var(--pill-bg); }
[data-theme="dark"]  .theme-toggle:hover { border-color: var(--amber); color: var(--amber); }
.theme-toggle .tt-icon { font-size: 12px; }

/* Signal-only boot / telemetry line */
.boot {
  font-family: var(--mono); font-size: 11px; letter-spacing: .4px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 12px; margin: 14px var(--gutter) 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.boot .amb { color: #ff9e52; }
.boot .ok  { color: var(--ok); }
.boot .cur {
  display: inline-block; width: 7px; height: 12px; background: var(--amber);
  vertical-align: -2px; margin-left: 3px; animation: blink 1.1s steps(1) infinite;
}
[data-theme="light"] .boot { display: none; }

/* Nav — full-width row; plain caps (Dossier) / //-prefixed bar (Signal) */
.nav {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .5px;
  color: var(--nav); padding: 10px var(--gutter);
}
.nav a { color: var(--nav); text-decoration: none; }
.nav a::before { content: var(--nav-prefix); opacity: .8; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent-hi); }
[data-theme="light"] .nav {
  text-transform: uppercase;
  border-top: 1px dashed var(--dash);
  margin-top: 14px;
}
[data-theme="dark"] .nav {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 12px;
}

/* ═══ Home ════════════════════════════════════════════════════════════ */
.frontpage { padding: 8px var(--gutter) 40px; }
main { min-height: 40vh; }

/* Featured */
.lead { display: block; }
.featured {
  display: grid; grid-template-columns: minmax(0,1fr) 224px; gap: 22px;
  padding-top: 22px;
}
[data-theme="dark"] .featured { grid-template-columns: 1fr; }

.fk {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
[data-theme="dark"] .fk::before { content: "// "; }
.lead-link { text-decoration: none; color: inherit; display: block; }
.ft {
  font-family: var(--display); font-weight: var(--display-weight);
  text-transform: var(--display-tform);
  font-size: clamp(24px, 4.6vw, 29px); line-height: 1.12;
  letter-spacing: -.3px; color: var(--title); margin: 0;
}
.ft em {
  font-style: italic; font-weight: 600; text-transform: none;
  color: var(--accent-hi); letter-spacing: 0;
}
.fl { font-size: 14px; line-height: 1.6; color: var(--lead); margin-top: 11px; max-width: 54ch; }
.fby {
  font-family: var(--mono); font-size: 11px; letter-spacing: .5px;
  color: var(--faint); margin-top: 12px;
}
[data-theme="dark"] .fby { text-transform: uppercase; }
.lead-link:hover .ft { color: var(--accent-hi); }

/* Subject-ID card (Dossier only) */
.idcard {
  border: 1px solid var(--card-line); background: var(--panel);
  border-radius: 8px; padding: 12px 13px; align-self: start;
}
[data-theme="dark"] .idcard { display: none; }
.idcard .idh {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--idborder); padding-bottom: 7px; margin-bottom: 9px;
  display: flex; justify-content: space-between; gap: 8px;
}
.idcard .kv {
  display: flex; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.9; color: var(--kvtext);
}
.idcard .kv span { color: var(--faint); }
.idcard .kv b { color: var(--ink); font-weight: 600; text-align: right; }
.barcode {
  height: 34px; margin-top: 11px;
  background-image: repeating-linear-gradient(90deg,
    var(--ink) 0 1px, transparent 1px 3px, var(--ink) 3px 6px, transparent 6px 7px,
    var(--ink) 7px 8px, transparent 8px 11px, var(--ink) 11px 12px, transparent 12px 15px);
}
.barcode-n {
  font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  color: var(--muted); text-align: center; margin-top: 5px;
}

/* Recent index */
.section-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--faint);
  margin: 26px 0 2px;
}
.index-wrap { display: grid; grid-template-columns: minmax(0,1fr) 190px; gap: 22px; margin-top: 6px; }
[data-theme="light"] .index-wrap { grid-template-columns: 1fr; }

.rows { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: baseline;
  padding: 11px 0; text-decoration: none; color: inherit;
}
[data-theme="light"] .row { border-bottom: 1px dashed var(--dash); }
[data-theme="dark"]  .row { border-top: 1px solid var(--dash); }
.row .dt { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.row .rt {
  font-family: var(--row-font); font-size: 15px; color: var(--rowtitle); line-height: 1.3;
}
[data-theme="dark"] .row .rt { font-size: 14px; }
.row .rt sup {
  font-family: var(--mono); font-size: 9px; color: var(--accent);
  letter-spacing: .5px; margin-left: 5px; vertical-align: super;
}
.row .tg {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--tag);
}
.row:hover .rt { color: var(--accent-hi); }

/* Right rail (Signal only) */
.rail { align-self: start; }
[data-theme="light"] .rail { display: none; }
.rail-h {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--faint); margin: 0 0 9px;
}
.rail-h + * + .rail-h, .rail-block + .rail-block { margin-top: 15px; }
.rail-item {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: #ccc5b7; padding: 5px 0; border-bottom: 1px solid var(--dash);
  text-decoration: none;
}
.rail-item .n { font-family: var(--mono); font-size: 11px; color: var(--dn); }
.rail-item:hover .label { color: var(--amber2); }
.rail-note {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 5px 8px; margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block; text-decoration: none;
}

/* Archive (taxonomy index + term) pages */
.archive-head { padding-top: 16px; }
.archive-head .ft { margin-bottom: 6px; }
.archive-rows { margin-top: 14px; }
.back-wrap { margin-top: 22px; }

/* Books — section intro (the _index.md body of a book) rendered above the rows */
.book-intro { margin-top: 14px; max-width: 60ch; }
.book-intro p { font-size: 14px; line-height: 1.6; color: var(--lead); margin-top: 10px; }
.book-intro a { color: var(--accent); text-underline-offset: 2px; }

.empty { padding: 60px var(--gutter); text-align: center; }
.empty-kicker { font-family: var(--mono); color: var(--accent); font-size: 12px; letter-spacing: 1px; }
.empty-title { font-family: var(--display); color: var(--title); }

/* ═══ Article ═════════════════════════════════════════════════════════ */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 40;
  box-shadow: 0 0 8px var(--star-glow);
}
.dispatch { padding: 26px var(--gutter) 40px; }
.dispatch-head { max-width: var(--measure); }
.kicker {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
}
.kicker .k-dot { color: var(--faint); }
.dispatch-title {
  font-family: var(--display); font-weight: var(--display-weight);
  text-transform: var(--display-tform);
  font-size: clamp(26px, 5vw, 36px); line-height: 1.12; letter-spacing: -.4px;
  color: var(--title); margin: 0;
}
.dispatch-standfirst {
  font-size: 16px; line-height: 1.6; color: var(--lead); margin: 12px 0 0; max-width: 58ch;
}
.dispatch-byline {
  font-family: var(--mono); font-size: 11px; letter-spacing: .4px; color: var(--faint);
  margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
}
.dispatch-tags { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--tag); text-decoration: none; border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 8px;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

.dispatch-body {
  max-width: var(--measure);
  font-size: 17px; line-height: 1.7; color: var(--ink);
  margin-top: 26px;
}
.dispatch-body > *:first-child { margin-top: 0; }
.dispatch-body h2, .dispatch-body h3, .dispatch-body h4 {
  font-family: var(--display); color: var(--title); line-height: 1.2;
  letter-spacing: -.2px; margin: 1.8em 0 .5em;
}
[data-theme="dark"] .dispatch-body h2 { text-transform: uppercase; letter-spacing: .3px; font-weight: 800; }
.dispatch-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
.dispatch-body h3 { font-size: 1.22em; }
.dispatch-body p, .dispatch-body ul, .dispatch-body ol { margin: 1em 0; }
.dispatch-body a { color: var(--accent); text-underline-offset: 2px; }
.dispatch-body strong { color: var(--title); }
.dispatch-body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.dispatch-body blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent);
  color: var(--lead); font-style: italic;
}
.dispatch-body :not(pre) > code {
  font-family: var(--mono); font-size: .86em;
  background: var(--code-bg); border: 1px solid var(--code-line);
  border-radius: 4px; padding: 1px 5px;
}
.dispatch-body .highlight, .dispatch-body pre {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.55;
  background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 8px;
  overflow-x: auto; margin: 1.2em 0;
}
.dispatch-body .highlight pre { border: 0; margin: 0; border-radius: 8px; }
.dispatch-body pre { padding: 14px 16px; }
.dispatch-body pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.dispatch-body .highlight .lntable { border: 0; margin: 0; }
.dispatch-body .highlight .lntable td { border: 0; padding: 0; }
.dispatch-body .highlight .lnt { color: var(--faint); user-select: none; padding-right: 12px; }
.dispatch-body table { border-collapse: collapse; width: 100%; font-size: .92em; margin: 1.2em 0; }
.dispatch-body th, .dispatch-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.dispatch-body th { background: var(--panel); font-family: var(--mono); font-size: .82em; text-transform: uppercase; letter-spacing: .5px; }

.dispatch-foot { max-width: var(--measure); margin-top: 40px; }
.foot-rule { border-top: 1px solid var(--line); margin-bottom: 16px; }
.back { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }

/* ═══ Footer ══════════════════════════════════════════════════════════ */
.colophon { border-top: 1px solid var(--line); padding: 22px var(--gutter) 40px; }
.colo-line { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 11px; letter-spacing: .5px; color: var(--faint); flex-wrap: wrap; }
.colo-star {
  width: 7px; height: 7px; border-radius: 50%; background: var(--star);
  box-shadow: 0 0 8px 1px var(--star-glow); flex: none;
  animation: star-pulse 3.4s ease-in-out infinite;
}
.colo-eof { color: var(--muted); }
.colo-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 10px; }

/* Theme-conditional utilities (motif blocks live in the DOM either way) */
[data-theme="light"] .only-signal,  [data-theme="light"] .foot-signal  { display: none; }
[data-theme="dark"]  .only-dossier, [data-theme="dark"]  .foot-dossier { display: none; }

/* ═══ Motion ══════════════════════════════════════════════════════════ */
@keyframes star-pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes blink { 50% { opacity: 0; } }

.reveal { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .brand-star, .colo-star, .boot .cur { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  body, .theme-toggle, .nav a { transition: none; }
}

/* ═══ Responsive ══════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  .featured { grid-template-columns: 1fr; }
  .idcard { max-width: 320px; }
  .index-wrap { grid-template-columns: 1fr; }
  .row { grid-template-columns: 72px 1fr; gap: 8px 10px; }
  .row .tg { grid-column: 2; }
  .brand-word { font-size: 26px; }
  .mast { align-items: flex-start; }
}
