/* ============================================================
   state-page.css — Per-city deep-dive page layout (city.html).
   The filename and the .state-page / .sp-* prefixes are inherited
   from the Signals scorecard this design system came from; they are
   kept to avoid a wide rename, and mean "detail page" here.
   Page chrome leans on rankings-page.css (.rp-card, .rp-table,
   .rp-section-title); this file just adds the hero, the figure,
   the rank pills, the map frame, and the empty state.
   ============================================================ */

.state-page {
  max-width: var(--max-width);
  margin: 0 auto;
  /* Reserves the chrome that overlays y = 0 — see rankings-page.css. */
  padding: calc(var(--space-7) + var(--chrome-overlay-h)) var(--space-5) var(--space-7);
  /* HOLDS THE FOOTER BELOW THE FOLD WHILE THE RECORD IS IN FLIGHT.
     #city-shell is `hidden` until the fetch resolves, so without this
     the main collapses to its own padding, the footer settles around
     y=213, and the reveal throws it down the page — one shift worth
     0.18 of a CLS of 0.56, which is in Core Web Vitals' "poor" band on
     the page a press link is most likely to point at.

     The reserve is a viewport minus whatever chrome is ABOVE us in
     flow, so the footer starts exactly at the fold and is never on
     screen to be moved. --chrome-flow-h, not --chrome-h: a fixed nav
     overlays this box rather than displacing it, and inside the
     WordPress theme the two differ. Falls back to 0px, which is its
     standalone value. Inert once the record lands — the loaded page is
     several times this tall — so it costs the common case nothing. */
  min-height: calc(100svh - var(--chrome-flow-h, 0px));
}

/* ── Hero ───────────────────────────────────────────────── */
.sp-hero {
  display: grid;
  /* EIGHT COLUMNS AND FOUR. It was `minmax(280px, 380px)` on a --space-6
     gutter, which is a size rather than a position: the figure card
     landed at x=1021, the only block on this page not starting on a
     column line. Four columns put it on column 9 (x=958) and give it
     448px — more than the 380px cap it had — and the headline keeps
     eight columns, which is 920px for a 76px display face. */
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--span-4));
  column-gap: var(--grid-gutter);
  row-gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-6);
}
.sp-back {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
  width: max-content;
}
/* Hover and focus share the colour promotion and NOTHING ELSE. They used
   to share an `outline: none` as well, which did nothing for hover — the
   global ring in base.css is :focus-visible only, so hover had no outline
   to suppress — and silently took the keyboard ring off the back link,
   because `.sp-back:focus-visible` (0,2,0) outranks `a:focus-visible`
   (0,1,1). That left colour as the sole focus indicator on this page's
   only navigation control. Outline is left undeclared here so the base
   rule keeps applying it; the cascade resolves per property. */
.sp-back:hover,
.sp-back:focus-visible { color: var(--primary-bright); }

/* ── Touch target ───────────────────────────────────────────
   "← All cities" is the page's back door and it is 20px tall. It sits
   alone above the title with nothing beside it, so the hit area can
   reach in every direction without colliding with anything — a
   negative-inset ::before takes it to 44px and leaves the hero grid
   exactly as it was. Short height is in the query because a landscape
   phone passes every width arm at 852px wide. */
@media (hover: none) and (pointer: coarse), (max-width: 720px), (max-height: 500px) {
  .sp-back { position: relative; }
  .sp-back::before {
    content: '';
    position: absolute;
    inset: -12px;
  }
}

/* Left column: eyebrow → title → dek (stacked, left-aligned) */
.sp-hero .eyebrow {
  grid-column: 1;
  margin: 0;
}
.sp-hero h1.display {
  grid-column: 1;
  font-size: clamp(40px, 6vw, 76px);
  margin: 0;
  line-height: 1.02;
  /* No max-width — let it fill the left column so it doesn't squish */
}
.sp-hero .dek {
  grid-column: 1;
  max-width: var(--measure-text);
  margin: 0;
}

/* Right column: big figure card, right-aligned, bottom-aligned with the dek */
.sp-hero-figure {
  grid-column: 2;
  grid-row: 2 / span 3;
  justify-self: end;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(79, 140, 255, 0.07), rgba(79, 140, 255, 0.02));
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  /* No max-width: the grid column sizes it now. */
}
.sp-hero-figure-label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sp-hero-figure-value.figure {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(56px, 7vw, 88px);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sp-hero-figure-value .sp-unit {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.32em;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-left: var(--space-2);
  vertical-align: super;
}
/* Was .sp-hero-figure-grade / .sp-grade-label, and the name was the
   tell: it held a bucketed word under the figure. It now carries one
   thing only — the fact that this period has no reading — so it is
   styled at the volume that fact deserves rather than as a caption. */
.sp-hero-figure-note {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
}
.sp-hero-figure-note[hidden] { display: none; }
.sp-figure-note-label {
  color: var(--text-soft);
  font-size: var(--text-md);
  font-weight: 700;
}

/* ── Rank pills ─────────────────────────────────────────── */
.sp-rank-pills {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* ── The reader's city, on a city page ─────────────────────
   Either "Your city · Not Boston?" or an offer to make it one. It
   sits under the rank pills because it is the last thing in the hero
   a reader needs, not the first: the figure, the rank and the pills
   all answer the question they came with, and this answers what to
   do about it. */
.sp-yourcity {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
}
.sp-yourcity[hidden] { display: none; }
.sp-yourcity .caption { color: var(--muted); }
/* THE ROW WRAPS; ITS ITEMS HAVE TO BE ABLE TO AS WELL. Both of these
   lines name the city — "Not Boston?" and "Set Boston as your city" —
   so both carry an export-supplied name. A flex item's automatic
   minimum is min-content, so the name held the row open past the
   viewport even though the row itself was free to wrap; the inherited
   break-word in base.css cannot help until the item is allowed to be
   narrower than its longest word. text-align is for the <button>,
   which would otherwise centre its second line against the
   left-aligned first. */
.sp-yourcity > * {
  min-width: 0;
  text-align: start;
}
/* Its own line inside the flex row: the comparison is a sentence about
   the data, and the button under it is an action. Running them together
   would read as one clause. */
.sp-yourcity__compare {
  flex: 0 0 100%;
  color: var(--text-soft);
}
.sp-pill {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(79, 140, 255, 0.04);
  font-size: var(--text-sm);
  color: var(--text-soft);
}
.sp-pill strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sp-pill .sp-pill-meta {
  color: var(--muted);
  font-size: var(--text-xs);
}

@media (max-width: 820px) {
  /* minmax(0, 1fr), not 1fr — a bare 1fr is minmax(AUTO, 1fr), and that
     auto floor is the track's min-content, i.e. the longest unbreakable
     word in it. The two-column rule above already spells this out; this
     override dropped the guard, so a 98-character city name blew the
     single column out to 999px inside a 393px viewport and took the
     eyebrow, headline, dek, CTA and figure card off the screen with it. */
  .sp-hero { grid-template-columns: minmax(0, 1fr); }
  .sp-hero h1.display { font-size: clamp(36px, 9vw, 56px); }
  .sp-hero-figure {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    max-width: none;
  }
}

/* ── KPI strip override ─────────────────────────────────── */
.state-page .kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ── KPI bands ───────────────────────────────────────────
   Replaces .kpi-strip--eight, which laid eight identically weighted
   cards in a grid because eight divides cleanly by four. It did, and
   that was the whole argument for it — the layout was chosen by the
   arithmetic of the card count rather than by what the figures mean.
   Read back, it said curb extent is as important as price, and that
   all eight are as important as each other.

   Two bands now, split on the only line a reader draws here: what it
   costs, and what is there. Price is the half that moves with the
   period toggle, so it leads at figure size. Supply is context for the
   ranking, so it follows at two-thirds the size and drops its card
   chrome entirely — a hairline rule and a caption are enough structure
   for four counts that are read as a set, not compared one to one.

   Neither band is a card. The section already sits inside the page's
   own rhythm; wrapping seven figures in seven boxes inside a strip
   inside a section was three levels of container for one idea. */
.kpi-bands {
  display: grid;
  gap: var(--space-6);
  width: 100%;
}
.kpi-band-caption {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-4);
}
.kpi-band-items {
  display: grid;
  /* The grid gutter, not a spacing-scale value that happens to match:
     two blocks align only if they share a container AND a gutter. */
  gap: var(--grid-gutter);
}

/* BOTH BANDS ARE FOUR COLUMNS, and that is the whole point of them
   being here rather than each taking the count its own content
   suggests. The lead band held three prices on a 3-up and the quiet
   band four counts on a 4-up, stacked directly on top of each other:
   items landed at x = 24/491/958 and 24/374/725/1075, so eight figures
   in two rows produced seven different vertical edges and only the left
   margin lined up.

   A 3-up and a 4-up cannot be reconciled — 12/3 lands on columns 1,5,9
   and 12/4 on 1,4,7,10, coinciding only at the first — so one of them
   had to move. The lead band moved: it now fills three of four columns
   and leaves the fourth open, which reads as breathing room at the end
   of a row and costs nothing, where a mismatched rhythm cost the reader
   an alignment they could have scanned down. */
.kpi-band-items { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Both bands take --figure-size from .kpi. They used to run 38px over
   21px, and because they sit directly on top of each other on the same
   four-column grid, the step read as two different components rather
   than one page's figures.

   The quiet band is still quiet — its label is muted and it carries no
   box. That is enough to say "supply, which does not move" against
   "price, which changes with the period toggle"; it does not also need
   to be half the size. */
.kpi-band--quiet .kpi .label { color: var(--muted); }

/* The band supplies the structure, so the tile supplies none. */
.kpi-bands .kpi {
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  gap: var(--space-2);
}

/* A price band of three and a supply band of two both fold to two, then
   to one. The step is still set by the tile: "OFF-STREET LOTS" over a
   four-figure count stops fitting under about 160px. */
@media (max-width: 900px) {
  .kpi-band-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .kpi-band-items { grid-template-columns: minmax(0, 1fr); }
}

/* ── Sections ───────────────────────────────────────────── */
.sp-section { margin-top: var(--space-6); }

/* ── The closing invitation ─────────────────────────────────
   MOVED 2026-10-05 to rankings-page.css, beside the grid it fits into.
   The ranking page closes with the same third column now, and this
   file is not loaded there — see ".rp-next-list .rp-next-find-title"
   in that file. Nothing about the column is city-page-specific. */

/* ── The neighborhood a link arrived at ─────────────────────
   ?hood= scrolls one row into view and marks it (see
   applyHoodDeepLink in js/city-detail.js). --primary, NOT the gold the
   ranking's saved-city row uses: the two marks mean different things —
   "the city you saved" against "the row you followed a link to" — and
   on the one page that could show both, two golds would say they were
   the same thing.

   The mark is not the only carrier. The row also takes programmatic
   focus, so a reader on a screen reader hears the row rather than
   being left to notice a tint. It survives exactly until the next
   render: a sort, a filter or a period change rewrites the table, by
   which point the reader has arrived and moved on. */
#cp-hood-table tbody tr.is-hood-target > td {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}
#cp-hood-table tbody tr.is-hood-target > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--primary-bright);
}
#cp-hood-table tbody tr.is-hood-target:focus-visible {
  outline: 2px solid var(--primary-bright);
  outline-offset: -2px;
}

.rp-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}
@media (max-width: 1180px) {
}

/* ── Map ────────────────────────────────────────────────── */
.sp-map-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.sp-map {
  width: 100%;
  height: 620px;
  background: var(--surface-1);
}
@media (max-width: 720px) {
  .sp-map { height: 460px; }
}
/* The floating .sp-map-legend / .sp-los-toggle block that used to live here
   was a Signals-era artifact: a row of traffic-light chips, each a colored
   dot beside a letter grade, toggling LOS bands on the map. Parking has no
   bands to toggle — the ramp is continuous — so nothing rendered it. Removed
   rather than left to be copied. */
.sp-map-note {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: var(--space-3) 0 0;
}
/* Printed under the map where no neighborhood clears the coverage floor.
   CAPTION SIZE, not body size: it was body text while it stood in for
   the map and was the section's whole content, but the map is drawn
   again and this now sits beside the note it replaces, under the same
   frame. At body size it outweighed the caption above the map and read
   as the section's subject rather than as the reason the shapes are
   missing. The bolded first clause still carries the finding. */
.sp-map-blurb {
  color: var(--muted);
  max-width: var(--measure-text);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: var(--space-3) 0 0;
}
.sp-map-blurb strong { color: var(--text); }

/* ── Mapbox dark popup ──────────────────────────────────── */
.sp-map .mapboxgl-popup-content {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.sp-map .mapboxgl-popup-tip { border-top-color: var(--surface-2); }
.sp-map .mapboxgl-popup-close-button { color: var(--muted); }
/* The zoom control is styled once, in css/components/map.css, and it
   is theme-aware there. The two rules that used to sit here — an
   opaque --surface-2 panel and a hard-coded invert on the icons —
   pinned it to dark mode and left the + and − invisible on light. */
.sp-popup-row { display: flex; gap: var(--space-2); align-items: baseline; }
/* The scope line in a neighborhood popup — present only when the
   polygon sits outside the downtown area, so it reads as a caveat on this
   one rather than a field every popup carries. */
.sp-popup-scope .label {
  color: var(--muted);
  font-style: italic;
  font-size: var(--text-xs);
  white-space: normal;
}

.sp-popup-row .label { color: var(--muted); font-size: var(--text-xs); letter-spacing: 0.06em; }
.sp-popup-row .value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Empty / error state ────────────────────────────────── */
/* Left-aligned, like every other page on this site. Centred, with a
   display headline over a centred paragraph over a centred button, this
   was the one screen that did not look like it belonged to the same
   product — and it is the screen a reader lands on when something has
   already gone wrong, which is the worst moment to change register.

   The `code` rule went with the URL syntax it used to set; nothing in
   an empty state should be showing the reader a query string. */
.sp-empty {
  max-width: var(--reading-width);
  margin: var(--space-7) 0;
}
/* --primary, not --gold-text. The accessibility note in .impeccable.md
   listed three places the brand gold lands as ink on the light theme and
   singled this one out as "the one to watch": the other two are a
   thousands comma and a full stop, and this is real words at 12px.
   Measured against the actual page it read 1.56:1 — the words "No city
   selected" and "City not found" were all but invisible on the DEFAULT
   theme, on the screen a reader reaches when something has already gone
   wrong.

   The gold was carrying a warning tint, but the 72px headline under it
   already carries that. Every other eyebrow on the site is --primary,
   which reads 5.93:1 here — so this both fixes the contrast and removes
   a colour exception rather than adding one. The token itself is
   untouched: the accepted trade for gold as a decorative mark stands. */
.sp-empty .eyebrow { color: var(--primary); margin-bottom: var(--space-3); }
.sp-empty .dek { margin: 0 0 var(--space-5); }

/* ── Table wrap ─────────────────────────────────────────────
   This page used to override the shared `max-height: 640px` to none,
   on the reasoning that a neighborhood table is short. Two problems.

   Most are short — but San Francisco lists 71 rows and Los Angeles 50,
   and `max-height` does nothing to a table that fits under it, so the
   override bought nothing for the short ones.

   Worse, `overflow: auto` survived. A scroll container that can never
   scroll gives its `position: sticky` head zero travel, so the column
   headings silently did not stick anywhere on this page — you scrolled
   71 rows of numbers with no idea which column was which.

   Inheriting the shared rule fixes that, and it keeps the head inside
   its own scroller where it can never collide with the sticky settings
   bar above it. */
