/* ModelForge website. Author: Vaishnavi. */
:root {
  color-scheme: dark;
  --bg: #0c0e14;
  --surface-1: #141821;
  --surface-2: #1b2030;
  --surface-3: #232a3d;
  --border: #262c3d;
  --grid: #232838;
  --text-primary: #f3f4f8;
  --text-secondary: #b6bccb;
  --text-muted: #7c8499;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --good: #3fb37f;
  --warn: #d99a1e;
  --bad: #e66767;
  --c0: #3987e5; --c1: #d95926; --c2: #199e70; --c3: #c98500; --c4: #d55181; --c5: #008300;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.25);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7; --surface-1: #ffffff; --surface-2: #f6f7f9; --surface-3: #eceef2; --border: #e1e4ea; --grid: #eceef2;
  --text-primary: #0b0b0b; --text-secondary: #4b4a47; --text-muted: #7b7a75;
  --accent: #2a78d6; --good: #1a8a5a; --warn: #a86f00; --bad: #c93a3a;
  --c0: #2a78d6; --c1: #eb6834; --c2: #1baf7a; --c3: #eda100; --c4: #e87ba4; --c5: #008300;
  --shadow: 0 1px 2px rgba(16,24,40,0.05), 0 4px 16px rgba(16,24,40,0.06);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f5f7; --surface-1: #ffffff; --surface-2: #f6f7f9; --surface-3: #eceef2; --border: #e1e4ea; --grid: #eceef2;
    --text-primary: #0b0b0b; --text-secondary: #4b4a47; --text-muted: #7b7a75;
    --accent: #2a78d6; --good: #1a8a5a; --warn: #a86f00; --bad: #c93a3a;
    --c0: #2a78d6; --c1: #eb6834; --c2: #1baf7a; --c3: #eda100; --c4: #e87ba4; --c5: #008300;
    --shadow: 0 1px 2px rgba(16,24,40,0.05), 0 4px 16px rgba(16,24,40,0.06);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text-primary);
  font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }

/* Navigation */
header.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: 1160px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-primary); font-weight: 650; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.nav-links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: var(--text-secondary); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.nav-links a:hover, .nav-links a.active { background: var(--surface-2); color: var(--text-primary); text-decoration: none; }
@media (max-width: 860px) { .nav-links { display: none; } }

button, .button {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px; padding: 8px 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
button:hover, .button:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); text-decoration: none; }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: progress; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.segmented button { border: 0; border-radius: 0; background: transparent; color: var(--text-secondary); padding: 7px 12px; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
select, input[type="number"] { font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-muted); }

/* Sections */
section.block { padding: 72px 0 24px; scroll-margin-top: 60px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 8px; }
h1 { font-size: 44px; line-height: 1.12; letter-spacing: -0.8px; margin: 0 0 16px; max-width: 760px; }
h2 { font-size: 30px; line-height: 1.2; letter-spacing: -0.4px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 4px; }
.lead { font-size: 17px; color: var(--text-secondary); max-width: 720px; margin: 0 0 24px; }
.sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 16px; }
.small { font-size: 12.5px; color: var(--text-muted); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; gap: 20px; }
.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.lab { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .two, .lab, .three { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 34px; } }
@media (max-width: 640px) { .wrap, .nav-inner { padding-left: 16px; padding-right: 16px; } }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 36px; align-items: center; padding: 64px 0 24px; }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero canvas { width: 100%; aspect-ratio: 1.15; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-1); display: block; }
.byline { margin-top: 18px; color: var(--text-muted); font-size: 14px; }
.byline b { color: var(--text-primary); }

/* Stats */
.stat { display: grid; gap: 2px; }
.stat .label { color: var(--text-muted); font-size: 12.5px; }
.stat .value { font-size: 28px; font-weight: 650; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.stat .note { color: var(--text-secondary); font-size: 12.5px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }

/* Risk badge */
.risk { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; border-radius: 8px; padding: 4px 10px; border: 1px solid currentColor; }
.risk::before { font-weight: 700; }
.risk.negligible, .risk.low { color: var(--good); }
.risk.negligible::before, .risk.low::before { content: "✓"; }
.risk.moderate { color: var(--warn); }
.risk.moderate::before { content: "!"; }
.risk.high { color: var(--bad); }
.risk.high::before { content: "✕"; }

/* Meter */
.meter { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--accent); transition: width 0.5s cubic-bezier(0.2, 0.75, 0.2, 1), background 0.3s ease; }

/* Live log */
.log { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; height: 132px; overflow: auto; color: var(--text-secondary); }
.log div { animation: fadein 0.3s ease both; }
.log .hit { color: var(--warn); }
.log .worst { color: var(--bad); }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 500; font-size: 12.5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { animation: rise 0.45s cubic-bezier(0.2, 0.75, 0.2, 1) both; }
tr.recommended td { background: color-mix(in srgb, var(--good) 10%, transparent); }
.scroll { overflow-x: auto; }

/* Probability bars */
.probs { display: grid; gap: 6px; }
.prob { display: grid; grid-template-columns: 92px minmax(0, 1fr) 52px; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-secondary); }
.prob .track { height: 9px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.prob .fill { height: 100%; border-radius: 5px; transition: width 0.35s ease; }
.prob b { color: var(--text-primary); font-variant-numeric: tabular-nums; text-align: right; }
.pred { font-size: 22px; font-weight: 650; }
.pred.disagree { color: var(--bad); }

/* Explorer */
.plane-wrap { position: relative; }
.plane-wrap canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: crosshair; image-rendering: pixelated; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-secondary); margin: 10px 0 0; }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.segment-chart svg { width: 100%; height: auto; display: block; }
svg text { fill: var(--text-muted); font-size: 11px; }

/* Digit pad */
.pad { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 100%; max-width: 320px; aspect-ratio: 1; touch-action: none; user-select: none; }
.pad div { border-radius: 4px; background: var(--surface-3); transition: background 0.1s ease; }
.pads { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.mini-pad { width: 150px; max-width: 150px; pointer-events: none; }
.sliders { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding-right: 6px; }
.slider-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-secondary); }
.slider-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slider-row b { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-primary); }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; counter-reset: step; }
@media (max-width: 900px) { .steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.step { position: relative; }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 12px; }
.bisect svg { width: 100%; height: auto; display: block; }

footer { border-top: 1px solid var(--border); margin-top: 72px; padding: 28px 0 48px; color: var(--text-muted); font-size: 13.5px; }
footer .wrap { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
footer b { color: var(--text-primary); }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.9); opacity: 0; } 60% { transform: scale(1.04); } 100% { transform: none; opacity: 1; } }
.reveal.visible { animation: rise 0.6s cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.pop { animation: pop 0.45s cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.card { transition: border-color 0.25s ease; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Compiler */
textarea { font: 12.5px/1.5 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%; resize: vertical; tab-size: 4; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
label.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.stages { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.stages li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); animation: rise 0.4s cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.stages .mark { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--good); }
.stages .mark.fail { background: var(--bad); }
.stages .mark.warn { background: var(--warn); }
.stages .detail { font-size: 12.5px; color: var(--text-muted); }
.stages .ms { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.error-box { margin-top: 12px; border: 1px solid var(--bad); border-radius: 10px; padding: 10px 12px; color: var(--bad); font-size: 13.5px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -4px 0 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-secondary); padding: 8px 12px; }
.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { animation: fadein 0.25s ease both; }
pre.code { margin: 0; max-height: 520px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 0; font: 12.5px/1.55 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; counter-reset: line; }
pre.code .ln { display: block; padding: 0 14px 0 0; white-space: pre; }
pre.code .ln::before { counter-increment: line; content: counter(line); display: inline-block; width: 44px; padding-right: 12px; text-align: right; color: var(--text-muted); opacity: 0.6; user-select: none; }
pre.code .ln.added { background: color-mix(in srgb, var(--good) 16%, transparent); }
pre.code .ln.removed { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.tok-kw { color: var(--accent); }
.tok-str { color: var(--good); }
.tok-num { color: var(--c1); }
.tok-com { color: var(--text-muted); font-style: italic; }
.tok-pre { color: var(--warn); }
.ir { display: grid; gap: 6px; }
.ir .node { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; min-width: 0; }
.ir .node.changed { border-color: var(--good); }
.ir .op { font: 700 11px ui-monospace, Menlo, Consolas, monospace; padding: 2px 7px; border-radius: 5px; color: #fff; background: #475569; white-space: nowrap; }
.ir .name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir .shape { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.decision { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; background: var(--surface-2); }
.verdict { font-weight: 650; }
.verdict.ok { color: var(--good); } .verdict.no { color: var(--bad); } .verdict.skip { color: var(--text-muted); } .verdict.warn { color: var(--warn); }
.neurons { display: flex; flex-wrap: wrap; gap: 4px; }
.neurons span { width: 16px; height: 16px; border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font: 11.5px ui-monospace, Menlo, Consolas, monospace; background: var(--surface-3); border-radius: 6px; padding: 3px 7px; color: var(--text-secondary); }
.terminal { background: #0b0d12; color: #d7dbe5; border-radius: 10px; padding: 14px 16px; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-x: auto; }
.terminal .prompt { color: #6aa8f0; }
.match { font-weight: 650; }
.match.ok { color: var(--good); } .match.no { color: var(--bad); }
.metric-table td:nth-child(n+2), .metric-table th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.better { color: var(--good); font-weight: 600; }
label.field > select, label.field > textarea, label.field > input[type="file"], label.field > input[type="text"] { width: 100%; max-width: 100%; min-width: 0; }
input[type="text"] { font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
.lab > * { min-width: 0; }
