/* Ontario Municipal Election night dashboard - dark results map */

:root {
  --bg:        #0a0c10;
  --bg-panel:  #11151b;
  --bg-raise:  #171c24;
  --line:      #232a34;
  --line-soft: #1a212a;

  --ink:       #e9edf3;
  --ink-dim:   #97a3b4;
  --ink-faint: #616d7e;

  --land:      #1b212b;   /* municipality with no results feed */
  --land-edge: #2b3542;
  --sea:       #0a0c10;

  --accent:    #4c8df6;
  --warn:      #f2994a;

  --r: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------------------------------------------------------------- header */
#app { display: flex; flex-direction: column; height: 100%; }

header {
  display: flex; align-items: center; gap: 22px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em;
}
.brand .sub {
  font-size: 11.5px; color: var(--ink-faint); margin-top: 1px;
}

/* tabs */
.tabs { display: flex; gap: 2px; background: var(--bg-raise);
        padding: 3px; border-radius: var(--r); border: 1px solid var(--line); }
.tab {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--ink-dim);
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 6px 16px; border-radius: 4px;
  transition: background .12s, color .12s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }

.status { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.pill {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 100px;
  background: rgba(76,141,246,.12); color: #8fb8fb; border: 1px solid rgba(76,141,246,.28);
}
.pill.final { background: rgba(120,200,140,.10); color: #86cf9c; border-color: rgba(120,200,140,.25); }
.status .meta { font-size: 11.5px; color: var(--ink-faint); text-align: right; }

/* ----------------------------------------------------------------- body */
main { flex: 1 1 auto; display: flex; min-height: 0; }

#map-wrap { position: relative; flex: 1 1 auto; min-width: 0; background: var(--sea); }
#map { display: block; width: 100%; height: 100%; cursor: default; }

/* map layers */
.muni      { stroke: var(--land-edge); stroke-width: .5px; vector-effect: non-scaling-stroke; }
.muni.hit  { cursor: pointer; }
.muni.nodata { fill: var(--land); }
.muni.dimmed { opacity: .25; }

.ward      { stroke: rgba(6,9,13,.85); stroke-width: .7px; vector-effect: non-scaling-stroke;
             cursor: pointer; }

.muni-outline { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.4px;
                pointer-events: none; vector-effect: non-scaling-stroke; }

.ward-label { fill: #fff; font-size: 10px; font-weight: 600; text-anchor: middle;
              pointer-events: none; paint-order: stroke;
              stroke: rgba(0,0,0,.8); stroke-width: 2.6px; }
.ward-label.sub { font-size: 9px; font-weight: 500; opacity: .9; }

/* floating controls */
.map-ctl {
  position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; align-items: center;
}
.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--ink); background: rgba(23,28,36,.92); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: var(--r); backdrop-filter: blur(6px);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--bg-raise); border-color: #3a4552; }
.btn[hidden] { display: none; }

/* legend */
.legend {
  position: absolute; left: 14px; bottom: 14px;
  background: rgba(17,21,27,.94); border: 1px solid var(--line);
  border-radius: var(--r); padding: 11px 13px; backdrop-filter: blur(6px);
  max-width: 290px;
}
.legend h4 { margin: 0 0 8px; font-size: 11px; font-weight: 650;
             letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim); }
.legend .row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.legend .sw { width: 13px; height: 13px; border-radius: 3px; flex: 0 0 auto;
              border: 1px solid rgba(255,255,255,.14); }
.ramp { height: 9px; border-radius: 3px; margin: 3px 0 5px;
        border: 1px solid rgba(255,255,255,.12); }
.ramp-ends { display: flex; justify-content: space-between;
             font-size: 10.5px; color: var(--ink-faint); }

/* --------------------------------------------------------------- tooltip */
#tip {
  position: fixed; pointer-events: none; z-index: 40;
  background: rgba(13,17,22,.97); border: 1px solid #2c3542;
  border-radius: 7px; padding: 10px 12px; min-width: 218px; max-width: 320px;
  box-shadow: 0 10px 34px rgba(0,0,0,.6);
  opacity: 0; transition: opacity .1s;
}
#tip.on { opacity: 1; }
#tip .t-name { font-weight: 650; font-size: 13.5px; }
#tip .t-sub  { font-size: 11px; color: var(--ink-faint); margin-bottom: 7px; }
#tip .t-none { font-size: 12px; color: var(--ink-faint); }

/* candidate rows (shared by tooltip + panel) */
.cand { display: grid; grid-template-columns: 9px 1fr auto auto; gap: 8px;
        align-items: baseline; padding: 2.5px 0; font-size: 12.5px; }
.cand .dot { width: 9px; height: 9px; border-radius: 2px; align-self: center; }
.cand .nm  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand .vt  { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.cand .pc  { font-family: var(--mono); font-size: 12px; font-weight: 650; min-width: 46px;
             text-align: right; }
.cand.win .nm { font-weight: 650; }
.cand.win .pc { color: #fff; }
.cand .chk { color: #86cf9c; margin-left: 4px; }

.bar { grid-column: 2 / -1; height: 3px; background: #222a35; border-radius: 2px;
       margin-top: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; }

/* ----------------------------------------------------------------- panel */
#panel {
  flex: 0 0 366px; border-left: 1px solid var(--line);
  background: var(--bg-panel); overflow-y: auto; padding: 16px 18px 40px;
}
#panel::-webkit-scrollbar { width: 9px; }
#panel::-webkit-scrollbar-thumb { background: #29323e; border-radius: 5px; }
#panel::-webkit-scrollbar-track { background: transparent; }

.p-title { font-size: 19px; font-weight: 680; letter-spacing: -.015em; margin: 0; }
.p-meta  { font-size: 11.5px; color: var(--ink-faint); margin: 2px 0 14px; }

.race { border-top: 1px solid var(--line-soft); padding: 12px 0 10px; }
.race:first-of-type { border-top: 0; }
.race h3 { margin: 0 0 2px; font-size: 12.5px; font-weight: 640; }
.race .rmeta { font-size: 11px; color: var(--ink-faint); margin-bottom: 7px; }

.hint { color: var(--ink-faint); font-size: 12.5px; line-height: 1.6; }
.hint b { color: var(--ink-dim); font-weight: 600; }
.hint ul { margin: 8px 0 0; padding-left: 17px; }
.hint li { margin: 5px 0; }

.sec-h { font-size: 11px; font-weight: 650; letter-spacing: .05em;
         text-transform: uppercase; color: var(--ink-faint);
         margin: 18px 0 6px; }

.chip { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 7px;
        border-radius: 100px; background: var(--bg-raise); color: var(--ink-dim);
        border: 1px solid var(--line); margin-left: 6px; }
.chip.ok { color: #86cf9c; border-color: rgba(120,200,140,.3); }

@media (max-width: 1080px) {
  #panel { flex-basis: 300px; }
  .brand .sub { display: none; }
}
