/* Demo pages — build on /css/site.css tokens. */
[hidden] { display: none !important; }
:root {
  --s-ref: #a9b8a9;
  --s-opt: #3c3;
  --warn: #e6c35c;
}

.demo-hero { padding: 48px 0 24px; background: var(--panel); }
.demo-hero h1 { font-size: clamp(28px, 5vw, 42px); margin: 0 0 8px; line-height: 1.2; }
.demo-hero p { max-width: 760px; color: var(--text); margin: 0 0 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 13px; }
.badges span { border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; color: var(--muted); }

.tool { display: grid; gap: 20px; grid-template-columns: 320px 1fr; padding: 24px 16px 48px; align-items: start; }
/* Full-bleed solid background behind the tool so the particle canvas doesn't show through. */
.tool-section { background: var(--bg); border-top: 1px solid var(--line); }
@media (max-width: 900px) { .tool { grid-template-columns: 1fr; } }

.controls fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 16px; padding: 12px 14px 4px; background: rgba(51, 68, 51, 0.5); }
.controls legend { font-family: var(--mono); color: var(--accent); padding: 0 6px; font-size: 14px; }
.controls label { margin-bottom: 10px; }
.controls select, .controls input[type="number"], .controls input[type="text"] {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 15px;
  color: var(--text); background: rgba(15, 22, 15, 0.7); border: 1px solid var(--line); border-radius: 4px;
}
.controls input[type="range"] { width: 100%; padding: 0; border: 0; background: none; accent-color: var(--accent-strong); }
.controls input[type="file"] { padding: 6px; font-size: 13px; }
.controls .out { float: right; font-family: var(--mono); color: var(--accent); }
.controls .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.controls .buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.controls .btn { padding: 9px 14px; font-size: 14px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
progress { width: 100%; height: 8px; accent-color: var(--accent-strong); }
.opt-status { font-family: var(--mono); font-size: 13px; min-height: 1.4em; color: var(--muted); }
.opt-status.ok { color: var(--accent-strong); }
.opt-status.err { color: var(--err); }

.results { min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 6px; background: rgba(51, 68, 51, 0.5); padding: 12px 14px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; margin: 0 0 8px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plots { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .plots { grid-template-columns: 1fr; } }
svg.chart { width: 100%; height: auto; display: block; }

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; font-family: var(--mono); }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { color: var(--muted); font-weight: 500; }
table.data b { color: var(--accent-strong); font-weight: 600; }
.swatch { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; }
.swatch.s-ref { background: var(--s-ref); }
.swatch.s-opt { background: var(--s-opt); }

.conf { padding: 1px 6px; border-radius: 3px; }
.conf.high { color: #1f2b1f; background: var(--s-opt); }
.conf.mid { color: #1f2b1f; background: var(--warn); }
.conf.low { color: #1f2b1f; background: var(--err); }
.confidence-note { font-family: var(--mono); font-size: 13px; }
.confidence-note.high { color: var(--accent-strong); }
.confidence-note.mid { color: var(--warn); }
.confidence-note.low { color: var(--err); }

.exports { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.exports label { margin: 0; width: 120px; }
.exports input { margin-top: 4px; padding: 7px 10px; }

/* Chart styling */
.grid-line line { stroke: rgba(170, 204, 170, 0.12); stroke-width: 1; }
.axis text { fill: var(--muted); font: 11px var(--mono); }
.axis .label { fill: var(--text); font-size: 12px; }
.axis .frame { fill: none; stroke: var(--line); }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; }
.series.s-ref { stroke: var(--s-ref); stroke-dasharray: 5 4; }
.series.s-opt { stroke: var(--s-opt); }
.series.thin { stroke-width: 1.2; opacity: 0.8; }
circle.series.s-opt { fill: var(--s-opt); stroke: #1f2b1f; stroke-width: 1.5; stroke-dasharray: none; }
.legend text { fill: var(--muted); font: 11px var(--mono); }
.legend-bg { fill: rgba(31, 43, 31, 0.85); stroke: none; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 0; }
.prose li { margin-bottom: 6px; }
.cta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.credits { font-size: 14px; color: var(--muted); }

/* Topology optimization editor */
.editor { overflow: hidden; }
.editor canvas { display: block; margin: 0 auto; touch-action: none; cursor: crosshair; }
.editor canvas.busy { cursor: progress; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tools button {
  font: 13px var(--mono); padding: 6px 10px; border-radius: 4px; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid var(--line);
}
.tools button[aria-pressed="true"] { background: var(--accent); color: #1f2b1f; border-color: var(--accent); }
.views { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--muted); }
.views label { display: flex; gap: 6px; align-items: center; margin: 0; }
.views input { width: auto; margin: 0; accent-color: var(--accent-strong); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend-row i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }
.metrics-line { font-family: var(--mono); font-size: 13px; color: var(--muted); min-height: 1.4em; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Wind tunnel */
.editor.flow { position: relative; }
.editor.flow canvas { margin: 0; border-radius: 3px; }
.editor.flow #cursor { position: absolute; left: 0; top: 0; pointer-events: none; }
.colorbar { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.colorbar i { display: inline-block; width: 160px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }
.colorbar #legend-label { margin-right: 6px; color: var(--text); }

/* Home energy retrofit */
:root { --s-heat: #e8915c; --s-cool: #6cb4e4; --s-sim: #e6c35c; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.controls details.sub { margin-bottom: 10px; }
.controls details.sub summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.controls label.off { opacity: 0.4; }
.controls select:disabled { opacity: 0.5; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { border: 1px solid var(--line); border-radius: 6px; background: rgba(51, 68, 51, 0.5); padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; }
.kpi .t { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.kpi .v { font: 600 22px var(--mono); color: var(--text); }
.kpi .u { font: 13px var(--mono); color: var(--muted); }
.kpi .b { flex-basis: 100%; font: 12px var(--mono); color: var(--muted); min-height: 1.3em; }
.kpi.better .v { color: var(--accent-strong); }
.kpi.worse .v { color: var(--err); }
rect.bar { stroke: none; }
.bar.s-heat, circle.bar.s-heat { fill: var(--s-heat); }
.bar.s-cool, circle.bar.s-cool { fill: var(--s-cool); }
.series.s-out { stroke: var(--s-cool); }
circle.series.s-sim { fill: var(--s-sim); stroke: #1f2b1f; stroke-width: 1.2; }
circle.series.s-ref { fill: var(--s-ref); stroke: #1f2b1f; stroke-width: 1.2; stroke-dasharray: none; }
circle.series.s-cur { fill: none; stroke: var(--text); stroke-width: 2.5; }
circle.series.clickable { cursor: pointer; }
circle.series.clickable:hover { stroke: var(--text); stroke-width: 2.5; }
.plots > * { min-width: 0; }
#details-table td:first-child { white-space: normal; }

/* Face re-identification */
.stage { position: relative; background: #0f160f; border-radius: 3px; overflow: hidden; aspect-ratio: 16 / 9; max-height: 70vh; margin: 0 auto; display: grid; place-items: center; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage video { visibility: hidden; }
.stage.live video { visibility: visible; }
.stage.mirror video { transform: scaleX(-1); }
.stage .placeholder { color: var(--muted); font: 14px var(--mono); padding: 16px; text-align: center; }
.stage.live .placeholder { display: none; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.people li { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); border-radius: 4px; padding: 6px 8px; min-width: 0; }
.people li.empty { border-left-width: 1px; color: var(--muted); font-size: 14px; grid-column: 1 / -1; }
.people img { width: 56px; height: 56px; border-radius: 3px; flex: none; object-fit: cover; }
.people div { min-width: 0; }
.people strong { color: var(--c); font-family: var(--mono); }
.people .sex { font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.people small { display: block; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people b { color: var(--accent-strong); font-weight: 600; }
.controls label.check { display: flex; gap: 8px; align-items: center; }
.controls label.check input { width: auto; margin: 0; accent-color: var(--accent-strong); }
