/* What Does Intelligence Cost? — the price of AI held to a fixed bar.
 *
 * Shares the paper, type and sidebar of the other AI timelines. Two hues
 * carry the argument: the accent for a held bar (the models that clear it and
 * the cheapest so far), ink for the frontier (the best model yet). Everything
 * else is grey, so the page still reads in grayscale.
 */
:root {
  --paper: #f5f3ec;
  --card: #fbfaf6;
  --ink: #1c1b18;
  --ink-2: #4f4c45;
  --ink-3: #847f74;
  --rule: #dad5c9;
  --rule-soft: #e8e4d9;
  --accent: #a64f2a;
  --bar: #c2541f;
  --task: #2f6f9a;
  --wash: rgba(28, 27, 24, 0.045);

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --side-w: 336px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-padding-top: calc(var(--appnav-h, 0px) + 24px); }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  max-width: 1720px;
  margin: 0 auto;
}

.side {
  position: sticky;
  top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px));
  height: calc(100dvh - var(--appnav-h, 0px));
  border-right: 1px solid var(--rule-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.side-inner { padding: 1.3rem 1.2rem 1.6rem 1.35rem; }

.kicker {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wordmark {
  margin-top: 0.3rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.5rem;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.wordmark em { font-style: italic; color: var(--accent); }
.lede { margin-top: 0.7rem; font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); }
.lede strong { color: var(--ink); font-weight: 600; }

.side-h {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.seg { display: flex; margin-top: 1rem; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; font-size: 0.74rem; font-weight: 500; padding: 0.3rem 0.5rem; border: 0; background: var(--card); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--wash); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- the bars: picker and table at once ---------- */

.bars { margin-top: 1.1rem; }
.bar-list { margin-top: 0.35rem; display: grid; }
.bar-group {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0.45rem 0 0.15rem;
  display: flex;
  justify-content: space-between;
}
.bar-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--rule-soft);
  background: none;
  padding: 0.32rem 0.4rem;
  margin: 0 -0.4rem;
  width: calc(100% + 0.8rem);
  border-radius: 4px;
  cursor: pointer;
}
.bar-btn:hover { background: var(--wash); }
.bar-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-top-color: transparent; }
.bar-btn[aria-pressed="true"] + .bar-btn { border-top-color: transparent; }
.bar-btn[aria-pressed="true"] .b-sub, .bar-btn[aria-pressed="true"] .b-rate { color: #cfcabe; }
.b-name { font-size: 0.8rem; font-weight: 500; line-height: 1.25; }
.b-sub { display: block; font-size: 0.66rem; color: var(--ink-3); font-weight: 400; }
.b-fold, .b-rate { font-family: var(--mono); font-size: 0.72rem; text-align: right; white-space: nowrap; }
.b-fold { font-weight: 600; font-size: 0.8rem; }
.b-rate { color: var(--ink-2); min-width: 3.6rem; }
.bar-btn.custom .b-name { font-style: italic; }
.hint { margin-top: 0.45rem; font-size: 0.7rem; line-height: 1.45; color: var(--ink-3); }

.readout { margin-top: 1.1rem; }
#readout { margin-top: 0.3rem; font-size: 0.8rem; line-height: 1.5; color: var(--ink-2); }
#readout .ro-big { font-family: var(--serif); font-size: 1.9rem; line-height: 1; color: var(--ink); }
#readout .ro-big em { font-style: italic; color: var(--bar); }
#readout .ro-row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0.4rem; padding: 0.22rem 0; border-top: 1px solid var(--rule-soft); }
#readout .ro-row:first-of-type { margin-top: 0.5rem; }
#readout .ro-k { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding-top: 0.15rem; }
#readout b { color: var(--ink); font-weight: 600; }
#readout .mono { font-family: var(--mono); font-size: 0.74rem; }
#readout p + p { margin-top: 0.4rem; }

.key {
  list-style: none;
  display: grid;
  gap: 0.25rem;
  margin-top: 1.1rem;
  font-size: 0.72rem;
  color: var(--ink-2);
}
.key li { display: flex; align-items: center; gap: 0.45rem; }
.key svg { width: 22px; height: 12px; flex: none; overflow: visible; }
.side-foot { margin-top: 1rem; font-size: 0.78rem; color: var(--ink-3); }

/* ---------- chart ---------- */

.chart-main {
  height: calc(100vh - var(--appnav-h, 0px));
  height: calc(100dvh - var(--appnav-h, 0px));
  position: sticky;
  top: var(--appnav-h, 0px);
  padding: 0.6rem 0.8rem 0.4rem 0.4rem;
}
.chart { width: 100%; height: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }

.grid { stroke: var(--rule-soft); stroke-width: 1; }
.grid.major { stroke: var(--rule); }
.tick { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-3); }
.axis-t { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-2); letter-spacing: 0.04em; }

.dot { fill: #b6b1a5; fill-opacity: 0.55; stroke: var(--paper); stroke-width: 0.8; cursor: pointer; }
.dot.on { fill: var(--bar); fill-opacity: 0.38; }
.dot.anchor { fill: var(--paper); fill-opacity: 1; stroke: var(--bar); stroke-width: 2.4; }
.dot.step { fill: var(--bar); fill-opacity: 1; stroke: var(--paper); stroke-width: 1.4; }
.dot.front { fill: var(--ink); fill-opacity: 1; stroke: var(--paper); stroke-width: 1.4; }
.dot.dim { fill-opacity: 0.22; }
.dot:hover, .dot.hl { stroke: var(--ink); stroke-width: 2; }
.task .dot { fill: #9fb6c6; fill-opacity: 0.7; }
.task .dot.step { fill: var(--task); fill-opacity: 1; }
.task .dot.front { fill: var(--ink); }

.stair { fill: none; stroke: var(--bar); stroke-width: 2.4; stroke-linejoin: round; }
.stair-ghost { fill: none; stroke: var(--bar); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.7; }
.task .stair { stroke: var(--task); }
.front-line { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.cut { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 2; }
.bar-rule { stroke: var(--bar); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.8; }

.lbl { font-family: var(--sans); font-size: 11.5px; fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 3.5px; stroke-linejoin: round; }
.lbl b, .lbl .b { font-weight: 600; fill: var(--ink); }
.lbl.bar-l { fill: var(--bar); }
.lbl.bar-l .b { fill: var(--bar); }
.lbl.task-l .b { fill: var(--task); }
.lbl.mono { font-family: var(--mono); font-size: 10.5px; }
.big-fold { font-family: var(--serif); font-size: 44px; fill: var(--bar); paint-order: stroke; stroke: var(--paper); stroke-width: 6px; }
.big-sub { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-2); letter-spacing: 0.04em; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }

/* ---------- reading ---------- */

.reading, .sources {
  max-width: 1720px;
  margin: 0 auto;
  padding: 3rem 1.6rem 1rem calc(var(--side-w) + 1.4rem);
}
.reading h2, .sources h2 { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; line-height: 1; }
.reading h2 em, .sources h2 em { font-style: italic; color: var(--accent); }
.reading-lede, .sources-lede { margin-top: 0.6rem; max-width: 72ch; color: var(--ink-2); font-size: 0.95rem; }
.findings {
  list-style: none;
  counter-reset: f;
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 1rem 1.6rem;
}
.findings li { counter-increment: f; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
.findings h3 { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.findings h3::before {
  content: counter(f, decimal-leading-zero);
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 0.2rem;
}
.findings p { margin-top: 0.4rem; font-size: 0.875rem; line-height: 1.6; }
.caveats .findings h3::before { content: none; }
.caveats .findings li { counter-increment: none; }

.tbl-scroll { overflow-x: auto; margin-top: 1.4rem; }
.ftable { border-collapse: collapse; font-size: 0.8rem; min-width: 40rem; width: 100%; max-width: 64rem; }
.ftable th, .ftable td { text-align: left; padding: 0.3rem 0.9rem 0.3rem 0; border-bottom: 1px solid var(--rule-soft); vertical-align: baseline; }
.ftable thead th { font-weight: 600; font-size: 0.76rem; white-space: nowrap; border-bottom-color: var(--rule); }
.ftable tbody th { font-weight: 500; }
.ftable td { font-family: var(--mono); font-size: 0.74rem; white-space: nowrap; }
.ftable td.num { text-align: right; }
.ftable a { color: var(--ink); text-decoration-color: var(--rule); }
.ftable .sub { color: var(--ink-3); font-size: 0.68rem; }

.source-list { margin-top: 0.8rem; columns: 2 26rem; column-gap: 2rem; font-size: 0.8rem; line-height: 1.45; color: var(--ink-2); padding-left: 1.4rem; }
.source-list li { break-inside: avoid; margin-bottom: 0.45rem; }
.source-list a { color: var(--ink); text-decoration-color: var(--rule); }
.source-list .pub { color: var(--ink-3); }

.colophon {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1.6rem 1.6rem 3rem calc(var(--side-w) + 1.4rem);
  font-size: 0.76rem;
  color: var(--ink-3);
  line-height: 1.6;
}

/* ---------- tooltip ---------- */

.tip {
  position: fixed;
  z-index: 4000;
  max-width: 19rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 7px;
  padding: 0.55rem 0.7rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.45;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.tip b { font-weight: 600; }
.tip .tip-k { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: #bdb8ac; margin-bottom: 0.15rem; }
.tip .tip-g { display: grid; grid-template-columns: auto 1fr; gap: 0 0.7rem; margin-top: 0.3rem; font-family: var(--mono); font-size: 0.68rem; color: #dcd8cd; }
.tip .tip-g span:nth-child(odd) { color: #a9a497; }
.tip .tip-why { margin-top: 0.35rem; color: #bdb8ac; font-size: 0.7rem; }

/* ---------- medium screens: the sidebar moves above ---------- */

@media (max-width: 1099px) {
  :root { --side-w: 0px; }
  .layout { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule-soft); overflow: visible; }
  .side-inner {
    max-width: 66rem;
    padding: 1.4rem 1.2rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 2.2rem;
    align-items: start;
  }
  .side-inner > .kicker, .side-inner > .wordmark, .side-inner > .lede, .side-inner > .seg { grid-column: 1; }
  .side-inner > .bars { grid-column: 2; grid-row: 1 / span 5; margin-top: 0; }
  .side-inner > .readout, .side-inner > .key, .side-inner > .side-foot { grid-column: 1; }
  .chart-main { position: static; height: 72vh; min-height: 440px; padding: 0.6rem 0.6rem 0.4rem 0; }
  .reading, .sources, .colophon { padding-left: 1.6rem; }
}
@media (max-width: 720px) {
  .side-inner { display: block; }
  .side-inner > .bars { margin-top: 1.1rem; }
  .chart-main { height: 78vh; min-height: 420px; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .side-inner { padding: 1.2rem 1rem; }
  .wordmark { font-size: 2.2rem; }
  .reading, .sources, .colophon { padding-left: 1rem; padding-right: 1rem; }
  .findings { grid-template-columns: 1fr; }
  .big-fold { font-size: 34px; }
}
