/* Overview: the filter row inside the navy hero, the stat tiles that overlap its lower edge,
   the "This week" strip, the district cards on their navy band, the closing band. */
.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.hero-over .hero-inner { padding-bottom: 150px; }
.hero-cta { min-height: 44px; padding: 0 18px; font-size: 15px; }
.hero-actions .btn { min-height: 44px; }
.hero-actions .share-status { color: var(--on-navy); }
.filter-card { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.filter-card .field { min-width: 200px; }
.filter-card .field > span { color: var(--ink-2); }
.filter-card select { min-height: 40px; }
.hero-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-top: 10px; }
.hero-foot .updated { margin-top: 0; }
.figures-asof { color: var(--muted); font-size: 14px; margin-top: 2px; }
.figures-asof:empty { display: none; }
.busy-note.sync-note { display: inline-flex; color: var(--on-navy-2); }
.lede-skel { max-width: 31em; gap: 12px; margin-top: 4px; }
.lede-skel .skel-line { height: 20px; }
.tiles-wrap { position: relative; max-width: 1128px; margin: -128px auto 0; padding: 0 20px; }
/* The tiles in two groups (founder, UX2 stop 4): what is open right now, whenever it was reported, and the year's two numbers
   under the switch that sets them. Each group's head sits on the hero's navy; where the groups stack, the year's head is its
   own navy bar over its two tiles. */
.tile-groups { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 14px; }
.tile-group { min-width: 0; display: flex; flex-direction: column; }
.tg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 44px; margin-bottom: 10px; background: var(--brand-navy); border-radius: var(--radius); }
.tg-label { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-navy-2); }
.tg-head .seg button { min-width: 84px; min-height: 40px; }
.tile-groups .tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-groups .tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile-groups .tile, .tile-groups .tile:nth-child(n+4) { grid-column: auto; }
.tg-note { margin: 8px 0 0; }
.tile-group .tiles { flex: 1; }
/* each section says what it counts: right now, the year chosen, the last 36 months, every district */
.sec-scope { margin: 0 0 0 auto; font-size: 13px; font-weight: 600; color: var(--on-navy-2); white-space: nowrap; }
.week-scope { margin: 4px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-navy-3); }
.tiles-wrap > .notice, .tiles-wrap > #load-error:not([hidden]) { margin-bottom: 14px; }
.tiles-wrap #notice-host:not(:empty) { margin-bottom: 14px; }

/* this week: a navy tab, then three figures on paper */
.week { display: grid; grid-template-columns: auto minmax(0, 1fr); margin-top: 16px; background: var(--paper-raised); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.week:empty { display: none; }
.week-tab { background: var(--brand-navy); padding: 14px 22px 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-right: 3px solid var(--brand-green); }
.week-tab .kicker { color: var(--on-navy); font-size: 13px; margin: 0; }
.week-dates { color: var(--on-navy-2); font-size: 14px; white-space: nowrap; }
.week-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.week-fig { padding: 12px 20px 13px; border-left: 1px solid var(--hairline); min-width: 0; }
.week-fig:first-child { border-left: 0; }
.week-fig dt { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.week-fig dd { margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.week-fig dd b { font-size: 28px; line-height: 1.15; }
.week-fig dd span { font-size: 13px; color: var(--muted); }
.week-skel { padding: 26px 20px; grid-column: 1 / -1; }

.tiles-band + .page { padding-top: 0; }
.page.figs > .section:first-of-type { margin-top: 36px; }
.answer-skel { max-width: 70ch; margin-top: 4px; }

/* district cards: paper cards on a navy band, each one a link to that district */
.dcards-band { background: var(--brand-navy); border-radius: var(--radius); border-top: 4px solid var(--brand-green); padding: 16px 18px 18px; margin-top: 14px; }
.dcards-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.dcards-title { color: var(--on-navy-2); font-size: 15px; }
.dcards-title strong { color: var(--on-navy); }
.dcards-all:empty { display: none; }
.dcards-all .btn { min-height: 40px; }
.dcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dcard { position: relative; background: var(--paper-raised); border: 1px solid transparent; border-radius: var(--radius); padding: 0 12px 12px; min-width: 0; display: flex; flex-direction: column; }
.dcards-band + .card { margin-top: 16px; }
.dcard:hover { box-shadow: 0 0 0 2px var(--brand-green); }
.dcard.is-selected { box-shadow: 0 0 0 3px var(--brand-green); }
.dcard-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin: 0 -12px; padding: 6px 12px 4px; text-decoration: none; color: var(--ink); background: var(--tint); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--hairline); }
.dcard-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }      /* the whole card is the link */
.dcard-link:focus-visible { outline: none; }
.dcard-link:focus-visible::after { outline: 3px solid var(--brand-green); outline-offset: 2px; }
.dcard-name { font-family: var(--font); font-size: 20px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
.dcard-go { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--link); }
.dcard.is-selected .dcard-link { background: var(--brand-navy-3); color: #fff; }
.dcard.is-selected .dcard-go { color: #fff; }
.dcard-rate { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 10px; min-height: 34px; }
.dcard-rate b { font-size: 28px; line-height: 1.15; }
.dcard-rate .too-early { font-size: 15px; min-width: 0; }
.dcard-rate-label { font-size: 13px; color: var(--muted); }
.dcard-none { color: var(--muted); }
.dcard-open { font-size: 14px; color: var(--ink-2); margin: 8px 0 6px; }
.dcard-open b { color: var(--ink); font-weight: 600; }
.dcard .mix { height: 10px; }
.dcard .mix .seg-part { height: 10px; }
.dcard-parts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; color: var(--ink-2); letter-spacing: -0.005em; }
.dcard-parts li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.dcard-parts .dot { width: 10px; height: 10px; }
.dcard-parts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2.4ch; text-align: right; }
.dcard .spark { margin-top: auto; padding-top: 12px; display: block; }
.dcard .spark svg { height: 30px; }
.dcard .spark-ends { display: flex; }
.dcard-skel { padding: 16px 0 4px; }

.cta-band { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; background: var(--brand-navy); border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.cta-band::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand-green); }
.cta-title { font-family: var(--font); font-size: 22px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
.cta-sub { color: var(--ink-2); margin-top: 2px; max-width: 62ch; }
.cta-band .btn { min-height: 44px; padding: 0 18px; }
@media (pointer: coarse), (max-width: 1023px) { .filter-card select, .tg-head .seg button { min-height: 44px; } .dcards-all .btn { min-height: 44px; } }
@media screen and (max-width: 1023px) {
  .dcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* the groups stack: the year's switch becomes a navy bar right over its two tiles */
  .tile-groups { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .tg-year .tg-head { padding: 4px 6px 4px 14px; }
  .sec-scope { white-space: normal; }
}
@media screen and (max-width: 719px) {
  /* phones: the words first, then the way to the map, then the choices */
  .hero-inner { display: flex; flex-direction: column; }
  .hero-top { display: contents; }
  .hero-inner > .lede { order: 1; }
  .hero-actions { order: 2; margin-top: 14px; }
  .hero-actions .hero-cta { flex: 1 1 auto; }
  .filter-card { order: 3; }
  .hero-foot { order: 4; }
  .figures-asof { order: 5; }
  .hero-over .hero-inner { padding-bottom: 124px; }
  .filter-card { gap: 10px 12px; margin-top: 16px; padding-top: 14px; }
  .filter-card .field { min-width: 0; flex: 1 1 100%; }
  .tiles-wrap { padding: 0 12px; margin-top: -110px; }
  .tile-groups .tiles-3, .tile-groups .tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-groups .tiles-3 .tile:first-child { grid-column: 1 / -1; }
  .tg-year .tg-head { padding: 6px; }
  .tg-year .tg-head .tg-label { padding-left: 8px; }
  .tg-head .seg { display: flex; flex: 1 1 100%; }
  .tg-head .seg button { flex: 1; }
  .sec-scope { margin-left: 0; flex-basis: 100%; }
  .week { grid-template-columns: 1fr; }
  .week-tab { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 10px 14px; border-right: 0; border-bottom: 3px solid var(--brand-green); }
  .week-tab .kicker { white-space: nowrap; }
  .week-scope { flex-basis: 100%; margin: 0; }
  .week-fig { padding: 10px 12px 11px; }
  .week-fig dd { display: block; }
  .week-fig dd b { display: block; font-size: 24px; }
  .week-fig dd span { display: block; line-height: 1.3; margin-top: 2px; }
  .dcards-band { padding: 14px 12px; margin-left: -4px; margin-right: -4px; }
  .dcards { grid-template-columns: 1fr; gap: 10px; }
  /* one district per row: the rate and the trend side by side, so eight cards stay a short scroll */
  .dcard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; align-items: start; }
  .dcard-link, .dcard .mix, .dcard-parts { grid-column: 1 / -1; }
  .dcard-rate { grid-column: 1; grid-row: 2; margin-top: 8px; }
  .dcard-open { grid-column: 1; grid-row: 3; margin: 2px 0 8px; }
  .dcard .spark { grid-column: 2; grid-row: 2 / span 2; padding-top: 10px; margin-top: 0; }
  /* the trend's two ends side by side when they fit in the half card, at least 6 px apart; when they do not (a four-digit count at 320 px
     ran past the card, and past the screen in two cities, FX2) the end goes under the start, still at the right. 6 px, not 8: at 375 px the
     two ends of a three-digit count have 7.9 px between them, which fitted (by a fraction of a pixel too little) and should not wrap */
  .dcard .spark-ends { flex-wrap: wrap; gap: 0 6px; }
  .dcard .spark-ends > :last-child { margin-left: auto; }
  .cta-band { padding: 18px 16px 18px 20px; }
  .cta-band .btn { width: 100%; }
}

/* the district table: always there on wide screens; on a phone a button folds it away (the cards above already compare the districts) */
.fold-toggle { display: none; }
@media screen and (max-width: 719px) {
  .district-table { border-top: 1px solid var(--hairline); margin-top: 12px; padding-top: 12px; }
  .fold-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 4px; padding: 0 14px; border: 1px solid var(--control-border); border-radius: var(--radius-s);
    background: var(--control-bg); color: var(--ink); font-weight: 500; font-size: 15px; cursor: pointer; }
  .fold-toggle::before { content: "▸"; }
  .fold-toggle[aria-expanded="true"]::before { content: "▾"; }
}
