/* Lateral Intelligence research-post styling.
   Tokens lifted from the LateralThinker post so the two read as one publication:
   warm paper ground, Newsreader for prose, Libre Franklin for chrome, IBM Plex Mono
   for anything the machine produced. */

:root {
  --bg:        #faf9f6;
  --surface:   #fdfdfb;
  --ink:       #1b1a17;
  --ink-70:    rgba(27, 26, 23, 0.70);
  --ink-55:    rgba(27, 26, 23, 0.55);
  --ink-45:    rgba(27, 26, 23, 0.45);
  --rule:      rgba(27, 26, 23, 0.16);
  --rule-soft: rgba(27, 26, 23, 0.08);

  --green:       oklch(0.52 0.11 150);
  --green-dark:  oklch(0.42 0.09 150);
  --green-light: oklch(0.75 0.13 150);
  --amber:       oklch(0.55 0.13 72);
  --red:         oklch(0.52 0.16 25);

  /* Terminal panes stay dark in both cases: they are a quotation of a machine. */
  --term-bg:     #15161a;
  --term-bar:    #1d1f24;
  --term-line:   #3b3f46;
  --term-ink:    #d7dae0;
  --term-dim:    #8b9099;
  --term-faint:  #6d727a;

  --serif: Newsreader, Georgia, "Times New Roman", serif;
  --sans:  "Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --col: 640px;    /* prose measure */
  --wide: 1240px;  /* full content width */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ───────────────────────────── masthead ───────────────────────────── */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 26px 32px 18px;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 9px; height: 9px;
  background: var(--ink);
  display: inline-block;
}
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-45);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); }

/* ─────────────────────────────── page ─────────────────────────────── */

.page {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 32px 90px;
}

.title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 46px;
  line-height: 1.12;
  letter-spacing: -0.005em;
  max-width: 30ch;
  margin: 58px 0 0;
}
.byline {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin: 26px 0 22px;
}

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 27px;
  letter-spacing: -0.005em;
  margin: 62px 0 14px;
  scroll-margin-top: 20px;
}

.prose { max-width: var(--col); }
.prose p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink);
  margin: 0 0 18px;
}
.prose em { font-style: italic; }
.prose strong { font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--ink-70);
}

/* Key numbers get the serif-italic treatment the reference gives its headline stats. */
.stat, .stat-bad {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.04em;
}
.stat { color: var(--green); }
.stat-bad { color: var(--amber); }

.equation {
  max-width: var(--col);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-70);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 16px 20px;
  margin: 0 0 20px;
  overflow-x: auto;
  white-space: nowrap;
}
.equation sub { font-size: 0.75em; }

/* ──────────────────────────── demo block ──────────────────────────── */

.demo { margin: 34px 0 12px; }

.demo-input {
  background: var(--surface);
  border: 1px solid var(--rule);
  margin-bottom: 14px;
}
/* Roomy like the reference: the prompt is the subject of the card, not a form field.
   But it must still read as typeable -- a borderless serif line next to a button was
   being mistaken for static text, so the underline is always faintly present and
   strengthens on hover and focus. */
.input-row {
  display: flex;
  align-items: baseline;
  gap: 13px;
  padding: 26px 26px 8px;
}
.sigil { color: var(--green); font-family: var(--mono); font-size: 15px; }
#prompt {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: none;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  padding: 0 0 7px;
  caret-color: var(--green);
  transition: border-color 140ms ease;
}
#prompt::placeholder { color: var(--ink-45); font-style: italic; }
#prompt:hover { border-bottom-color: var(--ink-45); }
#prompt:focus { outline: none; border-bottom-color: var(--green); }

.input-hint {
  margin: 0;
  padding: 0 26px 20px 52px;
  font-size: 12px;
  color: var(--ink-45);
  min-height: 34px;
}
.input-hint em { font-style: italic; color: var(--ink-55); }

.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule-soft);
  padding: 14px 26px 16px;
}
.knobs {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule-soft);
  padding: 13px 26px;
}
.knob { display: flex; align-items: center; gap: 8px; }
.knob > span {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-45);
}
/* The readout sits left of its slider in a flex row, so a value whose width
   changes mid-drag would shove the track sideways and slide the thumb out from
   under the cursor. Fixed box + tabular figures: the row never reflows. */
.knob > span b {
  color: var(--green);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 2.9em;
  text-align: right;
}
.knob input[type="number"] {
  width: 52px;
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: center;
  padding: 4px 2px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
}
/* Flatten the native control so it sits in the same visual register as .btn. */
.knob select {
  appearance: none;
  font-family: var(--sans);
  font-size: 12px;
  padding: 5px 24px 5px 8px;
  color: var(--ink);
  background: var(--bg) no-repeat right 8px center;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-45) 50%),
                    linear-gradient(135deg, var(--ink-45) 50%, transparent 50%);
  background-size: 4px 4px, 4px 4px;
  background-position: right 12px center, right 8px center;
  border: 1px solid var(--rule);
  border-radius: 0;
}
/* 61 detents (0-30 by 0.5) need room: at 96px each step was 1.6px, so the thumb
   quantised visibly under a smooth drag. 152px gives it 2.5px to move. */
.knob input[type="range"] {
  width: 152px;
  accent-color: var(--green);
  cursor: pointer;
  touch-action: none; /* let a drag be a drag, not a page scroll */
}
.knob input:focus, .knob select:focus { outline: 1px solid var(--green); }

.actions { display: flex; align-items: center; gap: 10px; }
.btn {
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 8px 15px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn-solid {
  background: var(--ink);
  color: #fdfdfb;
  border-color: var(--ink);
  font-weight: 500;
}
.btn-solid:hover { background: #000; }
.btn:disabled { opacity: 0.45; cursor: progress; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--ink-55);
  border: 1px solid var(--rule);
  padding: 5px 10px;
}
.chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
}
.chip.ready::before { background: var(--green); }

/* ───────────────────────── terminal panes ─────────────────────────── */

.term {
  background: var(--term-bg);
  border: 1px solid var(--term-line);
  overflow: hidden;
}
.term-wide { margin-bottom: 14px; }
.term-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .term-pair { grid-template-columns: 1fr; } }

.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--term-bar);
  border-bottom: 1px solid var(--term-line);
  padding: 8px 12px;
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #3b3f46; }
.term-title {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--term-dim);
}
.term-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--term-faint);
  min-width: 76px;
  text-align: right;
}
.term-state.live { color: var(--green-light); }

.term-body { padding: 16px 18px 18px; }
/* Fixed heights so the panes hold their shape from idle through streaming, rather
   than reflowing the page under the reader as text arrives. */
.term-wide .term-body { min-height: 268px; }
.term-pair .term-body { min-height: 208px; }

.term-meta {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--term-faint);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.term-meta b {
  color: var(--term-ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.term-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--term-faint);
  margin: 10px 0 0;
  min-height: 16px;
}

/* the token canvas: every slot exists from step one */
.token-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 96px;
  align-content: flex-start;
}
.tok {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.3;
  padding: 2px 4px;
  background: #1e2026;
  color: var(--term-dim);
  border-left: 2px solid transparent;
  white-space: pre;
  transition: background-color 420ms ease, color 420ms ease;
}
/* pieces carrying the ▁ marker — exactly what the constraint counts */
.tok.ws { border-left-color: var(--green); color: var(--term-ink); }
.tok.blank { background: transparent; color: #2f333a; }
.tok.changed {
  background: var(--green-dark);
  color: #eef3ef;
  transition: none;
}

.term-out { border-top: 1px solid var(--term-line); margin-top: 14px; padding-top: 13px; }
.out-text {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  color: var(--term-ink);
  margin: 0;
  min-height: 3.1em;
}
.waiting { color: var(--term-faint); }
.cursor {
  display: inline-block;
  width: 7px; height: 1em;
  vertical-align: -2px;
  background: var(--green-light);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.verdict { margin: 12px 0 0; min-height: 22px; }
.badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid;
}
.badge.hit  { color: var(--green-light); border-color: var(--green); }
.badge.miss { color: #e0a08a; border-color: #6b4a3e; }
.elapsed {
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--term-faint);
}

/* ───────────────────────────── figures ────────────────────────────── */

.figure { margin: 40px 0 8px; max-width: 900px; }
.fig-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin-bottom: 14px;
}
.figure > figcaption:last-child {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-55);
  max-width: var(--col);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 14px;
}
.figure > figcaption b { color: var(--ink); font-weight: 600; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid-line { stroke: var(--rule-soft); stroke-width: 1; }
.axis-text { fill: var(--ink-45); font-size: 10px; font-family: var(--sans); }
.series-line { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.target-line { stroke: var(--ink-45); stroke-width: 1; stroke-dasharray: 4 4; }
.callout {
  font-family: var(--serif);
  font-size: 17px;
  fill: var(--green-dark);
}

/* ───────────────────────────── table ──────────────────────────────── */

.datatable {
  border-collapse: collapse;
  width: 100%;
  max-width: 900px;
  margin: 34px 0 0;
  font-family: var(--serif);
  font-size: 15px;
}
.datatable th {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-45);
  text-align: right;
  padding: 0 0 10px 18px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.datatable th:first-child { text-align: left; padding-left: 0; }
.datatable td {
  text-align: right;
  padding: 11px 0 11px 18px;
  border-bottom: 1px solid var(--rule-soft);
  font-variant-numeric: tabular-nums;
  color: var(--ink-70);
  white-space: nowrap;
}
.datatable td:first-child { text-align: left; padding-left: 0; color: var(--ink-55); }
.datatable tr.lead td { color: var(--ink); font-weight: 600; }
.datatable tr.lead td b { color: var(--green-dark); }
.swatch {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 9px;
  vertical-align: 1px;
}
.table-note {
  max-width: var(--col);
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-55);
  margin: 16px 0 0;
}
.table-note em { color: var(--ink); font-style: italic; }

/* ───────────────────────────── footer ─────────────────────────────── */

.site-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  margin-top: 72px;
  padding-top: 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-45);
}
.foot-env { font-family: var(--mono); text-transform: none; letter-spacing: 0; }

.err {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  margin: 12px 0 0;
}

/* The interval sits under the number it qualifies, in the same column. Explicit
   colour and weight so the lead row's emphasis does not inherit down into it. */
.datatable td .ci {
  display: block;
  margin-top: 3px;
  color: var(--ink-45);
  font-size: 12.5px;
  font-weight: 400;
}
.datatable th .th-sub {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-45);
  opacity: 0.75;
}
