@font-face {
  font-family: 'Public Sans';
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/public-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Public Sans';
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/public-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-weight: 500 700;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-weight: 500 700;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #F7F5F0;
  --surface: #FFFEFB;
  --ink: #1F2430;
  --muted: #5B6170;
  --body: #4A5060;
  --line: #E4E0D6;
  --line-strong: #B9B3A6;
  --track: #F2EFE8;
  --accent: #3D5A80;
  --danger: #B8403C;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Public Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(247, 245, 240, .92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { padding-top: 14px; padding-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.pill-active { background: var(--ink); color: var(--bg); font-weight: 600; }
.soon { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #F1E6C8; color: #6B5418; }

/* Portada */
.section-vote { padding-top: 56px; padding-bottom: 24px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.hero-text { max-width: 640px; }
.eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 5vw, 54px); line-height: 1.05; letter-spacing: -.01em; text-wrap: balance; }
.lede { margin: 16px 0 0; font-size: 17px; line-height: 1.55; color: var(--body); text-wrap: pretty; }
.countdown { display: flex; gap: 10px; align-items: baseline; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.countdown-num { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown-label { font-size: 14px; color: var(--muted); line-height: 1.3; }

.group-title { margin: 44px 0 14px; font-size: 15px; font-weight: 600; }
.group-title-other { margin-top: 32px; }

/* Tarjetas de partido */
.main-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.party-card {
  text-align: left; cursor: pointer; padding: 0; border-radius: 16px; overflow: hidden;
  background: var(--surface); border: 2px solid var(--line); color: inherit;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.party-card[aria-pressed="true"] { border-color: var(--party); box-shadow: 0 8px 24px rgba(31, 36, 48, .10); }
.party-card-top { height: 96px; background: var(--party); display: flex; align-items: flex-end; justify-content: space-between; padding: 16px 18px; }
.party-card-short { font-family: var(--serif); font-weight: 700; font-size: 34px; color: #fff; line-height: 1; }
.party-check { width: 28px; height: 28px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--party); opacity: 0; transition: opacity .15s; }
.party-card[aria-pressed="true"] .party-check { opacity: 1; }
.party-card-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.party-card-name { font-size: 15px; font-weight: 600; }
.party-card-status { font-size: 13px; color: var(--muted); }

.other-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.party-chip {
  cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line); text-align: left; color: inherit;
  transition: border-color .15s, background .15s;
}
.party-chip[aria-pressed="true"] { border-color: var(--party); background: #fff; }
.party-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--party); }
.party-chip-text { display: flex; flex-direction: column; min-width: 0; }
.party-chip-short { font-size: 14px; font-weight: 600; }
.party-chip-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.party-card:disabled, .party-chip:disabled { cursor: default; }
.voted .party-card:not([aria-pressed="true"]), .voted .party-chip:not([aria-pressed="true"]) { opacity: .55; }

@media (hover: hover) {
  a:hover { color: var(--accent); }
  .pill-active:hover { color: var(--bg); }
  .party-card:not(:disabled):hover { transform: translateY(-2px); }
  .party-chip:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--line-strong); }
  .soon-card-blue:hover { border-color: #9FB2C4; color: var(--ink); }
  .soon-card-green:hover { border-color: #AFB792; color: var(--ink); }
}

/* Barra de confirmación */
.vote-bar { margin-top: 28px; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.vote-bar-text { display: flex; flex-direction: column; gap: 2px; }
.vote-bar-title { font-size: 15px; font-weight: 600; }
.vote-bar-sub { font-size: 14px; color: var(--muted); }
.btn { cursor: pointer; padding: 13px 26px; border-radius: 999px; border: none; background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; transition: background .15s; }
.btn:disabled { background: var(--line-strong); cursor: default; }
.btn-block { width: 100%; }
.vote-again { margin: 12px 0 0 auto; }

/* Resultados */
.section-results { padding-top: 40px; padding-bottom: 24px; }
.results-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px clamp(18px, 3vw, 36px); }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--danger); text-transform: uppercase; letter-spacing: .08em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #D64541; animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(214, 69, 65, .45); } 70% { box-shadow: 0 0 0 8px rgba(214, 69, 65, 0); } 100% { box-shadow: 0 0 0 0 rgba(214, 69, 65, 0); } }
.serif-title { margin: 8px 0 0; font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.1; }
.results-total { text-align: right; }
.results-total-num { font-family: var(--serif); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }

.stack { margin-top: 24px; height: 14px; border-radius: 999px; overflow: hidden; display: flex; background: #EEEAE1; }
.stack-seg { height: 100%; background: var(--party); transition: width .8s ease; }
.rows { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.row { display: grid; grid-template-columns: minmax(72px, 120px) minmax(0, 1fr) 120px; gap: 14px; align-items: center; }
.row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-short { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-mine { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: var(--ink); color: #fff; }
.row-track { height: 26px; border-radius: 6px; background: var(--track); overflow: hidden; }
.row-bar { height: 100%; background: var(--party); border-radius: 6px; transition: width .8s ease; }
.row-nums { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.row-pct { font-size: 15px; font-weight: 700; }
.row-votes { font-size: 12px; color: var(--muted); min-width: 52px; text-align: right; }
.results-empty { margin-top: 24px; padding: 40px 20px; border-radius: 14px; background: var(--track); text-align: center; }
.results-empty-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.disclaimer { margin: 24px 0 0; font-size: 12px; color: #6B7080; line-height: 1.5; }

@media (max-width: 520px) {
  .row { grid-template-columns: 76px minmax(0, 1fr) 64px; gap: 10px; }
  .row-votes { display: none; }
}

/* Muy pronto */
.section-soon { padding-top: 40px; padding-bottom: 72px; }
.soon-title { margin: 0 0 16px; font-size: 28px; }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.soon-card { text-decoration: none; padding: 26px; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; border: 1px solid; transition: border-color .15s; }
.soon-card-blue { background: #E8EEF3; border-color: #D5DEE7; --tone: #3D5A80; }
.soon-card-green { background: #EEF0E6; border-color: #DDE1CF; --tone: #5A6438; }
.soon-tag { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff; color: var(--tone); }
.soon-card-title { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.soon-card-text { font-size: 15px; line-height: 1.55; color: var(--body); text-wrap: pretty; }
.soon-card-link { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--tone); }

/* Pie */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { padding-top: 22px; padding-bottom: max(22px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.footer-inner a { color: inherit; }

/* Diálogo de verificación */
.dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 28px 24px 24px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(31, 36, 48, .22);
}
.dialog::backdrop { background: rgba(31, 36, 48, .45); }
.dialog[open] { animation: dialogIn .18s ease-out; }
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: none; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.dialog-title { margin: 0 32px 10px 0; font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.15; }
.dialog-text { margin: 0 0 18px; font-size: 14px; line-height: 1.55; color: var(--body); }
.dialog-note { margin: 0 0 18px; padding: 10px 12px; border-radius: 10px; background: #F1E6C8; color: #6B5418; font-size: 13px; line-height: 1.45; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--body); margin-bottom: 18px; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
.google-button { display: flex; justify-content: center; min-height: 44px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 12px; color: var(--muted); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 16px; margin-bottom: 14px; }
.input:focus { outline: none; border-color: var(--ink); }
.input-code { font-size: 24px; font-weight: 600; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.turnstile:not(:empty) { margin-bottom: 14px; display: flex; justify-content: center; }
.link-btn { display: block; margin: 14px auto 0; padding: 6px; border: none; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dialog-msg { margin: 14px 0 0; font-size: 14px; line-height: 1.45; color: var(--danger); }
.dialog-msg:empty { display: none; }

/* Página de texto (privacidad) */
.prose { max-width: 720px; padding-top: 48px; padding-bottom: 72px; }
.prose h1 { font-size: clamp(30px, 4vw, 40px); margin-bottom: 20px; }
.prose h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 32px 0 8px; }
.prose p, .prose li { font-size: 16px; line-height: 1.65; color: var(--body); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
