/* Sightline — the page is built to read as a map application, because that is
   what the result is for: somebody looking at an unfamiliar city and deciding
   where the cars go. Light surfaces, one elevation scale, and a single
   pale-blue -> blue -> red ramp shared by the choropleth, the charts and the
   exported feature maps, so "bright" means the same thing everywhere. */
:root {
  --land: #e9ebee;
  --water: #aadaff;
  --bg: #f6f7f9;
  --surface: #fff;
  --surface-2: #f1f3f4;
  --line: #e2e5e9;
  --line-2: #cdd2d8;
  --text: #1f2126;
  --muted: #5f6368;
  --dim: #858b92;
  --blue: #1a73e8;
  --blue-soft: #e8f0fe;
  --red: #d93025;
  --green: #188038;
  --r-card: 14px;
  --r-tile: 8px;
  --sh-1: 0 1px 2px rgba(60, 64, 67, .2), 0 1px 3px 1px rgba(60, 64, 67, .09);
  --sh-2: 0 1px 3px rgba(60, 64, 67, .22), 0 4px 10px 3px rgba(60, 64, 67, .09);
  --sh-3: 0 2px 6px rgba(60, 64, 67, .24), 0 10px 28px 4px rgba(60, 64, 67, .12);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Google Sans Text", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
[hidden] { display: none !important; }
.wrap { width: min(1120px, 92vw); margin: 0 auto; }
.wrap-wide { width: min(1440px, 95vw); margin: 0 auto; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; height: 58px;
  padding: 0 max(16px, 2.5vw);
  background: var(--surface); box-shadow: var(--sh-1);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.brand .mark {
  width: 20px; height: 20px; flex: none; border-radius: 50% 50% 50% 2px;
  transform: rotate(-45deg);
  background: linear-gradient(140deg, var(--blue), #4285f4 55%, var(--red));
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 500; letter-spacing: .2px;
}
.spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------------------------------------------------------------- hero */
.hero { padding: 54px 0 10px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  height: 26px; padding: 0 12px 0 10px; border-radius: 999px;
  background: var(--blue-soft); color: #174ea6;
  font-size: 12px; font-weight: 500; letter-spacing: .2px;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .18);
}
h1 {
  font-size: clamp(30px, 4.2vw, 52px); line-height: 1.08;
  letter-spacing: -1.6px; font-weight: 600; margin-bottom: 22px; max-width: 22ch;
}
h1 .accent { color: var(--blue); }
.ledes { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; max-width: 1000px; }
.lede { font-size: 15.5px; line-height: 1.62; color: var(--muted); }
.lede strong { color: var(--text); font-weight: 600; }
.lede em { font-style: normal; color: var(--text); }

/* --------------------------------------------------------------- bands */
.band { padding: 44px 0; }
.band.pad { padding: 30px 0 56px; }
h2 { font-size: clamp(21px, 2.4vw, 30px); line-height: 1.18; letter-spacing: -.8px; font-weight: 600; }
.sub { font-size: 14.5px; color: var(--muted); margin-top: 8px; }
.sechead { margin-bottom: 20px; }

/* ------------------------------------------------------- the map stage */
/* The panel floats over the map the way a map app's sidebar does, so it is a
   sibling of the stage rather than a child of it — below 1080px it drops out of
   the overlay and becomes an ordinary card underneath. */
.explorer { position: relative; }
.mapstage {
  position: relative; height: 620px; border-radius: var(--r-card); overflow: hidden;
  background: var(--land); box-shadow: var(--sh-2);
  touch-action: none;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#map.dragging { cursor: grabbing; }
#map .zone { stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; }
#map .zone:hover { stroke: #202124; stroke-width: 1.6; }
#map .zone.sel { stroke: #202124; stroke-width: 2.4; }
#map .lake { fill: var(--water); stroke: none; }

/* the floating furniture of a map: panel, legend, controls, attribution */
.panel {
  position: absolute; left: 14px; top: 14px; width: 352px; max-height: calc(100% - 28px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 12px; box-shadow: var(--sh-3);
  overflow: hidden;
}
.p-search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px;
  border-bottom: 1px solid var(--line); flex: none;
}
.p-search svg { flex: none; color: var(--muted); }
.p-search b { font-size: 14.5px; font-weight: 500; }
.p-search span { font-size: 12px; color: var(--dim); margin-left: auto; flex: none; }
.p-body { padding: 16px 16px 18px; overflow: auto; }
.p-name { font-size: 21px; font-weight: 600; letter-spacing: -.4px; line-height: 1.2; }
.p-meta { font-size: 12px; color: var(--dim); margin-top: 5px; font-family: var(--mono); }
.p-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 12px; }
.num { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.num b {
  display: block; font-size: 25px; font-weight: 600; letter-spacing: -.8px;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.num span {
  display: block; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--dim); margin-top: 3px;
}
.num.pred { background: var(--blue-soft); border-color: #d2e3fc; }
.num.pred b { color: #174ea6; }
.rankrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.rankrow b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.rankrow .good { color: var(--green); }
.rankrow .off { color: var(--red); }
.p-hint { font-size: 12px; line-height: 1.55; color: var(--dim); margin-top: 12px; }

.mapctl {
  position: absolute; right: 14px; bottom: 14px;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 9px; box-shadow: var(--sh-2); overflow: hidden;
}
.mapctl button {
  width: 40px; height: 40px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1; font-family: inherit;
}
.mapctl button:hover { background: var(--surface-2); color: var(--text); }
.mapctl button + button { border-top: 1px solid var(--line); }
.maplegend {
  position: absolute; right: 14px; top: 14px;
  background: var(--surface); border-radius: 9px; box-shadow: var(--sh-2);
  padding: 10px 12px 11px; width: 190px;
}
.maplegend .lg-t {
  font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 7px;
}
.rampbar { height: 7px; border-radius: 4px; background: linear-gradient(90deg, #d6e3fc, #4285f4 52%, #d93025); }
.lg-s { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); margin-top: 5px; }
.mapattr {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 10.5px; color: #6b7178; background: rgba(255, 255, 255, .82);
  padding: 3px 8px; border-radius: 5px;
}
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  transform: translate(-50%, -142%);
  background: #202124; color: #fff; border-radius: 7px; padding: 6px 9px;
  font-size: 12px; white-space: nowrap; box-shadow: var(--sh-2);
}
.tip i { display: block; font-style: normal; font-size: 11px; color: #bdc1c6; margin-top: 1px; }

/* -------------------------------------------------- the network, large */
.netcard {
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--sh-2);
  padding: 16px 18px 18px;
}
.net-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.net-h b { font-size: 14.5px; font-weight: 600; }
.net-h span { font-size: 12.5px; color: var(--dim); }
.flowstrip { display: flex; align-items: flex-start; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.stage { flex: 1 1 0; min-width: 108px; }
.stage .shot {
  border-radius: var(--r-tile); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.stage img { width: 100%; aspect-ratio: 1; display: block; image-rendering: pixelated; }
.stage.chip-in img { image-rendering: auto; }
.stage .st-l { font-size: 11px; font-weight: 600; letter-spacing: .3px; margin-top: 8px; }
.stage .st-s { font-size: 11px; color: var(--dim); font-family: var(--mono); }
.stage.chip-in .st-l { color: var(--blue); }
.arrow {
  flex: 0 0 26px; display: flex; align-items: center; justify-content: center;
  color: var(--line-2); align-self: center; margin-bottom: 34px;
}
.outbox {
  flex: 0 0 auto; min-width: 152px; align-self: center; margin-bottom: 34px;
  border-left: 3px solid var(--blue); padding: 2px 0 2px 14px;
}
.outbox b {
  display: block; font-size: 34px; font-weight: 600; letter-spacing: -1.4px;
  color: #174ea6; line-height: 1; font-variant-numeric: tabular-nums;
}
.outbox span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.net-x { font-size: 12.5px; line-height: 1.62; color: var(--muted); margin-top: 14px; max-width: 104ch; }
.net-x b { color: var(--text); font-weight: 600; }

/* -------------------------------------------------------- result cards */
.resultgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rescard {
  background: var(--surface); border-radius: 12px; box-shadow: var(--sh-1);
  padding: 16px 18px 8px; border-top: 3px solid var(--line-2);
}
.rescard.hot { border-top-color: var(--blue); }
.rc-h { font-size: 14.5px; font-weight: 600; }
.rc-h span { display: block; font-weight: 400; color: var(--dim); font-size: 12px; margin-top: 2px; }
.rc-rows { display: flex; gap: 26px; margin-top: 14px; }
.rc-rows div { flex: 1; border-top: 1px solid var(--line); padding: 9px 0 12px; }
.rc-rows span { display: block; font-size: 11px; letter-spacing: .4px; color: var(--dim); text-transform: uppercase; }
.rc-rows b { font-size: 23px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.resnote { font-size: 14.5px; line-height: 1.62; color: var(--muted); max-width: 92ch; margin-top: 18px; }
.resnote b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------- local inference card */
.runcard { margin-top: 16px; border-left: 3px solid var(--blue); }
.runbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.runbar button { border: 0; cursor: pointer; font-family: inherit; }
.runbar button:disabled { opacity: .55; cursor: default; }
.runbar span { font-size: 12.5px; color: var(--muted); flex: 1 1 320px; }
#live { margin-top: 16px; }
#live canvas {
  width: 100%; aspect-ratio: 1; display: block; border-radius: var(--r-tile);
  border: 1px solid var(--line); background: var(--surface-2);
  image-rendering: pixelated;
}
#live .stage.chip-in canvas { image-rendering: auto; }
.pending { opacity: .35; }

/* -------------------------------------------------------- epoch slider */
.band.alt { background: #eef0f3; }
.epochbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border-radius: 12px; box-shadow: var(--sh-1);
  padding: 14px 18px; margin-bottom: 18px;
}
.epochbar label {
  font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--dim);
}
.epochbar input[type=range] {
  /* Bounded rather than greedy: left to flex-grow it pushed the epoch number
     to the far edge of the card, a screen away from the slider setting it. */
  flex: 0 1 420px; min-width: 200px; accent-color: var(--blue); height: 22px; cursor: pointer;
}
.epochbar b {
  font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--blue); min-width: 2.5ch; text-align: right;
}
.epochbar b + span {
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  margin-left: 10px; padding-left: 16px; border-left: 1px solid var(--line);
}
.tagged {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: #fdeceb; color: #a5271d; font-size: 10.5px; font-weight: 500;
  letter-spacing: .2px; vertical-align: 1px;
}
.tagged.cold { background: var(--blue-soft); color: #174ea6; }
#snap-ny, #snap-chi { height: 330px; }
#curve { height: 250px; }

/* ------------------------------------------------- the OSM comparison */
.baseline {
  background: var(--surface); border-radius: 12px; box-shadow: var(--sh-1);
  padding: 18px 20px 16px; margin-top: 20px;
}
.baseline h3 { font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.baseline .sub { max-width: 88ch; margin: 8px 0 16px; }
.cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp th, .cmp td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.cmp th:first-child, .cmp td:first-child { text-align: left; }
.cmp th {
  font-size: 11px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
}
.cmp td { font-size: 15px; }
.cmp td:first-child { font-size: 14px; }
.cmp tr.win td { font-weight: 600; }
.cmp tr.win td:first-child { color: var(--blue); }
.cmp .lose { color: var(--red); }

.poster {
  width: 100%; height: auto; display: block; border-radius: 12px;
  box-shadow: var(--sh-2); background: var(--surface);
}

/* ------------------------------------------------------------- charts */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chartcard { background: var(--surface); border-radius: 12px; box-shadow: var(--sh-1); padding: 16px 18px 18px; }
.chartcard h3 { font-size: 14.5px; font-weight: 600; margin-bottom: 12px; }
.chartcard canvas { width: 100%; height: 300px; display: block; }
.cap { font-size: 12.5px; line-height: 1.6; color: var(--muted); margin-top: 12px; }
.cap b { color: var(--text); font-weight: 600; }

.foot { padding: 26px 0 44px; }
.foot p { font-size: 12px; color: var(--dim); line-height: 1.65; }
.foot a { color: var(--muted); }

@media (max-width: 1080px) {
  .panel { position: static; width: auto; max-height: none; margin: 14px 0 0; }
  .mapstage { height: 520px; }
}
@media (max-width: 860px) {
  .ledes, .resultgrid, .two { grid-template-columns: 1fr; gap: 14px; }
  .lede + .lede { margin-top: 12px; }
  .mapstage { height: 440px; }
  .maplegend { display: none; }
  .stage { min-width: 132px; }
}
