/* Haze website styles. Colors come from the logo: slate with teal (light) or glowing cyan (dark). */
:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
  --bg: #0b1120; --surface: #0f172a; --surface-2: #131c31; --line: #1f2a40; --text: #e2e8f0; --muted: #94a3b8;
  --accent: #5eead4; --accent-strong: #2dd4bf; --accent-ink: #042f2e; --bad: #fb7185; --ok: #34d399; --warn: #fbbf24;
  --code-bg: #0d1526; --code-active: #ffffff08; --code-selection: #5eead433; --code-comment: #64748b;
  --code-keyword: #5eead4; --code-number: #fbbf24; --code-operator: #94a3b8; --code-type: #a5b4fc; --code-fn: #7dd3fc;
  --radius: 12px; --shadow: 0 10px 40px -20px #000c;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc; --surface: #ffffff; --surface-2: #f1f5f9; --line: #e2e8f0; --text: #0f172a; --muted: #475569;
    --accent: #0d9488; --accent-strong: #0f766e; --accent-ink: #ffffff; --bad: #e11d48; --ok: #059669; --warn: #b45309;
    --code-bg: #f8fafc; --code-active: #0f172a08; --code-selection: #0d948833; --code-comment: #64748b;
    --code-keyword: #0f766e; --code-number: #b45309; --code-operator: #475569; --code-type: #4f46e5; --code-fn: #0369a1;
    --shadow: 0 10px 40px -24px #0f172a55;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: 0.05em 0.35em; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 0.4em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.spacer { flex: 1; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
section { padding: 72px 0; }
.eyebrow { color: var(--accent); font: 600 0.8rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: 0.04em; }
.brand img { width: 30px; height: 30px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px; }
  body.nav-open .nav-links { display: flex; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 500 0.9rem var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.big { padding: 12px 20px; font-size: 1rem; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: 500 0.88rem var(--sans); }
.chip-btn.active, .chip-btn:hover { color: var(--text); border-color: var(--accent); }

/* hero */
.hero { padding: 64px 0 40px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -200px -20% auto auto; width: 700px; height: 700px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 18%, transparent), transparent); pointer-events: none; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); margin: 0 0 18px; }
.hero h1 .glow { color: var(--accent); text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 45%, transparent); }
.hero-logo { width: min(340px, 80%); margin-bottom: 20px; display: block; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 0; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; }
.hero-card canvas { width: 100%; height: 260px; display: block; }
.hero-controls { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; margin-top: 6px; font-size: 0.92rem; }
.hero-controls input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 18px; height: 18px; }
.readout { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); }
.readout.safe { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.readout .q { font-size: 0.85rem; color: var(--muted); }
.readout .exact { font: 700 1.5rem var(--mono); color: var(--bad); margin-right: 6px; }
.readout.safe .exact { color: var(--ok); }
.readout .sim { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }

/* widget */
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.widget-bar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.widget select.preset { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: 500 0.92rem var(--sans); max-width: 100%; }
.live { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 0.88rem; }
.live input { accent-color: var(--accent); }
.blurb { margin: 0; padding: 10px 14px; color: var(--muted); font-size: 0.92rem; border-bottom: 1px solid var(--line); }
.blurb:empty { display: none; }
.widget-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: 560px; }
.widget-main .editor { border-right: 1px solid var(--line); min-height: 0; overflow: hidden; }
.widget-main .editor .cm-editor { height: 100%; }
.output { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.tabs { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; color: var(--muted); padding: 6px 10px; border-radius: 7px; cursor: pointer; font: 500 0.88rem var(--sans); }
.tab.active { background: var(--surface-2); color: var(--text); }
.status { font-size: 0.8rem; color: var(--muted); text-align: right; }
.results { padding: 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.results-text { margin: 0; padding: 14px; overflow: auto; flex: 1; white-space: pre-wrap; font-size: 0.82rem; }
.empty { padding: 20px; }
@media (max-width: 900px) { .widget-main { grid-template-columns: minmax(0, 1fr); height: auto; } .widget-main .editor { height: 360px; border-right: none; border-bottom: 1px solid var(--line); } .results { max-height: 520px; } }

/* result cards */
.rec { border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; }
.rec-ok { border-left-color: var(--ok); }
.rec-bad { border-left-color: var(--bad); }
.rec-info { border-left-color: var(--accent); }
.rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kind { font: 600 0.72rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.rec-title { background: none !important; border: none !important; padding: 0 !important; font-weight: 600; word-break: break-word; }
.pill { font: 600 0.75rem var(--sans); padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); } .pill.info { color: var(--accent); }
.loc { margin-left: auto; background: none; border: none; color: var(--muted); font: 0.75rem var(--mono); cursor: pointer; }
.loc:hover { color: var(--accent); }
.rec-body { margin-top: 6px; }
.big { font: 600 1.15rem var(--mono); }
.big .label, .label { font: 500 0.78rem var(--sans); color: var(--muted); }
.sep { color: var(--muted); }
.num { cursor: help; border-bottom: 1px dotted color-mix(in srgb, var(--muted) 60%, transparent); }
.ibar { position: relative; height: 8px; background: var(--surface-2); border-radius: 999px; margin: 8px 0 6px; overflow: hidden; }
.ibar-bel { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.ibar-gap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent) 55%, transparent) 0 4px, transparent 4px 8px); }
.branches { margin-top: 8px; font-size: 0.85rem; }
.branches summary { cursor: pointer; color: var(--muted); }
.branches table { width: 100%; border-collapse: collapse; margin-top: 6px; font-family: var(--mono); font-size: 0.8rem; }
.branches td, .branches th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.branches th { color: var(--muted); font-weight: 500; }
.pibar { display: inline-block; width: 36px; height: 6px; background: var(--surface-2); border-radius: 99px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.pibar span { display: block; height: 100%; background: var(--muted); }
.cex { margin-top: 10px; border: 1px dashed color-mix(in srgb, var(--bad) 60%, var(--line)); border-radius: 9px; padding: 8px 10px; background: color-mix(in srgb, var(--bad) 5%, transparent); }
.cex-head { font-size: 0.85rem; margin-bottom: 6px; }
.cex-title { font-weight: 700; color: var(--bad); }
.kv { font-size: 0.82rem; display: flex; gap: 8px; } .kv .k { color: var(--muted); min-width: 72px; }
.state { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.var { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; font: 0.8rem var(--mono); }
.var .k { background: var(--surface-2); color: var(--muted); padding: 2px 7px; }
.var .v { padding: 2px 7px; }
.state.small .var { font-size: 0.74rem; }
.hist { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.hrow { display: grid; grid-template-columns: minmax(60px, auto) 1fr auto; gap: 10px; align-items: center; font: 0.82rem var(--mono); }
.htrack { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.hbar { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); border-radius: 3px; }
.evalb + .evalb { margin-top: 10px; }
pre.msg { margin: 4px 0 0; white-space: pre-wrap; font-size: 0.8rem; color: var(--muted); }
.tests-top { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.coverage { width: 100%; max-width: 360px; }
.coverage .axis { stroke: var(--line); } .coverage .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.coverage .tick { fill: var(--muted); font: 10px var(--mono); }
.coverage .cov-line { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.coverage .cov-fail { fill: var(--bad); }
.tests-facts { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); font-size: 0.84rem; }
.runs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.run { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.run-fail { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.run-head { display: flex; gap: 8px; align-items: center; font-size: 0.82rem; }
.run-id { font: 600 0.78rem var(--mono); color: var(--muted); min-width: 52px; }
.chip { font: 600 0.72rem var(--sans); padding: 1px 7px; border-radius: 999px; }
.chip.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.chip.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.step { font: 0.74rem var(--mono); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; }
.step-n { color: var(--accent); margin-right: 6px; }
@media (max-width: 700px) { .tests-top { grid-template-columns: minmax(0, 1fr); } }

/* features */
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.feature h3 { margin: 0; font-size: 1.2rem; }
.feature p { margin: 0; color: var(--muted); }
.feature pre.code { max-height: 220px; }
.feature .results { padding: 0; overflow: visible; }
@media (max-width: 900px) { .features { grid-template-columns: minmax(0, 1fr); } .compare { display: block; overflow-x: auto; } }
pre.code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow: auto; margin: 0; font-size: 0.82rem; line-height: 1.5; }

/* pipeline */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: relative; }
.stage h3 { margin: 0 0 6px; font-size: 1.05rem; }
.stage p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.stage.trusted { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stage .tag { position: absolute; top: 12px; right: 12px; font: 600 0.7rem var(--mono); color: var(--accent); }
.grades { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.grades code { font-size: 0.8rem; }
@media (max-width: 900px) { .pipeline { grid-template-columns: 1fr 1fr; } }

/* comparison */
.compare { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 0.93rem; }
.compare th, .compare td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.compare td:first-child { font-weight: 600; white-space: nowrap; }
.compare .haze { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.table-scroll { overflow-x: auto; }

/* install */
.install-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 24px 0 12px; }
.install-panel { position: relative; }
.install-panel pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px 90px 16px 16px; margin: 0; overflow-x: auto; }
.install-panel .copy { position: absolute; top: 10px; right: 10px; }

/* gallery strip and page */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 24px; }
.field-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--text); }
.field-card:hover { border-color: var(--accent); text-decoration: none; }
.field-card strong { display: block; }
.field-card span { color: var(--muted); font-size: 0.85rem; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.example summary { cursor: pointer; padding: 14px 16px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.example .field { font: 600 0.72rem var(--mono); color: var(--accent); text-transform: uppercase; min-width: 110px; }
.example-body { padding: 0 16px 16px; }
.example-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 0.85rem; flex-wrap: wrap; }
.example-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.example-cols pre.code { max-height: 520px; }
.example-cols .results { padding: 0; max-height: 520px; }
#gallery-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
@media (max-width: 900px) { .example-cols { grid-template-columns: minmax(0, 1fr); } }

/* play page */
.play-page .widget { border-radius: 0; border-left: none; border-right: none; }
.play-page .widget-main { height: calc(100vh - 60px - 54px - 44px); min-height: 480px; }

/* tour */
.tour { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; padding: 32px 0; }
#tour-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; align-self: start; }
#tour-nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 0.92rem; }
#tour-nav a.active { background: var(--surface); color: var(--text); text-decoration: none; }
#tour-prose { max-width: 50em; }
#tour-prose h2 { margin-top: 0; }
.tour-foot { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.tour .widget-main { height: 460px; }
@media (max-width: 900px) { .tour { grid-template-columns: minmax(0, 1fr); } #tour-nav { position: static; flex-direction: row; flex-wrap: wrap; } }

/* docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; padding: 32px 0 64px; }
.docs-nav { position: sticky; top: 80px; align-self: start; display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.docs-nav a { color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.docs-nav a.active { color: var(--text); background: var(--surface); }
.prose { max-width: 52em; min-width: 0; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose h2 { margin-top: 1.8em; } .prose h3 { margin-top: 1.4em; }
@media (max-width: 900px) { .docs { grid-template-columns: minmax(0, 1fr); } .docs-nav { position: static; } }

/* footer */
footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: 0.9rem; }
footer .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
footer a { color: var(--muted); } footer a:hover { color: var(--text); }
footer h4 { color: var(--text); margin: 0 0 8px; font-size: 0.9rem; }
footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 700px) { footer .wrap { grid-template-columns: minmax(0, 1fr); } }
.noscript { padding: 12px; border: 1px solid var(--warn); border-radius: 8px; color: var(--warn); margin: 12px 0; }
