/* ==========================================================================
   xCO / Dark Matter Labs — shared web stylesheet
   Derived from the xCO design system (https://xco-style-guide-woad.vercel.app/)
   and the sample papers in Dark-Matter-Labs/xCO-papers.
   Hyperlegible editorial system: golden-ratio grid, Fibonacci spacing
   (13 / 21 / 34 / 55 / 89), navy + orange, Crimson Pro / Inter / DM Mono.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --shadow: #192640;      /* deep navy — text + structure */
  --midtone: #F27F3D;     /* orange — STRUCTURE on paper: rules, borders, underlines.
                             Only 2.67:1 on white, so never use it for text on paper.
                             On navy it is 5.66:1 and safe for text. */
  --midtone-ink: #C34F0D; /* orange — TEXT on paper. Same hue (21.8°) and saturation as
                             --midtone, darkened to 4.60:1 on --highlight so it passes
                             WCAG AA for body text. */

  /* Paper is deliberately NOT pure #FFFFFF. It carries a trace of the brand navy hue
     (OKLCH 99.1% 0.0025 264) — a chroma far too small to read as a colour, but enough
     to stop the page feeling like a blank browser default and to tie the surface to the
     palette. Hex first so old browsers get a correct value; OKLCH second for browsers
     that support it. Never make the OKLCH line load-bearing. */
  --highlight: #FBFCFE;
  --highlight: oklch(99.1% 0.0025 264);

  --page-pad: 55px;
  --measure: 760px;       /* reading measure */
  --phi-major: 61.8fr;
  --phi-minor: 38.2fr;

  --s1: 13px; --s2: 21px; --s3: 34px; --s4: 55px; --s5: 89px;

  --serif: "Crimson Pro", Georgia, "Times New Roman", serif;
  --sans: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--highlight); color: var(--shadow); }

body {
  margin: 0;
  background: var(--highlight);
  color: var(--shadow);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--shadow); text-decoration-color: var(--midtone); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--midtone-ink); }

h1, h2, h3, .display, .nav-title { font-family: var(--sans); font-weight: 500; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(48px, 8vw, 108px); max-width: 1120px; }
h2 { font-size: clamp(30px, 4vw, 52px); margin: 0 0 var(--s3) 0; }
h3 { font-size: clamp(23px, 2.4vw, 32px); margin: var(--s3) 0 var(--s1) 0; }

p { margin: 0 0 var(--s2) 0; max-width: var(--measure); }
strong { font-weight: 600; }
ul, ol { max-width: var(--measure); padding-left: 1.1em; }
li { margin: 0 0 10px 0; }
hr { border: 0; border-top: 1.5px solid var(--shadow); margin: var(--s4) 0; max-width: var(--measure); }

.mono, .eyebrow, .label, .data, .caption, .footnote-index, .source-list {
  font-family: var(--mono); font-weight: 400; letter-spacing: -0.01em;
}
.small { font-size: 15px; line-height: 1.55; }

/* term: an internal wiki concept not (yet) published as its own page */
.term { font-family: var(--sans); font-weight: 500; letter-spacing: -0.01em; border-bottom: 1.5px dotted var(--midtone); }

/* focus, skip link, motion ------------------------------------------------
   Keyboard and assistive-tech affordances. These are not decoration: without a
   visible focus ring a keyboard user cannot tell where they are on the page. */

/* :focus-visible only — so a mouse click doesn't leave a ring behind, but every
   keyboard tab does. The 3px offset keeps the ring clear of the text itself. */
:focus-visible {
  outline: 3px solid var(--midtone-ink);
  outline-offset: 3px;
  border-radius: 1px;
}
/* On navy panels the ring must switch to paper to stay visible. */
.footer :focus-visible,
.dark-card :focus-visible,
.slide-dark :focus-visible,
.hn-poster :focus-visible,
.hn-commit :focus-visible {
  outline-color: var(--highlight);
}

/* Skip link: first tab stop, hidden until focused. Every page should carry
   <a class="skip-link" href="#main">Skip to content</a> as the first body child. */
.skip-link {
  position: absolute; left: var(--s1); top: -100px; z-index: 100;
  background: var(--shadow); color: var(--highlight);
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none;
  padding: var(--s1) var(--s2);
  transition: top .12s ease;
}
.skip-link:focus { top: var(--s2); color: var(--highlight); }

/* Respect a stated preference for less motion. The smooth-scroll on <html> and
   the card lift are the only motion in the system; both are disabled here. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* structure ------------------------------------------------------------- */
.page-shell { min-height: 100vh; border-left: 13px solid var(--shadow); }

.top-rule { position: fixed; top: 0; left: 0; right: 0; height: 8px; background: var(--shadow); z-index: 20; }
.top-rule::after { content: ""; display: block; width: 34vw; height: 8px; background: var(--midtone); margin-left: 13px; }

.hero {
  min-height: 78vh;
  display: grid;
  grid-template-columns: minmax(0, var(--phi-major)) minmax(300px, var(--phi-minor));
  gap: var(--s4);
  padding: var(--s5) var(--page-pad) var(--s4) var(--page-pad);
  align-items: end;
}
.hero-copy { padding-bottom: var(--s2); }
.hero-single { display: block; }

.eyebrow { font-size: 14px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 var(--s3) 0; }
.subtitle { max-width: 850px; font-size: clamp(22px, 2.4vw, 34px); line-height: 1.32; margin-top: var(--s3); font-family: var(--serif); }

.document-meta {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1.5px solid var(--shadow); border-bottom: 1.5px solid var(--shadow);
  max-width: 960px; margin: 0 var(--page-pad);
}
.document-meta div { padding: var(--s1) var(--s2) var(--s1) 0; border-right: 1.5px solid var(--shadow); min-height: 84px; }
.document-meta div:last-child { border-right: 0; }
.document-meta .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: var(--s1); }
.document-meta .value { font-family: var(--sans); font-size: 20px; line-height: 1.2; }

/* body sections: sticky mono label + content, golden-ratio ---------------- */
main { padding: 0; }
.section {
  display: grid; grid-template-columns: minmax(200px, var(--phi-minor)) minmax(0, var(--phi-major));
  gap: var(--s4); padding: var(--s5) var(--page-pad); border-bottom: 1.5px solid var(--shadow);
}
.section-label {
  position: sticky; top: var(--s3); align-self: start;
  font-family: var(--mono); font-size: 14px; line-height: 1.55;
  text-transform: uppercase; letter-spacing: 0.06em; padding-top: 8px;
}
.section-label::before { content: ""; display: block; width: 55px; height: 1.5px; background: var(--midtone); margin-bottom: var(--s1); }
.section-content { min-width: 0; }

/* section-wide: full-width section variant for large matrices / figures —
   the mono label sits above the content instead of in a side column */
.section-wide { display: block; }
.section-wide .section-label { position: static; margin-bottom: var(--s3); }

.lead { font-family: var(--sans); font-size: clamp(26px, 3.2vw, 44px); line-height: 1.12; letter-spacing: -0.03em; max-width: 1060px; margin-bottom: var(--s4); }

.quote-block { margin: var(--s4) 0; border-left: 8px solid var(--midtone); padding: var(--s2) 0 var(--s2) var(--s3); font-family: var(--sans); font-size: clamp(24px, 3vw, 40px); line-height: 1.15; letter-spacing: -0.03em; max-width: 1060px; }
.quote-block p { max-width: 1060px; margin: 0; }

/* cards ------------------------------------------------------------------ */
/* A fixed 2-up grid repeated down a long page is the "identical card grids" failure —
   same shape, same rhythm, section after section, until the eye stops registering it.
   The 2-up stays the default because it is right most of the time; these modifiers exist
   so a page can VARY its rhythm rather than defaulting into monotony.
     .aside-grid--wide  : one emphatic full-width card (a claim, a warning, a summary)
     .aside-grid--auto  : lets the item count decide the columns
     .aside-grid--three : a denser 3-up for short parallel items
   Rule of use: don't run the same variant twice in a row. */
.aside-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); margin: var(--s3) 0 var(--s4) 0; max-width: 1060px; }
.aside-grid--wide { grid-template-columns: 1fr; }
.aside-grid--auto { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.aside-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1240px; }
/* Let one card in a default grid span both columns to break the run. */
.aside-grid .card--span { grid-column: 1 / -1; }
.card { border: 1.5px solid var(--shadow); padding: var(--s2); min-height: 160px; position: relative; background: var(--highlight); min-width: 0; overflow-wrap: break-word; }
.aside-grid > * { min-width: 0; }
.card .label { display: block; font-size: 12px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s2); }
.card p { font-size: 18px; line-height: 1.45; margin-bottom: 0; }
.card h3 { margin-top: 0; }
.dark-card { background: var(--shadow); color: var(--highlight); }
.dark-card .label { color: var(--midtone); }
.dark-card a { color: var(--highlight); }
.accent-card { border-left: 13px solid var(--midtone); }
.card-link { text-decoration: none; display: block; transition: transform .12s ease; }
.card-link:hover { transform: translateY(-2px); }
.card-link:hover .card { border-color: var(--midtone); }

/* copy block -------------------------------------------------------------
   A bordered specimen of text that exists to be LIFTED — bio copy, boilerplate,
   a standard description someone will paste into a programme or a deck.
   Distinct from .quote-block (one display line, sans, huge, orange rule) and from
   .card (a parallel item in a grid, 18px, single paragraph). This is running serif
   prose, held to the reading measure, with real paragraph separation, and no accent —
   the border alone says "this is a discrete object you may take whole".
   Multi-paragraph by design: .card p and .quote-block p both zero their margins,
   which silently runs paragraphs together. */
.copy-block {
  border: 1.5px solid var(--shadow); background: var(--highlight);
  padding: var(--s3); margin: var(--s2) 0 var(--s4) 0;
  max-width: calc(var(--measure) + var(--s3) * 2);
}
.copy-block .label {
  display: block; font-family: var(--mono); font-size: 12px; line-height: 1.4;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s2);
}
.copy-block p { font-size: 19px; line-height: 1.5; margin-bottom: var(--s2); max-width: none; }
.copy-block p:last-child { margin-bottom: 0; }

.caption { font-size: 13px; line-height: 1.5; margin-top: var(--s1); max-width: 780px; }

/* tables ----------------------------------------------------------------- */
.table-wrap { max-width: 1240px; overflow-x: auto; border: 1.5px solid var(--shadow); margin: var(--s4) 0; }
table { width: 100%; border-collapse: collapse; font-size: 17px; line-height: 1.42; }
th, td { text-align: left; padding: var(--s1) var(--s2); border-bottom: 1px solid var(--shadow); vertical-align: top; }
th { font-family: var(--sans); font-weight: 500; }
tr:last-child td { border-bottom: 0; }

/* footer ----------------------------------------------------------------- */
.footer { background: var(--shadow); color: var(--highlight); padding: var(--s4) var(--page-pad); }
.footer a { color: var(--highlight); text-decoration-color: var(--midtone); }
.footer .label { color: var(--midtone); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s1); }
.footer p { max-width: 720px; }

/* slide deck --------------------------------------------------------------
   Full-viewport slides for proposal decks (e.g. xco-proposal-deck.html).
   Same vocabulary as the papers — kicker, lead, cards, tables — one idea
   per screen. Prints one slide per page. */
.slide {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--s5) var(--page-pad);
  border-bottom: 1.5px solid var(--shadow);
}
.slide-kicker {
  font-family: var(--mono); font-size: 14px; line-height: 1.4;
  text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 var(--s3) 0;
}
.slide-kicker::before { content: ""; display: block; width: 55px; height: 1.5px; background: var(--midtone); margin-bottom: var(--s1); }
.slide-dark { background: var(--shadow); color: var(--highlight); }
.slide-dark .slide-kicker { color: var(--midtone); }
.slide-dark a { color: var(--highlight); text-decoration-color: var(--midtone); }
.slide-dark .card { background: transparent; border-color: var(--highlight); }
.slide-dark .card .label { color: var(--midtone); }
.slide-dark .quote-block { border-left-color: var(--midtone); }
.slide-dark hr { border-top-color: var(--highlight); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3) var(--s2); margin: var(--s3) 0; max-width: 1240px; }
.stat { border-top: 1.5px solid currentColor; padding-top: var(--s1); }
.stat .data { display: block; font-size: clamp(30px, 3.6vw, 50px); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 8px; }
.stat .label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.5; }

.deck-progress {
  position: fixed; bottom: var(--s2); right: var(--s2); z-index: 30;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  background: var(--highlight); color: var(--shadow);
  border: 1.5px solid var(--shadow); padding: 6px 13px;
}

/* chain: a labelled sequence of chips with accent arrows (deck process chains) */
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; margin: var(--s2) 0 var(--s3) 0; max-width: 1060px; }
.chain span {
  font-family: var(--mono); font-size: 13px; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.04em;
  border: 1.5px solid var(--shadow); padding: 8px 13px; white-space: nowrap;
}
.chain i { font-style: normal; color: var(--midtone-ink); padding: 0 10px; font-family: var(--mono); font-size: 15px; }
.chain .loop { border-style: dashed; }
.slide-dark .chain span { border-color: var(--highlight); }

/* deck-figure: framed diagram block for inline SVG schematics */
.deck-figure { border: 1.5px solid var(--shadow); padding: var(--s2); margin: var(--s3) 0; max-width: 1060px; background: var(--highlight); }
.deck-figure svg { display: block; width: 100%; height: auto; }
.deck-figure .caption { margin-top: var(--s1); }
.slide-dark .deck-figure { border-color: var(--highlight); background: var(--shadow); }

/* formula: self-contained, legibly typeset equation block (no external math JS) */
.formula {
  border-left: 3px solid var(--midtone);
  padding: var(--s1) var(--s2);
  margin: var(--s2) 0 var(--s3) 0;
  max-width: 1060px;
  background: rgba(25, 38, 64, 0.03);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.5;
}
.formula .eq { font-style: italic; }
.formula var { font-style: italic; font-family: var(--serif); }
.formula sub, .formula sup { font-style: normal; font-size: 0.72em; font-family: var(--mono); }
.formula .op { font-style: normal; color: var(--midtone-ink); padding: 0 0.25em; }
.formula .gloss { display: block; margin-top: 8px; font-family: var(--mono); font-size: 13px; line-height: 1.5; letter-spacing: -0.01em; font-style: normal; color: var(--shadow); }
.formula .stack { display: block; margin: 4px 0; }
.slide-dark .formula { background: rgba(255, 255, 255, 0.05); }

/* def-list: term → definition pairs (e.g. link derivations, decision sequence) */
.def-list { max-width: 1060px; margin: var(--s2) 0 var(--s3) 0; }
.def-list .def { border-top: 1.5px solid var(--shadow); padding: var(--s1) 0 var(--s2) 0; }
.def-list .def-key { font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--midtone-ink); display: block; margin-bottom: 6px; }
.def-list .def-key b { color: var(--shadow); font-weight: 500; }
.def-list .def p { margin-bottom: 8px; }
.def-list .falsifier { font-family: var(--mono); font-size: 13px; line-height: 1.5; letter-spacing: -0.01em; color: var(--shadow); opacity: 0.75; }

/* responsive ------------------------------------------------------------- */
/* Intermediate step. The page gutter was jumping 55px -> 24px in one move at 980px;
   this gives the tablet range a proportionate margin instead of a desktop one. */
@media (max-width: 1200px) {
  :root { --page-pad: 34px; }
}

@media (max-width: 980px) {
  .slide { min-height: auto; padding: var(--s4) var(--page-pad); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .deck-progress { display: none; }

  :root { --page-pad: 24px; }
  .page-shell { border-left-width: 8px; }
  .chain span { white-space: normal; }
  /* .aside-grid deliberately NOT collapsed here — see the 720px rule below. Two
     narrow cards read better than one very wide one at tablet width. */
  .hero, .section, .document-meta { grid-template-columns: 1fr; gap: var(--s3); }
  .aside-grid { gap: var(--s2); }
  .aside-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { min-height: auto; padding-top: var(--s5); }
  .section-label { position: static; }
  .document-meta { max-width: none; }
  .document-meta div { border-right: 0; border-bottom: 1.5px solid var(--shadow); min-height: 0; }
  .document-meta div:last-child { border-bottom: 0; }
}

/* Below this a two-up card grid stops being readable — one column, full width. */
@media (max-width: 720px) {
  .aside-grid, .aside-grid--three, .aside-grid--auto { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

@media print {
  .top-rule { display: none; }
  body { font-size: 12pt; }
  .page-shell { border-left: 0; }
  .section, .hero { break-inside: avoid; }
  .slide { min-height: auto; break-inside: avoid; break-after: page; }
  .deck-progress { display: none; }
}

/* ==========================================================================
   Horizon Notes — poster component (shared by horizon-notes.html and
   horizon-notes-library.html). Uses the system tokens; scoped by .hn- prefix.
   ========================================================================== */
.hn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); max-width: 1160px; margin: var(--s3) 0 var(--s4) 0; }
@media (max-width: 820px) { .hn-grid { grid-template-columns: 1fr; } }
.hn-item { min-width: 0; }
.hn-poster { background: var(--shadow); color: var(--highlight); aspect-ratio: 3 / 4; padding: var(--s3); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.hn-poster::before { content: ""; position: absolute; top: 0; left: 0; width: 40%; height: 8px; background: var(--midtone); }
.hn-head { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--highlight); opacity: 0.72; margin-top: var(--s1); line-height: 1.5; }
.hn-anchor { font-family: var(--mono); font-size: 13px; line-height: 1.5; letter-spacing: -0.01em; margin-top: var(--s2); color: var(--highlight); opacity: 0.92; }
.hn-q { font-family: var(--sans); font-weight: 500; letter-spacing: -0.03em; line-height: 1.02; font-size: clamp(24px, 3vw, 38px); margin-top: auto; margin-bottom: 0; padding-top: var(--s3); }
.hn-warrant { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.35; margin-top: var(--s2); opacity: 0.9; max-width: none; }
.hn-handle { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; margin-top: var(--s2); opacity: 0.6; }
.hn-handle .arw { color: var(--midtone); }
.hn-coda { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; color: var(--midtone); margin-top: var(--s2); padding-top: var(--s1); border-top: 1.5px solid rgba(242,127,61,0.35); }
.hn-commit { grid-column: 1 / -1; background: var(--shadow); color: var(--highlight); aspect-ratio: auto; padding: var(--s4); display: block; }
.hn-commit::before { width: 61.8%; }
.hn-commit .hn-thesis { font-family: var(--sans); font-weight: 500; letter-spacing: -0.035em; line-height: 1.0; font-size: clamp(34px, 5vw, 60px); margin: var(--s2) 0 var(--s3) 0; max-width: 900px; }
.hn-commit .hn-brand { font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--midtone); }
.hn-commit .hn-body { font-family: var(--serif); font-size: 19px; line-height: 1.4; margin-top: var(--s2); max-width: 760px; opacity: 0.94; }
.hn-commit .hn-falsifier { font-family: var(--sans); font-weight: 500; font-size: clamp(18px, 2vw, 23px); letter-spacing: -0.02em; margin-top: var(--s3); max-width: 760px; }
.hn-commit .hn-charge { font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; font-size: clamp(24px, 3.2vw, 40px); color: var(--midtone); margin-top: var(--s3); }
.hn-boundary { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; margin-top: var(--s1); padding-left: 13px; border-left: 3px solid var(--midtone); }
.hn-boundary b { font-weight: 500; }
.hn-order { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; opacity: 0.75; margin-top: var(--s1); padding-left: 13px; }
.hn-flag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; margin-top: var(--s1); padding-left: 13px; color: var(--midtone); }
.hn-movement { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; margin: var(--s4) 0 0 0; padding-top: var(--s2); border-top: 1.5px solid var(--shadow); }
.hn-movement:first-of-type { border-top: 0; }
