/*
 * For licensing see accompanying LICENSE file.
 * Copyright (C) 2026 Apple Inc. All Rights Reserved.
 */

:root {
  --bg: #0d1117; --panel: #161b22; --line: #30363d; --fg: #e6edf3; --dim: #8b949e;
  --ar: #8b949e; --sd: #f85149; --frozen: #58a6ff; --online: #3fb950; --accent: #3fb950;
  --warn: #d29922;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
a { color: var(--frozen); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 24px; }
.prose { max-width: 720px; }
h1 { font-size: 46px; line-height: 1.12; margin: 0 0 14px; letter-spacing: -0.02em; }
h2 { font-size: 30px; margin: 0 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 18px; margin: 0 0 6px; }
p { margin: 0 0 14px; }
.dim { color: var(--dim); }
.kicker { color: var(--accent); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; font-size: 16px; margin-bottom: 6px; }

/* hero */
.hero { padding: 72px 0 40px; }
.hero .sub { font-size: 20px; color: var(--dim); max-width: 760px; }
.hero img { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin-top: 26px; display: block; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat b { display: block; font-size: 32px; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 14px; }

/* sections */
section { padding: 64px 0; border-top: 1px solid var(--line); }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 22px 0; }
.takeaway { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; margin: 18px 0 0; font-weight: 600; }
.note { font-size: 13px; color: var(--dim); margin-top: 10px; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
button, .seg button {
  background: #21262d; color: var(--fg); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover { border-color: var(--dim); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04260f; font-weight: 600; }
button.on { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
.seg { display: inline-flex; gap: 0; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
input[type=range] { accent-color: var(--accent); }
label.slider { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--dim); }

/* charts */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; touch-action: none; }
.chart .axis line, .chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--dim); font-size: 12px; }
.chart .label { fill: var(--dim); font-size: 12px; }
.chart .cursor { stroke: var(--fg); stroke-opacity: .35; stroke-dasharray: 3 3; }
.chart .ghost { stroke-opacity: .13; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--dim); margin: 2px 0 6px; }
.legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.readout div { background: #0d1117; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.readout b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.readout span { font-size: 12px; color: var(--dim); }

/* method simulation */
.sim { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.ctx { font-size: 15px; color: var(--dim); margin-bottom: 10px; }
.ctx .mono { color: var(--fg); }
.paths { display: flex; flex-direction: column; gap: 6px; }
.path { display: grid; grid-template-columns: 74px repeat(4, 1fr) 92px; gap: 6px; align-items: center; }
.path .tag { font-size: 12px; color: var(--dim); }
.tok {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px; text-align: center; white-space: pre;
  padding: 6px 4px; border-radius: 6px; background: #21262d; border: 1px solid var(--line);
  transition: background .35s, border-color .35s, color .35s, opacity .35s;
}
.tok.acc { background: rgba(63,185,80,.18); border-color: var(--online); color: #7ee787; }
.tok.rej { background: rgba(248,81,73,.15); border-color: var(--sd); color: #ffa198; }
.tok.after { opacity: .35; }
.bar { height: 10px; border-radius: 5px; background: #21262d; position: relative; overflow: hidden; }
.bar > i { position: absolute; top: 0; bottom: 0; left: 50%; transition: all .4s; border-radius: 5px; }
.rw { font-size: 12px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.steps { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.steps button.done { border-color: var(--online); }
.explain { min-height: 78px; font-size: 15px; background: #0d1117; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.slot { margin-bottom: 10px; }
.slot .name { font-size: 12px; color: var(--dim); margin-bottom: 3px; }
.cand { display: grid; grid-template-columns: 64px 1fr 40px; gap: 6px; align-items: center; font-size: 12px; margin: 2px 0; }
.cand .bar > i { left: 0; background: #484f58; }
.cand.correct .bar > i { background: var(--online); }
.cand .p { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }

/* drift viz */
.dist { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.dist div { flex: 1; border-radius: 3px 3px 0 0; transition: height .25s; }
.prefix { display: flex; gap: 4px; margin-top: 6px; }
.prefix div { flex: 1; height: 22px; border-radius: 4px; border: 1px solid var(--line); background: #21262d; position: relative; overflow: hidden; }
.prefix div i { position: absolute; inset: 0; transition: width .25s; }

footer { padding: 50px 0 80px; border-top: 1px solid var(--line); color: var(--dim); font-size: 15px; }
pre.cmd { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; color: var(--fg); }

@media (max-width: 760px) {
  h1 { font-size: 34px; } .stats, .readout { grid-template-columns: repeat(2, 1fr); }
  .grid2, .grid3, .sim { grid-template-columns: 1fr; }
}

/* joint-marginal reels */
.reelrow { display: grid; grid-template-columns: 190px 150px 70px 150px 1fr; gap: 10px; align-items: center; margin: 12px 0; }
.reellabel b { display: block; } .reellabel span { font-size: 13px; color: var(--dim); }
.reel { height: 54px; line-height: 54px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: #0d1117;
  font: 600 19px ui-monospace, Menlo, monospace; transition: border-color .2s, color .2s; }
.reel.spin { color: var(--dim); border-color: #d29922; }
.reel.ok { border-color: var(--online); color: #7ee787; } .reel.bad { border-color: var(--sd); color: #ffa198; }
.reelarrow { text-align: center; color: var(--dim); font-size: 13px; }
.verdict { font-weight: 600; font-size: 15px; } .verdict.acc { color: #7ee787; } .verdict.rej { color: #ffa198; }
@media (max-width: 760px) { .reelrow { grid-template-columns: 1fr 1fr; } .reellabel, .verdict { grid-column: span 2; } .reelarrow { display: none; } }

/* segmented control: keep the highlighted button's border on top of its neighbours */
.seg button { position: relative; }
.seg button:hover { z-index: 1; }
.seg button.on { z-index: 2; }

/* one column for everything: same side padding, text as wide as the boxes */
.wrap { max-width: 900px; margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }
.hero, section, footer { padding-left: 24px; padding-right: 24px; }
.prose { max-width: none; }
.takeaway.prose { max-width: none; }

/* centred hero */
.hero { text-align: center; }
.hero .sub { margin-left: auto; margin-right: auto; }
.hero .stat { text-align: left; }
