/* StaffData local directories
   Palette taken from Stockport itself: viaduct brick, Mersey green, millstone grey. */
:root {
  --paper: #f2f4f1;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #5b6672;
  --line: #d6dbd5;
  --brick: #a23e2a;
  --brick-soft: #f4e3dd;
  --mersey: #24695a;
  --mersey-ink: #1b5246;
  --mersey-soft: #dcece6;
  --slate: #7d8792;
  --focus: #2f6fd6;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171c; --surface: #1a2128; --ink: #e8ece9; --muted: #9aa5ae; --line: #2c353e;
    --brick: #e07a62; --brick-soft: #3a2420; --mersey: #5cbfa6; --mersey-ink: #8fd8c4; --mersey-soft: #1c3631;
    --slate: #6e7883; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12171c; --surface: #1a2128; --ink: #e8ece9; --muted: #9aa5ae; --line: #2c353e;
  --brick: #e07a62; --brick-soft: #3a2420; --mersey: #5cbfa6; --mersey-ink: #8fd8c4; --mersey-soft: #1c3631;
  --slate: #6e7883; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); font-variant-numeric: tabular-nums; }
a { color: var(--mersey-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.muted { color: var(--muted); }
.pos { color: var(--mersey); }
.neg { color: var(--brick); }

/* ---------- header ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 19px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; background: var(--brick); border-radius: 11px 11px 2px 2px; }
.top-nav { display: flex; gap: 20px; font-size: 15px; }
.top-nav a { color: var(--ink); text-decoration: none; }
.top-nav a:hover { text-decoration: underline; }


.sponsor-band { background: var(--ink); color: var(--paper); font-size: 14px; }
.sponsor-band-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.sb-label { opacity: .75; }
.sb-sponsor { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.sb-sponsor img { display: block; max-height: 28px; width: auto; }
.sb-sponsor:hover strong { text-decoration: underline; }
.sb-tag { opacity: .75; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 40px; }
@media (min-width: 960px) { .hero { padding: 72px 0 56px; } }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: end; }
.hero-in > * { min-width: 0; }
@media (min-width: 960px) { .hero-in { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; } }
.place { margin: 0 0 12px; color: var(--muted); font-weight: 600; font-size: 15px; }
h1 { font: 800 clamp(40px, 7vw, 76px)/0.98 var(--display); letter-spacing: -0.03em; margin: 0 0 20px; max-width: 12ch; }
.lede { font-size: 18px; max-width: 54ch; margin: 0 0 28px; color: var(--ink); }
.hero-search { display: flex; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-md); padding: 4px; max-width: 560px; }
.hero-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 17px; padding: 12px 12px; color: var(--ink); }
.hero-search input:focus { outline: none; }
.hero-search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.hero-search button { border: 0; border-radius: var(--r-sm); background: var(--mersey); color: #fff; font: 600 16px var(--body); padding: 0 22px; cursor: pointer; }
.hero-search button:hover { background: var(--mersey-ink); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 32px 0 0; max-width: 560px; }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, minmax(0, max-content)); justify-content: start; gap: 24px 24px; max-width: none; } }
.facts div { border-left: 3px solid var(--line); padding-left: 12px; display: flex; flex-direction: column; }
.facts dt { font-size: 13px; color: var(--muted); max-width: 22ch; line-height: 1.35; }
.facts dd { margin: auto 0 0; padding-top: 2px; font: 700 26px/1.1 var(--display); letter-spacing: -0.01em; }

.hero-chart { margin: 0; }
.viaduct { width: 100%; height: auto; display: block; overflow: visible; }
.v-base { stroke: var(--ink); stroke-width: 2; }
.v-up { fill: var(--brick); }
.v-down { fill: var(--slate); }
.v-link { cursor: pointer; }
.v-link:hover path, .v-link:focus-visible path { opacity: .82; }
.v-val { font: 700 13px var(--body); fill: var(--ink); text-anchor: middle; }
.v-key { font: 600 13px var(--body); fill: var(--muted); text-anchor: middle; }
.hero-chart figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .v-up, .v-down { transform-box: fill-box; animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
  .v-up { transform-origin: bottom; }
  .v-down { transform-origin: top; }
  .v-link:nth-of-type(2) path { animation-delay: .04s } .v-link:nth-of-type(3) path { animation-delay: .08s }
  .v-link:nth-of-type(4) path { animation-delay: .12s } .v-link:nth-of-type(5) path { animation-delay: .16s }
  .v-link:nth-of-type(6) path { animation-delay: .2s } .v-link:nth-of-type(7) path { animation-delay: .24s }
  .v-link:nth-of-type(8) path { animation-delay: .28s } .v-link:nth-of-type(9) path { animation-delay: .32s }
  @keyframes rise { from { transform: scaleY(0); } }
}

/* ---------- directory ---------- */
.directory { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 32px 0 48px; scroll-margin-top: 0; }
.dir-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 960px) { .dir-in { grid-template-columns: 270px minmax(0, 1fr); gap: 40px; } }

.filters { display: none; flex-direction: column; gap: 18px; }
.filters.is-open { display: flex; }
@media (min-width: 960px) { .filters { display: flex; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; padding-right: 4px; } }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; }
.filters h2 { font: 700 22px var(--display); margin: 0; }
.filters label, .filters legend { display: block; font-size: 14px; font-weight: 600; }
.filters select { display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; font-size: 15px; padding: 10px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); }
.seg { border: 0; padding: 0; margin: 0; }
.seg legend { margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { flex: 1; margin: 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 14px; }
.seg label:first-of-type span { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.seg label:last-of-type span { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.seg label + label span { border-left: 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

.link-btn { background: none; border: 0; padding: 0; color: var(--mersey-ink); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn-primary { display: inline-block; border: 0; border-radius: var(--r-sm); background: var(--mersey); color: #fff; font: 600 16px var(--body); padding: 12px 18px; cursor: pointer; text-align: center; text-decoration: none; }
.btn-primary:hover { background: var(--mersey-ink); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.export-box { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--mersey-soft); border-radius: var(--r-md); }
.fine { margin: 0; font-size: 13px; color: var(--muted); }

.supporters { display: flex; flex-direction: column; gap: 10px; }
.supporters h3 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.supporter { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-size: 14px; }
.supporter img { max-height: 32px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.supporter strong { font-size: 15px; }
.supporter span { color: var(--muted); }
.supporter:hover { border-color: var(--ink); }
.open-slot { border-style: dashed; }

/* results */
.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
#count { margin: 0; flex: 1; min-width: 200px; color: var(--muted); }
#count strong { color: var(--ink); font: 700 22px var(--display); }
.sort { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sort select { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); }
.btn-filters { display: inline-block; font: 600 15px var(--body); padding: 9px 16px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); cursor: pointer; }
.btn-export-m { display: inline-block; font: 600 15px var(--body); padding: 10px 16px; border: 0; background: var(--mersey); color: #fff; border-radius: var(--r-sm); cursor: pointer; }
@media (min-width: 960px) { .btn-filters, .btn-export-m { display: none; } }

.table { border-top: 2px solid var(--ink); }
.tr { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr) 118px 100px 130px; gap: 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.th { font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 4px; }
.num { text-align: right; }
.co-btn { all: unset; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.co-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.co-name { font-weight: 600; line-height: 1.3; }
.co-btn:hover .co-name { text-decoration: underline; text-underline-offset: 3px; }
.co-sub { font-size: 13px; color: var(--muted); }
.c-ind { font-size: 14px; line-height: 1.35; }
.c-ind small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.tag { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); cursor: help; }
.detail .wide { grid-column: 1 / -1; }
@media (max-width: 820px) { .c-ind .tag { margin-left: 6px; margin-top: 0; } }
.c-inc { font-size: 14px; color: var(--muted); }
.c-hc { font-weight: 600; }
.chg { display: inline-flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
.chg b { font-weight: 700; }
.chg small { font-size: 13px; min-width: 44px; text-align: right; opacity: .85; }
.chg.flat { color: var(--muted); }
.tr.is-open { background: var(--paper); }
.detail { grid-column: 1 / -1; padding: 6px 0 4px; }
.detail dl { display: grid; gap: 12px 28px; margin: 0; }
@media (min-width: 720px) { .detail dl { grid-template-columns: 1fr 1fr; } }
.detail dt { font-size: 13px; color: var(--muted); }
.detail dd { margin: 2px 0 0; font-size: 15px; }
.detail-links { display: flex; gap: 20px; margin: 14px 0 0; font-size: 15px; font-weight: 600; }

.promo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 16px; margin: 10px 0; background: var(--brick-soft); border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-size: 14px; }
.promo span { color: var(--muted); }
.promo strong { font-size: 16px; }
.promo em { font-style: normal; color: var(--muted); }
.promo:hover strong { text-decoration: underline; }
.promo-open { background: transparent; border: 1px dashed var(--line); }

.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 24px; }
.pager button { font: 600 14px var(--body); min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); cursor: pointer; }
.pager button[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .gap { align-self: center; color: var(--muted); padding: 0 4px; }

/* mobile: rows become cards */
@media (max-width: 820px) {
  .th { display: none; }
  .tr { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 2px; }
  .c-co { grid-column: 1 / -1; }
  .c-ind, .c-inc { grid-column: 1 / -1; }
  .c-ind small { display: inline; margin-left: 6px; }
  .c-inc::before, .c-hc::before { content: attr(data-label) " "; color: var(--muted); font-weight: 400; font-size: 13px; }
  .c-inc::before { content: "Incorporated "; }
  .c-hc { text-align: left; }
  .c-hc::before { content: "Staff "; }
}

/* ---------- about + footer ---------- */
.about { padding: 48px 0; }
.about-in { display: grid; gap: 32px; }
@media (min-width: 860px) { .about-in { grid-template-columns: 1fr 1fr; gap: 56px; } }
.about h2 { font: 700 24px var(--display); margin: 0 0 10px; letter-spacing: -0.01em; }
.about p { margin: 0; max-width: 60ch; color: var(--ink); }
.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; font-size: 14px; color: var(--muted); }
.foot-in { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.foot p { margin: 0; }
.foot a { color: inherit; }

/* ---------- export dialog ---------- */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(10, 20, 30, .28); }
.dlg::backdrop { background: rgba(18, 24, 30, .55); }
.dlg form { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.dlg h2 { font: 700 26px/1.1 var(--display); margin: 0; letter-spacing: -0.01em; }
.dlg p { margin: 0; color: var(--muted); }
.ex-sponsor { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--brick-soft); border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.ex-sponsor span { font-size: 13px; color: var(--muted); }
.ex-sponsor img { max-height: 36px; width: auto; align-self: flex-start; }
.ex-sponsor strong { font-size: 18px; }
.ex-sponsor em { font-style: normal; color: var(--muted); font-size: 14px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px 16px; }
.btn-secondary { font: 600 16px var(--body); padding: 11px 18px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); cursor: pointer; }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 520px) { .dlg-actions { flex-direction: column-reverse; align-items: stretch; } .dlg-actions .btn-primary, .dlg-actions .btn-secondary { width: 100%; } .dlg-actions .link-btn { align-self: center; padding: 8px; } }

/* ---------- towns index ---------- */
.towns { padding: 56px 0 72px; }
.town-list { display: grid; gap: 16px; margin-top: 32px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.town-card { display: flex; flex-direction: column; gap: 6px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.town-card h2 { font: 700 28px var(--display); margin: 0; letter-spacing: -0.02em; }
.town-card p { margin: 0; color: var(--muted); font-size: 15px; }
a.town-card:hover { border-color: var(--ink); }
.town-card.soon { border-style: dashed; }
@media (max-width: 959px) {
  #count { flex-basis: 100%; }
  .sort { font-size: 0; flex: 1; min-width: 0; gap: 0; }
  .sort select { font-size: 15px; width: 100%; padding: 9px 8px; }
}

#rows.is-loading { opacity: .55; transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) { #rows.is-loading { transition: none; } }
.more-note { margin: 20px 0 0; padding: 14px 16px; background: var(--paper); border-radius: var(--r-md); color: var(--muted); font-size: 15px; }

