/* Thousands x Bets stylesheet.

   Structure comes from hairline rules and a left locator margin rather than boxes, echoing the
   numbered rulebooks in the corpus. Serif (Source Serif 4) is for text a person wrote; mono
   (IBM Plex Mono) is for anything a machine emitted: scores, ids, enums, counts.

   Every text/background pair meets WCAG AA. --paper on --teal is only 2.84:1, so teal as a
   background always takes --ink text. */

:root {
  /* Ground, in three levels, so surfaces have direction */
  --ink:        #100E0C;   /* the page */
  --ink-raised: #1A1714;   /* above the page: masthead, refusals, nav panel  */
  --ink-sunken: #080706;   /* below the page: quote wells, the input field   */

  --rule:       #2E2823;   /* the hairline — the primary structural device   */

  /* Text */
  --paper:      #F2EEE6;   /* primary                                        */
  --paper-dim:  #A69C8E;   /* secondary, and insufficient_context            */

  /* Accent */
  --teal:       #119DA4;   /* accent; as a background it takes --ink text    */
  --teal-lift:  #35C2C8;   /* the same accent lifted for links on dark       */

  /* Refusal states: one hue per refusal_type */
  --amber: #E2A64B;        /* no_live_data — also a negative eval delta      */
  --azure: #7FAEDC;        /* no_account_access                              */
  --rose:  #E0767D;        /* no_advice                                      */
  /* insufficient_context deliberately uses --paper-dim: it is the absence
     colour, and it should not look like a fifth opinion. */

  /* Shape */
  --r: 2px;                /* interactive controls only; everything else 0   */

  /* Measure */
  --page-w: 1080px;
  --read-w: 720px;         /* prose measure, ~68ch at 17px serif             */
  --chat-w: 760px;         /* chat column                                    */
  --margin-w: 11rem;       /* the left locator column                        */

  /* Motion */
  --speed: 180ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Type */
  --serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino,
           Georgia, 'Times New Roman', serif;
  --mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo,
           Consolas, monospace;
}

/* Reset and base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  font-optical-sizing: auto;   /* Source Serif 4 carries a real opsz axis */
  -webkit-font-smoothing: antialiased;
}

/* The icon sprite lives inline in every page and must never take up space.
   width/height 0 rather than display:none — the latter has historically
   broken <use> references in some engines. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Every icon is a stroked, monochrome symbol inheriting currentColor. */
.icon {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

img, svg { max-width: 100%; }

/* Headings */

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 500; line-height: 1.18; }

.display {
  font-size: clamp(2.4rem, 5.5vw, 3.75rem);
  font-weight: 400; line-height: 1.05; letter-spacing: -0.022em;
  margin: 0 0 1rem; text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.018em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); letter-spacing: -0.012em; }
h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.005em; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: 1.1875rem; line-height: 1.6; color: var(--paper-dim);
  max-width: 58ch;
}
.prose { max-width: var(--read-w); color: var(--paper-dim); }
.prose strong { color: var(--paper); font-weight: 600; }

a { color: var(--teal-lift); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

em { font-style: italic; }

/* Mono is the machine voice: ids, enums, scores, counts. */
code, .mono, .num {
  font-family: var(--mono);
  font-size: 0.875em;
  font-variant-numeric: tabular-nums;
}

/* Focus: visible on every interactive element */
:focus-visible {
  outline: 2px solid var(--teal-lift);
  outline-offset: 2px;
}

.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-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--teal); color: var(--ink);
  padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.8125rem;
}
.skip-link:focus { left: 0; }

/* Layout primitives */

.wrap { width: 100%; max-width: var(--page-w); margin-inline: auto; padding-inline: 28px; }
.wrap--read { max-width: calc(var(--read-w) + 56px); }

/* Vertical rhythm is deliberately uneven: an opening breathes, a dense
   reference section does not. */
.section      { padding-block: clamp(3rem, 7vw, 5rem); }
.section--open{ padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(2rem, 4vw, 3rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 2.75rem); }

.rule-top { border-top: 1px solid var(--rule); }

/* A small label where a section genuinely needs one. Sentence case, mono,
   sitting on a rule — not a tracked-out all-caps eyebrow. */
.label {
  font-family: var(--mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.04em; color: var(--paper-dim);
  display: block; margin-bottom: 0.75rem;
}

/* Masthead */

.masthead {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink-raised);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 60px;
}

/* Wordmark; the × is U+00D7 */
.wordmark {
  font-family: var(--serif); font-size: 1.125rem; font-weight: 600;
  letter-spacing: -0.015em; color: var(--paper); white-space: nowrap;
  flex: none;
}
.wordmark:hover { color: var(--paper); text-decoration: none; }
.wordmark__x {
  color: var(--teal-lift); font-size: 0.78em; font-weight: 400;
  margin-inline: 0.28em; vertical-align: 0.04em;
}

/* Navigation */
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 400;
  color: var(--paper-dim); padding: 0.4rem 0.7rem; border-radius: var(--r);
}
.nav a:hover { color: var(--paper); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--paper); }
.nav a.nav__cta {
  color: var(--ink); background: var(--teal); font-weight: 500;
  margin-left: 0.5rem; padding-inline: 0.9rem;
}
.nav a.nav__cta:hover { background: var(--teal-lift); color: var(--ink); }

/* Mobile disclosure, hidden above the breakpoint */
.nav__toggle {
  display: none; align-items: center; gap: 0.45rem;
  font-family: var(--mono); font-size: 0.8125rem;
  background: transparent; color: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r);
  padding: 0.4rem 0.7rem; cursor: pointer;
}
.nav__toggle .icon { font-size: 1rem; }
.nav__panel { display: none; }

/* Controls */

.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 500;
  padding: 0.7rem 1.15rem; border-radius: var(--r);
  border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--paper);
}
.btn--primary { background: var(--teal); color: var(--ink); }
.btn--primary:hover { background: var(--teal-lift); color: var(--ink); text-decoration: none; }
.btn--quiet { border-color: var(--rule); color: var(--paper); }
.btn--quiet:hover { border-color: var(--paper-dim); text-decoration: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }

/* Sport tabs. Text only — an icon beside a word that already names the sport
   would carry no information. */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tab {
  font-family: var(--mono); font-size: 0.8125rem; cursor: pointer;
  padding: 0.45rem 0.9rem; border-radius: var(--r);
  background: transparent; color: var(--paper-dim);
  border: 1px solid var(--rule);
}
.tab:hover { color: var(--paper); }
.tab[aria-selected='true'] {
  color: var(--ink); background: var(--teal); border-color: var(--teal);
}
.tabpanel[hidden] { display: none; }

/* Ruled entries: one row grammar shared across pages, with page-specific columns. */

.list { border-bottom: 1px solid var(--rule); }
/* Topic rows carry a description capped at its reading measure, so the row
   itself takes a measure too — otherwise the tag drifts to the far edge with
   an empty gulf behind it. */
.list--topics { max-width: 880px; }

.entry {
  display: grid; gap: 0.3rem 1.5rem;
  padding: 1.15rem 0.6rem 1.15rem 0;
  border-top: 1px solid var(--rule);
  color: inherit; text-align: left; width: 100%;
  background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
  font: inherit; cursor: pointer;
}
a.entry:hover, button.entry:hover { background: var(--ink-raised); text-decoration: none; }
a.entry:hover .entry__title { color: var(--teal-lift); }

/* index: title + tag, description spanning beneath */
.entry--topic { grid-template-columns: 1fr auto; align-items: baseline; }
.entry--topic .entry__desc { grid-column: 1 / -1; }

.entry__title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.005em; }
.entry__desc  { color: var(--paper-dim); font-size: 0.9375rem; max-width: 62ch; margin: 0; }
.entry__tag {
  font-family: var(--mono); font-size: 0.6875rem; color: var(--paper-dim);
  white-space: nowrap;
}
.entry__tag--refuse { color: var(--rose); }

/* teams: a locator margin against the question, which is the subject */
.entry--matter { grid-template-columns: minmax(0, var(--margin-w)) 1fr; align-items: start; }
.entry__locator {
  font-family: var(--mono); font-size: 0.75rem; line-height: 1.5;
  color: var(--paper-dim); padding-top: 0.25rem;
}
.entry__locator b { display: block; color: var(--paper); font-weight: 500; }
.entry__question {
  font-size: 1.1875rem; line-height: 1.45; color: var(--paper);
  margin: 0; text-wrap: pretty;
}

/* Figures */

.figures {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0; border-block: 1px solid var(--rule);
}
.figures > div { padding: 1.1rem 1.25rem; border-left: 1px solid var(--rule); }
.figures > div:first-child { border-left: 0; padding-left: 0; }
.figures dt {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.04em;
  color: var(--paper-dim); order: 2;
}
.figures dd {
  font-family: var(--mono); font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--paper); margin: 0 0 0.15rem; letter-spacing: -0.02em;
}
.figures > div { display: flex; flex-direction: column; }

/* Panels and wells */

.panel {
  background: var(--ink-raised); border: 1px solid var(--rule);
  padding: 1.25rem 1.4rem;
}
.well {
  background: var(--ink-sunken); border: 1px solid var(--rule);
  padding: 1rem 1.15rem;
}

/* A marginal note: a rule on the left, no box. */
.note {
  border-left: 2px solid var(--teal);
  padding: 0.35rem 0 0.35rem 1.15rem;
  color: var(--paper-dim); font-size: 0.9375rem;
  max-width: 74ch;
}
.note strong { color: var(--paper); font-weight: 600; }

/* Assistant — chat column */

body.page-assistant { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.assistant { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* A flex column so the empty state can be anchored to the composer. */
.assistant__scroll {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
.chat {
  width: 100%; max-width: var(--chat-w); margin-inline: auto;
  padding: 2.5rem 28px 1.5rem;
  display: flex; flex-direction: column; gap: 2rem;
}
/* While only the empty state is showing, push it down so it sits against the
   composer instead of leaving a dead zone between the two. Removed by
   assistant.js on the first question, when normal top-down flow takes over. */
.assistant__scroll.is-empty .chat { margin-top: auto; }

/* User question */
.msg-user { display: flex; justify-content: flex-end; }
.msg-user__bubble {
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 0.7rem 1rem;
  max-width: 85%; overflow-wrap: anywhere;
}

/* Assistant answer */
.msg-bot { animation: enter var(--speed) var(--ease); }

.answer { border-left: 2px solid var(--teal); padding-left: 1.35rem; }
.answer__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.answer__meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem;
  margin-top: 1.25rem; padding-top: 0.7rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.6875rem; color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}

/* Citation apparatus */

.citations { margin-top: 1.5rem; }
.citations__label {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.04em;
  color: var(--paper-dim); padding-bottom: 0.5rem;
}
.cite { border-top: 1px solid var(--rule); }
.cite:last-child { border-bottom: 1px solid var(--rule); }

.cite__toggle {
  width: 100%; font: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1.75rem 1fr auto auto;
  align-items: baseline; gap: 0 0.6rem;
  padding: 0.7rem 0.4rem 0.7rem 0; background: transparent;
  border: 0; color: var(--paper);
}
.cite__toggle:hover { background: var(--ink-raised); }

.cite__index {
  font-family: var(--mono); font-size: 0.75rem; color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}
.cite__ref { min-width: 0; }
.cite__doc { font-size: 0.9375rem; font-weight: 600; }
.cite__mark { color: var(--teal-lift); margin-inline: 0.4em; font-weight: 400; }
.cite__section { font-size: 0.9375rem; color: var(--teal-lift); }

.cite__score {
  font-family: var(--mono); font-size: 0.75rem; color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}
.cite__chev {
  color: var(--paper-dim); font-size: 0.8rem; align-self: center;
  transition: transform var(--speed) var(--ease);
}
.cite__toggle[aria-expanded='true'] .cite__chev { transform: rotate(90deg); }

/* The one deliberate animation in the system. 0fr → 1fr is animatable where
   height:auto is not; the inner wrapper clips while it grows. No JS measures
   anything — the aria-expanded attribute is the only state. */
.cite__panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--speed) var(--ease);
}
.cite__toggle[aria-expanded='true'] + .cite__panel { grid-template-rows: 1fr; }
.cite__panel > div { overflow: hidden; }

.cite__quote {
  margin: 0 0 0.9rem 2.35rem; padding: 0.9rem 1.1rem;
  background: var(--ink-sunken); border-left: 1px solid var(--rule);
  color: var(--paper-dim); font-size: 0.9375rem; line-height: 1.6;
  overflow-wrap: anywhere;
}
.cite__quote strong { color: var(--paper); font-weight: 600; }
.cite__id {
  display: block; margin-top: 0.65rem; font-family: var(--mono);
  font-size: 0.6875rem; color: var(--paper-dim); opacity: 0.75;
}

/* Refusals: one state per refusal_type. Each has an icon and label, so colour is never the only signal. */

.refusal {
  border-left: 2px solid var(--rf, var(--paper-dim));
  background: color-mix(in srgb, var(--rf, var(--paper-dim)) 9%, var(--ink-raised));
  padding: 1.1rem 1.35rem;
  display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.85rem;
}
/* Sized up a little from the body scale: this glyph is the non-colour signal
   that distinguishes the four states, so it has to read at a glance. */
.refusal__icon {
  grid-row: span 2; color: var(--rf); font-size: 1.3rem;
  padding-top: 0.1rem;
}
.refusal__type {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500;
  color: var(--rf); letter-spacing: 0.01em;
}
.refusal__enum { color: var(--paper-dim); margin-left: 0.75rem; font-weight: 400; }
.refusal__msg { margin: 0; color: var(--paper); font-size: 1rem; }

.refusal--no_live_data         { --rf: var(--amber); }
.refusal--no_account_access    { --rf: var(--azure); }
.refusal--no_advice            { --rf: var(--rose); }
.refusal--insufficient_context { --rf: var(--paper-dim); }

/* An outage is not a refusal and must not be mistaken for one: dashed, grey,
   no icon, no colour coding. */
.error-note {
  border: 1px dashed var(--rule); padding: 1rem 1.2rem;
  color: var(--paper-dim); font-size: 0.9375rem;
}
.error-note strong { color: var(--paper); font-weight: 600; }

/* Loading */
.thinking {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--paper-dim); font-family: var(--mono); font-size: 0.8125rem;
}
.dots { display: inline-flex; gap: 4px; }
.dots span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--teal-lift);
  animation: pulse 1.3s var(--ease) infinite;
}
.dots span:nth-child(2) { animation-delay: 0.16s; }
.dots span:nth-child(3) { animation-delay: 0.32s; }

/* Empty state: left-aligned, anchored to the composer */
.empty { max-width: 100%; }
.empty h2 { margin-bottom: 0.6rem; }
.empty p { color: var(--paper-dim); font-size: 1rem; max-width: 58ch; }
.empty .list { margin-top: 1.75rem; }

.entry--ask { grid-template-columns: 1fr auto; align-items: baseline; padding-block: 0.9rem; }
.entry--ask .entry__question { font-size: 1rem; }

/* Composer */
.composer-shell { border-top: 1px solid var(--rule); background: var(--ink); }
.composer { width: 100%; max-width: var(--chat-w); margin-inline: auto; padding: 1rem 28px 1.1rem; }

.composer__box {
  display: flex; align-items: flex-end; gap: 0.5rem;
  background: var(--ink-sunken); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 0.4rem 0.4rem 0.4rem 0.85rem;
}
.composer__box:focus-within { border-color: var(--teal); }
/* The textarea suppresses its own outline so the ring can sit on the box that
   visually *is* the field. :has() scopes it to keyboard focus on the textarea
   specifically, so focusing the send button rings the button and not both. */
.composer__box:has(textarea:focus-visible) {
  outline: 2px solid var(--teal-lift);
  outline-offset: 2px;
}

.composer textarea {
  flex: 1; font-family: var(--serif); font-size: 1rem; color: var(--paper);
  background: transparent; border: 0; resize: none; outline: none;
  padding: 0.45rem 0; max-height: 160px; line-height: 1.5; overflow-y: auto;
}
.composer textarea::placeholder { color: var(--paper-dim); }

.composer__send {
  flex: none; width: 36px; height: 36px; border-radius: var(--r);
  display: grid; place-items: center; cursor: pointer;
  background: var(--teal); color: var(--ink); border: 0;
}
.composer__send .icon { font-size: 1.05rem; stroke-width: 1.9; }
.composer__send:hover:not([disabled]) { background: var(--teal-lift); }
.composer__send[disabled] { opacity: 0.4; cursor: not-allowed; }

.composer__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 0.6rem;
  font-family: var(--mono); font-size: 0.6875rem; color: var(--paper-dim);
}
.composer__right { display: flex; align-items: center; gap: 1.1rem; }
/* Shown by assistant.js near the cap */
.composer__count[hidden] { display: none; }
.composer__count.is-over { color: var(--rose); }

.scope { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.scope__btn {
  font-family: var(--mono); font-size: 0.6875rem; cursor: pointer;
  padding: 0.2rem 0.5rem; border-radius: var(--r);
  background: transparent; border: 1px solid transparent; color: var(--paper-dim);
}
.scope__btn:hover { color: var(--paper); }
.scope__btn[aria-pressed='true'] { color: var(--paper); border-color: var(--rule); background: var(--ink-raised); }

.status { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--paper-dim); }
.status--ok   .status__dot { background: var(--teal-lift); }
.status--down .status__dot { background: var(--rose); }

/* How it works: numbered, because the pipeline layers really are sequential. */

.doc-section { display: grid; grid-template-columns: 3.5rem 1fr; gap: 0 1.5rem; }
.doc-section__num {
  font-family: var(--mono); font-size: 0.8125rem; color: var(--paper-dim);
  padding-top: 0.4rem; font-variant-numeric: tabular-nums;
}
.doc-section__body { min-width: 0; }

.pipeline-figure { margin: 1.5rem 0 0; overflow-x: auto; }
.pipeline-figure svg { display: block; min-width: 680px; width: 100%; height: auto; }
.pipeline-figure figcaption {
  margin-top: 1rem; font-size: 0.9375rem; color: var(--paper-dim); max-width: 74ch;
}

/* Refusal reference */
.refusal-defs { margin: 1.25rem 0 0; border-bottom: 1px solid var(--rule); }
.refusal-def {
  display: grid; grid-template-columns: minmax(0, 13rem) 1fr; gap: 0.3rem 1.5rem;
  padding: 0.95rem 0 0.95rem 1rem;
  border-top: 1px solid var(--rule);
  border-left: 2px solid var(--rf);
}
.refusal-def dt {
  font-family: var(--mono); font-size: 0.8125rem; color: var(--rf); font-weight: 500;
}
.refusal-def dd { margin: 0; color: var(--paper-dim); font-size: 0.9375rem; }
.refusal-def--no_live_data         { --rf: var(--amber); }
.refusal-def--no_account_access    { --rf: var(--azure); }
.refusal-def--no_advice            { --rf: var(--rose); }
.refusal-def--insufficient_context { --rf: var(--paper-dim); }

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 1.25rem; }
table.data {
  width: 100%; border-collapse: collapse; min-width: 560px;
  font-size: 0.9375rem;
}
table.data caption { text-align: left; }
table.data th, table.data td {
  padding: 0.6rem 1rem 0.6rem 0; text-align: left;
  border-bottom: 1px solid var(--rule);
}
table.data thead th {
  font-family: var(--mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.04em; color: var(--paper-dim);
  white-space: nowrap; border-bottom-color: var(--paper-dim);
}
table.data td.num {
  font-family: var(--mono); font-size: 0.8125rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  text-align: right; padding-right: 1.5rem;
}
table.data th.num { text-align: right; padding-right: 1.5rem; }
table.data tbody tr:hover { background: var(--ink-raised); }
.delta-good { color: var(--teal-lift); }
.delta-bad  { color: var(--amber); }

/* The two headline rows are lifted by weight and a faint ground — never by a
   colour that would override the delta coding, which is the one thing those
   rows exist to show. */
tr.row-headline { background: color-mix(in srgb, var(--teal) 7%, var(--ink)); }
tr.row-headline td:first-child { color: var(--paper); font-weight: 600; }
.dim { color: var(--paper-dim); }

.legend {
  display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 0.9rem;
  font-family: var(--mono); font-size: 0.6875rem; color: var(--paper-dim);
}
.legend__item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend__swatch { width: 9px; height: 2px; background: var(--sw); }

/* Findings */
.findings { border-bottom: 1px solid var(--rule); margin-top: 1.5rem; }
.finding {
  display: grid; grid-template-columns: 2rem 1fr; gap: 0.4rem 1rem;
  padding: 1.15rem 0; border-top: 1px solid var(--rule);
}
.finding__num {
  font-family: var(--mono); font-size: 0.75rem; color: var(--paper-dim);
  padding-top: 0.25rem;
}
.finding h3 { margin: 0 0 0.35rem; }
.finding p { margin: 0; color: var(--paper-dim); font-size: 0.9375rem; max-width: 70ch; }

.loading-row { color: var(--paper-dim); font-size: 0.9375rem; padding: 1rem 0; }

/* Stack description list */
.stack-defs { margin: 1.25rem 0 0; border-bottom: 1px solid var(--rule); }
.stack-def {
  display: grid; grid-template-columns: minmax(0, 9rem) 1fr; gap: 0.3rem 1.5rem;
  padding: 1rem 0; border-top: 1px solid var(--rule);
}
.stack-def dt { font-family: var(--mono); font-size: 0.8125rem; color: var(--paper); }
.stack-def dd { margin: 0; color: var(--paper-dim); font-size: 0.9375rem; max-width: 70ch; }

/* Footer */

.site-footer { border-top: 1px solid var(--rule); padding-block: 2.5rem; margin-top: 3rem; }
.site-footer__inner { display: grid; gap: 1.25rem; }
@media (min-width: 800px) { .site-footer__inner { grid-template-columns: 1.3fr 1fr; gap: 3rem; } }
.site-footer p { font-size: 0.875rem; color: var(--paper-dim); margin: 0; max-width: 60ch; }
.site-footer strong { color: var(--paper); font-weight: 600; }
.site-footer .disclaimer { border-left: 2px solid var(--amber); padding-left: 1rem; }

/* Motion: only a citation opening, a message arriving, and the loading pulse. */

@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

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

/* Narrow screens */

@media (max-width: 767px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }

  .masthead { position: sticky; }
  .nav__panel[data-open='true'] {
    display: block;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--ink-raised); border-bottom: 1px solid var(--rule);
    padding: 0.5rem 0 0.9rem;
  }
  .nav__panel a {
    display: block; font-family: var(--mono); font-size: 0.9375rem;
    color: var(--paper); padding: 0.75rem 28px;
  }
  .nav__panel a[aria-current='page'] { color: var(--teal-lift); }
  .nav__panel a.nav__cta {
    background: transparent; color: var(--teal-lift); margin: 0.35rem 28px 0;
    border: 1px solid var(--teal); padding: 0.7rem 1rem; text-align: center;
  }
}

@media (max-width: 640px) {
  .wrap, .chat, .composer { padding-inline: 20px; }
  .nav__panel a, .nav__panel a.nav__cta { padding-inline: 20px; }
  .nav__panel a.nav__cta { margin-inline: 20px; }
  .chat { padding-top: 1.75rem; gap: 1.75rem; }

  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures > div { border-left: 1px solid var(--rule); padding-inline: 1rem; }
  .figures > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .figures > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }

  /* The locator moves above the question rather than squeezing beside it. */
  .entry--matter { grid-template-columns: 1fr; gap: 0.5rem; }
  .entry__locator { padding-top: 0; }
  .entry__locator b { display: inline; }
  .entry__question { font-size: 1.0625rem; }

  .doc-section { grid-template-columns: 1fr; gap: 0; }
  .doc-section__num { padding-top: 0; margin-bottom: 0.35rem; }

  .refusal-def, .stack-def { grid-template-columns: 1fr; }
  .msg-user__bubble { max-width: 92%; }
  .answer { padding-left: 1.1rem; }
  .cite__quote { margin-left: 0; }
  .composer__foot { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
}
