/* Arkansas Fiscal Mechanics -- shared design system.
 *
 * Sibling to arkansas-enrollment-viz. The token block below reuses that
 * tool's exact CSS custom-property NAMES and VALUES (--surface-1,
 * --page-plane, --text-primary, ... plus the --band-covid/--band-efa
 * era-shading pair), so a reader who has seen the enrollment tool reads this
 * one as the same system. The enrollment viz inlines this block per page;
 * this tool factors the shared tokens + layout grammar + verification-badge
 * system into one linked stylesheet instead (still a fully static site, no
 * build step) so the token definitions are single-sourced across five views
 * -- the whole point being cross-view consistency. Each view adds only its
 * OWN view-specific CSS inline.
 *
 * The three --verify-* tokens are NEW to this tool (the enrollment viz has no
 * verification concept). They are an ordinal sequential ramp in a
 * teal-leaning hue, deliberately outside the enrollment tool's blue/gray/red
 * typology ramp, so a verification badge is never mistaken for a trajectory
 * color. See shared.js CLASSIFICATION for the rationale and the always-present
 * text label that keeps color off the critical path.
 */

:root {
  --surface-1:      #fcfcfb;
  --page-plane:     #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --border:         rgba(11,11,11,0.44);
  --link:           #2a78d6;
  --band-covid:     rgba(208, 59, 59, 0.08);
  --band-efa:       rgba(27, 175, 122, 0.09);

  /* Verification badges (ordinal: exact strongest -> observed weakest).
     Light mode: darker/more-saturated teal = stronger. Each has a matching
     faint --*-bg fill for the pill background. */
  --verify-exact:      #0f6b5c;
  --verify-exact-bg:   rgba(15, 107, 92, 0.12);
  --verify-applied:    #3a8fb0;
  --verify-applied-bg: rgba(58, 143, 176, 0.12);
  --verify-observed:   #7d7a73;
  --verify-observed-bg: rgba(125, 122, 115, 0.13);

  /* Preliminary / computed marker (fy36) -- amber, distinct from the
     verification ramp; means "this figure is provisional," a different axis
     from how-verified. */
  --prelim:            #b5730c;
  --prelim-bg:         rgba(181, 115, 12, 0.12);

  /* District Funding Detail chart palette (the "lag, drawn" two-line chart,
     the dollars bars, and the ledger's proportional bars). The two-line pair
     is enrollment (blue, == --link) vs. funding basis (green, NEW). Blue+green
     sit on the CVD deutan/protan confusion axis, so the pair is only used WITH
     the always-present secondary encodings the approved mock established:
     right-edge DIRECT LABELS on both lines, a signed gap fill, and distinct
     vertical separation -- meeting the "distinguishable with a secondary
     channel" bar rather than relying on hue alone. --series-basis is the one
     new validated token the mock needed (the token set had no green). The
     ledger's own bars reuse --link / --cushion / --growth; the ledger's
     verification DOTS reuse the teal --verify-* ramp above (not the mock's
     stand-in blue), keeping verification a single visual language sitewide. */
  --series-enroll:     var(--link);        /* enrollment line (3q ADM) */
  --series-basis: var(--cat-5);            /* funding-basis line (lagged ADM) */
  --gap-funded:        rgba(0, 131, 0, 0.14);   /* basis > enrollment (funded, departed) */
  --gap-unfunded:      rgba(42, 120, 214, 0.13);/* enrollment > basis (enrolled, not yet funded) */
  --bar-strong:        var(--link);        /* dollars chart, selected year */
  --bar-dim:           #9ec5f4;            /* dollars chart, other years */
  --cushion:           #eb6834;            /* declining-enrollment cushion / negative amounts */
  --growth:            #2a78d6;            /* student-growth funding */

  /* Complete-funding-picture stacked-bar layers (Phase 2.2). Categorical order,
     from the approved drill-down-mock_v2_complete_picture.html:
       1 state    = --link (blue)          2 req_local = --series-basis (green)
       3 add_local = magenta               4 federal   = amber
     Slots 3/4 are sub-3:1 on the surface by design; the legend + direct labels
     + the State Aid Table provide the "distinguishable by a second channel"
     relief (same rule the two-line chart uses). (A fifth "on-behalf" layer was
     investigated and dropped -- see qa/registry_revenue_layers.md.) */
  --layer-state:       var(--link);
  --layer-req:         var(--series-basis);
  --layer-add:         #e87ba4;
  --layer-fed:         #eda100;

  /* Categorical palette — shared vocabulary across both sibling sites (keep byte-identical). */
  --cat-1: #2a78d6;   /* blue   */
  --cat-2: #eb6834;   /* orange */
  --cat-3: #1baf7a;   /* teal   */
  --cat-4: #008300;   /* green  */
  --cat-5: #008300;   /* green (brightens in dark) */
  --cat-6: #e87ba4;   /* pink   */
  --cat-7: #eda100;   /* amber  */
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --border:         rgba(255,255,255,0.33);
    --link:           #3987e5;
    --band-covid:     rgba(230, 103, 103, 0.10);
    --band-efa:       rgba(25, 158, 112, 0.12);

    /* Dark mode: brighter teal = stronger (inverted from light, same as the
       enrollment tool inverts its ramps). */
    --verify-exact:      #4fc9b3;
    --verify-exact-bg:   rgba(79, 201, 179, 0.16);
    --verify-applied:    #6fc0dc;
    --verify-applied-bg: rgba(111, 192, 220, 0.15);
    --verify-observed:   #a3a099;
    --verify-observed-bg: rgba(163, 160, 153, 0.15);

    --prelim:            #e0a44a;
    --prelim-bg:         rgba(224, 164, 74, 0.16);

    /* Dark mode: brighter series so both lines clear the surface, and stronger
       gap tints. The basis green is lifted from the mock's #008300 to a
       legible mid-green on the near-black plane (the mock was reviewed in
       light mode); the direct-label CVD relief is unchanged. */
    --series-basis: var(--cat-5);
    --gap-funded:        rgba(53, 168, 84, 0.22);
    --gap-unfunded:      rgba(57, 135, 229, 0.20);
    --bar-dim:           #184f95;
    --cushion:           #d95926;
    --growth:            #3987e5;

    /* Layers on the near-black plane: pink/amber lifted for legibility. */
    --layer-add:         #ec8fb3;
    --layer-fed:         #e0a44a;
  
    --cat-1: #3987e5;
    --cat-2: #d95926;
    --cat-3: #199e70;
    --cat-4: #008300;
    --cat-5: #35a854;
    --cat-6: #d55181;
    --cat-7: #c98500;
  }
}

/* Respect a reader's data-theme override the same way the Artifact/enrollment
   conventions do -- explicit toggle wins over the OS preference in both
   directions. (Present for parity; the static site itself ships no toggle
   today, but any future one will Just Work.) */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Two content widths: the reading column (720px, matching the enrollment
   tool) for prose-first pages, and a wide plane for the State Aid Table / Total Funding Table
   that need horizontal room. Wide content always scrolls inside its own
   container, never the page body. */
.page { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
/* The two table pages. Widened from 1120px because the Total Funding Table outgrew
   it once the wealth column landed, and the cap was silently scrolling the
   Status column -- advertised in the page lede AND the landing card -- off the
   right edge on a desktop with room to spare (Phase 2.4 rec 7). */
.page-wide { max-width: 1400px; margin: 0 auto; padding: 40px 24px 80px; }

.view-nav { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }
.view-nav a { color: var(--link); }
.view-nav .current { color: var(--text-primary); font-weight: 600; }

h1 { font-size: 26px; font-weight: 700; margin: 0 0 14px; line-height: 1.25; }
.lede { font-size: 17px; font-weight: 600; color: var(--text-primary); margin: 0 0 16px; }
p { margin: 0 0 16px; color: var(--text-secondary); }
p a, li a { color: var(--link); }

h2 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gridline);
}

/* Hero stats -- same anatomy as the enrollment landing (large tabular-nums
   figures, ink tokens only, no red/green coloring of headline numbers). */
.hero-stats { display: flex; flex-wrap: wrap; gap: 20px; margin: 20px 0 40px; }
.hero-stat { flex: 1 1 180px; min-width: 0; }
.hero-stat .stat-number {
  font-size: 34px; font-weight: 800; line-height: 1.1;
  color: var(--text-primary); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.hero-stat .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Verification badge -- a small pill carrying the class swatch + text label.
   Text label is mandatory (color is never the sole channel; see shared.js).
   `data-verify` = exact | applied | observed selects the token pair. */
.verify-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 8px; border-radius: 999px;
  white-space: nowrap; vertical-align: middle;
}
.verify-badge .verify-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.verify-badge[data-verify="exact"]    { color: var(--verify-exact);    background: var(--verify-exact-bg); }
.verify-badge[data-verify="exact"]    .verify-dot { background: var(--verify-exact); }
.verify-badge[data-verify="applied"]  { color: var(--verify-applied);  background: var(--verify-applied-bg); }
.verify-badge[data-verify="applied"]  .verify-dot { background: var(--verify-applied); }
.verify-badge[data-verify="observed"] { color: var(--verify-observed); background: var(--verify-observed-bg); }
.verify-badge[data-verify="observed"] .verify-dot { background: var(--verify-observed); }

/* Preliminary marker pill (fy36). */
.prelim-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  color: var(--prelim); background: var(--prelim-bg);
}

/* Meta links + footer -- footer carries the same author bio the enrollment
   tool uses (the footer-methodology convention the handoff calls out); the
   exact prose lives in each page so it's greppable/editable, but the styling
   is shared here. */
.meta-links { margin-top: 28px; font-size: 13px; color: var(--text-muted); }
.meta-links a { color: var(--text-secondary); }
.site-footer {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--gridline);
  font-size: 13px; color: var(--text-muted);
}
.site-footer a { color: var(--text-secondary); }

/* Data vintage -- "how fresh is this?", answered in every footer, built from
   the data files themselves (see scripts/build_vintage.py). */
.vintage {
  margin: 10px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.vintage strong { color: var(--text-secondary); font-weight: 600; }

/* Companion-site cross-link -- points readers to the sibling K-12 enrollment
   site. One-directional for now (enrollment adds no reverse link until this
   site is live). Design unification Phase 1a. */
.companion { margin: 10px 0 0; font-size: 13px; }

/* Skip link -- first focusable element on every page, visible only on focus.
   Every view is nav-then-content, so without this a keyboard user tabs the
   same six nav links before reaching anything new (Phase 2.4 rec 17). */
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--surface-1); color: var(--link);
  border: 1px solid var(--link); border-radius: 8px;
  padding: 9px 14px; font-size: 14px; font-weight: 600; text-decoration: none;
  transition: top 120ms;
}
.skip-link:focus { top: 8px; }
/* the landmark itself must not draw a focus ring when targeted by the skip link */
main:focus { outline: none; }

/* Available to assistive tech, invisible on screen -- for header rows that a
   sighted reader gets from layout but a screen reader has no other route to. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* Tabular figures everywhere numbers are compared in a column. */
.num { font-variant-numeric: tabular-nums; }

/* Glossary term (Phase 2.3 jargon layer) -- a dotted-underline span with a
   plain-language tooltip on hover, focus, or tap. The dotted underline + help
   cursor + accessible label carry the "defined term" meaning without relying on
   color; the tip itself is one shared floating element (see shared.js
   initGlossary). Underline uses text-decoration so it never adds layout height
   (keeps the statewide "glossary-only = zero layout change" carve-out true). */
.gloss {
  text-decoration: underline dotted var(--text-muted);
  text-underline-offset: 2px;
  cursor: help;
}
.gloss:hover, .gloss:focus-visible { text-decoration-color: var(--link); color: var(--text-primary); }
.gloss:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
.gloss-tip {
  position: absolute; z-index: 50; max-width: 300px;
  background: var(--surface-1); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  padding: 9px 12px; font-size: 12.5px; line-height: 1.45;
}
