/* Shared styles for the per-project interactive models. Palette = the validated dataviz reference palette. */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface-1: #fcfcfb; --surface-2: #f2f1ee; --border: rgba(11,11,11,0.10);
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --good: #006300; --accent-wash: rgba(42,120,214,0.10); --shadow: 0 4px 16px rgba(0,0,0,.10);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321; --border: rgba(255,255,255,0.10);
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --axis: #383835;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --good: #0ca30c; --accent-wash: rgba(57,135,229,0.16); --shadow: 0 4px 16px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321; --border: rgba(255,255,255,0.10);
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
  --good: #0ca30c; --accent-wash: rgba(57,135,229,0.16); --shadow: 0 4px 16px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text-primary);
       font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--series-1); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.topbar { border-bottom: 1px solid var(--border); background: var(--page); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
.topbar a { text-decoration: none; color: var(--text-secondary); }
.topbar a:hover { color: var(--text-primary); }
.topbar .spacer { flex: 1; }
.btn { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 999px;
       padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { background: var(--accent-wash); }
.btn.primary { background: var(--series-1); border-color: transparent; color: #fff; font-weight: 600; }
.btn.on { border-color: var(--series-1); background: var(--accent-wash); font-weight: 600; }

header.model-head { padding: 28px 0 8px; }
.eyebrow { color: var(--text-secondary); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 8px; font-weight: 650; }
.lede { color: var(--text-secondary); max-width: 820px; margin: 0; }
.how { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.panel h2 { font-size: 15px; margin: 0 0 2px; font-weight: 600; }
.panel .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; margin: 18px 0; align-items: start; }
.layout.wide-left { grid-template-columns: 1fr 340px; }
.stack { display: grid; gap: 16px; }
@media (max-width: 900px) { .layout, .layout.wide-left { grid-template-columns: 1fr; } }

.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 4px 0 12px; }
.controls label { font-size: 13px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center; }
select { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px;
         padding: 5px 8px; font: inherit; font-size: 13px; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 10px 0; font-size: 13px; }
.slider .name { color: var(--text-secondary); }
.slider .value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.slider .value.changed { color: var(--series-1); }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--series-1); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text-secondary); padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--accent-wash); color: var(--text-primary); font-weight: 600; }

.timeline { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.timeline input[type=range] { flex: 1; accent-color: var(--series-1); }
.timeline .play { width: 38px; height: 38px; border-radius: 50%; padding: 0; font-size: 15px; display: grid; place-items: center; }
.timeline .year { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat .label { color: var(--text-secondary); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .note { color: var(--text-muted); font-size: 12px; }
.hero-num { font-size: 52px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }

.chart { width: 100%; position: relative; }
.chart svg { display: block; overflow: visible; }
.chart.scroll-x { overflow-x: auto; overflow-y: hidden; }   /* wide diagrams scroll inside their panel on small screens */
.chart text, svg.chart text { font-size: 12px; fill: var(--text-secondary); }
.chart .val { fill: var(--text-primary); font-weight: 600; }
.chart .muted { fill: var(--text-muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-secondary); margin: 2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-rect { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.key-line { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.ramp { height: 10px; border-radius: 3px; width: 180px; }

details.tbl { margin-top: 10px; font-size: 13px; }
details.tbl summary { cursor: pointer; color: var(--text-muted); }
details.tbl .scroll { max-height: 260px; overflow: auto; margin-top: 6px; }
details.tbl table { border-collapse: collapse; width: 100%; }
details.tbl td, details.tbl th { padding: 3px 8px; border-bottom: 1px solid var(--grid); text-align: left; position: relative; }
details.tbl th { position: sticky; top: 0; background: var(--surface-1); }
details.tbl td.n, details.tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }

.notes { color: var(--text-secondary); font-size: 14px; max-width: 900px; }
.notes li { margin: 4px 0; }
footer { color: var(--text-muted); font-size: 13px; padding: 28px 0 48px; border-top: 1px solid var(--border); margin-top: 28px; }

#tip { position: fixed; pointer-events: none; z-index: 50; background: var(--surface-1); color: var(--text-primary);
       border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow);
       opacity: 0; transition: opacity .08s; max-width: 280px; }
#tip .t-title { color: var(--text-secondary); margin-bottom: 4px; }
#tip .t-row { display: flex; align-items: center; gap: 8px; }
#tip strong { font-variant-numeric: tabular-nums; }
#tip .name { color: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
