/* FreeFM Lab: styles. Same colours and fonts as the blog posts (assets/blog/blog.css); Dark by default. */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/blog/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/blog/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/blog/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/blog/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/blog/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  --bg: #fcfcfc; --panel: #ffffff; --panel-2: #f3f4f6; --input: #ffffff; --border: #e2e4e7; --border-2: #c9cdd2;
  --text: #2a2a2a; --soft: #3d4248; --heading: #111316; --muted: #5f656b;
  --accent: #1d7aa3; --accent-ink: #ffffff; --accent-soft: rgba(29, 122, 163, 0.22); --accent-bg: #e3f1f7;
  --train: #8b9197; --truth: #111316; --mean: #1d7aa3; --band: rgba(29, 122, 163, 0.24);
  --evidence: #a94f15; --evidence-bg: #fbeee4;
  --good: #1f7a3d; --watch: #8a5a00; --bad: #b3261e; --bad-bg: #fbeceb;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1d20; --panel: #25282c; --panel-2: #2c3035; --input: #1b1d20; --border: #353a40; --border-2: #4a5058;
  --text: #d0d4d8; --soft: #c2c7cc; --heading: #eef0f2; --muted: #a3a9af;
  --accent: #6ec6e2; --accent-ink: #0f1a1f; --accent-soft: rgba(110, 198, 226, 0.3); --accent-bg: #1f3a44;
  --train: #8a9198; --truth: #eef0f2; --mean: #6ec6e2; --band: rgba(110, 198, 226, 0.28);
  --evidence: #f0a35e; --evidence-bg: #2e2a24;
  --good: #5cc98a; --watch: #f2c14e; --bad: #ef6b6b; --bad-bg: #2f2224;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { color: var(--heading); font-family: var(--serif); font-weight: 600; margin: 0; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lbl { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; padding: 0 28px; border-bottom: 1px solid var(--border); min-height: 64px; background: var(--bg); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; padding: 12px 0; }
.brand b { font: 600 22px var(--serif); color: var(--heading); }
.brand span { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 22px; overflow-x: auto; max-width: 100%; }
.tab { font-weight: 500; font-size: 14px; color: var(--muted); text-decoration: none; padding: 12px 2px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--heading); }
.tab[aria-current="page"] { color: var(--heading); border-bottom-color: var(--accent); }
.tab.is-off { opacity: .55; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; padding: 8px 0; }
.device { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.device svg { stroke: var(--good); }
.theme-btn { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--muted); font-size: 13px; min-height: 34px; }
.theme-btn:hover { color: var(--heading); border-color: var(--border-2); }

/* ---------- common pieces ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.btn { font-weight: 500; font-size: 14px; border-radius: 8px; padding: 10px 16px; border: 1px solid var(--border); background: var(--panel-2); color: var(--heading); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; }
.btn:hover { border-color: var(--border-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.chip { font-weight: 500; font-size: 13px; border-radius: 999px; padding: 7px 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"], .chip.on { border-color: var(--accent); color: var(--heading); background: var(--accent-bg); }
.chip input { accent-color: var(--accent); margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill.good { color: var(--good); } .pill.watch { color: var(--watch); } .pill.bad { color: var(--bad); } .pill.info { color: var(--accent); }
.alert { border: 1.5px solid var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.alert b { display: flex; align-items: center; gap: 8px; color: var(--heading); }
.alert svg { stroke: var(--bad); flex: none; width: 18px; height: 18px; }
.alert.watch { border-color: var(--watch); background: var(--panel); }
.alert.watch svg { stroke: var(--watch); }
.alert span { font-size: 14px; color: var(--soft); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { background: var(--input); border: 1px solid var(--border); border-radius: 6px; color: var(--heading); padding: 8px 10px; font-size: 14px; min-height: 40px; width: 100%; }
.field input { font-family: var(--mono); }
.stepfield { display: flex; gap: 6px; }
.stepfield input { width: 72px; flex: none; }
.stepfield select { flex: 1; min-width: 0; }
.progress { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- start view ---------- */
.start { max-width: 1060px; margin: 0 auto; padding: 52px 28px 48px; display: flex; flex-direction: column; gap: 40px; }
.hero { display: flex; flex-direction: column; gap: 16px; max-width: 780px; }
.hero h1 { font-size: 46px; line-height: 1.12; }
.hero p { font-size: 18px; line-height: 1.6; color: var(--soft); }
.drops { display: flex; flex-wrap: wrap; gap: 16px; }
.drop { flex: 1 1 260px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; border: 1.5px dashed var(--border-2); border-radius: 12px; padding: 26px 20px; cursor: pointer; background: var(--panel); min-height: 44px; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.loaded { border-style: solid; border-color: var(--good); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop b { color: var(--heading); font-size: 16px; }
.drop .sub, .drop .info { font-size: 13px; color: var(--muted); }
.drop.loaded .info { color: var(--good); }
.drop svg { stroke: var(--accent); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.points { display: flex; flex-wrap: wrap; gap: 32px; }
.point { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; }
.point svg { stroke: var(--evidence); }
.point b { color: var(--heading); font-size: 16px; }
.point span { color: var(--muted); font-size: 14px; }
.sec-head { display: flex; flex-direction: column; gap: 4px; }
.sec-head h2 { font-size: 21px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.example { padding: 16px 18px; text-align: left; display: flex; flex-direction: column; gap: 4px; cursor: pointer; color: var(--text); font-size: 13px; }
.example:hover { border-color: var(--accent); }
.example b { color: var(--heading); font-size: 15px; }
.example .mono { font-size: 12px; color: var(--muted); }
.domain { padding: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.domain b { color: var(--heading); font-size: 16px; }
.domain .q { color: var(--evidence); }
.domain .note { font-size: 12px; color: var(--muted); }
.contact-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; background: var(--accent-bg); border: 1px solid var(--accent-soft); border-radius: 10px; padding: 18px 22px; }
.contact-box p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--soft); }
.contact-box b { color: var(--heading); font-weight: 600; }
.foot { display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 20px; }

/* ---------- forecast view ---------- */
.layout { display: flex; flex-wrap: wrap; gap: 24px; padding: 24px 28px 48px; max-width: 1440px; margin: 0 auto; }
.side { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 16px; }
.mainc { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.box { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.minidrop { position: relative; display: flex; flex-direction: column; gap: 2px; border: 1px dashed var(--border-2); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.minidrop:hover, .minidrop.over { border-color: var(--accent); }
.minidrop.loaded { border-style: solid; }
.minidrop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.minidrop b { color: var(--heading); font-weight: 500; }
.minidrop span { font-size: 13px; color: var(--muted); }
.minidrop.loaded b::after { content: " ✓"; color: var(--good); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.suggest-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.suggest-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.suggest-list ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.title-row h1 { font-size: 26px; }
.placeholder { padding: 48px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chartcard { padding: 18px 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 18px; vertical-align: middle; margin-right: 6px; }
.legend .l-train { border-top: 2px solid var(--train); }
.legend .l-truth { border-top: 2px solid var(--truth); }
.legend .l-mean { border-top: 2px dashed var(--mean); }
.legend .l-band { height: 10px; background: var(--band); border-radius: 2px; }
.panel { position: relative; }
.panel + .panel { margin-top: 6px; }
.panel-name { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: manipulation; }
.chart:focus-visible { outline: 2px solid var(--accent); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .s-train { fill: none; stroke: var(--train); stroke-width: 1.4; }
.chart .s-truth { fill: none; stroke: var(--truth); stroke-width: 1.5; }
.chart .s-mean { fill: none; stroke: var(--mean); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .s-band { fill: var(--band); stroke: none; }
.chart .s-split { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .s-sel { fill: var(--bg); stroke: var(--evidence); stroke-width: 2.5; }
.chart .s-mark { stroke: var(--evidence); }
.chart .s-hit { fill: transparent; cursor: crosshair; }
.pop { position: absolute; z-index: 5; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; border-color: var(--evidence); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: 260px; }
.pop b { color: var(--heading); }
.pop button { background: none; border: 0; padding: 4px 0 0; color: var(--evidence); font-weight: 500; text-align: left; cursor: pointer; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls input[type=range] { flex: 1 1 200px; accent-color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.metric { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.metric .big { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.metric .big span:first-child { font: 26px var(--mono); color: var(--heading); }
.metric p { font-size: 13px; color: var(--muted); line-height: 1.45; }
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: right; padding: 8px 10px; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { padding: 9px 10px; border-top: 1px solid var(--border); text-align: right; color: var(--soft); }
table.data td.num { font-family: var(--mono); color: var(--heading); }
table.data tr.me td { background: var(--accent-bg); color: var(--heading); font-weight: 600; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.error { border: 1px solid var(--bad); background: var(--bad-bg); color: var(--heading); border-radius: 8px; padding: 10px 12px; font-size: 14px; }

/* ---------- why view ---------- */
.why-side { flex: 1 1 260px; max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { flex: 1; accent-color: var(--evidence); }
.why-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.why-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.why-head h2 { font-size: 22px; }
.bars { display: flex; flex-direction: column; gap: 14px; max-width: 780px; }
.bar { display: grid; grid-template-columns: minmax(130px, 200px) 1fr 64px; align-items: center; gap: 4px 12px; }
.bar .t { color: var(--heading); font-size: 14px; }
.bar .track { height: 12px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar .track span { display: block; height: 100%; background: var(--evidence); border-radius: 6px; }
.bar .w { font-family: var(--mono); color: var(--heading); text-align: right; }
.bar .then { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.multiples figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.multiples figcaption { font-size: 13px; color: var(--muted); }
.mini { display: block; width: 100%; height: auto; background: var(--panel-2); border-radius: 8px; }
.mini .now { fill: none; stroke: var(--truth); stroke-width: 1.8; }
.mini .fc { fill: none; stroke: var(--mean); stroke-width: 1.8; stroke-dasharray: 5 3; }
.mini .past { fill: none; stroke: var(--evidence); stroke-width: 1.8; }
.mini .cut { stroke: var(--muted); stroke-dasharray: 2 3; }
.timeline { display: block; width: 100%; height: auto; }
.timeline .tl { fill: none; stroke: var(--train); stroke-width: 1; }
.timeline .mk { stroke: var(--evidence); }
.timeline text { fill: var(--muted); font: 11px var(--sans); }

/* ---------- trust view ---------- */
.narrow { max-width: 1200px; margin: 0 auto; padding: 28px 28px 48px; display: flex; flex-direction: column; gap: 20px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.check { padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.check-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-head h2 { font-size: 19px; }
.check .big { font: 28px var(--mono); color: var(--heading); }
.check p { font-size: 14px; line-height: 1.6; color: var(--soft); }
.scale { display: flex; flex-direction: column; gap: 6px; }
.scale .track { position: relative; height: 28px; }
.scale .base, .scale .ok, .scale .warn { position: absolute; top: 12px; height: 4px; border-radius: 2px; }
.scale .base { left: 0; right: 0; background: var(--panel-2); }
.scale .ok { left: 0; background: var(--good); opacity: .55; }
.scale .warn { background: var(--watch); opacity: .55; }
.scale .typ { position: absolute; top: 4px; width: 2px; height: 20px; background: var(--muted); }
.scale .now { position: absolute; top: 6px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; border: 2px solid var(--bg); }
.scale .legend-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

@media (max-width: 700px) {
  .top { padding: 0 16px; gap: 0 16px; }
  .top-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .brand span { display: none; }
  .start { padding: 32px 16px; gap: 32px; }
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 16px; }
  .layout { padding: 16px; }
  .side, .why-side { max-width: none; }
  .layout.forecast .side { order: 2; }
  .narrow { padding: 20px 16px; }
  .checks { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 1fr 56px; }
  .bar .track { grid-column: 1 / 3; grid-row: 2; }
  .bar .then { grid-column: 1 / 3; }
  .pop { position: static; margin-top: 8px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .progress span { transition: none; } }
