/* Price Index — light/dark, system fonts, Cash Rate–style chrome. */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --paper: #f7f7f7;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --faint: #767676;
  --line: #e6e6e6;
  --accent: #2a3a4e;
  --soft: #f0f0f0;
  --max: 52rem;
  --chart-line: #2a3a4e;
  --chart-fill: #f7f7f7;
  --chart-grid: rgba(26, 26, 26, 0.12);
  --chart-text: #767676;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414;
  --paper: #1a1a1a;
  --ink: #e8e8e8;
  --muted: #a8a8a8;
  --faint: #8c8c8c;
  --line: #333333;
  --accent: #b7c7db;
  --soft: #262626;
  --chart-line: #c5d2e4;
  --chart-fill: #1a1a1a;
  --chart-grid: rgba(232, 232, 232, 0.12);
  --chart-text: #8c8c8c;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141414;
    --paper: #1a1a1a;
    --ink: #e8e8e8;
    --muted: #a8a8a8;
    --faint: #8c8c8c;
    --line: #333333;
    --accent: #b7c7db;
    --soft: #262626;
    --chart-line: #c5d2e4;
    --chart-fill: #1a1a1a;
    --chart-grid: rgba(232, 232, 232, 0.12);
    --chart-text: #8c8c8c;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--ink);
}

a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  padding: 1.1rem 0 0;
  background: var(--bg);
}

.site-header .wrap {
  display: flex;
  flex-direction: column;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 0.55rem;
  flex-wrap: wrap;
}

.brand {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.desk-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.desk-picker-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  flex: 0 0 auto;
}

.desk-select {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 12rem;
  border: 1px solid var(--line);
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.28rem 1.65rem 0.28rem 0.62rem;
  border-radius: 999px;
  cursor: pointer;
}

.desk-select:hover {
  border-color: var(--ink);
}

.theme-toggle {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--ink);
}

.site-nav {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.1rem 0;
  display: inline-block;
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1.5px 0 var(--ink);
}

.page {
  padding: 1.4rem 0 3.2rem;
}

.kicker {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.4rem;
}

h1 {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(1.45rem, 3.4vw, 1.95rem);
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin: 0 0 0.35rem;
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.lede,
.meta,
.note,
.legal,
figcaption,
.chart-note {
  color: var(--muted);
}

.lede {
  margin: 0 0 1rem;
  max-width: 40rem;
  font-size: 0.95rem;
}

.hero {
  padding: 0.2rem 0 1.2rem;
}

.official-value {
  margin: 0.5rem 0 0.15rem;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 8vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: lining-nums;
}

.official-period {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.panel {
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.panel + .panel,
.chart-panel,
.table-panel {
  margin-top: 1rem;
}

.index-ledger {
  border: 1px solid var(--line);
  background: var(--paper);
}

.ledger-head,
.ledger-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1.4fr) minmax(5rem, 0.9fr) minmax(6rem, 1fr) minmax(6rem, 1fr);
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  padding: 0.55rem 1rem;
}

.ledger-head {
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.ledger-row {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--soft);
  font-size: 0.92rem;
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-row:hover {
  background: var(--soft);
  color: var(--ink);
}

.ledger-row.is-lead .col-value {
  font-weight: 600;
}

.col-value {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

.series-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.series-table th,
.series-table td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--soft);
  text-align: left;
  vertical-align: top;
}

.series-table th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.series-table td.num,
.series-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.chart-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-note,
.note,
.legal {
  font-size: 0.9rem;
}

.note,
.legal {
  margin: 0.7rem 0 0;
  max-width: 46rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.site-footer .wrap {
  padding: 1rem 0 1.3rem;
  font-size: 0.92rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  color: var(--ink);
}

.footer-nav {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.ledger-row.is-comparison .col-series {
  color: var(--muted);
}

@media (max-width: 640px) {
  .brand-row {
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .desk-select {
    max-width: none;
    flex: 1 1 10rem;
  }

  .ledger-head,
  .ledger-row {
    grid-template-columns: 1fr 1fr;
  }

  .ledger-head .col-period,
  .ledger-head .col-source,
  .ledger-row .col-period,
  .ledger-row .col-source {
    display: none;
  }

  .series-table th:nth-child(4),
  .series-table td:nth-child(4) {
    display: none;
  }
}

@media (max-width: 480px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
