/* ---------- Theme tokens ---------- */
:root {
  --bg: #0F0F0F;
  --panel: #171717;
  --shell: rgba(31, 31, 31, 0.6);
  --surface: #1F1F1F;
  --divider: rgba(255, 255, 255, 0.06);
  --shadow: inset 0 1px 0 0 #ffffff08, inset 0 0 0 1px #ffffff08, 0 0 0 1px #0000001a, 0 2px 2px 0 #0000001a, 0 4px 4px 0 #0000001a, 0 8px 8px 0 #0000001a;
  --line: rgba(255, 255, 255, 0.045);
  --mark: rgba(255, 255, 255, 0.40);
  --dash: rgba(255, 255, 255, 0.08);
  --text: #EDEDED;
  --muted: #929292;
  --btnBg: #EDEDED;
  --btnText: #0F0F0F;
  --ring: rgba(255, 255, 255, 0.14);
  --artWin: #161616;
  --artBar: #1E1E1E;
  --artDot: #2C2C2C;
  --artLine: #242424;
  --artHead: #333333;
  --artEdge: rgba(255, 255, 255, 0.06);
  --artOpacity: 0.6;
  --bubble: rgba(255, 255, 255, 0.03);
  --bubbleHi: rgba(255, 255, 255, 0.07);

  --font-sans: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --wrap: 1180px;

  color-scheme: dark;
}

/* Light tokens: applied for an explicit light choice, or "system" on a light OS */
:root[data-theme=light] {
  --bg: #F5F4F0;
  --panel: #FFFFFF;
  --shell: rgba(29, 32, 38, 0.035);
  --surface: #FFFFFF;
  --divider: rgba(29, 32, 38, 0.08);
  --shadow: 0px 0px 0px 1px #0000000f, 0px 1px 2px -1px #0000000f, 0px 2px 4px 0px #0000000a;
  --line: rgba(29, 32, 38, 0.055);
  --mark: rgba(29, 32, 38, 0.45);
  --dash: rgba(29, 32, 38, 0.09);
  --text: #1D2026;
  --muted: #5E636B;
  --btnBg: #2B2F36;
  --btnText: #F5F4F0;
  --ring: rgba(29, 32, 38, 0.16);
  --artWin: #FFFFFF;
  --artBar: #ECEAE4;
  --artDot: #D3CFC6;
  --artLine: #E4E1DA;
  --artHead: #2B2F36;
  --artEdge: rgba(29, 32, 38, 0.08);
  --artOpacity: 0.9;
  --bubble: rgba(29, 32, 38, 0.025);
  --bubbleHi: rgba(29, 32, 38, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root[data-theme=system] {
    --bg: #F5F4F0;
    --panel: #FFFFFF;
    --shell: rgba(29, 32, 38, 0.035);
    --surface: #FFFFFF;
    --divider: rgba(29, 32, 38, 0.08);
    --shadow: 0px 0px 0px 1px #0000000f, 0px 1px 2px -1px #0000000f, 0px 2px 4px 0px #0000000a;
    --line: rgba(29, 32, 38, 0.055);
    --mark: rgba(29, 32, 38, 0.45);
    --dash: rgba(29, 32, 38, 0.09);
    --text: #1D2026;
    --muted: #5E636B;
    --btnBg: #2B2F36;
    --btnText: #F5F4F0;
    --ring: rgba(29, 32, 38, 0.16);
    --artWin: #FFFFFF;
    --artBar: #ECEAE4;
    --artDot: #D3CFC6;
    --artLine: #E4E1DA;
    --artHead: #2B2F36;
    --artEdge: rgba(29, 32, 38, 0.08);
    --artOpacity: 0.9;
    --bubble: rgba(29, 32, 38, 0.025);
    --bubbleHi: rgba(29, 32, 38, 0.06);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
html, body { background: var(--bg); }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.85; }
a, button { transition: transform 120ms ease-out; }
a:active, button:active { transform: scale(0.97); }
a:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a, button { transition: none; }
  a:active, button:active { transform: none; }
}

.page { min-height: 100vh; }
.mono { font-family: var(--font-mono); }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  padding: 8px 12px; border-radius: 6px;
  background: var(--btnBg); color: var(--btnText); font-size: 14px;
}
.skip:focus { top: 12px; }

/* Bordered centre column shared by every band */
.wrap {
  position: relative;
  max-width: var(--wrap);
  margin: 0 auto;
  box-sizing: border-box;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 20px; height: 20px; display: block; }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center;
  height: 44px; padding: 0 20px; border-radius: 6px;
  font-size: 15px; font-weight: 500;
}
.btn-primary { background: var(--btnBg); color: var(--btnText); }
.btn-secondary { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px dashed var(--dash); }
.hdr {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 6px clamp(20px, 4vw, 32px);
}
.hdr .brand { justify-self: start; }
.hdr-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px;
  font-size: 14px; color: var(--muted);
}
.hdr-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.hdr-signin { font-size: 14px; padding: 9px 12px; color: var(--text); }
.hdr-cta {
  font-size: 14px; font-weight: 500; padding: 8px 15px; border-radius: 6px;
  background: var(--btnBg); color: var(--btnText);
}
@media (max-width: 760px) {
  .hdr { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .hdr-nav { order: 3; width: 100%; justify-content: center; }
}

/* ---------- Hero ---------- */
.band { border-bottom: 1px solid var(--line); }
.hero {
  min-height: clamp(560px, calc(100vh - 170px), 880px);
  padding: clamp(64px, 9vw, 112px) clamp(20px, 4vw, 40px) clamp(56px, 7vw, 88px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 28px;
}
.eyebrow {
  margin: 0; display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px; border-radius: 8px;
  background: var(--surface); box-shadow: var(--shadow);
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
}
.eyebrow svg { width: 14px; height: 14px; display: block; }
.hero h1 {
  margin: 0; max-width: 760px;
  font-size: clamp(32px, 4.6vw, 56px); line-height: 1.05; font-weight: 500;
  letter-spacing: -0.04em; text-wrap: balance;
}
.hero-lede {
  margin: 0; max-width: 620px;
  font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; color: var(--muted); text-wrap: pretty;
}
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hero-note { margin: -12px 0 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ---------- How it works ---------- */
.hw { display: grid; grid-template-columns: 1fr 1fr; scroll-margin-top: 16px; }
.hw-copy {
  padding: clamp(48px, 7vw, 96px) clamp(20px, 4vw, 56px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 64px;
}
.hw-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.kicker { margin: 0; font-size: 13px; font-weight: 500; }
.hw h2 {
  margin: 0; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; font-weight: 500;
  letter-spacing: -0.035em;
}
.hw h2 span { display: block; }
.hw h2 .dim { color: var(--muted); }
.hw-body {
  margin: 0; max-width: 440px; font-size: 16px; line-height: 1.6; color: var(--muted); text-wrap: pretty;
}
.hw-intro .btn { margin-top: 4px; }

/* Tabs: radio inputs drive the active label and panel, no JS needed */
.hw-switch { position: relative; }
.hw-r { position: absolute; opacity: 0; pointer-events: none; }
.hw-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--divider); }
.hw-tabs label {
  position: relative; padding: 0 0 14px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: color 150ms ease-out;
}
.hw-tabs label:hover { color: var(--text); }
.hw-tabs label::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--text); opacity: 0; transition: opacity 150ms ease-out;
}
#hw1:checked ~ .hw-tabs label[for=hw1],
#hw2:checked ~ .hw-tabs label[for=hw2],
#hw3:checked ~ .hw-tabs label[for=hw3] { color: var(--text); }
#hw1:checked ~ .hw-tabs label[for=hw1]::after,
#hw2:checked ~ .hw-tabs label[for=hw2]::after,
#hw3:checked ~ .hw-tabs label[for=hw3]::after { opacity: 1; }
#hw1:focus-visible ~ .hw-tabs label[for=hw1],
#hw2:focus-visible ~ .hw-tabs label[for=hw2],
#hw3:focus-visible ~ .hw-tabs label[for=hw3] { outline: 2px solid var(--muted); outline-offset: 4px; border-radius: 2px; }
.hw-panels { padding-top: 24px; min-height: 104px; }
.hw-p {
  display: none; margin: 0; max-width: 440px;
  font-size: 16px; line-height: 1.6; color: var(--muted); text-wrap: pretty;
}
.hw-p strong { color: var(--text); font-weight: 500; }
#hw1:checked ~ .hw-panels .p1,
#hw2:checked ~ .hw-panels .p2,
#hw3:checked ~ .hw-panels .p3 { display: block; }

/* Illustration column */
.hw-art {
  position: relative; overflow: hidden; min-height: 680px; box-sizing: border-box;
  padding: clamp(40px, 5vw, 64px) clamp(20px, 4vw, 40px);
  border-left: 1px dashed var(--dash);
}
.hw-art-bg {
  position: absolute; left: -8%; bottom: -1%; width: 116%; height: auto; display: block;
  opacity: var(--artOpacity);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
}
.art-win { fill: var(--artWin); stroke: var(--artEdge); }
.art-bar { fill: var(--artBar); }
.art-dot { fill: var(--artDot); }
.art-head { fill: var(--artHead); }
.art-line { fill: var(--artLine); }
.art-halo { fill: var(--bg); stroke: var(--bg); }
.hw-art-caption {
  position: relative; z-index: 1; margin: 0;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.8; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); opacity: 0.75;
}
@media (max-width: 900px) {
  .hw { grid-template-columns: 1fr; }
  .hw-art { border-left: 0; border-top: 1px dashed var(--dash); }
}

/* Agent trace card */
.trace { position: relative; z-index: 1; max-width: 420px; margin: 40px auto 0; }
.trace-shell {
  position: relative; padding: 8px; border-radius: 20px;
  background: var(--shell); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.trace-card { border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.trace-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--divider); font-size: 13px;
}
.trace-agent { display: inline-flex; align-items: center; gap: 8px; }
.trace-dot { width: 8px; height: 8px; border-radius: 50%; background: #2150D9; }
.trace-name { font-weight: 500; }
.trace-via { color: var(--muted); }
.trace-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.trace-body { display: flex; flex-direction: column; gap: 8px; padding: 16px; margin: 0; list-style: none; }
.trace-req {
  align-self: flex-start; display: inline-flex; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--bubble); box-shadow: inset 0 0 0 1px var(--divider);
  font-family: var(--font-mono); font-size: 13px;
}
.trace-req span { color: var(--muted); }
.trace-answer {
  align-self: flex-end; max-width: 86%; margin-top: 6px; padding: 12px 14px; border-radius: 8px;
  background: var(--bubbleHi); box-shadow: inset 0 0 0 1px var(--divider);
}
.trace-label {
  margin: 0 0 6px 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.trace-q { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 500; text-wrap: pretty; }
.trace-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--divider);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */
.site-footer .inner { position: relative; max-width: var(--wrap); margin: 0 auto; box-sizing: border-box; overflow: hidden; }
.ftr {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px 32px;
  padding: clamp(56px, 7vw, 88px) clamp(20px, 4vw, 56px) 0;
}
.ftr-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.ftr-tagline { margin: 0; font-size: 14px; color: var(--muted); }
.ftr-col { display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.ftr-col p { margin: 0 0 4px 0; font-weight: 500; }
.ftr-col a { color: var(--muted); transition: color 150ms ease-out; }
.ftr-col a:hover { opacity: 1; color: var(--text); }
.ftr-base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 72px clamp(20px, 4vw, 56px) clamp(32px, 4vw, 48px);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
@media (max-width: 760px) {
  .ftr { grid-template-columns: 1fr 1fr; }
  .ftr > :first-child { grid-column: 1 / -1; }
}

/* Theme switcher */
.tsw {
  display: inline-flex; gap: 2px; padding: 2px; margin-top: 8px; border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--divider);
}
.tsw button {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.tsw button[aria-pressed=true] { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.tsw button:focus-visible { outline: 2px solid var(--muted); outline-offset: 1px; }

/* ---------- Questions (homepage) ---------- */
.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;
}
.qa {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px 56px;
  padding: clamp(48px, 7vw, 96px) clamp(20px, 4vw, 56px);
}
.qa-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.qa h2 { margin: 0; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; font-weight: 500; letter-spacing: -0.035em; }
.qa-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--divider); }
.qa-list li { border-bottom: 1px solid var(--divider); }
.qa-list a {
  display: flex; justify-content: space-between; gap: 16px; padding: 14px 2px;
  font-size: 15px; color: var(--text);
}
.qa-list a::after { content: "→"; color: var(--muted); }
@media (max-width: 900px) { .qa { grid-template-columns: 1fr; } }

.search { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 6px; border: 0;
  background: var(--surface); box-shadow: var(--shadow); color: var(--text);
  font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline: 2px solid var(--muted); outline-offset: 1px; }
.search button {
  height: 40px; padding: 0 16px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--btnBg); color: var(--btnText); font: inherit; font-size: 14px; font-weight: 500;
}

/* ---------- Answer and search pages ---------- */
.doc {
  max-width: var(--wrap); min-height: calc(100vh - 34px); box-sizing: border-box;
  padding: clamp(48px, 7vw, 88px) clamp(20px, 4vw, 56px);
  font-size: 16px; line-height: 1.6;
}
.doc > * { max-width: 680px; }
.doc h1 { margin: 0 0 24px; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.1; font-weight: 500; letter-spacing: -0.035em; }
.doc h2 { margin: 40px 0 12px; font-size: 18px; font-weight: 500; }
.doc p, .doc ul { color: var(--muted); }
.doc strong { color: var(--text); font-weight: 500; }
.doc a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dash); }
.doc code { font-family: var(--font-mono); font-size: 0.9em; }
.doc .search { margin: 0 0 32px; }
.doc .result { padding: 8px 0 16px; border-bottom: 1px solid var(--divider); }
.doc .result h2 { margin-top: 16px; }
.doc-more { margin-top: 40px; }

/* ---------- 404 ---------- */
.nf {
  min-height: calc(100vh - 34px);
  box-sizing: border-box;
  padding: clamp(64px, 9vw, 112px) clamp(20px, 4vw, 40px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 24px;
}
.nf h1 { margin: 0; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; font-weight: 500; letter-spacing: -0.035em; }
.nf p { margin: 0; max-width: 460px; font-size: 16px; line-height: 1.6; color: var(--muted); }
