:root,
[data-theme="light"] {
  --bg: #fbf8f1;
  --surface: #fffdf8;
  --surface-2: #f3eee2;
  --ink: #0b0906;
  --muted: #4e4638;
  --faint: #8f8471;
  --border: rgba(143,110,51,.28);
  --pine: #8f6e33;
  --pine-dark: #6e501f;
  --pine-soft: rgba(143,110,51,.09);
  --gold: #c9a45c;
  --gold-soft: #e9d7a7;
  --rust: #8f4b38;
  --red-soft: #f2ded7;
  --blue: #74624a;
  --shadow: 0 16px 42px rgba(78,56,25,.10);
}
[data-theme="dark"] {
  --bg: #0b0906;
  --surface: #100d08;
  --surface-2: #15110c;
  --ink: #f4eddd;
  --muted: #b8ae97;
  --faint: #817662;
  --border: rgba(201,164,92,.28);
  --pine: #c9a45c;
  --pine-dark: #e9d7a7;
  --pine-soft: rgba(201,164,92,.10);
  --gold: #c9a45c;
  --gold-soft: #1e1810;
  --rust: #d98a71;
  --red-soft: #33201a;
  --blue: #b8ae97;
  --shadow: 0 12px 32px rgba(0, 0, 0, .3);
}
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: none; text-size-adjust: none; scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Jost", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--pine); color: white; border-radius: 4px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell { min-height: 100dvh; }
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.back-link { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.back-link:hover { color: var(--pine); }
.brand-mark-frame { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--gold); }
.brand-mark { width: 28px; height: 28px; object-fit: contain; }
.brand strong { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 15px; font-weight: 600; letter-spacing: .20em; }
.brand span { display: block; color: var(--pine); font-size: 9px; letter-spacing: .24em; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.updated { color: var(--muted); font-size: 12px; }
.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 0; transition: .25s ease;
}
.icon-button:hover { border-color: var(--pine); color: var(--pine); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
main { width: min(1440px, 100%); margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px) 64px; }
.intro {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end;
  padding: clamp(40px, 7vw, 84px) 0 36px;
}
.eyebrow { color: var(--pine); text-transform: uppercase; letter-spacing: .22em; font-size: 11px; font-weight: 500; margin-bottom: 10px; }
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; letter-spacing: -.025em; line-height: 1.02; }
h1 { max-width: 850px; font-size: clamp(40px, 5vw, 68px); font-weight: 500; }
h1 em { color: var(--pine); font-weight: 400; }
h2 { font-size: clamp(28px, 2.6vw, 38px); font-weight: 500; }
h3 { font-size: 16px; }
.intro-copy { max-width: 700px; color: var(--muted); font-size: 17px; margin-top: 18px; }
.intro-actions { display: flex; gap: 10px; }
.primary-button, .secondary-button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 0; padding: 0 20px; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; border: 1px solid transparent;
}
.primary-button { color: #0b0906; background: var(--gold); }
.primary-button:hover { background: #e9d7a7; }
.secondary-button { color: var(--ink); background: var(--surface); border-color: var(--border); }
.secondary-button:hover { border-color: var(--pine); color: var(--pine); }
.primary-button svg, .secondary-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lens-section, .chart-section, .data-section { margin-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 18px; }
.section-heading > p { max-width: 460px; color: var(--muted); font-size: 14px; text-align: right; }
.lens-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); background: transparent; }
.lens-card {
  appearance: none; border: 0; border-right: 1px solid var(--border); background: transparent; text-align: left;
  padding: 22px; min-height: 132px; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px;
  color: var(--ink); transition: background .18s ease;
}
.lens-card:last-child { border-right: 0; }
.lens-card:hover { background: var(--surface-2); }
.lens-card.active { background: var(--gold); color: #0b0906; }
.lens-index { font: 500 12px "Cormorant Garamond"; opacity: .75; }
.lens-copy strong { display: block; font-size: 17px; }
.lens-copy small { display: block; margin-top: 3px; opacity: .72; font-size: 12px; }
.lens-result { grid-column: 2; align-self: end; display: flex; justify-content: space-between; font-size: 14px; }
.lens-result b { font-variant-numeric: tabular-nums; }
.summary-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.summary-card { min-height: 178px; background: transparent; border: 1px solid var(--border); padding: 22px; }
.summary-card.featured { background: var(--pine-soft); border-color: var(--border); }
.summary-card.caution { background: color-mix(in srgb, var(--gold-soft) 50%, var(--surface)); border-color: var(--border); }
.summary-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.summary-value { font: 500 clamp(28px, 2.8vw, 40px) "Cormorant Garamond", Georgia, serif; letter-spacing: -.025em; margin: 18px 0 7px; font-variant-numeric: tabular-nums; }
.summary-card p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.score-line { display: flex; justify-content: space-between; align-items: end; margin-top: 18px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); font-size: 12px; color: var(--muted); }
.score-line strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.confidence { display: inline-block; margin-top: 14px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.confidence.high { color: var(--pine); }
.confidence.medium { color: var(--blue); }
.confidence.low, .confidence.very-low { color: var(--rust); }
.text-button { border: 0; background: none; color: var(--ink); font-size: 13px; font-weight: 700; margin-top: 14px; padding: 5px 0; }
.text-button:hover { color: var(--pine); }
.chart-section { background: transparent; border: 1px solid var(--border); padding: 26px 28px 20px; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swipe-hint { display: none !important; color: var(--pine); font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.central { background: var(--pine); }
.dot.southern { background: var(--gold); }
.ring { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.plot-wrap { position: relative; padding: 6px 0 20px 28px; }
.scatter { width: 100%; height: 340px; overflow: visible; }
.axis-label { color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.y-label { position: absolute; left: -30px; top: 45%; transform: rotate(-90deg); }
.x-label { text-align: center; margin-top: -4px; }
.x-label span { margin: 0 60px; }
.scatter .grid { stroke: var(--border); stroke-width: 1; }
.scatter .axis-text { fill: var(--faint); font: 11px "Jost"; }
.scatter .point-label { fill: var(--ink); font: 500 12px "Jost"; pointer-events: none; }
.scatter .point { cursor: pointer; transition: opacity .18s ease; }
.scatter .point:hover { opacity: .7; }
.table-heading { align-items: end; }
.filters { display: flex; gap: 8px; }
select, input {
  min-height: 44px; border: 1px solid var(--border); border-radius: 0; background: var(--surface);
  padding: 0 12px; font-size: 14px; outline: none;
}
select:focus, input:focus { border-color: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 14%, transparent); }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 13px; width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { padding-left: 38px; width: 200px; }
.table-shell { background: transparent; border: 1px solid var(--border); overflow-x: auto; overscroll-behavior: contain; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); border-bottom: 1px solid var(--border); text-align: left; }
th button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; padding: 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
th button:hover { color: var(--pine); }
td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr { transition: background .16s ease; cursor: pointer; }
tbody tr:hover, tbody tr.highlight { background: var(--pine-soft); }
tbody tr:last-child td { border-bottom: 0; }
.market-name { min-width: 170px; }
.market-name strong { display: block; font-size: 14px; }
.market-name small { color: var(--muted); }
.metric-main { display: block; font-weight: 650; font-size: 14px; white-space: nowrap; }
.metric-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; }
.delta.positive { color: var(--pine); }
.delta.negative { color: var(--rust); }
.score-pill { display: inline-flex; align-items: center; gap: 7px; min-width: 70px; }
.score-pill i { height: 3px; background: var(--gold); display: block; }
.evidence-button { min-height: 36px; border: 1px solid var(--border); background: var(--surface); border-radius: 0; padding: 0 10px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.evidence-button:hover { color: var(--pine); border-color: var(--pine); }
.table-note { margin-top: 10px; color: var(--muted); font-size: 12px; max-width: 850px; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state svg { width: 28px; margin: 0 auto 12px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.empty-state p { color: var(--muted); margin: 5px auto 16px; font-size: 13px; }
.sources-section { margin-top: 52px; padding-top: 28px; border-top: 1px solid var(--border); display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.source-links { display: flex; gap: 22px; flex-wrap: wrap; }
.source-links a { color: var(--muted); font-size: 13px; text-underline-offset: 4px; }
.source-links a:hover { color: var(--pine); }
.dialog {
  width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  border: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--ink);
  padding: 0; box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(12, 18, 14, .58); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: 24px 26px; border-bottom: 1px solid var(--border); }
.close-dialog { font-size: 26px; font-weight: 300; }
#detailContent { padding: 24px 26px 28px; }
.detail-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-kpi { background: var(--surface-2); padding: 14px; border-radius: 0; }
.detail-kpi span { display: block; color: var(--muted); font-size: 11px; }
.detail-kpi strong { display: block; margin-top: 6px; font-size: 18px; font-variant-numeric: tabular-nums; }
.detail-note { margin-top: 22px; color: var(--muted); font-size: 14px; }
.source-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.source-box h3 { margin-bottom: 8px; }
.source-box a { display: inline-block; color: var(--pine); font-size: 13px; margin: 4px 14px 4px 0; }
.method-grid { padding: 24px 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.method-grid article span { color: var(--gold); font: 600 12px "Jost", "Segoe UI", sans-serif; }
.method-grid h3 { margin: 5px 0; }
.method-grid p, .formula-box p { color: var(--muted); font-size: 13px; }
.formula-box { margin: 0 26px 20px; background: var(--pine-soft); padding: 18px; border-radius: 0; border: 1px solid var(--border); }
.formula-box h3 { margin-bottom: 6px; }
.fine-print { margin: 0 26px 26px; color: var(--muted); font-size: 12px; }
.brand-footer { margin-top: 48px; padding: 28px 0 8px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand-footer p { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
@media (max-width: 980px) {
  .intro { grid-template-columns: 1fr; align-items: start; }
  .intro-actions { justify-self: start; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .lens-grid { grid-template-columns: 1fr; }
  .lens-card { border-right: 0; border-bottom: 1px solid var(--border); min-height: 106px; }
  .lens-card:last-child { border-bottom: 0; }
}
@media (max-width: 680px) {
  .topbar { height: 64px; padding: 0 16px; }
  .updated, .back-link { display: none; }
  main { padding: 0 16px 40px; }
  .intro { padding: 34px 0 24px; gap: 24px; }
  .intro-actions { width: 100%; }
  .intro-actions button { flex: 1; }
  .section-heading { display: block; }
  .section-heading > p { text-align: left; margin-top: 8px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 150px; }
  .chart-section { padding: 20px 14px 16px; }
  .legend { margin-top: 12px; }
  .swipe-hint { display: inline-flex !important; }
  .plot-wrap { overflow-x: auto; overscroll-behavior-inline: contain; padding-bottom: 22px; }
  .scatter { width: 720px; height: 300px; max-width: none; }
  .filters { margin-top: 16px; width: 100%; }
  .filters label { flex: 1; }
  .filters select, .filters input { width: 100%; }
  .sources-section { display: block; }
  .source-links { margin-top: 18px; display: grid; gap: 10px; }
  .detail-kpis, .method-grid { grid-template-columns: 1fr; }
  .dialog-head, #detailContent, .method-grid { padding-left: 18px; padding-right: 18px; }
  .formula-box, .fine-print { margin-left: 18px; margin-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
