/* Palette values are the validated reference instance. The three fund-type
   series (blue / orange / aqua) cleared all-pairs CVD and normal-vision gates
   in both modes. Light-mode aqua sits at 2.74:1 against the surface, below the
   3:1 bar -- so every fund-type mark carries a visible direct label and a table
   view exists. Colour never carries meaning alone here. */

:root {
  color-scheme: light;

  --surface-1: #fcfcfb;
  --plane:     #f9f9f7;
  --ink:       #0b0b0b;
  --ink-2:     #52514e;
  --muted:     #898781;
  --grid:      #e1e0d9;
  --axis:      #c3c2b7;
  --hairline:  rgba(11, 11, 11, 0.10);

  --series-1: #2a78d6;  /* General funds */
  --series-2: #eb6834;  /* Federal funds */
  --series-3: #1baf7a;  /* Special funds */

  --seq-200: #9ec5f4;
  --seq-350: #5598e7;
  --seq-450: #2a78d6;
  --seq-600: #184f95;

  --good: #0ca30c;
  --warn: #fab219;

  --radius: 10px;
  --wrap: 1140px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --plane:     #0d0d0d;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --grid:      #2c2c2a;
    --axis:      #383835;
    --hairline:  rgba(255, 255, 255, 0.10);
    --series-1:  #3987e5;
    --series-2:  #d95926;
    --series-3:  #199e70;
    --seq-200:   #184f95;
    --seq-350:   #256abf;
    --seq-450:   #3987e5;
    --seq-600:   #86b6ef;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --plane:     #0d0d0d;
  --ink:       #ffffff;
  --ink-2:     #c3c2b7;
  --grid:      #2c2c2a;
  --axis:      #383835;
  --hairline:  rgba(255, 255, 255, 0.10);
  --series-1:  #3987e5;
  --series-2:  #d95926;
  --series-3:  #199e70;
  --seq-200:   #184f95;
  --seq-350:   #256abf;
  --seq-450:   #3987e5;
  --seq-600:   #86b6ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--plane);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }

a { color: inherit; }

/* ------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 60px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 640; letter-spacing: -0.01em; text-decoration: none;
  margin-right: auto; font-size: 15px;
}
.brand-mark {
  width: 12px; height: 20px; border-radius: 3px;
  background: linear-gradient(var(--series-1) 0 33%, var(--series-2) 33% 66%, var(--series-3) 66% 100%);
}
.topnav { display: flex; gap: 20px; font-size: 14px; }
.topnav a { color: var(--ink-2); text-decoration: none; }
.topnav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.fy-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fy-label { color: var(--muted); }
#fy-select {
  font: inherit; font-size: 14px; padding: 5px 10px;
  border-radius: 8px; border: 1px solid var(--axis);
  background: var(--surface-1); color: var(--ink);
}

/* The budget-type qualifier is chrome, not a footnote: FY2027 is a proposal,
   not a fact, and the distinction has to survive scrolling. */
.basis-strip {
  font-size: 12.5px; text-align: center; padding: 5px 24px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-2);
}
.basis-strip[data-kind="projected"] { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.basis-strip[data-kind="actual"]    { background: color-mix(in srgb, var(--good) 11%, transparent); }

/* ---------------------------------------------------------------- hero */

.hero { padding: 64px 24px 40px; }
.eyebrow {
  margin: 0 0 12px; font-size: 12.5px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.hero-figure {
  margin: 0; font-size: clamp(48px, 9vw, 92px); line-height: 1;
  letter-spacing: -0.035em; font-weight: 680;
}
.hero-sub { margin: 14px 0 0; font-size: 19px; color: var(--ink-2); max-width: 58ch; }
.hero-note {
  margin: 24px 0 0; font-size: 14.5px; color: var(--muted);
  max-width: 64ch; padding-left: 14px; border-left: 2px solid var(--axis);
}

/* ------------------------------------------------------------ sections */

.section { padding: 44px 24px; border-top: 1px solid var(--hairline); }
.section-head { max-width: 68ch; margin-bottom: 28px; }
.section-head h2 {
  margin: 0 0 10px; font-size: 30px; letter-spacing: -0.022em; font-weight: 660;
}
.section-lede { margin: 0; color: var(--ink-2); font-size: 16px; }

.panel {
  margin: 0; background: var(--surface-1);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 20px;
}
.panel figcaption { margin-bottom: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 16px; font-weight: 640; }
.panel-note { margin: 0; font-size: 13px; color: var(--muted); }

.split-grid {
  display: grid; gap: 20px; margin-top: 22px;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

/* --------------------------------------------------------- fund split */

.fund-split { display: grid; gap: 12px; }
.fund-bar { display: flex; width: 100%; height: 46px; gap: 2px; }
.fund-seg {
  border-radius: 4px; position: relative; min-width: 3px;
  display: flex; align-items: center; justify-content: center;
  cursor: default; transition: filter .12s;
}
.fund-seg:hover { filter: brightness(1.08); }
.fund-seg-label {
  font-size: 12px; font-weight: 640; color: #fff;
  white-space: nowrap; padding-inline: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.fund-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13.5px; }
.fund-legend-item { display: flex; align-items: center; gap: 8px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.fund-legend-amt { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fund-legend-pct { color: var(--muted); }

/* -------------------------------------------------------------- chart */

.chart { display: grid; gap: 7px; }
.row {
  display: grid; grid-template-columns: minmax(120px, 1.1fr) 3fr auto;
  gap: 12px; align-items: center; font-size: 13.5px;
}
.row-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-track { display: block; background: var(--grid); border-radius: 4px; height: 15px; overflow: hidden; }
/* display:block is load-bearing. These are <span>s, and width/height are
   ignored on inline elements -- without it the fill collapses to nothing and
   every bar renders as an identical empty grey track. The track itself gets
   away with it only because it is a direct grid child and so is blockified. */
.row-fill { display: block; height: 100%; border-radius: 4px; background: var(--seq-450); }
.row-val { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 78px; text-align: right; }

.table-toggle { margin-top: 16px; font-size: 13px; }
.table-toggle summary { cursor: pointer; color: var(--ink-2); }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--hairline); }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.caveat {
  margin-top: 22px; padding: 14px 16px; font-size: 13.5px; color: var(--ink-2);
  background: color-mix(in srgb, var(--warn) 9%, var(--surface-1));
  border: 1px solid var(--hairline); border-radius: var(--radius);
}

/* ------------------------------------------------------------- drill */

.crumbs { display: flex; flex-wrap: wrap; gap: 7px; font-size: 13.5px; margin-bottom: 16px; }
.crumbs button {
  font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--series-1); text-decoration: underline; text-underline-offset: 2px;
}
.crumbs .sep { color: var(--muted); }
.crumbs .current { color: var(--ink-2); }

.drill { min-height: 220px; }
.card-list { display: grid; gap: 8px; }
.card {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 13px 16px; color: inherit;
  transition: border-color .12s, transform .12s;
}
.card:hover { border-color: var(--series-1); transform: translateX(2px); }
.card-name { font-weight: 560; font-size: 14.5px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-amt { font-variant-numeric: tabular-nums; font-size: 14.5px; white-space: nowrap; }
.card-meter { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.card-meter i { display: block; height: 100%; background: var(--seq-350); border-radius: 3px; }

/* The statutory "why" text -- visually the most prominent thing on a
   programme page, because it is the answer to the question the site asks. */
.why {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-left: 3px solid var(--series-1);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px;
}
.why h4 { margin: 0 0 8px; font-size: 12.5px; letter-spacing: .07em;
          text-transform: uppercase; color: var(--muted); font-weight: 600; }
.why p { margin: 0; font-size: 15.5px; line-height: 1.6; }
.why .attrib { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.detail-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ---------------------------------------------------------- trendline */

.trend { width: 100%; height: 132px; display: block; overflow: visible; }
.trend .grid-line { stroke: var(--grid); stroke-width: 1; }
.trend .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
.trend .line-projected { stroke-dasharray: 5 4; }
.trend .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.trend text { font-size: 10.5px; fill: var(--muted); }

/* --------------------------------------------------------- recipients */

.search { display: flex; gap: 10px; margin-bottom: 20px; max-width: 560px; }
.search input {
  flex: 1; font: inherit; font-size: 15px; padding: 10px 14px;
  border: 1px solid var(--axis); border-radius: 9px;
  background: var(--surface-1); color: var(--ink);
}
.search select {
  font: inherit; font-size: 14px; padding: 0 10px;
  border: 1px solid var(--axis); border-radius: 9px;
  background: var(--surface-1); color: var(--ink); flex: none;
}
.search button {
  font: inherit; font-weight: 580; padding: 10px 20px; cursor: pointer;
  border: 0; border-radius: 9px; background: var(--series-1); color: #fff;
}
.vendor-results { display: grid; gap: 8px; }

/* -------------------------------------------------------- methodology */

.sources-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.source-card {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px;
}
.source-card h4 { margin: 0 0 6px; font-size: 14.5px; }
.source-card p { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.source-card dl { margin: 0; font-size: 12.5px; color: var(--muted);
                  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.source-card dt { font-weight: 600; }
.source-card dd { margin: 0; font-variant-numeric: tabular-nums; }

.limits { margin-top: 30px; max-width: 76ch; }
.limits h3 { font-size: 17px; margin: 0 0 12px; }
.limits ul { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.limits li { font-size: 14.5px; color: var(--ink-2); }

.foot {
  border-top: 1px solid var(--hairline); padding: 28px 0 48px;
  font-size: 13px; color: var(--muted);
}
.foot p { margin: 0 0 6px; }

.loading { color: var(--muted); font-size: 14px; padding: 28px 0; }
.error {
  color: var(--ink); background: color-mix(in srgb, #d03b3b 12%, var(--surface-1));
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; font-size: 14px;
}

@media (max-width: 720px) {
  .topnav { display: none; }
  .row { grid-template-columns: minmax(90px, 1fr) 2fr auto; font-size: 12.5px; }
  .hero { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
