/* chiwardboard — clean civic light-first; dark selected, not flipped.
   Data colors per the validated viz palette; Chicago flag colors as chrome only. */
:root {
  color-scheme: light dark;
  --page: #fbfbf9;
  --surface: #ffffff;
  --ink: #14141a;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e7e6e0;
  --border: rgba(11, 11, 11, 0.10);
  --bar: #2a78d6;
  --bar-thin: #c3c2b7;
  --chi-blue: #7cc6e8;      /* flag stripe */
  --chi-red: #e4002b;       /* flag star */
  --accent: #0e6ba8;        /* chrome accent, deep lake blue */
  --map-empty: #e7e6e0;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Big Shoulders", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #101014;
    --surface: #1a1a1f;
    --ink: #f4f4f0;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c31;
    --border: rgba(255, 255, 255, 0.10);
    --bar: #3987e5;
    --bar-thin: #52514e;
    --chi-blue: #5da8cc;
    --chi-red: #ef3d5d;
    --accent: #5fb0dd;
    --map-empty: #2c2c31;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15.5px/1.55 var(--sans); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 34px 20px 64px; }
@media (min-width: 1400px) { .wrap { max-width: 1360px; } }
a { color: inherit; }

/* masthead */
.wordmark { display: flex; align-items: center; gap: 14px; }
.flag { width: 74px; height: 24px; flex: none; }
.flag .stripe { fill: var(--chi-blue); }
.flag .stars path { fill: var(--chi-red); }
.wordmark h1 {
  font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: 0.015em;
  margin: 0; text-transform: uppercase;
}
.wm-accent { color: var(--accent); }
.tagline { color: var(--ink-2); margin: 6px 0 0; }

/* hook */
.hook { margin: 40px 0 26px; }
.hook-line {
  font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1.08;
  text-transform: uppercase; letter-spacing: 0.01em; margin: 0; max-width: 24ch; text-wrap: balance;
}
.hook-sub { color: var(--ink-2); margin: 12px 0 0; max-width: 62ch; }
.fig { font-family: var(--mono); font-size: 0.92em; }

/* type switcher */
.types { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.types button {
  font: 600 13.5px/1 var(--sans); color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
}
.types button:hover { border-color: var(--accent); color: var(--ink); }
.types button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* finder */
.finder { margin: 0 0 26px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.finder-label { display: block; font: 700 12px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin-bottom: 8px; }
.finder-row { display: flex; gap: 8px; flex-wrap: wrap; }
.finder-row input {
  flex: 1 1 240px; font: 15px var(--sans); color: var(--ink);
  background: var(--page); border: 1px solid var(--grid); border-radius: 8px; padding: 9px 12px;
}
.finder-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.finder-row button {
  font: 600 14px var(--sans); border-radius: 8px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.finder-row button#finder-gps { background: transparent; color: var(--accent); }
.finder-note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }

/* your-ward card */
.mine { margin: 0 0 26px; padding: 14px 16px; border-left: 4px solid var(--chi-red); background: var(--surface); border-radius: 0 10px 10px 0; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.mine h3 { font-family: var(--display); text-transform: uppercase; font-size: 20px; margin: 0 0 4px; }
.mine p { margin: 0; color: var(--ink-2); }
.mine .err { color: var(--ink-2); }

/* board layout */
.board-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(540px, 600px); gap: 26px; align-items: start; }
@media (max-width: 820px) { .board-grid { grid-template-columns: minmax(0, 1fr); } }
.pane-title { font-family: var(--display); text-transform: uppercase; font-weight: 700; font-size: 19px; margin: 0 0 8px; }
.map-pane { position: sticky; top: 14px; min-width: 0; }
@media (max-width: 820px) {
  .map-pane { position: static; }
  /* stacked layout: keep the map a readable panel, not a full-screen column */
  .map-box { max-width: min(100%, 460px); margin-left: auto; margin-right: auto; }
}
.map-box { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
#map { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 400 / 486; }
#map path {
  stroke: var(--surface); stroke-width: 0.8; cursor: pointer;
  transition: fill .12s ease;
}
#map path:hover { stroke: var(--ink); stroke-width: 1.6; }
#map path.sel { stroke: var(--chi-red); stroke-width: 2.4; }
#map:hover path:not(:hover):not(.sel) { fill-opacity: 0.82; }
.map-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--ink); color: var(--page); font-size: 12.5px; line-height: 1.4;
  padding: 6px 9px; border-radius: 6px; white-space: nowrap;
}
.map-tip .fig { color: inherit; }
.map-tip .tip-cta { opacity: .7; font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }

/* table */
.board-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 480px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 9px; border-bottom: 1px solid var(--grid);
}
td { padding: 6px 9px; border-bottom: 1px solid var(--grid); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
tbody tr.mine-row { background: color-mix(in srgb, var(--chi-red) 7%, transparent); }
.c-rank { width: 2.4em; }
.c-num, td.c-num, th.c-num { text-align: right; }
.c-bar { width: 44%; }
td.c-rank { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
td.c-ward { font-weight: 600; }
td.c-ward > a { white-space: nowrap; }
td.c-ward .row-sub { white-space: normal; }
td.c-ward .thin-tag {
  font-weight: 500; font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--grid); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  vertical-align: 1px; white-space: nowrap;
}
td.c-num { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
td.c-src { font-size: 12px; }
td.c-src a { color: var(--muted); }
.barcell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.bar {
  height: 9px; background: var(--bar);
  border-radius: 0 4px 4px 0;
  flex: none;
  max-width: calc(100% - 4em);  /* the tip label always fits */
}
tr.thin .bar { background: var(--bar-thin); }
.bar-val { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

/* methodology + footer */
.method { margin: 34px 0 0; }
.method h2 { font-family: var(--display); text-transform: uppercase; font-size: 18px; letter-spacing: 0.02em; color: var(--ink); margin: 0 0 8px; }
.method ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); font-size: 14px; max-width: 82ch; }
.method > p { max-width: 82ch; }
.method li { margin: 0 0 6px; }
.foot { margin-top: 42px; padding-top: 14px; border-top: 1px solid var(--grid); color: var(--muted); font-size: 12.5px; }
.foot p { margin: 0 0 6px; }

/* shared: subpages, ward labels, share */
.wrap.narrow { max-width: 720px; }
.masthead a.home { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.crumb { font-size: 13.5px; margin: 22px 0 6px; }
.crumb a { color: var(--accent); text-decoration: none; }
.ward-title { font-family: var(--display); text-transform: uppercase; font-weight: 800; font-size: 40px; margin: 4px 0 2px; }
.ward-sub { color: var(--ink-2); margin: 0 0 12px; }
.ward-actions { margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.share-btn {
  font: 600 13.5px var(--sans); cursor: pointer; border-radius: 999px; padding: 8px 16px;
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
}
.share-btn:hover { background: var(--accent); color: #fff; }
.share-done { font-size: 13px; color: var(--ink-2); }
.row-sub { font-size: 12px; color: var(--muted); }
td .row-sub a, .row-sub { font-weight: 400; }
td.c-ward a { text-decoration: none; color: inherit; }
td.c-ward a:hover { color: var(--accent); }
#map text {
  font: 700 11.5px var(--sans); fill: var(--ink); pointer-events: none;
  paint-order: stroke; stroke: var(--surface); stroke-width: 2.8px; stroke-linejoin: round;
}

/* ward report card fits a phone without horizontal scroll */
.card-table table { min-width: 0; }
.card-table td, .card-table th { padding-left: 8px; padding-right: 8px; }

@media (max-width: 480px) {
  .wordmark h1 { font-size: 25px; }
  .flag { width: 56px; height: 18px; }
  .hook-line { font-size: 34px; }
}

/* ward office contact block */
.office {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 20px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
@media (max-width: 700px) { .office { grid-template-columns: 1fr; gap: 22px; } }
.office-h {
  font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 10px;
}
.office-name { font-weight: 650; margin: 0 0 10px; }
.office-row { display: flex; gap: 12px; padding: 5px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.office-row:first-of-type { border-top: 0; }
.office-k { flex: 0 0 84px; color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.office-v { flex: 1; color: var(--ink-2); }
.office-v a { color: var(--accent); }
.office-alt { color: var(--muted); font-size: 12.5px; }
.office-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.file-btn {
  display: inline-block; margin: 4px 0 2px;
  font: 600 14px var(--sans); text-decoration: none;
  background: var(--accent); color: #fff;
  border-radius: 8px; padding: 10px 16px;
}
.file-btn:hover { filter: brightness(1.08); }

.table-gloss { font-size: 12.5px; color: var(--muted); margin: 10px 2px 0; max-width: 78ch; }
.method code { font-family: var(--mono); font-size: 0.92em; }
