/* ============================================================
   MIRADOR 2027 — sistema de diseño
   Identidad: atlas político mexicano. Acento magenta INE,
   tipografía institucional (Archivo) + Inter + Space Grotesk.
   ============================================================ */

:root {
  --canvas: #eceff3;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #14161a;
  --ink-2: #3b414b;
  --muted: #6b7280;
  --hair: #dce1e7;
  --hair-2: #e9edf1;
  --accent: #c6007e;       /* magenta INE */
  --accent-ink: #8f005b;

  /* Contexto temático (se redefine en el tema oscuro). */
  --topbar-bg: rgba(255,255,255,.86);
  --map-border: #14161a;   /* líneas que separan estados (ligeras en oscuro) */
  --sin-eleccion: #d7dde4; /* relleno de estados sin elección */
  --dom-bg-1: #e8edf3;     /* fondo del mapa de dominio (tintado, no blanco) */
  --dom-bg-2: #dde4ee;

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-data: 'Space Grotesk', 'Inter', system-ui, sans-serif;

  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(20,22,26,.04), 0 8px 24px rgba(20,22,26,.06);
  --shadow-sm: 0 1px 2px rgba(20,22,26,.05), 0 2px 8px rgba(20,22,26,.05);
  --maxw: 1200px;
  color-scheme: light;
}

/* ---------- Tema oscuro ---------- */
[data-theme="dark"] {
  --canvas: #12151a;
  --surface: #1d2129;
  --surface-2: #272c37;
  --ink: #eef1f6;
  --ink-2: #c9d0db;
  --muted: #8f97a6;
  --hair: #303644;
  --hair-2: #2a2f3a;
  --accent: #ef45a4;
  --accent-ink: #f46fbc;

  --topbar-bg: rgba(18,21,26,.86);
  --map-border: #dfe4ec;
  --sin-eleccion: #3a4150;
  --dom-bg-1: #171b23;
  --dom-bg-2: #10141b;

  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
b { font-weight: 700; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--surface); padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem clamp(1rem, 4vw, 2.5rem);
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.brand { display: flex; align-items: center; gap: .55rem; }
.brand-mark {
  color: var(--accent); font-size: 1.35rem; line-height: 1;
  transform: translateY(1px);
}
.brand-name { font-family: var(--font-display); font-weight: 800; letter-spacing: .04em; font-size: 1.05rem; }
.brand-year {
  color: var(--accent); margin-left: .28rem;
  font-family: var(--font-data); font-weight: 700;
}
.nav { display: flex; gap: .35rem; margin-left: .5rem; }
.nav a {
  padding: .45rem .8rem; border-radius: 999px;
  font-size: .92rem; font-weight: 500; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--surface); }
.demo-badge {
  font-family: var(--font-data); font-size: .68rem; font-weight: 600; letter-spacing: .06em;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 999px; padding: .32rem .7rem;
  white-space: nowrap;
}

/* Indicador "EN VIVO" con punto animado. */
.live {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-data); font-size: .7rem; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #16b364; flex: none; }
.live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(22,179,100,.5);
  animation: livePulse 1.6s ease-out infinite;
}
@keyframes livePulse {
  0% { transform: scale(.4); opacity: .9; }
  80%, 100% { transform: scale(2.4); opacity: 0; }
}
.live-label { color: #12a25e; letter-spacing: .09em; }
.live-since { color: var(--muted); font-weight: 500; }

/* Botón para alternar fondo claro/oscuro. */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--hair); background: var(--surface);
  color: var(--ink-2); cursor: pointer; border-radius: 999px;
  padding: .32rem .7rem; font-family: var(--font-data); font-size: .76rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); }

/* ---------- Layout base ---------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.25rem, 3.5vw, 2.75rem) clamp(1rem, 4vw, 2.5rem) 3rem;
}
.app > section { margin-bottom: clamp(1.75rem, 4vw, 3rem); }
.app > section:last-child { margin-bottom: 0; }

.eyebrow {
  margin: 0 0 .7rem;
  font-family: var(--font-data); font-size: .74rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
}
.ficticio { color: var(--accent-ink); }
.fuente-real { color: var(--muted); font-weight: 600; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.1rem;
}
.section-head h2 { font-size: 1.4rem; }
.see-all { color: var(--accent-ink); font-weight: 600; font-size: .9rem; }
.see-all:hover { text-decoration: underline; }
.side-note { color: var(--muted); font-size: .8rem; font-family: var(--font-data); }

/* ---------- Hero (vista general) ---------- */
.hero { padding-top: .5rem; }
.hero-h {
  font-size: clamp(2rem, 5.2vw, 3.5rem); line-height: 1.02; max-width: 18ch;
}
.hero-num {
  font-family: var(--font-data); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.hero-sub { color: var(--ink-2); margin: 1rem 0 0; font-size: 1.02rem; }

/* ---------- Board (mapa + panel) ---------- */
.board { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.5rem; align-items: start; }
.board-map, .board-side { display: grid; gap: 1rem; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.lg-item { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 500; }
.lg-name { color: var(--ink-2); }
.lg-sw { width: 15px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-hatch {
  background:
    repeating-linear-gradient(45deg, #fff 0 2px, transparent 2px 5px),
    var(--c) !important;
  border: 1px solid var(--c);
}
.lg-key { display: inline-flex; gap: .7rem; color: var(--muted); font-family: var(--font-data); font-size: .72rem; }
.legend-lg .lg-item { font-size: .9rem; }

.metric-toggle {
  display: inline-flex; background: var(--surface); border: 1px solid var(--hair);
  border-radius: 999px; padding: 3px; box-shadow: var(--shadow-sm);
}
.metric-toggle button {
  border: 0; background: none; cursor: pointer;
  font-family: var(--font-data); font-size: .82rem; font-weight: 600; color: var(--muted);
  padding: .4rem .85rem; border-radius: 999px; transition: background .15s, color .15s;
}
.metric-toggle button.on { background: var(--ink); color: var(--surface); }

/* ---------- Mapa SVG ---------- */
.map-stage {
  position: relative; background: var(--surface);
  border: 1px solid var(--hair); border-radius: var(--r);
  padding: .8rem; box-shadow: var(--shadow);
}
.map-stage svg { width: 100%; height: auto; display: block; overflow: visible; }
.map-stage-lg { padding: 1.2rem; }
/* Líneas oscuras que separan cada estado (claras en el tema oscuro, legibles sobre partido).
   El mapa usa proyección Mercator (radianes), por lo que los grosores van en esa unidad. */
.estado path { stroke: var(--map-border); stroke-width: .0012px; transition: stroke-width .15s; }
/* El relleno neutro de los estados sin elección sigue el tema activo y deja ver el basemap. */
.estado.no-elige path { fill: var(--sin-eleccion); fill-opacity: .55; }
.estado.flip path { stroke: var(--map-border); stroke-width: .0028px; }
/* Sin filtros SVG/CSS: al cambiar de estado a municipios algunos motores conservan una capa negra rasterizada. */
.estado.elegible:hover path:first-child { stroke-width: .0038px; }
.estado:focus { outline: none; }
.estado.elegible:focus-visible path:first-child { stroke: var(--accent); stroke-width: .0052px; }
.estado.no-elige path { pointer-events: none; }

.map-hover {
  position: absolute; top: 0; left: 0; pointer-events: none;
  min-width: 150px; background: var(--ink); color: var(--surface);
  border-radius: 10px; padding: .6rem .7rem; z-index: 5;
  opacity: 0; transition: opacity .12s; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  will-change: transform;
}
.map-hover.on { opacity: 1; }
.mh-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.mh-name { font-family: var(--font-display); font-weight: 700; }
.mh-status { font-family: var(--font-data); font-size: .66rem; color: #c9ccd2; text-transform: uppercase; letter-spacing: .05em; }
.mh-party { margin: .35rem 0 .3rem; display: flex; align-items: center; gap: .4rem; }
.mh-flip { font-family: var(--font-data); font-size: .64rem; color: #ffd0ea; border: 1px solid #7a3560; border-radius: 5px; padding: 0 .3rem; }
.mh-metric { font-size: .82rem; color: #d6d9df; font-family: var(--font-data); }
.mh-metric b { color: #fff; }

/* ---------- Chips, puntos, estatus, flip ---------- */
.chip {
  display: inline-flex; align-items: center; padding: .18rem .55rem;
  border-radius: 999px; font-size: .78rem; font-weight: 600; font-family: var(--font-data);
  background: var(--ink); color: var(--surface); white-space: nowrap;
}
.chip-soft { background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.pdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: .35rem; vertical-align: -1px; }
.status { font-family: var(--font-data); font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 6px; }
.status-segura { background: color-mix(in srgb, #1f7a45 15%, var(--surface)); color: #2c9b62; }
.status-probable { background: color-mix(in srgb, #2d6cb0 15%, var(--surface)); color: #4a88c8; }
.status-inclinada { background: color-mix(in srgb, #b26a12 17%, var(--surface)); color: #d18a2a; }
.status-renida { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent-ink); }
.flip-tag { font-family: var(--font-data); font-size: .68rem; font-weight: 600; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 6px; padding: .16rem .45rem; }
.flip-tag.sm { font-size: .6rem; padding: .05rem .3rem; }
.hold-tag { font-family: var(--font-data); font-size: .68rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--hair); border-radius: 6px; padding: .16rem .45rem; }

/* ---------- Logotipos de partido (chips de fondo claro, tinte por partido) ---------- */
.plogo {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: color-mix(in srgb, var(--pc) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--pc) 32%, transparent);
  border-radius: 6px; vertical-align: middle; box-sizing: border-box;
}
.plogo img { display: block; width: auto; height: var(--plo-h, 27px); }
.plogo-xs { --plo-h: 24px; padding: 3px 7px; border-radius: 6px; }
.plogo-md { --plo-h: 30px; padding: 4px 10px; }
.plogo-lg { --plo-h: 40px; padding: 5px 14px; }
.plogo-xl { --plo-h: 54px; padding: 6px 18px; }

/* ---------- Probabilidad apilada ---------- */
.pb { display: flex; width: 100%; height: 9px; border-radius: 999px; overflow: hidden; background: var(--hair-2); }
.pb-seg { display: block; height: 100%; }

/* ---------- Panel lateral (stats + balance) ---------- */
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.stat { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.stat-k { display: block; font-family: var(--font-data); font-weight: 700; font-size: 1.9rem; line-height: 1; letter-spacing: -.02em; }
.stat-l { display: block; color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.balance { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 1rem; box-shadow: var(--shadow-sm); }
.side-title { font-size: 1rem; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.bal-bar { display: flex; height: 20px; border-radius: 6px; overflow: hidden; background: var(--hair-2); }
.bal-seg { height: 100%; }
.bal-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin-top: .7rem; }
.bal-li { font-size: .82rem; color: var(--ink-2); }
.bal-li b { font-family: var(--font-data); }

/* ---------- Carreras para observar ---------- */
.race-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.race-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.race-card:hover, .race-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cdd4dc; outline: none; }
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.rc-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.rc-fav { display: flex; align-items: center; gap: .4rem; margin-bottom: .7rem; }
.rc-foot { display: flex; justify-content: space-between; margin-top: .6rem; color: var(--muted); font-size: .82rem; }
.rc-foot b { font-family: var(--font-data); color: var(--ink); }

/* ---------- Predicciones ---------- */
.pred-hero { padding-top: .5rem; }
.pred-h { font-size: clamp(2rem, 5vw, 3rem); }
.pred-sub { color: var(--ink-2); margin: .8rem 0 0; }
.scen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.scen-card { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1.3rem 1.3rem 1.4rem; box-shadow: var(--shadow-sm); overflow: hidden; }
.scen-logo { margin-bottom: .8rem; }
.scen-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.scen-p { font-family: var(--font-data); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--c); letter-spacing: -.02em; }
.scen-t { margin: .7rem 0 0; color: var(--ink-2); font-size: .98rem; }

.proj-rows { display: grid; gap: .55rem; }
.proj-row { display: grid; grid-template-columns: 190px 1fr 46px 64px; align-items: center; gap: .8rem; }
.proj-name { font-weight: 600; font-size: .95rem; }
.proj-track { height: 16px; background: var(--hair-2); border-radius: 6px; overflow: hidden; }
.proj-fill { display: block; height: 100%; border-radius: 6px; }
.proj-val { font-family: var(--font-data); font-weight: 700; text-align: right; }
.proj-range { font-family: var(--font-data); font-size: .8rem; color: var(--muted); text-align: right; }

.sortbar { display: inline-flex; gap: .25rem; background: var(--surface); border: 1px solid var(--hair); border-radius: 999px; padding: 3px; }
.sortbar button { border: 0; background: none; cursor: pointer; font-family: var(--font-data); font-size: .78rem; font-weight: 600; color: var(--muted); padding: .35rem .75rem; border-radius: 999px; }
.sortbar button.on { background: var(--ink); color: var(--surface); }

.ftable { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.ft-row { display: grid; grid-template-columns: 1.3fr 1.4fr 1.6fr 60px 60px 100px; align-items: center; gap: .8rem; padding: .7rem 1rem; border-top: 1px solid var(--hair-2); cursor: pointer; }
.ft-row:first-child { border-top: 0; }
.ft-row:hover, .ft-row:focus-visible { background: var(--surface-2); outline: none; }
.ft-name { font-weight: 600; }
.ft-fav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ft-prob, .ft-margen { font-family: var(--font-data); font-weight: 600; text-align: right; }
.ft-status { justify-self: end; }

/* ---------- Detalle de estado ---------- */
.back { display: inline-block; color: var(--accent-ink); font-weight: 600; font-size: .9rem; margin-bottom: 1rem; }
.back:hover { text-decoration: underline; }
.detail-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.detail-h { font-size: clamp(2rem, 5vw, 3rem); }
.detail-tags { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }
.detail-kpis { display: flex; gap: 1.5rem; }
.kpi { text-align: right; }
.kpi-k { display: block; font-family: var(--font-data); font-weight: 700; font-size: 1.7rem; line-height: 1; }
.kpi-l { display: block; color: var(--muted); font-size: .78rem; margin-top: .3rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1.2rem; box-shadow: var(--shadow-sm); }
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h3 { font-size: 1.05rem; }
.panel-sub { color: var(--muted); font-size: .8rem; font-family: var(--font-data); }
.trend-wrap { width: 100%; }
.trend { width: 100%; height: auto; display: block; }
.trend .grid { stroke: var(--hair-2); stroke-width: 1; }
.trend .grid-lbl { fill: var(--muted); font-family: var(--font-data); font-size: 9px; }
.trend-legend { display: flex; gap: 1rem; margin-top: .6rem; flex-wrap: wrap; }
.tl-item { font-size: .85rem; color: var(--ink-2); }

.vbars { display: flex; align-items: flex-end; gap: .8rem; height: 170px; padding-top: .5rem; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.vbar-col { width: 100%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; }
.vbar-fill { width: 100%; border-radius: 6px 6px 0 0; min-height: 3px; transition: height .5s ease; }
.vbar-val { font-family: var(--font-data); font-weight: 700; font-size: clamp(.67rem, 1.5vw, .9rem); margin-top: .4rem; white-space: nowrap; }
.vbar-lbl { font-size: .74rem; color: var(--muted); }
.panel-note { margin: .8rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.35; }

.problist { display: grid; gap: .55rem; }
.pl-row { display: grid; grid-template-columns: 1fr 90px 44px; align-items: center; gap: .6rem; }
.pl-name { font-size: .9rem; }
.pl-bar { height: 10px; background: var(--hair-2); border-radius: 999px; overflow: hidden; }
.pl-bar span { display: block; height: 100%; }
.pl-val { font-family: var(--font-data); font-weight: 600; text-align: right; font-size: .9rem; }

.survey-wrap { overflow-x: auto; }
.survey { width: 100%; border-collapse: collapse; font-size: .88rem; }
.survey th { text-align: right; color: var(--muted); font-weight: 600; font-family: var(--font-data); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .6rem; border-bottom: 1px solid var(--hair); }
.survey th:first-child, .survey td:first-child { text-align: left; }
.survey td { padding: .5rem .6rem; border-bottom: 1px solid var(--hair-2); text-align: right; }
.st-casa { font-weight: 600; }
.st-n, .st-val { font-family: var(--font-data); }
.st-val { font-weight: 600; }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 4rem 1rem; color: var(--ink-2); }
.empty h2 { margin-bottom: .6rem; }
.empty code { background: var(--surface); border: 1px solid var(--hair); border-radius: 6px; padding: .1rem .4rem; font-family: var(--font-data); }
.hint { color: var(--muted); margin-top: 1rem; }

/* ---------- Footer ---------- */
.foot { max-width: var(--maxw); margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem; border-top: 1px solid var(--hair); display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; color: var(--muted); font-size: .82rem; }
.foot-warn b { color: var(--accent-ink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .board { grid-template-columns: 1fr; }
  .scen { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .proj-row { grid-template-columns: 120px 1fr 40px; }
  .proj-range { display: none; }
  .ft-row { grid-template-columns: 1.2fr 1fr 54px; }
  .ft-bar, .ft-margen, .ft-status { display: none; }
  .detail-hero { align-items: flex-start; }
  .detail-kpis { gap: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   Encuestas — landing
   ============================================================ */
.enc-hero { padding-top: .5rem; }
.enc-h { font-size: clamp(2rem, 5vw, 3rem); }
.enc-sub { color: var(--ink-2); margin: .8rem 0 0; max-width: 62ch; }
.enc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
.enc-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1.2rem; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.enc-card:hover, .enc-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cdd4dc; outline: none; }
.enc-card.big { grid-column: span 2; }
.ec-top h3 { font-size: 1.12rem; line-height: 1.15; letter-spacing: -.01em; }
.ec-chart { margin: .9rem 0 .6rem; }
.ec-chart svg { width: 100%; height: auto; display: block; }
.ec-topline { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin-top: auto; }
.tl-chip { display: inline-flex; flex-direction: column; border-left: 3px solid var(--c); padding-left: .5rem; }
.tl-v { font-family: var(--font-data); font-weight: 700; font-size: 1.35rem; line-height: 1; color: var(--c); }
.tl-l { font-size: .74rem; color: var(--muted); margin-top: .15rem; }
.ec-go { margin-top: .9rem; color: var(--accent-ink); font-weight: 600; font-size: .85rem; }

.enc-state-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.es-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: .55rem .8rem; cursor: pointer; text-align: left; color: var(--ink); }
.es-row:hover { border-color: #cdd4dc; background: var(--surface-2); }
.es-name { font-weight: 500; font-size: .9rem; }
.es-lead { font-family: var(--font-data); font-size: .78rem; color: var(--muted); }
.es-lead b { color: var(--ink); }

/* Encuestas — detalle */
.enc-detail { }
.ed-title { font-size: clamp(1.6rem, 4vw, 2.4rem); max-width: 24ch; }
.ed-sub { color: var(--ink-2); margin: .6rem 0 0; }
.ed-topline { display: flex; flex-wrap: wrap; gap: 1.2rem 1.8rem; margin: 1.2rem 0; }
.ed-chartwrap { position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1.2rem 1rem .6rem; box-shadow: var(--shadow-sm); }
.ed-chartwrap svg { width: 100%; height: auto; display: block; }
.enop { position: absolute; top: 1rem; left: 1rem; z-index: 2; background: var(--accent); color: #fff; font-family: var(--font-data); font-weight: 700; font-size: .72rem; padding: .2rem .5rem; border-radius: 6px; }
.ed-now-tag { position: absolute; top: 1rem; right: 1rem; z-index: 2; color: var(--muted); font-size: .72rem; font-family: var(--font-data); }
.ed-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .8rem; }
.edl-item { font-size: .88rem; color: var(--ink-2); }
.ed-foot { color: var(--muted); font-size: .82rem; margin-top: 1rem; }
.pollchart .pc-grid { stroke: var(--hair-2); stroke-width: 1; }
.pollchart .pc-glbl { fill: var(--muted); font-family: var(--font-data); font-size: 9px; }
.pollchart .pc-xlbl { fill: var(--muted); font-family: var(--font-data); font-size: 9px; text-anchor: middle; }
.pollchart .pc-now { font-family: var(--font-data); font-size: 11px; font-weight: 700; }

/* ============================================================
   Home — previsualización de encuestas
   ============================================================ */
.hp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hp-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 1rem; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.hp-card:hover, .hp-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cdd4dc; outline: none; }
.hp-q { font-size: .96rem; line-height: 1.2; letter-spacing: -.01em; min-height: 2.3em; }
.hp-spark { margin: .6rem 0 .5rem; }
.hp-spark svg { width: 100%; height: auto; display: block; }
.hp-chips { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
.hp-chip { font-size: .82rem; color: var(--ink-2); border-left: 3px solid var(--c); padding-left: .4rem; }
.hp-chip b { font-family: var(--font-data); color: var(--c); }


@media (max-width: 720px) {
  .enc-grid { grid-template-columns: 1fr; }
  .enc-card.big { grid-column: auto; }
  .hp-grid { grid-template-columns: 1fr; }
}
