:root {
  --paper: #f5f1e6;
  --paper-card: #fbf8f0;
  --paper-alt: #ece5d4;
  --paper-2: var(--paper-alt);
  --ink: #181613;
  --ink-muted: #4f4941;
  --ink-soft: #6b6358;
  --rule-heavy: #1c1915;
  --rule-hair: #cbc2af;
  --rule: var(--rule-hair);
  --crimson: #8c1d24;
  --slate: #1b4d6e;
  --forest: #1e5c3a;
  --emerald: var(--forest);
  --ochre: #9a6314;
  --stone: #7b7366;
  --serif: "Newsreader", Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="evening"] {
  --paper: #161412;
  --paper-card: #1e1b18;
  --paper-alt: #27221d;
  --paper-2: var(--paper-alt);
  --ink: #ede6d8;
  --ink-muted: #c2b8a8;
  --ink-soft: #9c9284;
  --rule-heavy: #d8cebd;
  --rule-hair: #3e3830;
  --rule: var(--rule-hair);
  --crimson: #e06c75;
  --slate: #61afef;
  --forest: #6cc08a;
  --emerald: var(--forest);
  --ochre: #e5c07b;
  --stone: #8f877b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 220ms var(--ease-editorial), color 220ms var(--ease-editorial);
}

code, pre {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--paper-alt);
  padding: 1px 5px;
  border-radius: 2px;
}
a {
  color: var(--crimson);
  text-decoration: none;
  transition: color 180ms var(--ease-editorial), border-color 180ms var(--ease-editorial);
}
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

.live-ribbon {
  background: var(--paper-alt);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-hair);
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 5px 14px;
}
.live-ribbon .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--forest);
  margin-right: 7px;
  vertical-align: middle;
}

.sheet {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 28px 52px;
}

/* Folio Strip */
.folio-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--rule-hair);
}
.folio-controls { display: flex; gap: 8px; align-items: center; }

/* Masthead */
.masthead {
  text-align: center;
  padding: 14px 8px 12px;
  border-bottom: 2px solid var(--rule-heavy);
}
.masthead .kicker {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--crimson);
  font-weight: 600;
  margin-bottom: 4px;
}
.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.06;
}
.masthead h1 a { color: inherit; text-decoration: none; }
.masthead .subtitle {
  margin: 6px auto 0;
  max-width: 68ch;
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-muted);
}

/* Navigation */
nav.ed-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 4px 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-heavy);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
nav.ed-nav::-webkit-scrollbar { display: none; }
nav.ed-nav a {
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
nav.ed-nav a:hover {
  color: var(--ink);
  text-decoration: none;
  border-bottom-color: var(--rule-hair);
}
nav.ed-nav a.active {
  color: var(--crimson);
  text-decoration: none;
  border-bottom-color: var(--crimson);
}
.nav-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--crimson);
  line-height: 1;
}
.nav-divider {
  width: 1px;
  height: 14px;
  background: var(--rule-hair);
  flex: 0 0 1px;
}

nav.ed-subnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  padding: 6px 0 8px;
  margin: -10px 0 16px;
  border-bottom: 1px solid var(--rule-hair);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
}
nav.ed-subnav a { color: var(--ink-muted); }
nav.ed-subnav a:hover { color: var(--crimson); text-decoration: underline; }

.lineage-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  border-left: 3px solid var(--crimson);
  padding: 8px 12px;
  margin: -6px 0 16px;
  font-family: var(--sans);
  font-size: 0.8125rem;
}
.lineage-strip.older-ref { border-left-color: var(--slate); }
.lineage-strip .lineage-label {
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--crimson);
  margin-right: 6px;
}
.lineage-strip.older-ref .lineage-label { color: var(--slate); }
.lineage-links { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.lineage-pill {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--rule-hair);
  background: var(--paper);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}
.lineage-pill:hover { border-color: var(--crimson); color: var(--crimson); text-decoration: none; }

.chronicle-continuity {
  margin: 28px 0 16px;
  padding: 18px 0 8px;
  border-top: 2px solid var(--rule-heavy);
}
.chronicle-continuity .cont-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule-hair);
  padding-bottom: 6px;
}
.chronicle-continuity .cont-head h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 700;
}
.continuity-pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}
.pager-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--rule-hair);
  background: var(--paper-card);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink);
}
.pager-slot.right { text-align: right; }
.pager-slot.center { text-align: center; justify-content: center; align-items: center; font-weight: 600; }
.pager-slot.muted { color: var(--ink-soft); background: var(--paper-alt); }
.pager-slot .pk {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.pager-slot a.pk-link { font-weight: 700; color: var(--crimson); }
.continuity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.continuity-grid.single { grid-template-columns: 1fr; }
.cont-col {
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  padding: 10px 14px;
}
.cont-col h4 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-hair);
  padding-bottom: 4px;
}
.cont-col ul { margin: 0; padding-left: 16px; font-size: 0.875rem; }
.cont-col li { margin-bottom: 6px; }
.continuity-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--rule-hair);
  font-family: var(--sans);
  font-size: 0.8125rem;
}
.continuity-pills a {
  padding: 4px 9px;
  border: 1px solid var(--rule-hair);
  background: var(--paper-card);
  color: var(--ink);
  font-weight: 600;
}
.continuity-pills a:hover { border-color: var(--crimson); text-decoration: none; }
.continuity-pills a.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Controls & Segmented Buttons */
button, .pill, .btn-link {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--paper-card);
  color: var(--ink);
  border: 1px solid var(--rule-heavy);
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: background-color 180ms var(--ease-editorial), color 180ms var(--ease-editorial), border-color 180ms var(--ease-editorial);
}
button:hover, .pill:hover, .btn-link:hover { background: var(--paper-alt); text-decoration: none; }
button.active, .pill.active { background: var(--ink); color: var(--paper); }

.btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule-heavy);
  background: var(--paper-card);
}
.btn-group > button,
.btn-group > .pill,
.btn-group > .btn-link {
  border: none;
  border-right: 1px solid var(--rule-hair);
  min-height: 32px;
}
.btn-group > button:last-child,
.btn-group > .pill:last-child,
.btn-group > .btn-link:last-child {
  border-right: none;
}

.section-kicker {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--crimson);
  margin-bottom: 4px;
}

/* Front Spread */
.front-spread {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(290px, 1fr);
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--rule-heavy);
  margin-bottom: 26px;
  align-items: start;
}
.lead-story {
  padding-right: 26px;
  border-right: 1px solid var(--rule-hair);
}
.lead-headline {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2.8vw, 2.35rem);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.deck {
  margin: 0 0 12px;
  font-size: 1.06rem;
  line-height: 1.48;
  color: var(--ink-muted);
  font-style: italic;
}
.byline {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 6px 0 10px;
  border-top: 1px solid var(--rule-hair);
  border-bottom: 1px solid var(--rule-hair);
  margin-bottom: 14px;
}
.news-cols-2 {
  column-count: 2;
  column-gap: 26px;
  column-rule: 1px solid var(--rule-hair);
}
.news-cols-2 p { margin: 0 0 12px; }
.dropcap::first-letter {
  float: left;
  font-size: 3.15rem;
  line-height: 0.86;
  padding: 4px 8px 0 0;
  font-weight: 700;
  color: var(--crimson);
}
blockquote.pull-quote {
  margin: 16px 0 6px;
  padding: 12px 16px;
  border-top: 2px solid var(--rule-heavy);
  border-bottom: 2px solid var(--rule-heavy);
  background: var(--paper-card);
  font-size: 1.04rem;
  font-style: italic;
  text-align: center;
}
blockquote.pull-quote cite {
  display: block;
  margin-top: 5px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

/* Factbox */
.factbox {
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  border-top: 3px solid var(--rule-heavy);
  padding: 16px 18px;
}
.factbox h3 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  border-bottom: 1px solid var(--rule-heavy);
  padding-bottom: 6px;
}
.kpi-item, .spec-item {
  border-bottom: 1px solid var(--rule-hair);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.kpi-item:last-child, .spec-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.kpi-item .lbl, .spec-item .lbl {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.kpi-item .val, .spec-item .val {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi-item .sub, .spec-item .sub {
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.spec-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  padding: 12px 14px;
}
.spec-strip .spec-item {
  border-bottom: none;
  border-right: 1px solid var(--rule-hair);
  padding-bottom: 0;
  padding-right: 12px;
  margin-bottom: 0;
}
.spec-strip .spec-item:last-child { border-right: none; padding-right: 0; }
.invariants-note {
  font-size: 0.875rem;
  background: var(--paper-alt);
  padding: 10px 12px;
  border-left: 3px solid var(--crimson);
  margin-top: 12px;
}
.invariants-note ul { margin: 6px 0 0; padding-left: 16px; }
.invariants-note li { margin-bottom: 4px; }

/* Sections */
.broadsheet-sec {
  padding-bottom: 26px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--rule-heavy);
}
.sec-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule-heavy);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.sec-head h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.sec-intro {
  margin: 0 0 14px;
  max-width: 72ch;
  color: var(--ink-muted);
  font-size: 0.96rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.col-pane {
  padding-right: 18px;
  border-right: 1px solid var(--rule-hair);
}
.col-pane:last-child { border-right: none; padding-right: 0; }
.col-pane h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--rule-heavy);
  padding-bottom: 4px;
}

.flow-card {
  padding: 10px 12px;
  border: 1px solid var(--rule-hair);
  background: var(--paper-card);
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.flow-card.good { border-left: 3px solid var(--forest); }
.flow-card.note { border-left: 3px solid var(--slate); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-top: 2px solid var(--rule-heavy);
  border-bottom: 1px solid var(--rule-heavy);
  background: var(--paper-card);
  margin-bottom: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
}
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule-hair);
  text-align: left;
  vertical-align: middle;
}
th {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--paper-alt);
  border-bottom: 1px solid var(--rule-heavy);
  white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; transition: color 160ms var(--ease-editorial); }
th.sortable:hover { color: var(--crimson); }
td.num, th.num {
  text-align: right;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}
tr:hover td { background: var(--paper-alt); }
.pos { color: var(--forest); font-weight: 700; }
.neg { color: var(--crimson); font-weight: 700; }

.tag {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--rule-hair);
  background: var(--paper);
  display: inline-block;
  white-space: nowrap;
}
.tag.sebeni { border-color: var(--forest); color: var(--forest); }
.tag.api { border-color: var(--slate); color: var(--slate); }
.tag.slm { border-color: var(--ochre); color: var(--ochre); }

.figure-frame {
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  border-top: 2px solid var(--rule-heavy);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.fig-caption {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.pareto-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}
svg.pareto-svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--paper);
  border: 1px solid var(--rule-hair);
}

td.heat {
  text-align: right;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--rule-hair);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}
.token-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.tchip {
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 3px 7px;
  border: 1px solid var(--rule-heavy);
  background: var(--paper);
}
.tchip.alt { background: var(--paper-alt); }
.bar-track {
  height: 10px;
  background: var(--paper-alt);
  border: 1px solid var(--rule-hair);
  overflow: hidden;
}
.bar-fill { height: 100%; }

.inspect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}
.inspect-card {
  background: var(--paper-card);
  border: 1px solid var(--rule-hair);
  border-top: 3px solid var(--rule-heavy);
  padding: 12px 14px;
  font-size: 0.875rem;
}
.inspect-card.oracle { border-top-color: var(--forest); }
.inspect-card.sebeni { border-top-color: var(--forest); }
.inspect-card.api { border-top-color: var(--slate); }
.inspect-card.slm { border-top-color: var(--ochre); }
.inspect-card h4 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  border-bottom: 1px solid var(--rule-hair);
  padding-bottom: 4px;
}
pre.snippet {
  background: var(--paper);
  border: 1px solid var(--rule-hair);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0;
  max-height: 290px;
}

.article-body {
  max-width: 72ch;
  margin: 0 auto;
}
.article-body h3 {
  margin: 22px 0 8px;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--rule-hair);
  padding-bottom: 4px;
}

footer.colophon {
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  padding-top: 12px;
}

@media (max-width: 960px) {
  .sheet { padding: 10px 16px 40px; }
  nav.ed-nav { justify-content: flex-start; }
  .front-spread, .pareto-grid, .cols-3, .continuity-grid, .continuity-pager { grid-template-columns: 1fr; }
  .pager-slot.right { text-align: left; }
  .lead-story, .col-pane { padding-right: 0; border-right: none; }
  .col-pane { border-bottom: 1px solid var(--rule-hair); padding-bottom: 14px; }
  .news-cols-2 { column-count: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .folio-controls, .toolbar, nav.ed-nav, nav.ed-subnav, .lineage-strip, .chronicle-continuity, .live-ribbon { display: none !important; }
  body { background: #ffffff; color: #000000; font-size: 11pt; }
}
