/* Tulsa Pantry Gap Map. Base tokens and typography follow the house style of
   ok-syringe-access / tech-hiring-gap; colors come from the dataviz skill's validated
   reference palette. The map ramp (--q1..--q4) is the blue ordinal ramp, validated
   with --ordinal in both modes; "none" is a neutral, not a ramp step. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d67;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;            /* pantries: categorical slot 2, orange */
  --accent-text: #1c5cab;
  --none: #e1e0d9;          /* zero / no data: neutral */
  --q1: #86b6ef; --q2: #3987e5; --q3: #1c5cab; --q4: #0d366b;
  --route: #a3a198;
  --tract-line: #fcfcfb;
  --out: #f9f9f7;           /* not high need, gap layer: outline only */
  --serif: "Iowan Old Style", "Source Serif 4", "Noto Serif", "Palatino Linotype", Palatino, "Charter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a198;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
    --s1: #3987e5; --s2: #d95926; --accent-text: #86b6ef; --none: #262624;
    --q1: #184f95; --q2: #3987e5; --q3: #6da7ec; --q4: #b7d3f6;
    --route: #6f6d67; --tract-line: #1a1a19; --out: #0d0d0d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a198;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --s1: #3987e5; --s2: #d95926; --accent-text: #86b6ef; --none: #262624;
  --q1: #184f95; --q2: #3987e5; --q3: #6da7ec; --q4: #b7d3f6;
  --route: #6f6d67; --tract-line: #1a1a19; --out: #0d0d0d;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 17px/1.6 var(--sans); }
a { color: var(--accent-text); text-underline-offset: 2px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.prose { max-width: 680px; }
p { margin: 0 0 16px; }

/* masthead */
.mast { padding: 56px 0 24px; }
.eyebrow { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; font-weight: 600; }
h1 { font-family: var(--serif); font-size: clamp(36px, 7vw, 68px); line-height: 1.02; letter-spacing: -0.025em; margin: 0 0 20px; font-weight: 700; max-width: 14em; text-wrap: balance; }
.dek { font-family: var(--serif); font-size: clamp(19px, 2.4vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 640px; margin: 0; text-wrap: pretty; }
.byline { font-size: 13.5px; color: var(--muted); margin-top: 18px; }

/* hero: the three windows side by side */
.hero { margin-top: 36px; padding-top: 20px; border-top: 2px solid var(--ink); }
.hero-head { font-size: 14px; color: var(--ink-2); margin: 0 0 14px; max-width: 40em; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.hs-val { font-family: var(--serif); font-size: clamp(36px, 7vw, 56px); line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.hs-lab { font-size: 14px; font-weight: 600; margin-top: 6px; }
.hs-sub { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 4px; }
.meter { height: 6px; border-radius: 3px; background: var(--none); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }

/* sticky nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--grid); }
.nav-in { max-width: 980px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; height: 48px; font-size: 14px; }
.nav-home { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.nav-links a:hover, .nav-links a.on { color: var(--ink); background: var(--ring); }
#theme { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--axis); background: transparent; color: var(--ink-2); font-size: 15px; cursor: pointer; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }

/* sections */
section.part { padding: 56px 0 8px; border-top: 1px solid var(--grid); margin-top: 40px; }
h2 { font-family: var(--serif); font-size: clamp(28px, 4.6vw, 40px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 18px; max-width: 20em; text-wrap: balance; }
h3 { font-size: 17px; margin: 28px 0 8px; }
.prose p, .prose li { font-family: var(--serif); font-size: 19px; line-height: 1.62; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 10px; }
.caveat { font-size: 15px; color: var(--ink-2); border-left: 3px solid var(--s2); background: color-mix(in srgb, var(--s2) 7%, transparent); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 20px 0; line-height: 1.55; }
.caveat strong { color: var(--ink); }

/* map figure */
figure { margin: 24px 0 12px; background: var(--surface); border-radius: 16px; padding: 18px 18px 12px; box-shadow: 0 0 0 1px var(--ring), 0 2px 10px rgba(0,0,0,.05); }
figcaption.title { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 0 0 4px; }
figcaption.sub { font-size: 14px; color: var(--ink-2); margin: 0 0 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 0 10px; }
.ctl-lab { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin-right: 6px; }
.seg { display: inline-flex; background: var(--page); border-radius: 999px; padding: 3px; box-shadow: inset 0 0 0 1px var(--grid); flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--ink-2); padding: 7px 13px; min-height: 36px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 0 0 1px var(--ring), 0 1px 3px rgba(0,0,0,.08); }
.ctl-group { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.mapbox { position: relative; border-radius: 12px; overflow: hidden; background: var(--page); box-shadow: inset 0 0 0 1px var(--grid); touch-action: none; }
.mapbox svg { display: block; width: 100%; height: auto; }
.tract { stroke: var(--tract-line); stroke-width: .6; vector-effect: non-scaling-stroke; cursor: pointer; }
.tract.out { stroke: var(--axis); stroke-width: .6; }
.tract.sel { stroke: var(--ink); stroke-width: 2.5; }
.tract.top { stroke: var(--ink); stroke-width: 1.6; }
.route { fill: none; stroke: var(--route); stroke-width: 1.4; vector-effect: non-scaling-stroke; pointer-events: none; opacity: .9; }
.pantry { stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: pointer; }
.pantry.open { fill: var(--s2); }
.pantry.closed { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4; }
.pantry.unlisted { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 2 2; }
.rank-label { font: 700 11px var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; text-anchor: middle; }
.place-label { font: 600 11px var(--sans); fill: var(--ink-2); paint-order: stroke; stroke: var(--page); stroke-width: 3px; pointer-events: none; text-anchor: middle; letter-spacing: .02em; }
.zoom-btns { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.zoom-btns button { width: 36px; height: 36px; border-radius: 8px; border: 0; background: var(--surface); color: var(--ink); font-size: 18px; box-shadow: 0 0 0 1px var(--ring), 0 1px 3px rgba(0,0,0,.12); cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
.legend .ramp { display: flex; align-items: center; gap: 2px; }
.legend .ramp span { display: inline-flex; flex-direction: column; align-items: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend .ramp i { display: block; width: 42px; height: 12px; border-radius: 3px; margin-bottom: 2px; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.k-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.k-out { display: inline-block; width: 14px; height: 10px; border: 1px solid var(--axis); background: var(--out); border-radius: 2px; }
.k-line { display: inline-block; width: 18px; height: 2px; background: var(--route); }
.k-ring { display: inline-block; width: 14px; height: 10px; border: 2px solid var(--ink); border-radius: 2px; }
.legend-title { font-weight: 650; color: var(--ink); width: 100%; font-size: 13.5px; }

/* info panel: below the map on phones, beside it on wide screens */
.map-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .map-layout { grid-template-columns: minmax(0, 1fr) 290px; } }
.info { background: var(--page); border-radius: 12px; padding: 14px 16px; font-size: 14px; box-shadow: inset 0 0 0 1px var(--grid); min-height: 120px; }
.info h4 { margin: 0 0 2px; font-size: 16px; line-height: 1.3; }
.info .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.info dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin: 0; }
.info dt { color: var(--ink-2); }
.info dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.info dd small { font-weight: 400; color: var(--muted); }
.info .sep { grid-column: 1 / -1; border-top: 1px solid var(--grid); margin: 6px 0 2px; }
.info .note { color: var(--muted); font-size: 12.5px; margin-top: 10px; line-height: 1.45; }
.info .hours { line-height: 1.5; margin: 6px 0; }
.flag { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--ring); color: var(--ink-2); margin: 2px 4px 2px 0; }
.src { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.src a { color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 12px; box-shadow: 0 0 0 1px var(--ring); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data td.where { min-width: 200px; }
table.data td.where small { display: block; color: var(--muted); font-size: 12px; }
table.data tr[data-geoid] { cursor: pointer; }
table.data tr[data-geoid]:hover td { background: var(--ring); }
.table-view { margin-top: 12px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--ink-2); padding: 6px 0; }
.table-view .table-wrap { max-height: 420px; overflow: auto; }
.moe { color: var(--muted); font-size: 12px; }

/* stat tiles for findings */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; }
.tile { background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: 0 0 0 1px var(--ring); border-top: 3px solid var(--s1); }
.tile .lab { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.tile .val { font-family: var(--serif); font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; }
.tile .sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* method list */
.method dt { font-weight: 700; margin-top: 18px; font-size: 16px; }
.method dd { margin: 4px 0 0; font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }
.checks { list-style: none; padding: 0; margin: 12px 0; font-size: 15px; }
.checks li { padding: 6px 0 6px 26px; position: relative; border-bottom: 1px solid var(--grid); line-height: 1.5; }
.checks li::before { content: "✓"; position: absolute; left: 4px; top: 6px; color: var(--s1); font-weight: 700; }
.checks li.fail::before { content: "✗"; color: #d03b3b; }

footer { border-top: 1px solid var(--grid); padding: 24px 0 48px; margin-top: 56px; font-size: 14px; color: var(--muted); }
footer code { font-size: 13px; }

/* sources page */
.srcs article { background: var(--surface); border-radius: 12px; padding: 18px 20px; box-shadow: 0 0 0 1px var(--ring); margin: 16px 0; }
.srcs h2 { font-size: 20px; margin: 0 0 2px; }
.srcs .pub { color: var(--ink-2); margin: 0 0 10px; font-size: 15px; }
.srcs dt { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 10px; }
.srcs dd { margin: 2px 0 0; font-size: 15px; word-break: break-word; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .mast { padding-top: 32px; }
  .nav-home { display: none; }
  .hero-stats { gap: 12px; }
  .hs-sub { display: none; }
  .hs-lab { font-size: 12.5px; }
  .prose p, .prose li { font-size: 17.5px; }
  figure { padding: 14px 10px 10px; margin-left: -6px; margin-right: -6px; border-radius: 12px; }
  .seg button { padding: 7px 10px; font-size: 13.5px; }
  .tile .val { font-size: 28px; }
  .legend .ramp i { width: 34px; }
}
@media (prefers-reduced-motion: no-preference) { .tract { transition: fill .25s ease; } }
@media (forced-colors: active) { .pantry.open { fill: CanvasText; } .tract { stroke: CanvasText; } }
