/* inference-atlas. Tokens and rules: DESIGN.md. */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #F5F5F4;
  --surface: #FFFFFF;
  --ink: #1C1B19;
  --muted: #6B6A66;
  --hairline: #E4E2DE;
  --coral: #E8735A;
  --coral-ink: #B8472F;
  --code-bg: #1C1B19;
  --weights: #CFCCC6;
  --ink-hover: #3A3935;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  caret-color: var(--coral-ink);
}
/* rgb() lines are fallbacks for browsers without color-mix() (Safari < 16.4). */
::selection { background: rgb(232 115 90 / 25%); background: color-mix(in srgb, var(--coral) 25%, transparent); }
:focus-visible { outline: 2px solid var(--coral-ink); outline-offset: 2px; }

a { color: var(--coral-ink); text-decoration: underline; text-underline-offset: 3px; }
a:visited { color: var(--muted); }
code, pre, output, .num { font-family: var(--mono); }
.num, output, td, .verdict, .stats, .hint, .kv-legend { font-variant-numeric: tabular-nums; }

h1, h2, h3, .verdict { text-wrap: balance; }
h1, h2 { margin: 48px 0 12px; font-size: 20px; line-height: 1.3; font-weight: 600; }
h3 { margin: 32px 0 8px; font-size: 16px; line-height: 1.3; font-weight: 600; }
p { margin: 0 0 12px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 14px; margin: 4px 0 0; min-height: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: 16px; top: -48px; }
.skip:focus { top: 8px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header: wordmark, GitHub link, the one hero illustration */
.site { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 8px 16px; padding-top: 24px; }
.brand { margin: 0; font-size: inherit; line-height: inherit; }
.wordmark { font-size: 20px; font-weight: 600; color: var(--ink); text-decoration: none; }
.wordmark:visited { color: var(--ink); }
.tagline { margin: 4px 0 0; color: var(--muted); }
.gh { font-size: 14px; padding: 12px 0; }
.hero { grid-column: 1 / -1; width: 100%; height: auto; max-height: 280px; object-fit: contain; }
.hero-phone { display: none; }

/* Controls: 4 in a row, 2 columns from 640 to 1023, 2x2 on phones */
.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input, select, button { font: inherit; color: var(--ink); }
input[type='text'], input[type='number'], input:not([type]), select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px;
  transition: border-color 150ms;
}
input:hover, select:hover { border-color: var(--muted); }
input:disabled { color: var(--muted); }

.segmented { display: flex; border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); overflow: hidden; }
.segmented button {
  flex: 1; min-height: 44px; border: 0; background: transparent; cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.segmented button + button { border-left: 1px solid var(--hairline); }
.segmented button[aria-pressed='true'] { background: var(--ink); color: var(--surface); }
.segmented button:focus-visible { outline-offset: -3px; }

/* Notices */
.notice { font-size: 14px; margin: 16px 0 0; }
.notice.error, .slo { color: var(--coral-ink); font-weight: 600; }
.notice button { margin-left: 8px; }

/* Verdict */
.eyebrow { margin-top: 32px; font-size: 14px; color: var(--muted); font-weight: 400; }
.verdict { font-size: 40px; line-height: 1.15; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
.verdict.long { font-size: 24px; line-height: 1.3; }
.stats { font-size: 16px; margin-bottom: 4px; }
.estimate { font-size: 14px; color: var(--muted); }
.skeleton { display: block; height: 0.9em; width: 70%; background: var(--hairline); }

details > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; }
/* The marker is decoration: the empty alt text keeps screen readers from naming the glyph. */
details > summary::before { content: '▸'; content: '▸' / ''; font-size: 0.9em; line-height: 1; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary::-webkit-details-marker { display: none; }
details > summary { list-style: none; }
details > summary h2 { display: inline; margin: 0; }
.tune, .how { margin-top: 32px; }
.explain { font-size: 14px; margin-bottom: 16px; }
.explain summary { color: var(--coral-ink); text-decoration: underline; text-underline-offset: 3px; }
.explain dl { margin: 12px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.explain dt { font-weight: 600; }
.explain dd { margin: 0; }

/* Break-even chart */
.chart { margin: 16px 0 0; }
.chart figcaption { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.chart-box { height: 320px; touch-action: pan-y; }
.chart-box svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-box text { font: 12px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-box .axis { stroke: var(--hairline); stroke-width: 1; }
.chart-box .api { fill: none; stroke: var(--coral-ink); stroke-width: 2; stroke-dasharray: 6 4; }
.chart-box .self { fill: none; stroke: var(--coral-ink); stroke-width: 2; }
.chart-box .self-area { fill: var(--coral); opacity: 0.12; }
.chart-box .cross { fill: var(--coral); stroke: var(--surface); stroke-width: 2; }
.chart-box .you { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-box .probe { stroke: var(--ink); stroke-width: 1; }
.chart-box text.label { fill: var(--ink); font-weight: 600; }
.readout { font-size: 14px; min-height: 24px; margin: 8px 0 0; }

hr { border: 0; border-top: 1px solid var(--hairline); margin: 48px 0 0; }

/* Command card: the only card, the only shadow */
.command-card {
  background: var(--surface); border-radius: 12px; padding: 16px;
  box-shadow: 0 2px 8px rgba(28, 27, 25, .08);
}
.command-card pre {
  margin: 0; padding: 16px; border-radius: 8px; background: var(--code-bg); color: var(--surface);
  font-size: 14px; line-height: 1.6; overflow-x: auto; white-space: pre;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  min-height: 44px; padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  transition: background-color 150ms, color 150ms;
}
.btn.secondary { background: var(--surface); color: var(--ink); }
.btn:hover { background: var(--ink-hover); color: var(--surface); }

/* KV sim */
.kvbar {
  position: relative; display: flex; height: 48px; margin: 16px 0 8px;
  border: 1px solid var(--hairline); background: var(--surface); overflow: hidden;
}
.kv-weights {
  flex: none; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap;
  background: var(--weights); color: var(--ink); font-size: 14px;
}
.kv-users { position: relative; flex: none; display: flex; gap: 1px; padding-left: 1px; }
.kv-users .u { flex: 1 1 0; min-width: 0; background: var(--coral); }
.kv-users .u.pages {
  background-image: linear-gradient(to right, transparent calc(100% - 1px), rgb(255 255 255 / 55%) 0);
  background-image: linear-gradient(to right, transparent calc(100% - 1px), color-mix(in srgb, var(--surface) 55%, transparent) 0);
}
.kv-users .u.dense, .kv-users.dense {
  background-color: var(--coral);
  background-image: repeating-linear-gradient(90deg, transparent 0 3px, rgb(255 255 255 / 30%) 3px 4px);
  background-image: repeating-linear-gradient(90deg, transparent 0 3px, color-mix(in srgb, var(--surface) 30%, transparent) 3px 4px);
}
.kv-cover {
  position: absolute; inset: 0; background: var(--surface);
  transform-origin: right center; transform: scaleX(1);
  transition: transform 2.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.played .kv-cover { transform: scaleX(0); }
.kv-legend { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.kv-legend strong { color: var(--ink); }
.kv-legend.pending { visibility: hidden; }
.slider { display: block; font-size: 14px; font-weight: 600; margin-top: 16px; }
input[type='range'] { width: 100%; min-height: 44px; accent-color: var(--coral-ink); }

/* Tune assumptions */
.tune-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-top: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; margin-top: 12px; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hairline); }
th { font-weight: 600; }
.how { margin-top: 16px; }
.how li { margin-bottom: 8px; }

footer { margin: 64px 0 32px; padding-top: 16px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--muted); }

@media (max-width: 1023px) {
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { height: 260px; }
}
@media (max-width: 639px) {
  .verdict { font-size: 28px; }
  .verdict.long { font-size: 20px; }
  .chart-box { height: 200px; }
  .controls { gap: 12px; }
  .tune-grid { grid-template-columns: 1fr; }
  .hero-top { display: none; }
  .hero-phone { display: block; max-height: 200px; margin-top: 32px; }
  .explain dl { grid-template-columns: 1fr; gap: 0 0; }
  .explain dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .kv-cover { display: none; }
}
