/* Expat Vote UK */
:root {
  --navy: #0e1b33;
  --navy-2: #16264a;
  --red: #d0202e;
  --gold: #f5b40a;
  --ink: #1c2330;
  --muted: #5b6575;
  --bg: #f7f8fa;
  --card: #ffffff;
  --line: #e3e7ee;
  --ok: #0c7a43;
  --warn: #b45309;
  --hot: #b91c1c;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(14, 27, 51, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 27, 51, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand {
  color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: .3px;
  text-decoration: none;
}
.brand span { color: var(--gold); }
.nav a {
  color: #cdd6e4; text-decoration: none; font-size: .92rem; margin-left: 18px; font-weight: 500;
}
.nav a:hover { color: #fff; }

/* Hero */
.hero {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(208,32,46,.35), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(245,180,10,.18), transparent 55%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 72px 0 56px;
}
.hero-kicker {
  text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 700;
  color: var(--gold); margin: 0 0 12px;
}
.hero h1 { font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 1.15; margin: 0 0 16px; font-weight: 800; }
.hero-lede { font-size: 1.1rem; max-width: 46rem; color: #d7deea; margin: 0 0 26px; }
.hero-lede strong { color: #fff; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 700;
  text-decoration: none; font-size: .98rem; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 20px rgba(208,32,46,.35); }
.btn-ghost { border: 1.5px solid rgba(255,255,255,.45); color: #fff; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 16px 16px 12px;
}
.stat-num { display: block; font-size: 1.7rem; font-weight: 800; color: #fff; }
.stat-label { font-size: .8rem; color: #b9c3d4; display: block; margin-top: 2px; }
.stat-label small { color: #8794a9; }

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: #eef1f6; }
.section-kicker {
  text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; font-weight: 700;
  color: var(--red); margin: 0 0 8px;
}
.section h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 14px; font-weight: 800; }
.section-lede { color: var(--muted); max-width: 46rem; margin: 0 0 24px; }

/* Steps */
.steps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 18px; }
.step {
  display: flex; gap: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow);
}
.step-num {
  flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem;
}
.step h3 { margin: 2px 0 8px; font-size: 1.1rem; }
.step p { margin: 0 0 8px; color: #333c4d; }
.fine { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
a { color: #123f8f; }

/* Deadlines */
.deadlines {
  margin-top: 26px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.deadlines h3 { margin: 0 0 16px; }
.deadline-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.deadline {
  border-left: 4px solid var(--gold); background: #fbf7ec; padding: 12px 14px; border-radius: 8px;
}
.dl-when { display: block; font-weight: 700; font-size: .95rem; color: #7a5a06; }
.dl-what { display: block; font-size: .88rem; color: #4a4436; margin-top: 2px; }

/* Lookup */
.lookup { margin: 8px 0 26px; }
.search-box { position: relative; max-width: 640px; }
#seat-search {
  width: 100%; padding: 16px 18px; font-size: 1.05rem; border-radius: 12px;
  border: 2px solid #c9d2df; background: #fff; color: var(--ink); outline: none;
  box-shadow: var(--shadow);
}
#seat-search:focus { border-color: var(--navy); }
.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: 0 14px 34px rgba(14,27,51,.16); max-height: 330px; overflow-y: auto;
}
.suggestion {
  padding: 11px 16px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid #f0f2f6; font-size: .95rem;
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover, .suggestion.active { background: #eef2fa; }
.suggestion .s-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.suggestion.none { color: var(--muted); cursor: default; font-style: italic; }

/* Result card */
.result-card {
  margin-top: 26px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.rc-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  padding: 22px 26px; color: #fff; background: var(--navy);
}
.rc-name { font-size: 1.35rem; font-weight: 800; margin: 0; }
.rc-region { color: #b9c3d4; font-size: .9rem; }
.rc-badge {
  margin-left: auto; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .85rem;
  background: #fff; color: var(--ink);
}
.rc-now {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 10px 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 10px;
  background: #f6f8fb; font-size: .92rem; color: var(--ink);
}
.rc-body { padding: 24px 26px; }
.rc-majority { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.rc-majority .big { font-size: 2.4rem; font-weight: 800; color: var(--hot); line-height: 1; }
.rc-majority .lbl { color: var(--muted); font-size: .95rem; }
.rc-bars { display: grid; gap: 10px; margin-bottom: 22px; }
.rc-bar-row { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 10px; }
.rc-bar-label { font-size: .9rem; font-weight: 600; }
.rc-bar-track { height: 22px; background: #edf0f5; border-radius: 6px; overflow: hidden; }
.rc-bar-fill { height: 100%; border-radius: 6px; }
.rc-bar-val { font-size: .9rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.rc-compare { border-top: 1px dashed var(--line); padding-top: 18px; }
.rc-compare h4 { margin: 0 0 10px; font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cmp-row { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 12px; align-items: center; margin-bottom: 8px; }
.cmp-label { font-size: .88rem; color: #333c4d; }
.cmp-track { height: 16px; background: #edf0f5; border-radius: 5px; overflow: hidden; }
.cmp-fill { height: 100%; border-radius: 5px; }
.rc-verdict { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: #f4f7fb; font-size: .95rem; }

/* Chips */
.tightest { margin-top: 34px; }
.tightest h3 { font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.chip {
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  cursor: pointer; font-size: .9rem; font-weight: 600; transition: border-color .12s ease, transform .12s ease;
}
.chip:hover { border-color: var(--red); transform: translateY(-1px); }
.chip .chip-n { color: var(--hot); font-weight: 800; }

/* Evidence */
.evidence-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.ev {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.ev-num { display: block; font-size: 2.2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.ev p { margin: 6px 0 0; font-size: .93rem; color: #333c4d; }
.quote {
  margin-top: 30px; border-left: 5px solid var(--gold); background: #fff;
  padding: 20px 24px; border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow);
}
.quote p:first-child { font-style: italic; color: var(--muted); margin: 0 0 8px; }
.quote-ans { margin: 0; }

/* Sources */
.sources { margin: 14px 0 0; padding-left: 20px; color: #333c4d; }
.sources li { margin-bottom: 10px; font-size: .95rem; }

/* Footer */
.site-footer { background: var(--navy); color: #b9c3d4; padding: 28px 0; font-size: .9rem; }
.site-footer p { margin: 0; }

/* Responsive */
@media (max-width: 860px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .evidence-grid { grid-template-columns: repeat(2, 1fr); }
  .deadline-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero { padding: 52px 0 44px; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .evidence-grid { grid-template-columns: 1fr; }
  .step { padding: 18px; gap: 14px; }
  .step-num { flex-basis: 38px; height: 38px; font-size: 1rem; }
  .rc-head { padding: 18px; }
  .rc-body { padding: 18px; }
  .rc-bar-row { grid-template-columns: 110px 1fr 70px; }
  .cmp-row { grid-template-columns: 1fr; gap: 4px; }
  .nav a { margin-left: 10px; font-size: .82rem; }
  .brand { font-size: 1rem; }
}

/* ============ Postcode + name lookup ============ */
.lookup { margin: 8px 0 26px; }
.lookup-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 22px; align-items: start; }
.lookup-col { display: flex; flex-direction: column; gap: 8px; }
.lookup-col .search-box { max-width: none; }
.lookup-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); margin-bottom: 0;
}
.lookup-or {
  align-self: center; margin-top: 34px; color: var(--muted);
  font-style: italic; font-size: .88rem; white-space: nowrap;
}
.postcode-form { display: flex; gap: 10px; }
#postcode-input {
  flex: 1; min-width: 0; padding: 16px 18px; font-size: 1.05rem; border-radius: 12px;
  border: 2px solid #c9d2df; background: #fff; color: var(--ink); outline: none;
  box-shadow: var(--shadow); text-transform: uppercase;
}
#postcode-input:focus { border-color: var(--navy); }
.btn-postcode {
  border: none; cursor: pointer; padding: 0 22px; border-radius: 12px;
  background: var(--navy); color: #fff; font-weight: 700; font-size: .98rem;
  box-shadow: var(--shadow); transition: background .12s ease;
}
.btn-postcode:hover { background: var(--navy-2); }
.postcode-msg { margin: 2px 0 0; }
.postcode-msg.postcode-err { color: var(--hot); font-weight: 600; }

/* ============ Map ============ */
.map-block { margin: 34px 0 0; position: relative; isolation: isolate; }
.map-block h3 { margin: 0 0 14px; font-size: 1.15rem; }
.map-controls { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 0 0 12px; align-items: flex-end; }
.map-controls .view-toggle { margin: 0; }
.view-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.vt-group { display: flex; flex-direction: column; gap: 4px; }
.vt-group-label {
  font-size: .64rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .11em; color: var(--muted);
}
.vt-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font: inherit; font-size: .85rem; font-weight: 700; padding: 7px 14px;
  border-radius: 999px; cursor: pointer;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.vt-btn:hover { color: var(--ink); border-color: var(--navy); }
.vt-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.vt-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.vt-btn.vt-warn[aria-pressed="true"] { border-color: #b45309; box-shadow: 0 0 0 2px rgba(180,83,9,.35); }
.vt-single[aria-pressed="true"] { background: #fff; border-color: var(--navy); color: var(--ink); }
.vt-single[aria-pressed="true"]::before { content: "✓ "; color: var(--navy); }
/* map area: legend sits beside the map on wide screens, below it on small ones */
.map-area { display: block; }
.map-stack { position: relative; }
.map {
  position: relative; z-index: 0;
  height: 560px; border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); overflow: hidden; background: #dfe7f2;
}
.map[hidden] { display: none; }
.hexmap {
  display: block; width: 100%; height: 560px; background: #eef3fa;
}
#hexmap .hex { stroke: #fff; stroke-width: 0.6; transition: fill .45s ease, fill-opacity .45s ease; }
#hexmap .hex:hover { stroke: #111827; stroke-width: 1.6; cursor: pointer; }
#hexmap .hex-sel { stroke: #111827; stroke-width: 2.4; fill-opacity: .95; }
#hexmap .hex-city {
  font: 700 9.5px/1 var(--font); fill: #fff;
  paint-order: stroke; stroke: rgba(14,27,51,.82); stroke-width: 2.4px;
  text-anchor: middle; pointer-events: none;
}
.hex-tip {
  position: fixed; z-index: 1200; pointer-events: none;
  background: var(--navy); color: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: .8rem; line-height: 1.4;
  box-shadow: 0 6px 18px rgba(14,27,51,.3); max-width: 260px;
}
.hex-tip strong { color: var(--gold); }
.city-label {
  white-space: nowrap; font: 700 11px/1.1 var(--font); color: var(--ink);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
  pointer-events: none;
}

/* hex pan + zoom */
.hexmap { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.hexmap.hex-grabbing { cursor: grabbing; }
.hexmap:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; border-radius: var(--radius); }
.hex-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 30; display: flex; flex-direction: column; gap: 6px; }
.hex-zoom[hidden] { display: none; }
.hex-zoom button {
  width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 1.3rem; font-weight: 700; line-height: 1;
  box-shadow: 0 4px 14px rgba(14,27,51,.14);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s ease;
}
.hex-zoom button:hover { border-color: var(--navy); }
.hex-zoom button:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.hex-zoom .hz-reset { height: 32px; width: 44px; font-size: .7rem; }
.hex-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 25; pointer-events: none; white-space: nowrap;
  background: rgba(14,27,51,.86); color: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: .78rem;
  transition: opacity .5s ease;
}
.hex-hint.hex-hint-hide { opacity: 0; }
.hex-empty {
  position: absolute; inset: 0; z-index: 20; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(238,243,250,.7); font-weight: 600; color: var(--muted); font-size: .95rem;
}
.hex-empty[hidden] { display: none; }
.hex-empty button {
  border: none; cursor: pointer; font: inherit; font-weight: 700; font-size: .88rem;
  background: var(--navy); color: #fff; border-radius: 999px; padding: 10px 18px;
}
.hex-empty button:hover { background: var(--navy-2); }
.hex-empty button:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* legend — outside the map, a panel of show/hide toggles */
.map-legend {
  margin-top: 12px;
  background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow);
  font-size: .8rem; line-height: 1.45;
}
.map-legend-title {
  font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  font-size: .68rem; color: var(--muted);
}
.map-legend-date { font-size: .68rem; color: var(--muted); margin: 2px 0 10px; }
.map-legend-rows { display: grid; gap: 2px; }
.legend-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  border: none; background: none; padding: 7px 8px; margin: 0;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: .8rem;
  text-align: left; color: var(--ink);
  transition: background .12s ease, opacity .2s ease;
}
.legend-item:hover { background: #eef2fa; }
.legend-item:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.legend-item[aria-pressed="false"] { opacity: .45; }
.li-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.li-tick { color: var(--ok); font-weight: 800; flex: 0 0 12px; text-align: center; }
.li-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-count { margin-left: auto; padding-left: 6px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; white-space: nowrap; }
.li-tag {
  padding-left: 40px; color: var(--muted); font-size: .7rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-legend-dot {
  width: 11px; height: 11px; flex: 0 0 11px; border-radius: 3px;
  border: 1.5px solid rgba(0,0,0,.18); display: inline-block;
}

/* Leaflet chrome, tuned to the site */
#map { font: inherit; }
#map .leaflet-control-attribution {
  font-size: .68rem; background: rgba(255,255,255,.85); color: var(--muted);
}
#map .leaflet-control-attribution a { color: #123f8f; }
#map .leaflet-bar a {
  color: var(--ink); border-radius: 6px;
}
#map .leaflet-tooltip {
  background: var(--navy); color: #fff; border: none; border-radius: 8px;
  padding: 6px 10px; font-size: .8rem; box-shadow: 0 6px 18px rgba(14,27,51,.3);
}
#map .leaflet-tooltip strong { color: var(--gold); }
#map .leaflet-tooltip-top:before    { border-top-color: var(--navy); }
#map .leaflet-tooltip-bottom:before { border-bottom-color: var(--navy); }
#map .leaflet-tooltip-left:before   { border-left-color: var(--navy); }
#map .leaflet-tooltip-right:before  { border-right-color: var(--navy); }
#map .leaflet-popup-content-wrapper {
  border-radius: 12px; box-shadow: 0 12px 30px rgba(14,27,51,.25); color: var(--ink);
}
#map .leaflet-popup-content { margin: 12px 16px; font-size: .88rem; line-height: 1.5; }
#map .leaflet-popup-content em { color: var(--muted); }
@media (hover: hover) {
  #map path.leaflet-interactive:hover { stroke: #111827; stroke-width: 1.4; }
}
#map path.leaflet-interactive { transition: fill .45s ease, fill-opacity .45s ease; }

/* wide screens: legend panel beside the map */
@media (min-width: 1024px) {
  .map-area { display: flex; gap: 16px; align-items: flex-start; }
  .map-area .map-stack { flex: 1 1 auto; min-width: 0; }
  .map-legend { flex: 0 0 272px; width: 272px; margin-top: 0; max-height: 560px; overflow-y: auto; }
}

@media (max-width: 860px) {
  .lookup-grid { grid-template-columns: 1fr; gap: 14px; }
  .lookup-or {
    display: flex; align-items: center; gap: 12px; margin: 2px 0;
    width: 100%; justify-content: center;
  }
  .lookup-or::before, .lookup-or::after { content: ""; flex: 1; height: 1px; background: #c9d2df; }
  .map { height: 420px; }
  .hexmap { height: 420px; }
}
@media (max-width: 560px) {
  .map { height: 360px; }
  .hexmap { height: 360px; }
  .btn-postcode { padding: 0 16px; }
}
