@font-face {
  font-family: "Domaine Display Narrow";
  src: url("assets/fonts/DomaineDispNar-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Domaine Display Narrow";
  src: url("assets/fonts/DomaineDispNar-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #f2efe8;
  --panel: #fbfaf7;
  --ink: #17212a;
  --muted: #687682;
  --line: #d4d0c7;
  --teal: #176b70;
  --teal-dark: #0b4e56;
  --aqua: #8fd1cd;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand-serif: "Domaine Display Narrow", "Iowan Old Style", "Palatino Linotype", Baskerville, Georgia, serif;
  --ui-paper: #f4ede3;
  --ui-paper-strong: #efe4d5;
  --ui-ink: #1a1715;
  --ui-muted: #5f5852;
  --ui-line: rgba(34, 31, 28, .16);
  --ui-line-strong: rgba(34, 31, 28, .24);
  --ui-card: rgba(255, 252, 248, .84);
  --ui-ocean: #47697a;
  --ui-rust: #9e5a3d;
  --ui-shadow: 0 22px 48px rgba(20, 18, 16, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }

button, select { outline-offset: 3px; }

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 32px clamp(20px, 4vw, 64px) 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.controls label > span,
.control-field > label,
.metric-label,
.controls legend,
#scope-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(42px, 5vw, 76px); line-height: .96; }
h2 { font-size: clamp(34px, 4vw, 62px); line-height: 1; }

.dek {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 19px);
}

.period { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.period i { width: 64px; height: 1px; background: var(--line); }
.period strong { color: var(--ink); font-size: 22px; }

main { width: min(1800px, 100%); margin: 0 auto; }

.controls {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 22px clamp(20px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
}

.controls label, .controls fieldset, .control-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.controls label > span, .controls legend, .control-field > label, .metric-label { display: block; }

select {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #bfc5c7;
  border-radius: 4px;
  font-weight: 600;
}

.segmented {
  display: inline-flex;
  height: 48px;
  padding: 4px;
  background: #e5e3dd;
  border: 1px solid #c9ccc9;
  border-radius: 6px;
}

.segmented button {
  padding: 0 18px;
  color: #52606b;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.segmented button.active { color: var(--ink); background: var(--panel); box-shadow: 0 1px 4px rgba(24, 33, 42, .12); }
.metric-field.is-disabled { opacity: .48; }
.metric-field.is-disabled button { cursor: default; }

.map-shell { margin: 42px clamp(16px, 3vw, 48px) 0; padding: clamp(22px, 3vw, 44px); background: var(--panel); }

.map-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 20px; }
.map-subtitle { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
#scope-label { margin-top: 9px; text-align: right; }

.map-stage {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  background: #f7f5f0;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.map-stage.is-loading::after {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: 50%;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(251, 250, 247, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(42, 37, 33, .08);
  content: "Cargando cartografía…";
  transform: translate(-50%, -50%);
  font-size: 12px;
  letter-spacing: .04em;
}

#map {
  display: block;
  width: 100%;
  min-height: 720px;
  height: clamp(720px, 64vw, 860px);
  cursor: grab;
  touch-action: none;
  transition: opacity .2s ease;
}
.map-stage.is-loading #map { opacity: .16; }
#map:active { cursor: grabbing; }
.map-stage.apple-view { height: clamp(720px, 64vw, 860px); }
.map-stage.night-view {
  height: clamp(720px, 64vw, 860px);
  background: #030611;
  border-color: rgba(28, 43, 72, .72);
}
.apple-map { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; background: #e8e6df; }
.map-stage.apple-view .apple-map { z-index: auto; }
.apple-map[hidden] { display: none; }
.apple-map-status {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  max-width: min(420px, calc(100% - 40px));
  padding: 14px 18px;
  color: var(--ink);
  background: rgba(251, 250, 247, .96);
  border: 1px solid rgba(196, 193, 184, .9);
  box-shadow: 0 8px 28px rgba(14, 25, 32, .14);
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}
.apple-map-status[hidden] { display: none; }
.night-map {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #030611;
  cursor: grab;
  touch-action: none;
}
.night-map:active { cursor: grabbing; }
.night-map[hidden] { display: none; }
.night-map-status {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  max-width: min(440px, calc(100% - 40px));
  padding: 14px 18px;
  color: rgba(242, 244, 248, .94);
  background: rgba(8, 13, 29, .9);
  border: 1px solid rgba(120, 137, 189, .3);
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .34);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(12px);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}
.night-map-status[hidden] { display: none; }
.map-stage.apple-view .legend { z-index: 6; }
.map-stage.apple-view .mk-map-view {
  z-index: auto !important;
}
.map-stage.apple-view .mk-controls-container {
  z-index: 2147482999 !important;
}
.map-stage.apple-view .mk-bottom-right-controls-container,
.map-stage.apple-view .mk-controls-container-controls-larger {
  position: absolute !important;
  z-index: 2147483000 !important;
  pointer-events: auto !important;
  isolation: isolate;
}
.map-stage.apple-view:has(.mk-bottom-right-controls-container:hover) .tooltip,
.map-stage.apple-view:has(.mk-controls-container-controls-larger:hover) .tooltip,
.map-stage.apple-view:has(.map-view-switcher:hover) .tooltip {
  display: none !important;
}

.apple-district-label {
  display: grid;
  width: 128px;
  min-height: 30px;
  padding: 3px 6px;
  place-items: center;
  color: #fff;
  background: rgba(18, 22, 24, .42);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
  pointer-events: none;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .025em;
  text-align: center;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, .86),
    1px -1px 0 rgba(0, 0, 0, .86),
    -1px 1px 0 rgba(0, 0, 0, .86),
    1px 1px 0 rgba(0, 0, 0, .86);
  text-transform: uppercase;
  white-space: normal;
}
.apple-district-label > span { display: block; }
.apple-district-label > small {
  display: block;
  margin-top: 2px;
  color: rgba(240, 242, 242, .88);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .72);
  text-transform: none;
}

.apple-district-label.is-hovered {
  background: rgba(18, 22, 24, .7);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .54), 0 5px 14px rgba(0, 0, 0, .34);
  transform: scale(1.06);
}

.map-view-switcher {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 16px;
  display: grid;
  gap: 7px;
  width: 390px;
  margin: 0;
  padding: 7px;
  background: rgba(251, 250, 247, .94);
  border: 1px solid rgba(196, 193, 184, .9);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(20, 35, 43, .16);
  backdrop-filter: blur(10px);
}
.map-switcher-group > span {
  display: block;
  margin: 0 4px 4px;
  color: #647079;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1;
  text-transform: uppercase;
}
.map-switcher-group + .map-switcher-group {
  padding-top: 6px;
  border-top: 1px solid rgba(68, 86, 97, .14);
}
.map-view-switcher legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.map-view-switcher .segmented { display: flex; width: 100%; height: 34px; padding: 2px; border: 0; border-radius: 5px; }
.map-view-switcher .segmented button { flex: 1; padding: 0 7px; font-size: 10.5px; }
.night-indicator strong {
  display: block;
  padding: 8px 10px;
  color: #f6e4aa;
  background: rgba(70, 77, 120, .28);
  border: 1px solid rgba(151, 157, 204, .16);
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.2;
}
.night-view .map-view-switcher {
  background: rgba(7, 12, 27, .9);
  border-color: rgba(114, 128, 179, .32);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
.night-view .map-switcher-group > span { color: rgba(191, 201, 225, .72); }
.night-view .map-switcher-group + .map-switcher-group {
  border-top-color: rgba(151, 164, 205, .16);
}
.night-view .map-view-switcher .segmented { background: rgba(45, 54, 88, .72); }
.night-view .map-view-switcher .segmented button { color: rgba(207, 215, 233, .78); }
.night-view .map-view-switcher .segmented button.active {
  color: #fff7db;
  background: rgba(103, 68, 121, .76);
  box-shadow: 0 0 14px rgba(244, 83, 109, .18);
}
.night-view .map-view-switcher {
  width: min(470px, calc(100% - 112px));
}

.geo-district, .cartogram-district, .tile { cursor: pointer; transition: opacity .16s ease, filter .16s ease, stroke .16s ease, stroke-width .16s ease; }
.geo-district { stroke: none; vector-effect: non-scaling-stroke; }
.geographic-district-mesh { pointer-events: none; fill: none; stroke: #445661; stroke-width: .65; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cartogram-district { stroke: rgba(28,44,52,.72); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.topogram-district { stroke: none; }
.department-district-mesh { pointer-events: none; fill: none; stroke: rgba(28,44,52,.72); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.geo-district:hover { opacity: 1; stroke: #111a21; stroke-width: 2; filter: none; }
.geo-district.department-unit:hover,
.geo-district.department-unit.selected { stroke: none; filter: brightness(.92); }
.cartogram-district:hover { opacity: 1; stroke: #111a21; stroke-width: 2; filter: none; }
.tile-group:hover .tile { opacity: 1; }
.tile-group:hover .tile-boundary {
  stroke: #111a21;
  stroke-width: 2.2;
  filter: none;
}
.geo-district.selected, .cartogram-district.selected, .tile-group.selected { filter: none; }
.geo-district.selected { stroke: #111a21; stroke-width: 2.4; }
.cartogram-district.selected { stroke: #111a21; stroke-width: 2.8; }
.tile { stroke: rgba(255,255,255,.28); stroke-width: .5; }
.tile-boundary { pointer-events: none; fill: none; stroke: rgba(19,35,43,.58); stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tile-group.selected .tile-boundary { stroke: #101a20; stroke-width: 3; }

.district-label { pointer-events: none; fill: #14232b; font-size: 12px; font-weight: 800; letter-spacing: .025em; text-anchor: middle; paint-order: stroke; stroke: rgba(255,255,255,.94); stroke-width: 3.5px; stroke-linejoin: round; transition: opacity .16s ease; }
.district-label.light { fill: #fff; stroke: rgba(16,43,48,.72); }
.district-label.small { font-size: 9.5px; }
.district-contribution {
  fill: rgba(49, 64, 71, .86);
  stroke: none;
  stroke-width: 0;
  paint-order: normal;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, .5));
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .015em;
  text-transform: none;
}
.district-label.light .district-contribution {
  fill: rgba(248, 249, 247, .9);
  filter: drop-shadow(0 1px 1px rgba(13, 27, 33, .72));
}
.district-label.small .district-contribution { font-size: 8.5px; }
.department-overview:not(.zoom-detail) .district-label { opacity: 0; }
.department-overview.zoom-detail .district-label { opacity: 1; }
.department-overview .district-label.label-collided,
.district-label.label-collided { opacity: 0; }

.province-boundary { pointer-events: none; fill: none; stroke: rgba(16, 29, 36, .86); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.department-boundary { pointer-events: none; fill: none; stroke: rgba(16, 29, 36, .82); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.province-label { pointer-events: none; fill: #163943; font-size: 14px; font-weight: 900; letter-spacing: .14em; text-anchor: middle; text-transform: uppercase; paint-order: stroke; stroke: rgba(251,250,247,.98); stroke-width: 5px; stroke-linejoin: round; transition: opacity .16s ease; }
.province-label.small { font-size: 11px; letter-spacing: .1em; }
.province-leader { pointer-events: none; stroke: rgba(22,57,67,.78); stroke-width: 1; vector-effect: non-scaling-stroke; transition: opacity .16s ease; }
.department-overview.zoom-detail .province-label,
.department-overview.zoom-detail .province-leader { opacity: 0; }
.department-overview.zoom-detail .province-boundary { opacity: 0; }

.tooltip {
  position: absolute;
  z-index: 4;
  width: min(300px, calc(100% - 20px));
  padding: 13px 15px;
  color: #fff;
  background: rgba(19, 30, 38, .94);
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(14, 25, 32, .2);
  pointer-events: none;
  font-size: 13px;
  line-height: 1.55;
}

.tooltip strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 400; }
.tooltip em { color: #9ee0db; font-style: normal; font-weight: 700; }

.legend {
  position: absolute;
  z-index: 3;
  left: 18px;
  bottom: 18px;
  width: min(940px, calc(100% - 36px));
  padding: 11px 13px;
  color: #394953;
  background: rgba(251, 250, 247, .93);
  border: 1px solid rgba(196, 193, 184, .85);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(42, 37, 33, .08);
  backdrop-filter: blur(10px);
  font-size: 11px;
}

.legend-classes { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 7px 3px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.legend-class {
  min-width: 0;
  padding: 3px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: opacity .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.legend-class:hover { background: rgba(35, 53, 62, .07); }
.legend-class:focus-visible { outline: 2px solid #243943; outline-offset: 2px; }
.legend.has-filter .legend-class:not(.is-active) { opacity: .48; }
.legend-class.is-active { background: rgba(255,255,255,.72); box-shadow: inset 0 0 0 2px #243943; }
.legend-class i { display: block; height: 10px; margin-bottom: 5px; border: 1px solid rgba(35, 53, 62, .15); }
.legend-class strong {
  display: -webkit-box;
  min-height: 2.3em;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.15;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.legend-class span { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.legend-title { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.legend-multiple-hint { flex: 0 0 auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.night-legend {
  width: min(620px, calc(100% - 36px));
  color: rgba(225, 231, 242, .92);
  background: rgba(7, 12, 27, .88);
  border-color: rgba(116, 132, 183, .3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.night-legend-scale {
  height: 10px;
  margin-top: 8px;
  background: linear-gradient(90deg, #152047, #30318f 20%, #a83283 42%, #ec4f55 58%, #ff9b38 74%, #ffe066 88%, #fffbd1);
  border: 1px solid rgba(232, 236, 247, .18);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(239, 78, 94, .18);
}
.night-legend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: rgba(196, 205, 225, .78);
  font-size: 10px;
}
.night-legend-note {
  margin: 7px 0 0;
  color: rgba(196, 205, 225, .64);
  font-size: 9.5px;
  line-height: 1.35;
}

.geo-district.rate-muted,
.cartogram-district.rate-muted {
  fill: #c7cac8 !important;
  opacity: .42;
}
.district-label.rate-muted { opacity: .16; }

.zoom-controls {
  position: absolute;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 32px 32px 44px;
  gap: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(85, 85, 85, .28);
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(20, 35, 43, .18);
  backdrop-filter: blur(10px);
}
.zoom-controls[hidden] { display: none; }
.zoom-controls button { height: 32px; color: #252525; background: transparent; border: 0; border-right: 1px solid rgba(85, 85, 85, .2); cursor: pointer; font-size: 18px; font-weight: 500; }
.zoom-controls button:hover { background: rgba(230, 230, 230, .85); }
.zoom-controls button:disabled { color: rgba(37, 37, 37, .32); cursor: default; }
.zoom-controls button:disabled:hover { background: transparent; }
.zoom-controls .zoom-reset { border-right: 0; font-size: 10px; font-variant-numeric: tabular-nums; }

.selection { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.selection { min-height: 42px; padding-left: 20px; border-left: 2px solid var(--aqua); }
.selection strong { color: var(--ink); }

.method { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; padding: 34px clamp(20px, 4vw, 64px) 48px; }
.method div { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.method span { color: #56a9a7; font-family: var(--serif); font-size: 28px; }
.method p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.method strong { color: var(--ink); }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px clamp(20px, 4vw, 64px); color: var(--muted); background: #e8e5de; font-size: 11px; }
footer p { margin: 0; }
footer a { color: inherit; text-underline-offset: 2px; }

@media (max-width: 1100px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .segmented { display: flex; }
  .segmented button { flex: 1; }
}

@media (max-width: 720px) {
  .masthead { align-items: flex-start; }
  .period { display: none; }
  .controls { grid-template-columns: 1fr; }
  .map-shell { margin-top: 20px; padding: 18px 10px; }
  .map-heading { display: block; padding: 0 8px; }
  #scope-label { margin-top: 18px; text-align: left; }
  .map-stage, #map { min-height: 640px; }
  .map-stage { border-radius: 14px; }
  #map { height: 640px; }
  .map-stage.apple-view,
  .map-stage.night-view { height: 720px; min-height: 720px; }
  .map-view-switcher { top: 10px; left: 10px; width: min(390px, calc(100% - 20px)); }
  .map-view-switcher .segmented button { padding: 0 3px; font-size: 9.5px; }
  .method { grid-template-columns: 1fr; }
  .selection { padding: 12px 0 0; border-top: 2px solid var(--aqua); border-left: 0; }
  footer { display: block; }
  footer p + p { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .geo-district, .cartogram-district, .tile { transition: none; }
}

/* Lenguaje editorial compartido con elecciones2026.
   La zona cartográfica y todos sus elementos internos quedan sin cambios. */
body {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at top left, rgba(71, 105, 122, .12), transparent 28%),
    linear-gradient(180deg, #f8f2ea 0%, #f2e8dc 100%);
}

.masthead {
  align-items: center;
  min-height: 118px;
  padding: 28px clamp(24px, 4vw, 68px);
  background: rgba(244, 237, 227, .88);
  border-color: var(--ui-line);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .42);
  backdrop-filter: blur(16px);
}

.eyebrow,
.controls label > span,
.control-field > label,
.metric-label,
.controls legend,
#scope-label {
  color: var(--ui-muted);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .14em;
}

.eyebrow {
  color: var(--ui-rust);
}

h1,
h2 {
  color: var(--ui-ink);
  font-family: var(--brand-serif);
  letter-spacing: -.025em;
}

h1 {
  font-size: clamp(48px, 5.2vw, 82px);
  font-weight: 500;
}

h2 {
  font-size: clamp(40px, 4.4vw, 68px);
}

.dek {
  max-width: 46rem;
  color: var(--ui-muted);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(16px, 1.55vw, 21px);
}

.period {
  color: var(--ui-muted);
  font-family: var(--sans);
}

.period i {
  background: var(--ui-line-strong);
}

.period strong {
  color: var(--ui-ink);
  font-family: var(--brand-serif);
  font-size: 27px;
  font-weight: 500;
}

.controls {
  align-items: start;
  margin: 22px clamp(16px, 3vw, 48px) 0;
  padding: 18px 20px 20px;
  background: linear-gradient(180deg, rgba(255, 252, 248, .96), rgba(250, 245, 239, .92));
  border: 1px solid rgba(170, 149, 126, .28);
  border-radius: 22px;
  box-shadow: 0 14px 28px rgba(42, 37, 33, .05);
}

select {
  height: 52px;
  padding-left: 18px;
  color: var(--ui-ink);
  background: rgba(255, 250, 244, .9);
  border-color: rgba(194, 177, 157, .62);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
  font-family: var(--sans);
  font-weight: 650;
}

select:hover {
  background: rgba(255, 253, 249, .99);
  border-color: rgba(179, 160, 138, .76);
}

select:focus-visible,
.controls button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(160, 136, 112, .22);
}

.controls .segmented {
  display: flex;
  height: 52px;
  padding: 4px;
  background: rgba(239, 232, 223, .88);
  border-color: rgba(194, 177, 157, .5);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62);
}

.controls .segmented button {
  padding: 0 20px;
  color: rgba(82, 69, 58, .92);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .01em;
}

.controls .segmented button.active {
  color: #3c3027;
  background: #e8ded1;
  border: 1px solid #c8b39a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62);
}

.control-field {
  position: relative;
}

.native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.web-select {
  position: relative;
  z-index: 8;
}

.web-select.is-open {
  z-index: 150;
}

.web-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 52px;
  margin-top: 8px;
  padding: 0 52px 0 18px;
  color: var(--ui-ink);
  background: rgba(255, 250, 244, .9);
  border: 1px solid rgba(194, 177, 157, .62);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 650;
  text-align: left;
}

.web-select-trigger:hover,
.web-select.is-open .web-select-trigger {
  background: rgba(255, 253, 249, .99);
  border-color: rgba(179, 160, 138, .76);
}

.web-select-trigger:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.web-select-value {
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-select-caret {
  position: absolute;
  top: 50%;
  right: 22px;
  width: 10px;
  height: 10px;
  color: var(--ui-muted);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  transform-origin: center;
  transition: transform 160ms ease;
}

.web-select.is-open .web-select-caret {
  transform: translateY(-50%) rotate(225deg);
}

.web-select-menu {
  position: absolute;
  z-index: 151;
  top: calc(100% + 9px);
  left: 0;
  width: 100%;
  min-width: min(360px, calc(100vw - 40px));
  max-height: min(430px, 66vh);
  padding: 10px;
  overflow: hidden;
  background: rgba(255, 252, 248, .985);
  border: 1px solid var(--ui-line);
  border-radius: 22px;
  box-shadow: var(--ui-shadow);
}

.web-select-menu[hidden] {
  display: none;
}

.web-select-menu-head {
  display: none;
}

.web-select-search {
  display: block;
  margin: 0 0 8px;
}

.web-select-search input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  color: var(--ui-ink);
  background: rgba(244, 237, 227, .74);
  border: 1px solid rgba(170, 149, 126, .3);
  border-radius: 12px;
  outline: 0;
  font-family: var(--sans);
  font-size: 13px;
}

.web-select-search input:focus {
  border-color: rgba(71, 105, 122, .44);
  box-shadow: 0 0 0 3px rgba(71, 105, 122, .12);
}

.web-select-options {
  max-height: min(356px, calc(66vh - 70px));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(95, 88, 82, .58) transparent;
  scrollbar-width: thin;
}

.web-select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ui-ink);
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  text-align: left;
}

.web-select-option:hover,
.web-select-option:focus-visible {
  background: rgba(34, 31, 28, .06);
  box-shadow: inset 0 0 0 1px rgba(34, 31, 28, .08);
  outline: 0;
}

.web-select-option.is-active {
  background: rgba(71, 105, 122, .1);
  box-shadow: inset 0 0 0 1px rgba(71, 105, 122, .34);
}

.web-select-option-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.web-select-option-check {
  color: var(--ui-ocean);
  font-weight: 800;
  opacity: 0;
}

.web-select-option.is-active .web-select-option-check {
  opacity: 1;
}

.web-select-option[hidden] {
  display: none;
}

.web-select-close {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--ui-ink);
  background: rgba(34, 31, 28, .06);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.map-shell {
  margin-top: 24px;
  background: rgba(255, 252, 248, .82);
  border: 0;
  border-radius: 26px;
  box-shadow: 0 0 0 1px rgba(170, 149, 126, .22), var(--ui-shadow);
}

.map-frame { position: relative; }

.map-subtitle {
  color: var(--ui-muted);
  font-family: var(--sans);
}

.selection {
  color: var(--ui-muted);
  font-family: var(--sans);
}

.selection {
  border-color: rgba(71, 105, 122, .52);
}

.selection strong {
  color: var(--ui-ink);
}

.selection.filter-summary {
  min-height: 0;
  width: 100%;
  padding: 15px 17px 14px;
  color: var(--ui-ink);
  background: rgba(255, 252, 248, .78);
  border: 1px solid rgba(170, 149, 126, .22);
  border-left: 4px solid var(--ui-ocean);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(58, 44, 30, .045);
}

.selection.map-selection {
  position: absolute;
  z-index: 3;
  top: 20px;
  right: 22px;
  width: auto;
  min-width: min(430px, calc(100% - 44px));
  max-width: min(570px, calc(100% - 44px));
  max-height: calc(100% - 166px);
  overflow: auto;
  backdrop-filter: blur(12px);
}
.selection.map-selection[hidden] { display: none; }

.map-stage.night-view + .selection.map-selection {
  width: min(340px, calc(100% - 44px));
  min-width: 0;
  color: rgba(220, 226, 240, .78);
  background: rgba(7, 12, 27, .82);
  border-color: rgba(126, 140, 187, .28);
  border-left-color: #9b4f82;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
}

.map-stage.night-view + .selection .filter-summary-head,
.map-stage.night-view + .selection .filter-summary-delta {
  border-color: rgba(151, 164, 205, .18);
}

.map-stage.night-view + .selection .filter-summary-kicker {
  color: #f2a55f;
}

.map-stage.night-view + .selection .filter-summary-count,
.map-stage.night-view + .selection .night-summary-story span,
.map-stage.night-view + .selection .filter-summary-delta {
  color: rgba(220, 226, 240, .7);
}

.night-summary-story {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 0 11px;
}

.selection .night-summary-population {
  color: #fff4d4;
  font-family: var(--brand-serif);
  font-size: clamp(34px, 3.2vw, 46px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.025em;
}

.night-summary-story span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.filter-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-line);
}

.filter-summary-kicker,
.filter-summary-count,
.filter-summary-point span,
.filter-summary-rate span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.filter-summary-kicker { color: var(--ui-rust); }
.filter-summary-count { color: var(--ui-muted); white-space: nowrap; }

.filter-summary-story {
  display: grid;
  grid-template-columns: max-content 16px max-content max-content;
  gap: 5px;
  align-items: end;
  padding: 13px 0 11px;
}

.filter-summary-point { min-width: 0; }
.selection .filter-summary-population {
  display: block;
  margin: 0 0 3px;
  color: var(--ui-ink);
  font-family: var(--brand-serif);
  font-size: clamp(27px, 2.6vw, 38px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.025em;
  white-space: nowrap;
}
.selection .filter-summary-point:first-child .filter-summary-population {
  color: #716c67;
  font-size: clamp(24px, 2.3vw, 34px);
}
.filter-summary-point span,
.filter-summary-rate span { display: block; color: var(--ui-muted); letter-spacing: .08em; }
.filter-summary-arrow { align-self: center; color: rgba(71, 105, 122, .58); font-size: 19px; text-align: center; }
.filter-summary-rate { min-width: 0; padding-left: 14px; border-left: 1px solid var(--ui-line); }
.selection .filter-summary-rate-value {
  display: block;
  margin: 0 0 3px;
  font-family: var(--brand-serif);
  font-size: clamp(31px, 3vw, 43px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.025em;
}
.selection .filter-summary-rate-value.is-positive { color: var(--ui-rust); }
.selection .filter-summary-rate-value.is-negative { color: var(--ui-ocean); }
.filter-summary-delta {
  margin: 0;
  padding-top: 9px;
  color: var(--ui-muted);
  border-top: 1px solid var(--ui-line);
  font-size: 11px;
}

.method {
  gap: 14px;
  padding-top: 24px;
}

.method div {
  min-height: 120px;
  padding: 22px;
  background: rgba(255, 252, 248, .74);
  border: 1px solid rgba(170, 149, 126, .2);
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(58, 44, 30, .04);
}

.method span {
  color: var(--ui-ocean);
  font-family: var(--brand-serif);
  font-size: 32px;
}

.method p {
  color: var(--ui-muted);
  font-family: var(--sans);
  font-size: 13px;
}

.method strong {
  color: var(--ui-ink);
}

footer {
  color: var(--ui-muted);
  background: rgba(239, 228, 213, .92);
  border-top: 1px solid rgba(170, 149, 126, .24);
  font-family: var(--sans);
}

@media (max-width: 1100px) {
  .controls {
    margin-inline: 18px;
  }

  .zoom-controls {
    bottom: 134px;
  }
}

@media (max-width: 720px) {
  .masthead {
    min-height: 0;
    padding: 24px 20px;
  }

  .controls {
    margin: 14px 12px 0;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
  }

  .controls label > span,
  .control-field > label,
  .metric-label,
  .controls legend {
    margin-bottom: 6px;
  }

  .web-select-trigger,
  .controls .segmented {
    height: 48px;
  }

  .map-shell {
    margin-top: 14px;
    margin-inline: 10px;
    padding-top: 20px;
    border-radius: 20px;
  }

  .map-heading { margin-bottom: 14px; }
  .map-subtitle { margin-top: 8px; line-height: 1.45; }
  #scope-label { margin-top: 12px; }

  .zoom-controls {
    top: 120px;
    right: 8px;
    bottom: auto;
  }

  .legend {
    bottom: 8px;
    left: 8px;
    width: calc(100% - 16px);
    padding: 9px;
    border-radius: 10px;
  }

  .legend-header { align-items: flex-start; flex-direction: column; gap: 2px; }
  .legend-title { font-size: 9px; line-height: 1.25; }
  .legend-multiple-hint { font-size: 8.5px; }
  .legend-classes {
    display: flex;
    gap: 3px;
    margin-top: 5px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  .legend-class { flex: 0 0 104px; }
  .legend-class i { height: 8px; margin-bottom: 4px; }
  .legend-class strong { min-height: 2.2em; font-size: 9.5px; }
  .legend-class span { font-size: 9px; }

  .selection.filter-summary {
    padding: 12px;
    border-top: 1px solid rgba(170, 149, 126, .22);
    border-left: 4px solid var(--ui-ocean);
  }

  .selection.map-selection {
    position: relative;
    order: -1;
    top: auto;
    right: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    margin: 0 0 10px;
    overflow: visible;
  }

  .map-stage.night-view + .selection.map-selection {
    width: 100%;
  }

  .map-frame {
    display: flex;
    flex-direction: column;
  }

  .filter-summary-story {
    grid-template-columns: minmax(0, .9fr) 12px minmax(0, 1.1fr) minmax(72px, .5fr);
    gap: 4px;
    padding: 10px 0 9px;
  }

  .filter-summary-rate {
    grid-column: auto;
    display: block;
    padding: 0 0 0 10px;
    border-top: 0;
    border-left: 1px solid var(--ui-line);
  }

  .selection .filter-summary-population { font-size: clamp(22px, 6.2vw, 29px); }
  .selection .filter-summary-point:first-child .filter-summary-population { font-size: clamp(20px, 5.8vw, 27px); }
  .selection .filter-summary-rate-value { font-size: clamp(26px, 7vw, 32px); }
  .filter-summary-arrow { font-size: 16px; }
  .filter-summary-point span,
  .filter-summary-rate span { font-size: 8px; letter-spacing: .06em; }
  .filter-summary-delta { padding-top: 8px; font-size: 10px; }

  .map-view-switcher {
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    gap: 5px;
    padding: 5px;
  }
  .map-switcher-group > span { margin-bottom: 3px; font-size: 7px; }
  .map-switcher-group + .map-switcher-group { padding-top: 5px; }
  .map-view-switcher .segmented { height: 30px; }
  .map-view-switcher .segmented button { padding: 0 2px; font-size: 8.5px; }

  .district-label {
    font-size: 29px;
    letter-spacing: .01em;
    stroke-width: 5px;
  }
  .district-label.small { font-size: 24px; }
  .district-contribution { font-size: 22px; }
  .district-label.small .district-contribution { font-size: 19px; }

  .method {
    gap: 10px;
    padding-top: 16px;
    padding-inline: 12px;
  }

  .method div {
    min-height: 102px;
    padding: 18px;
  }

  .web-select.is-open::before {
    position: fixed;
    z-index: 149;
    inset: 0;
    background: rgba(26, 23, 21, .28);
    backdrop-filter: blur(3px);
    content: "";
  }

  .web-select-menu {
    position: fixed;
    z-index: 151;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    min-width: 0;
    max-height: min(72vh, 760px);
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 30px 30px 0 0;
    box-shadow: 0 -18px 42px rgba(20, 18, 16, .14);
  }

  .web-select-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
    font-family: var(--sans);
  }

  .web-select-menu-head strong {
    font-size: 15px;
  }

  .web-select-search input {
    height: 48px;
    border-radius: 16px;
    font-size: 16px;
  }

  .web-select-options {
    max-height: calc(72vh - 120px - env(safe-area-inset-bottom));
  }

  .web-select-option {
    min-height: 50px;
    font-size: 15px;
  }
}
