:root {
  --bg: #0b0d12;
  --bg-soft: #11141b;
  --card: #151924;
  --border: #242a38;
  --text: #e8eaf0;
  --muted: #9aa3b5;
  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --ok: #3ecf8e;
  --bad: #ff6b6b;
  --info: #7aa2ff;
  --human: #c792ea;
  --code-bg: #0e1118;
  --radius: 12px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbfbfd;
    --bg-soft: #f2f3f7;
    --card: #ffffff;
    --border: #e1e4eb;
    --text: #151821;
    --muted: #5d6576;
    --accent: #c77700;
    --accent-soft: rgba(199, 119, 0, 0.1);
    --ok: #13875a;
    --bad: #c62f2f;
    --info: #2f5bd3;
    --human: #8a3fbf;
    --code-bg: #f4f5f8;
    color-scheme: light;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code, pre { font-family: var(--mono); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.brand svg circle { fill: var(--accent); stroke: none; }
.links { display: flex; gap: 22px; font-size: 15px; }
.links a { text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--text); }
.links .gh { color: var(--text); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; }

/* hero */
.hero { padding: 96px 0 72px; background: radial-gradient(900px 400px at 15% -10%, var(--accent-soft), transparent 70%); }
.eyebrow, .kicker { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 16px; }
h1 { font-size: clamp(44px, 7vw, 84px); line-height: 1.02; letter-spacing: -0.035em; margin: 0 0 24px; }
.accent { color: var(--accent); }
.lede { font-size: clamp(18px, 2vw, 21px); color: var(--muted); max-width: 720px; margin: 0 0 32px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.button { display: inline-block; padding: 12px 22px; border-radius: 10px; border: 1px solid var(--border); text-decoration: none; font-weight: 600; background: var(--card); }
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #111; }

/* tabs (install + demo) */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: -1px; }
.tabs button { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 1px solid transparent; border-bottom: none; padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--code-bg); border-color: var(--border); }
.install { max-width: 720px; }
.install .panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 0 10px 10px 10px; padding: 14px 16px; overflow-x: auto; }
.install code { font-size: 15px; white-space: nowrap; }
.install code::before { content: "$ "; color: var(--muted); }
.copy { font: inherit; font-size: 13px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; cursor: pointer; flex-shrink: 0; }
.copy:hover { border-color: var(--accent); }

/* proof strip */
.proof { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-soft); padding: 22px 0; }
.proof-title { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.proof ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 15px; }
.proof li::before { content: "✕"; color: var(--bad); font-weight: 700; margin-right: 8px; }

/* sections */
.section { padding: 96px 0; }
.section.dark { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
h2 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 18px; }
.section-lede { font-size: 19px; color: var(--muted); max-width: 760px; margin: 0 0 44px; }
h3 { font-size: 19px; margin: 0 0 8px; letter-spacing: -0.01em; }

.cards { display: grid; gap: 18px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.grid { grid-template-columns: repeat(4, 1fr); margin-top: 36px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card p { color: var(--muted); margin: 0; }
.card.small h3 { font-size: 16px; }
.card.small p { font-size: 15px; }

/* story */
.story p { font-size: 19px; color: var(--muted); }
.story .pull { font-size: clamp(22px, 3vw, 28px); line-height: 1.35; color: var(--text); border-left: 3px solid var(--accent); padding-left: 22px; margin: 36px 0; font-weight: 600; letter-spacing: -0.01em; }
.doctrine { list-style: none; counter-reset: d; padding: 0; margin: 36px 0 0; display: grid; gap: 10px; }
.doctrine li { counter-increment: d; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; font-size: 18px; }
.doctrine li::before { content: counter(d, decimal-leading-zero); font-family: var(--mono); color: var(--muted); margin-right: 16px; font-size: 14px; }
.doctrine span { color: var(--accent); font-weight: 700; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 40px; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; min-width: 0; }
.step p { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-head h3 { margin: 0; }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px; flex-shrink: 0; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: auto 0 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); }

/* demo */
.demo .panel { background: var(--code-bg); border: 1px solid var(--border); border-radius: 0 12px 12px 12px; padding: 20px; }
.demo-note { color: var(--muted); font-size: 15px; margin: 0 0 16px; max-width: 860px; }
.demo-note:last-child { margin: 16px 0 0; }
.terminal { background: #07090d; border-color: #1d2230; color: #d7dbe5; font-size: 13px; }
.t-call { color: #e6c07b; } .t-ok { color: #3ecf8e; } .t-bad { color: #ff6b6b; } .t-rev { color: #7aa2ff; } .t-human { color: #c792ea; }
.terminal .muted { color: #7f889b; }

/* diagram */
.diagram { margin: 40px 0 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; overflow-x: auto; }
.diagram svg { width: 100%; min-width: 640px; height: auto; display: block; font-family: system-ui, sans-serif; }
.d-box rect { fill: var(--bg-soft); stroke: var(--border); stroke-width: 1.5; }
.d-box.accent rect { fill: var(--accent-soft); stroke: var(--accent); }
.d-box text { fill: var(--text); font-size: 17px; font-weight: 600; text-anchor: middle; }
.d-box text.d-sub { fill: var(--muted); font-size: 13px; font-weight: 400; }
.d-line { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.d-arrowhead { fill: var(--muted); }
.d-label { fill: var(--muted); font-size: 13px; text-anchor: middle; }

/* get started */
.get { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.get .card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.get pre { margin: 0; }
.get a { color: var(--accent); text-decoration: none; font-weight: 600; margin-top: auto; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer nav { display: flex; gap: 22px; flex-wrap: wrap; font-size: 15px; }
.footer nav a { color: var(--muted); text-decoration: none; }
.footer nav a:hover { color: var(--text); }

@media (max-width: 960px) {
  .cards.three, .steps, .get { grid-template-columns: 1fr; }
  .cards.grid { grid-template-columns: repeat(2, 1fr); }
  .links a:not(.gh) { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 64px 0; }
  .cards.grid { grid-template-columns: 1fr; }
  .install code { font-size: 13px; }
}

/* downloads */
.files { width: 100%; border-collapse: collapse; font-size: 15px; }
.files th, .files td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.files th { color: var(--muted); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.files tr:last-child td { border-bottom: none; }
.files a { color: var(--accent); text-decoration: none; font-family: var(--mono); font-size: 14px; }
.files .hash { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; min-width: 240px; }
.note { font-size: 15px; margin-top: 12px; }
.table-card { margin-top: 40px; padding: 0; overflow-x: auto; }
.subhead { margin-top: 40px; }
.cards.tight { margin-top: 16px; }

/* ---------- landing v2 ---------- */
.hero-grid > *, .story-grid > *, .play > * { min-width: 0; }
.hero-grid h1 { font-size: clamp(40px, 5.4vw, 76px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 48px; align-items: center; }

/* live feed */
.feed { margin: 0; background: #07090d; border: 1px solid #1d2230; border-radius: 14px; box-shadow: 0 30px 80px -30px rgba(245, 165, 36, 0.25); overflow: hidden; }
.feed-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid #1d2230; background: #0c0f16; }
.feed-head .dot { width: 10px; height: 10px; border-radius: 50%; background: #2a3040; }
.feed-title { margin-left: 8px; font: 12px var(--mono); color: #7f889b; }
.feed-lines { list-style: none; margin: 0; padding: 14px 16px 18px; font: 13px/1.5 var(--mono); color: #d7dbe5; min-height: 300px; }
.feed-lines li { padding: 3px 0; opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease, transform 0.35s ease; }
.feed-lines li.shown { opacity: 1; transform: none; }
.feed-lines li span { display: inline-block; width: 74px; color: #7f889b; }
.f-call { color: #e6c07b; } .f-ok { color: #3ecf8e; } .f-bad { color: #ff6b6b; } .f-rev { color: #7aa2ff; } .f-human { color: #c792ea; }
.feed-lines .f-call span, .feed-lines .f-ok span, .feed-lines .f-bad span, .feed-lines .f-rev span, .feed-lines .f-human span { color: inherit; opacity: 0.75; }

/* story */
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.story-col { border-radius: var(--radius); padding: 26px; border: 1px solid var(--border); background: var(--card); }
.story-col.without { border-top: 3px solid var(--bad); }
.story-col.with { border-top: 3px solid var(--ok); }
.story-col h3 { font-size: 20px; margin-bottom: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { color: var(--muted); font-size: 15.5px; display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
.timeline time { font-family: var(--mono); font-size: 13px; color: var(--text); padding-top: 2px; }
.timeline strong { color: var(--text); }
.story-cost, .story-save { margin: 18px 0 0; font-weight: 700; font-size: 17px; }
.story-cost { color: var(--bad); } .story-save { color: var(--ok); }
.story-note { margin-top: 20px; color: var(--muted); font-size: 15px; }
.story-note a { color: var(--accent); }

/* icons */
.icon { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 12px; }

/* flow diagram */
.flow { margin: 36px 0 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; overflow-x: auto; }
.flow svg { display: block; width: 100%; min-width: 640px; height: auto; font-family: system-ui, sans-serif; }
.f-node rect { fill: var(--bg-soft); stroke: var(--border); stroke-width: 1.5; }
.f-node.guard rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.f-node text { fill: var(--text); font-size: 17px; font-weight: 600; text-anchor: middle; }
.f-node text.f-sub { fill: var(--muted); font-size: 13px; font-weight: 400; }
.f-line { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.f-line.ok { stroke: var(--ok); } .f-line.bad { stroke: var(--bad); }
.f-arrowhead { fill: var(--muted); } .f-arrowhead-ok { fill: var(--ok); } .f-arrowhead-bad { fill: var(--bad); }
.f-label { fill: var(--muted); font-size: 13px; text-anchor: middle; }
.f-pulse { stroke: none; }
.f-pulse.p1 { fill: var(--ok); } .f-pulse.p2 { fill: var(--bad); } .f-pulse.p3 { fill: var(--accent); }

/* playground */
.play { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.play-side { display: grid; gap: 14px; }
.play-policy, .play-meters { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.play-policy h3 { font-size: 15px; margin-bottom: 6px; }
.play-policy ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
.meter + .meter { margin-top: 12px; }
.meter-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.meter-label span:last-child { font-family: var(--mono); }
.bar-track { height: 10px; border-radius: 5px; background: var(--code-bg); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; width: 0; transition: width 0.4s ease; }
.bar-fill.ok { background: var(--ok); } .bar-fill.bad { background: var(--bad); }
.play-status { margin: 14px 0 0; font-weight: 700; color: var(--ok); }
.play-status.dead { color: var(--bad); }
.play-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.play-actions button { font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; }
.play-actions button:hover:not(:disabled) { border-color: var(--accent); }
.play-actions button.danger { color: var(--bad); }
.play-actions button.quiet { color: var(--muted); }
.play-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.play-log { background: #07090d; border: 1px solid #1d2230; border-radius: var(--radius); overflow: hidden; min-height: 420px; }
.play-message { margin: 0; padding: 12px 16px; font-size: 14px; color: #d7dbe5; border-bottom: 1px solid #1d2230; min-height: 46px; }
.play-message.ok { color: #3ecf8e; } .play-message.bad { color: #ff6b6b; } .play-message.wait { color: #e6c07b; }
.play-records { list-style: none; margin: 0; padding: 10px 16px 16px; font: 12.5px/1.45 var(--mono); color: #c9cedb; max-height: 420px; overflow-y: auto; }
.play-records li { display: grid; grid-template-columns: 28px 150px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #1a1f2b; }
.play-records li .seq { color: #7f889b; }
.play-records li .hash { grid-column: 2 / 4; color: #596175; font-size: 11px; }
.play-records li.k-denied .kind, .play-records li.k-scar .kind, .play-records li.k-terminated .kind, .play-records li.k-rejected .kind { color: #ff6b6b; }
.play-records li.k-allowed .kind, .play-records li.k-outcome .kind { color: #3ecf8e; }
.play-records li.k-pending .kind { color: #e6c07b; }
.play-records li.broken { background: rgba(255, 107, 107, 0.12); }
.play-records li.broken .hash { color: #ff6b6b; }
.play-records li.new { animation: flash 0.8s ease; }
@keyframes flash { from { background: rgba(245, 165, 36, 0.18); } to { background: transparent; } }

/* roles, apps, path */
.cards.roles { grid-template-columns: repeat(5, 1fr); margin-top: 36px; }
.cards.roles h3 { font-size: 17px; }
.cards.roles p { font-size: 15px; }
.cards.apps-grid { grid-template-columns: repeat(2, 1fr); margin-top: 36px; }
.app { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.app h3 { margin: 0; font-size: 21px; }
.app pre { margin: 0; }
.app a { color: var(--accent); text-decoration: none; font-weight: 600; margin-top: auto; }
.card .tag, .tag { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.path { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; counter-reset: none; }
.path li a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); text-decoration: none; font-size: 14px; color: var(--muted); transition: border-color 0.2s, transform 0.2s; }
.path li a:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }
.path li a span { font-size: 22px; font-weight: 800; color: var(--accent); }
.path li:nth-child(n+7) a span { color: var(--ok); }

/* scroll reveal (only when JS runs and motion is fine) */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .feed-lines li { opacity: 1; transform: none; transition: none; }
  .f-pulse { display: none; }
  .play-records li.new { animation: none; }
}

@media (max-width: 1080px) {
  .cards.roles { grid-template-columns: repeat(3, 1fr); }
  .path { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 960px) {
  .hero-grid, .story-grid, .play, .cards.apps-grid { grid-template-columns: 1fr; }
  .cards.roles { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .cards.roles { grid-template-columns: 1fr; }
  .path { grid-template-columns: repeat(2, 1fr); }
  .play-records li { grid-template-columns: 24px 1fr; }
  .play-records li .payload { grid-column: 2; }
  .play-records li .hash { grid-column: 2; }
  .timeline li { grid-template-columns: 46px 1fr; }
}
