/* SIA demo dashboard — Gumroad-flavored neobrutalism, light/dark themed. */

:root {
  --bg: #fdfcf7;
  --surface: #ffffff;
  --surface-2: #f4f3ec;
  --ink: #0a0a0a;
  --muted: #595959;
  --border: #0a0a0a;
  --accent: #ff90e8;      /* gumroad pink */
  --accent-2: #90a8ff;    /* periwinkle */
  --accent-3: #23a094;    /* teal */
  --accent-4: #ffc900;    /* yellow */
  --good: #23a094;
  --bad: #ff5d5d;
  --shadow: 6px 6px 0 var(--border);
  --shadow-sm: 3px 3px 0 var(--border);
  --shadow-lg: 10px 10px 0 var(--border);
  --radius: 10px;
}

[data-theme="dark"] {
  --bg: #100f14;
  --surface: #1b1a22;
  --surface-2: #24222c;
  --ink: #f4f2ea;
  --muted: #a8a4b8;
  --border: #f4f2ea;
  --accent: #ff90e8;
  --accent-2: #9db4ff;
  --accent-3: #4fd1c2;
  --accent-4: #ffd84d;
  --good: #4fd1c2;
  --bad: #ff7a7a;
  --shadow: 6px 6px 0 var(--border);
  --shadow-sm: 3px 3px 0 var(--border);
  --shadow-lg: 10px 10px 0 var(--border);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 80px; }

/* ── top bar ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 3px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .dot {
  width: 34px; height: 34px; border: 3px solid var(--border); border-radius: 50%;
  background: var(--accent); box-shadow: var(--shadow-sm);
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }

/* ── chunky 3D buttons ────────────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 800; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 3px solid var(--border); border-radius: var(--radius);
  padding: 9px 14px; box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--border); }
.btn:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--border); }
.btn.accent { background: var(--accent); }
.btn.sel { background: var(--accent); transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--border); }

/* ── cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
section { margin-bottom: 34px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 12px; }

/* ── hero ─────────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 820px){ .hero { grid-template-columns: 1fr; } }
.hero .big { font-size: clamp(34px, 6vw, 62px); font-weight: 900; letter-spacing: -.03em; line-height: 1.02; margin: 6px 0 4px; }
.hero .big .from { color: var(--muted); }
.hero .big .arrow { color: var(--accent); }
.hero .lede { color: var(--muted); font-size: 15px; max-width: 46ch; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-4); color: #0a0a0a;
  border: 3px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-weight: 900; box-shadow: var(--shadow-sm); font-size: 15px;
}
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.chip {
  font-size: 12px; font-weight: 700; padding: 6px 11px;
  border: 2.5px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
.chip b { font-weight: 900; }
.hero-right { display: grid; gap: 14px; align-content: start; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 24px; font-weight: 900; }

/* ── chart ────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: 320px; display: block; }
.chart .grid { stroke: var(--border); stroke-opacity: .14; stroke-width: 1; }
.chart .axis { stroke: var(--border); stroke-width: 2.5; }
.chart .area { fill: var(--accent); fill-opacity: .18; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--surface); stroke: var(--border); stroke-width: 3; cursor: pointer; transition: r .1s; }
.chart .pt:hover, .chart .pt.active { fill: var(--accent); r: 9; }
.chart .lbl { fill: var(--muted); font-size: 12px; font-weight: 700; }
.chart .vlbl { fill: var(--ink); font-size: 12px; font-weight: 900; }
.tooltip {
  position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, -120%);
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 800;
  padding: 6px 9px; border-radius: 7px; white-space: nowrap; transition: opacity .1s;
}

/* ── generation explorer ──────────────────────────────────────────────── */
.gen-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.gen-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
@media (max-width: 820px){ .gen-grid { grid-template-columns: 1fr; } }
.gen-meta .row { display:flex; justify-content:space-between; padding:9px 0; border-bottom:2px dashed var(--border); }
.gen-meta .row:last-child { border-bottom:0; }
.gen-meta .row .k { color: var(--muted); font-weight:700; font-size:13px; }
.gen-meta .row .v { font-weight:900; }
.delta-up { color: var(--good); } .delta-down { color: var(--bad); }
.errbar { display:flex; height:14px; border:2.5px solid var(--border); border-radius:999px; overflow:hidden; margin-top:8px; background: var(--surface-2);}
.errbar i { display:block; height:100%; }

.md { font-size: 14.5px; }
.md h1, .md h2, .md h3 { letter-spacing:-.01em; line-height:1.2; }
.md h1 { font-size: 22px; } .md h2 { font-size: 18px; margin-top: 1.2em; }
.md h3 { font-size: 15px; background: var(--accent); display:inline-block;
  border:2.5px solid var(--border); border-radius:7px; padding:2px 9px; box-shadow: var(--shadow-sm); }
.md code { background: var(--surface-2); border:1.5px solid var(--border); border-radius:5px; padding:1px 5px; font-size: 12.5px; }
.md pre { background: var(--surface-2); border:2.5px solid var(--border); border-radius:8px; padding:12px; overflow:auto; box-shadow: var(--shadow-sm); }
.md pre code { border:0; background:none; padding:0; }
.md blockquote { border-left: 5px solid var(--accent); margin:0; padding:6px 14px; background: var(--surface-2);
  border-radius: 6px; color: var(--muted); font-weight:700; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }

/* ── before / after playground ────────────────────────────────────────── */
.ba-controls { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
select.picker {
  font: inherit; font-weight:700; max-width:100%; flex:1; min-width: 280px;
  background: var(--surface); color: var(--ink);
  border:3px solid var(--border); border-radius: var(--radius); padding:10px 12px; box-shadow: var(--shadow-sm);
}
.q { font-size: 17px; font-weight: 800; margin: 4px 0 2px; }
.q-db { font-size:12px; color:var(--muted); font-weight:700; }
.ba-grid { display:grid; grid-template-columns: 1fr 1fr; gap:18px; margin-top:16px; }
@media (max-width: 820px){ .ba-grid { grid-template-columns: 1fr; } }
.ba-card { border:3px solid var(--border); border-radius: var(--radius); overflow:hidden; box-shadow: var(--shadow-sm); }
.ba-card .head { padding:10px 14px; font-weight:900; border-bottom:3px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.ba-card.bad .head { background: var(--bad); }
.ba-card.good .head { background: var(--good); }
.ba-card.gold .head { background: var(--accent-4); }
.ba-card .body { padding: 12px 14px; }
.sql { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:12.5px; background: var(--surface-2);
  border:2px solid var(--border); border-radius:7px; padding:10px; white-space:pre-wrap; word-break:break-word; }
.tbl-wrap { overflow:auto; margin-top:10px; max-height: 260px; border:2px solid var(--border); border-radius:7px; }
table.res { border-collapse: collapse; width:100%; font-size:12.5px; }
table.res th, table.res td { border:1px solid var(--border); padding:5px 8px; text-align:left; white-space:nowrap; }
table.res th { background: var(--surface-2); position:sticky; top:0; font-weight:900; }
.rowcount { font-size:12px; color:var(--muted); font-weight:700; margin-top:8px; }
.err { color: var(--bad); font-weight:800; font-size:12.5px; margin-top:8px; }
.gold-wrap { margin-top:18px; }

.foot { color: var(--muted); font-size:12.5px; text-align:center; margin-top:40px; line-height:1.7; }
.kbd { border:2px solid var(--border); border-radius:6px; padding:1px 6px; font-weight:800; background:var(--surface-2); }

/* ── animations & 3D ──────────────────────────────────────────────────── */
.tilt { transition: transform .18s ease, box-shadow .18s ease; transform-style: preserve-3d; will-change: transform; }

/* chart draw-in */
.chart .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .pt.pop { opacity: 0; transform-box: fill-box; transform-origin: center; animation: pop .4s ease forwards; }
@keyframes pop { 0%{opacity:0; r:0} 70%{r:10} 100%{opacity:1; r:7} }
.chart .vlbl.fade { opacity: 0; animation: fade .5s ease forwards; }
@keyframes fade { to { opacity: 1; } }

/* nav links in topbar */
.nav { display:flex; align-items:center; gap:10px; }
.nav a { text-decoration:none; }

/* play evolution */
.evobar { display:flex; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.evobar .hint { color: var(--muted); font-size:13px; font-weight:700; }

/* run-query playground */
.run-row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin:6px 0 4px; }
.runbtn { background: var(--accent-3); color:#04110f; }
[data-theme="dark"] .runbtn { color:#04110f; }
.spinner { width:16px; height:16px; border:3px solid var(--border); border-top-color: transparent; border-radius:50%;
  display:inline-block; animation: spin .7s linear infinite; vertical-align:-3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.runstate { font-weight:800; font-size:13px; }
.typing::after { content:"▋"; animation: blink 1s steps(1) infinite; color: var(--accent-3); }
@keyframes blink { 50% { opacity:0; } }
.reveal { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform:none; } }
.verdict { display:inline-flex; align-items:center; gap:7px; font-weight:900; border:3px solid var(--border);
  border-radius:999px; padding:4px 12px; box-shadow: var(--shadow-sm); }
.verdict.ok { background: var(--good); } .verdict.no { background: var(--bad); }
.learned {
  margin-top:18px; border:3px solid var(--border); border-radius: var(--radius);
  background: var(--accent); box-shadow: var(--shadow); padding:14px 16px; font-weight:800;
}
.learned small { display:block; font-weight:600; color:#3a0033; margin-top:4px; }
[data-theme="dark"] .learned small { color:#1a0017; }

/* explain page */
.prose { max-width: 80ch; }
.prose h2 { font-size: 26px; margin-top: 1.4em; letter-spacing:-.02em; }
.prose h3 { font-size: 17px; }
.prose p, .prose li { font-size: 15.5px; }
.loop { display:grid; grid-template-columns: repeat(4, 1fr); gap:14px; margin: 18px 0; }
@media (max-width:820px){ .loop { grid-template-columns: 1fr 1fr; } }
.loop .node { border:3px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding:14px; background: var(--surface); position:relative; animation: rise .5s both; }
.loop .node b { display:block; font-size:15px; }
.loop .node span { font-size:12.5px; color: var(--muted); font-weight:600; }
.loop .node .num { position:absolute; top:-14px; left:-14px; width:30px; height:30px; border-radius:50%;
  border:3px solid var(--border); background: var(--accent); display:grid; place-items:center; font-weight:900; box-shadow: var(--shadow-sm); }
.loop .node:nth-child(2){ animation-delay:.1s; background: var(--surface);} 
.loop .node:nth-child(2) .num{ background: var(--accent-2);}
.loop .node:nth-child(3) .num{ background: var(--accent-4);}
.loop .node:nth-child(4) .num{ background: var(--accent-3);}
.bignum { font-size: clamp(40px,8vw,84px); font-weight:900; letter-spacing:-.04em; line-height:1; }
.cta { display:inline-block; margin-top:8px; }
