/* ==========================================================================
   base.css — Design system de la Federación de Instituciones Culturales y Deportivas de La Plata
   Tokens (claro/oscuro) · reset · tipografía · layout · componentes compartidos · header/footer · print
   Documentación: tools/DESIGN.md · Demo: tools/showcase.html
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F5F7FC;
  --surface-2: #EBEEF7;
  --text: #0F1633;
  --text-muted: #4B5573;
  --primary: #1B2FD9;
  --primary-strong: #2023A3;
  --primary-contrast: #FFFFFF;
  --accent: #0005FA;
  --warm: #F5A524;
  --warm-ink: #3D2600;
  --border: #D9DEEC;
  --border-strong: #B9C1D9;
  --danger: #B42318;
  --success: #0E7A45;
  --live: #D91B3C;

  --primary-soft: color-mix(in srgb, var(--primary) 10%, var(--bg));
  --primary-soft-2: color-mix(in srgb, var(--primary) 18%, var(--bg));
  --ring: 0 0 0 3px var(--accent);
  --shadow-sm: 0 1px 2px rgb(15 22 51 / .05), 0 2px 8px -2px rgb(15 22 51 / .08);
  --shadow: 0 1px 2px rgb(15 22 51 / .05), 0 12px 32px -12px rgb(15 22 51 / .22);
  --shadow-lg: 0 2px 6px rgb(15 22 51 / .06), 0 32px 64px -24px rgb(15 22 51 / .32);
  --scrim: rgb(32 35 163 / .75);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', sans-serif;

  --fs-hero: clamp(2.6rem, 1.6rem + 4.5vw, 5rem);
  --fs-h1: clamp(2.375rem, 1.5rem + 3vw, 3.75rem);
  --fs-h2: clamp(2rem, 1.4rem + 2.2vw, 3.25rem);
  --fs-h3: clamp(1.375rem, 1.15rem + .8vw, 1.75rem);
  --fs-h4: 1.125rem;
  --fs-lead: clamp(1.125rem, 1rem + .5vw, 1.375rem);
  --fs-body: 1.0625rem;
  --fs-small: .875rem;
  --fs-xs: .8125rem;
  --lh-body: 1.6;
  --lh-tight: 1.1;

  --sp-1: .25rem;  --sp-2: .5rem;  --sp-3: .75rem; --sp-4: 1rem;  --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-12: 3rem;  --sp-16: 4rem;  --sp-24: 6rem; --sp-32: 8rem;
  --section-y: clamp(4rem, 8vw, 7.5rem);
  --container: 75rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-h: 64px;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-reveal: 700ms;

  --z-header: 50;
  --z-ficha: 60;
  --z-dialog: 70;
  --z-toast: 80;
}

[data-theme="dark"],
.section--dark,
.theme-dark {
  color-scheme: dark;
  --bg: #0B1020;
  --surface: #141B36;
  --surface-2: #1C2547;
  --text: #E7EAF6;
  --text-muted: #A9B1CC;
  --primary: #8FA0FF;
  --primary-strong: #A9B8FF;
  --primary-contrast: #0B1020;
  --accent: #6F84FF;
  --warm: #F5B544;
  --warm-ink: #3D2600;
  --border: #2A3457;
  --border-strong: #3B4775;
  --danger: #FF8A80;
  --success: #6FD3A0;
  --live: #FF5C7A;
  --primary-soft: color-mix(in srgb, var(--primary) 12%, var(--bg));
  --primary-soft-2: color-mix(in srgb, var(--primary) 20%, var(--bg));
  --shadow-sm: 0 0 0 1px var(--border);
  --shadow: 0 0 0 1px var(--border);
  --shadow-lg: 0 0 0 1px var(--border), 0 32px 64px -24px rgb(0 0 0 / .6);
  --scrim: rgb(11 16 32 / .72);
}
[data-theme="dark"] .section--dark,
[data-theme="dark"] .theme-dark { --bg: #070B18; --surface: #10162E; --surface-2: #182040; }

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
html:focus-within { scroll-behavior: smooth; }
html.nav-open { overflow: hidden; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--primary); text-decoration-thickness: from-font; text-underline-offset: .18em; }
a:hover { color: var(--primary-strong); }
:where(ul[class], ol[class]) { list-style: none; padding: 0; }
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
p, li, dd, figcaption, td, th { overflow-wrap: break-word; }
address { font-style: normal; }
hr { border: 0; border-top: 1px solid var(--border); margin-block: var(--sp-8); }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }
main { display: block; }
main:focus { outline: none; }

/* ---------- 3. Tipografía ---------- */
h1, h2, h3, .h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  line-height: var(--lh-tight);
  letter-spacing: -.02em;
  color: var(--text);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); letter-spacing: -.01em; line-height: 1.2; }
h4, .h4 { font-family: var(--font-body); font-size: var(--fs-h4); font-weight: 700; line-height: 1.3; }
.display { font-size: var(--fs-hero); letter-spacing: -.025em; line-height: 1.02; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6em;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary); margin-bottom: var(--sp-4);
}
.eyebrow::before { content: ""; width: 1.75rem; height: 2px; background: currentColor; border-radius: 2px; }
.eyebrow--plain::before { display: none; }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--text-muted); text-wrap: pretty; max-width: 62ch; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-small); }
.xs { font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-display); }
.text-center { text-align: center; }
.text-balance { text-wrap: balance; }
.emoji { font-family: var(--font-emoji); font-style: normal; line-height: 1; }

/* ---------- 4. Utilidades ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; top: var(--sp-3); left: var(--sp-3); z-index: 100;
  padding: .75rem 1.125rem; background: var(--text); color: var(--bg); font-weight: 700; text-decoration: none;
  border-radius: var(--radius); transform: translateY(-200%); transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: none; outline-color: var(--warm); color: var(--bg); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 56rem; }
.container--wide { max-width: 90rem; }
.stack > * + * { margin-top: var(--stack, var(--sp-4)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.flow > * + * { margin-top: 1em; }
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); } .mt-12 { margin-top: var(--sp-12); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); } .mb-8 { margin-bottom: var(--sp-8); }
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: initial; } .hide-desktop { display: none !important; } }

/* ---------- 5. Secciones ---------- */
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: calc(var(--section-y) * .6); }
.section--alt { background: var(--surface); }
.section--dark { background: var(--bg); color: var(--text); }
.section--dark .eyebrow { color: var(--primary); }
.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section__head--center { margin-inline: auto; text-align: center; }
.section__head--center .lead { margin-inline: auto; }
.section__head--split { max-width: none; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-4) var(--sp-8); }
.section__head--split > div { max-width: 46rem; }
.section__head h1, .section__head h2 { margin-bottom: var(--sp-4); }
.section__head .lead { margin-top: var(--sp-2); }
.section__head .eyebrow { margin-bottom: var(--sp-3); }

/* ---------- 6. Botones ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: transparent; --btn-bg-h: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .75rem 1.375rem;
  font-family: var(--font-body); font-weight: 700; font-size: .9375rem; line-height: 1.2; letter-spacing: .005em;
  color: var(--btn-fg); background: var(--btn-bg); border: 1.5px solid var(--btn-bd); border-radius: var(--radius);
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
  will-change: transform;
}
.btn:hover { background: var(--btn-bg-h); color: var(--btn-fg); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .icon { width: 1.125em; height: 1.125em; flex: none; }
.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--primary-contrast); --btn-bg-h: var(--primary-strong); box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn--primary:hover { box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn--secondary { --btn-bg: transparent; --btn-fg: var(--primary-strong); --btn-bd: var(--primary); --btn-bg-h: var(--primary-soft); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: transparent; --btn-bg-h: var(--surface-2); }
.btn--light { --btn-bg: #FFFFFF; --btn-fg: #2023A3; --btn-bg-h: #EBEEF7; }
.btn--outline-light { --btn-bg: transparent; --btn-fg: #FFFFFF; --btn-bd: rgb(255 255 255 / .7); --btn-bg-h: rgb(255 255 255 / .12); }
.btn--warm { --btn-bg: var(--warm); --btn-fg: var(--warm-ink); --btn-bg-h: color-mix(in srgb, var(--warm) 85%, #000); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bg-h: color-mix(in srgb, var(--danger) 85%, #000); }
.btn--pill { border-radius: var(--radius-full); }
.btn--sm { min-height: 2.75rem; padding: .5rem 1rem; font-size: var(--fs-small); }
.btn--lg { min-height: 3.5rem; padding: 1rem 1.75rem; font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 3rem; min-width: 3rem; }
.btn--icon.btn--sm { width: 2.75rem; min-width: 2.75rem; }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.link-arrow { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; text-decoration: none; color: var(--primary); }
.link-arrow::after { content: "→"; transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover::after { transform: translateX(4px); }
.link-arrow:hover { color: var(--primary-strong); text-decoration: underline; }

/* ---------- 7. Cards ---------- */
.card {
  --card-p: clamp(1.25rem, 3vw, 1.75rem);
  position: relative; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base);
}
.section--alt .card, .card--surface { background: var(--bg); }
.card--flat { box-shadow: none; }
.card--soft { background: var(--surface); border-color: transparent; box-shadow: none; }
.card__media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-reveal) var(--ease-out); }
.card__media--square { aspect-ratio: 1; }
.card__media--wide { aspect-ratio: 2 / 1; }
.card__body { padding: var(--card-p); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }
.card__body > :last-child { margin-top: auto; }
.card__body > :first-child:last-child { margin-top: 0; }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; line-height: 1.2; letter-spacing: -.01em; }
.card__title a { color: inherit; text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card__meta { font-size: var(--fs-small); color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.card__text { color: var(--text-muted); }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding-top: var(--sp-2); }
.card--hover:hover, .card--hover:focus-within { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card--hover:hover .card__media img { transform: scale(1.04); }
.card--accent { border-top: 4px solid var(--c, var(--primary)); }
.card--accent .card__title { color: var(--text); }
.card--accent .eyebrow { color: var(--c, var(--primary)); }
.card--center { align-items: center; text-align: center; }
.card--center .card__body { align-items: center; }
.card__icon {
  display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--c, var(--primary)) 12%, var(--bg)); color: var(--c, var(--primary)); margin-bottom: var(--sp-2);
}
.card__icon svg { width: 1.5rem; height: 1.5rem; }
.card__icon--emoji { font-family: var(--font-emoji); font-size: 1.5rem; }
[data-theme="dark"] .card__icon { background: color-mix(in srgb, var(--c, var(--primary)) 24%, var(--bg)); color: color-mix(in srgb, var(--c, var(--primary)) 55%, #fff); }

/* ---------- 8. Chips y badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 2.5rem; padding: .375rem .875rem;
  font-size: var(--fs-small); font-weight: 600; line-height: 1.2; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-full);
  text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.chip:active { transform: scale(.97); }
.chip.is-active, .chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip--static { cursor: default; }
.chip--static:hover { background: var(--surface); border-color: var(--border); }
.chip__emoji { font-family: var(--font-emoji); font-size: 1.1em; line-height: 1; }
.chip__count { font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-xs); padding: .1rem .45rem; border-radius: var(--radius-full); background: color-mix(in srgb, currentColor 12%, transparent); }
.chip--tipo {
  --c: var(--primary);
  background: color-mix(in srgb, var(--c) 9%, var(--bg));
  border-color: color-mix(in srgb, var(--c) 35%, var(--border));
  color: var(--text);
}
.chip--tipo:hover { background: color-mix(in srgb, var(--c) 18%, var(--bg)); border-color: color-mix(in srgb, var(--c) 60%, var(--border)); }
.chip--tipo.is-active, .chip--tipo[aria-pressed="true"], .chip--tipo[aria-checked="true"] { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 6px 16px -8px var(--c); }
[data-theme="dark"] .chip--tipo { background: color-mix(in srgb, var(--c) 22%, var(--bg)); border-color: color-mix(in srgb, var(--c) 55%, var(--border)); }
[data-theme="dark"] .chip--tipo.is-active, [data-theme="dark"] .chip--tipo[aria-pressed="true"], [data-theme="dark"] .chip--tipo[aria-checked="true"] { background: color-mix(in srgb, var(--c) 70%, #fff); border-color: transparent; color: #0B1020; }
.chip--sm { min-height: 2rem; padding: .25rem .7rem; font-size: var(--fs-xs); }
.chip--dot::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--primary)); flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip-row--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block: 2px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.chip-row--scroll::-webkit-scrollbar { display: none; }
.chip-row--scroll .chip { scroll-snap-align: start; flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; letter-spacing: .02em;
  color: var(--primary-strong); background: var(--primary-soft); border-radius: var(--radius-sm); white-space: nowrap;
}
.badge--neutral { color: var(--text-muted); background: var(--surface-2); }
.badge--warm { color: var(--warm-ink); background: var(--warm); }
.badge--success { color: #fff; background: var(--success); }
[data-theme="dark"] .badge--success { color: #061A10; }
.badge--danger { color: #fff; background: var(--danger); }
[data-theme="dark"] .badge--danger { color: #2A0400; }
.badge--outline { background: transparent; border: 1px solid currentColor; }
.badge--pill { border-radius: var(--radius-full); padding-inline: .75rem; }
.badge--live { color: #fff; background: var(--live); border-radius: var(--radius-full); padding: .3rem .8rem .3rem .6rem; text-transform: uppercase; letter-spacing: .08em; }
.badge--live::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
[data-theme="dark"] .badge--live { color: #2A0410; }
[data-theme="dark"] .badge--live::before { background: #2A0410; }
/* Alias usados por FED.core.fichaHTML (instituciones-core.js) */
.badge--muted { color: var(--text-muted); background: var(--surface-2); }
.badge--warn { color: var(--warm-ink); background: var(--warm); }
.badge--bib { color: #fff; background: var(--success); }
[data-theme="dark"] .badge--bib { color: #061A10; }
.badge--tipo { --c: var(--primary); color: var(--text); background: color-mix(in srgb, var(--c) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.badge--campo { color: var(--text-muted); background: transparent; border: 1px dashed var(--border-strong); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.8); } }

/* ---------- 9. Pin (marcador de institución) ---------- */
.pin {
  --c: var(--primary); --pin-w: 36px; --pin-h: 46px; --glyph: 18px;
  position: relative; display: inline-block; width: var(--pin-w); height: var(--pin-h); flex: none;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / .32));
  transform-origin: 50% 100%;
  transition: transform var(--dur-fast) var(--ease-out);
}
.pin__shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* Leaflet aplica `z-index: 200` a TODO <svg> dentro de .leaflet-map-pane: sin estas dos líneas la
   gota se pinta encima del emoji y los pines del mapa salen vacíos. La especificidad (0,2,0) gana. */
.pin .pin__shape { z-index: 1; }
.pin .pin__glyph { z-index: 2; }
.pin__shape path { fill: var(--c); stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.pin__shape circle { fill: #fff; }
.pin__glyph {
  position: absolute; left: 50%; top: calc(var(--pin-h) * .391); transform: translate(-50%, -50%);
  font-family: var(--font-emoji); font-size: var(--glyph); line-height: 1; font-style: normal; text-align: center;
}
.pin--sm { --pin-w: 24px; --pin-h: 31px; --glyph: 12px; }
.pin--lg { --pin-w: 48px; --pin-h: 61px; --glyph: 24px; }
.pin--campo .pin__shape path { stroke-dasharray: 2.6 2.2; stroke-width: 2; fill-opacity: .88; }
.pin--campo .pin__shape circle { stroke: var(--c); stroke-width: 1; stroke-dasharray: 2 2; }
.pin.is-hover, .pin:hover { transform: scale(1.12); }
.pin.is-selected { transform: scale(1.25); filter: drop-shadow(0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent)) drop-shadow(0 3px 4px rgb(0 0 0 / .35)); }

/* ---------- 10. Tabs ---------- */
.tabs {
  position: relative; display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: .5rem;
  min-height: 3rem; padding: .75rem 1rem; font-weight: 600; font-size: .9375rem; color: var(--text-muted);
  text-decoration: none; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
.tab::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--c, var(--primary)); transform: scaleX(0); transform-origin: 50% 100%; transition: transform var(--dur-base) var(--ease-out); }
.tab:hover { color: var(--text); background: var(--surface); }
.tab[aria-selected="true"], .tab.is-active { color: var(--text); }
.tab[aria-selected="true"]::after, .tab.is-active::after { transform: scaleX(1); }
.tab:focus-visible { outline-offset: -3px; }
.tab .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--primary)); }
.tabpanel { padding-top: var(--sp-8); }
.tabpanel[hidden] { display: none; }
.tabs--pills { border: 0; gap: var(--sp-2); }
.tabs--pills .tab { border-radius: var(--radius-full); border: 1px solid var(--border); background: var(--bg); min-height: 2.75rem; }
.tabs--pills .tab::after { display: none; }
.tabs--pills .tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Segmented control (Partido, orden) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius); }
.segmented > * { flex: 1; min-height: 2.5rem; padding: .375rem .875rem; border-radius: calc(var(--radius) - 3px); font-size: var(--fs-small); font-weight: 700; color: var(--text-muted); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.segmented > *:hover { color: var(--text); }
.segmented > [aria-pressed="true"], .segmented > [aria-checked="true"], .segmented > .is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented > :focus-visible { outline-offset: -2px; }

/* ---------- 11. Dialog ---------- */
dialog.dialog {
  position: fixed; inset: 0; z-index: var(--z-dialog); margin: auto;
  width: min(100% - 2rem, 56rem); max-height: min(100dvh - 2rem, 60rem);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.dialog:not([open]) { display: none; }
dialog.dialog::backdrop { background: rgb(11 16 32 / .62); backdrop-filter: blur(6px); animation: fade-in var(--dur-base) ease-out; }
dialog.dialog[open] { animation: dialog-in .35s var(--ease-out); }
.dialog__inner { display: flex; flex-direction: column; max-height: min(100dvh - 2rem, 60rem); }
.dialog__body { padding: clamp(1.5rem, 4vw, 2.75rem); overflow: auto; overscroll-behavior: contain; }
.dialog__body > * + * { margin-top: var(--sp-4); }
.dialog__media { aspect-ratio: 16 / 9; background: var(--surface-2); flex: none; }
.dialog__media img { width: 100%; height: 100%; object-fit: cover; }
.dialog__close {
  position: absolute; top: .875rem; right: .875rem; z-index: 2;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--text); border: 1px solid var(--border); backdrop-filter: blur(8px);
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.dialog__close:hover { background: var(--surface-2); transform: rotate(90deg); }
.dialog__close svg { width: 1.25rem; height: 1.25rem; }
.dialog__title { font-size: var(--fs-h3); padding-right: 3rem; }
.dialog__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding-top: var(--sp-2); }
.dialog--sm { width: min(100% - 2rem, 32rem); }
.dialog--lg { width: min(100% - 2rem, 72rem); }
@media (max-width: 599px) {
  dialog.dialog.dialog--sheet-mobile { width: 100%; margin: auto 0 0; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0; animation-name: sheet-in; }
  dialog.dialog.dialog--sheet-mobile .dialog__inner { max-height: 92dvh; }
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Lightbox (dialog para imágenes) */
dialog.dialog.lightbox { width: min(100% - 1rem, 90rem); max-height: 100dvh; background: transparent; border: 0; box-shadow: none; overflow: visible; }
.lightbox__figure { margin: 0; display: grid; place-items: center; gap: var(--sp-3); }
.lightbox__img { max-width: 100%; max-height: calc(100dvh - 7rem); width: auto; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); object-fit: contain; }
.lightbox__caption { color: #fff; text-align: center; font-size: var(--fs-small); }
.lightbox__counter { color: rgb(255 255 255 / .7); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.lightbox .dialog__close { position: fixed; top: 1rem; right: 1rem; background: rgb(255 255 255 / .12); color: #fff; border-color: rgb(255 255 255 / .25); }
.lightbox__nav {
  position: fixed; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: 50%; background: rgb(255 255 255 / .12); color: #fff; border: 1px solid rgb(255 255 255 / .25); backdrop-filter: blur(6px);
  transition: background-color var(--dur-fast);
}
.lightbox__nav:hover { background: rgb(255 255 255 / .25); }
.lightbox__nav--prev { left: 1rem; } .lightbox__nav--next { right: 1rem; }
.lightbox__nav svg { width: 1.25rem; height: 1.25rem; }

/* ---------- 12. Grillas ---------- */
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
@media (min-width: 600px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.grid--gap-lg { gap: clamp(1.5rem, 3vw, 2.5rem); }

/* ---------- 13. Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: end;
  min-height: clamp(26rem, 58vh, 40rem); color: #fff; background: var(--primary-strong);
}
.hero--full { min-height: min(100dvh - var(--header-h), 56rem); }
.hero--center { align-items: center; text-align: center; }
.hero--center .hero__content { margin-inline: auto; }
.hero--center .lead { margin-inline: auto; }
.hero--center .btn-group { justify-content: center; }
.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__media[data-parallax] { inset: -8% 0; }
.hero__media img, .hero__media video { width: 100%; height: 100%; object-fit: cover; }
.hero__scrim { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, color-mix(in srgb, var(--scrim) 70%, transparent) 0%, var(--scrim) 60%, color-mix(in srgb, var(--scrim) 100%, #0B1020 25%) 100%); }
.hero__content { position: relative; max-width: 52rem; padding-block: clamp(3.5rem, 9vw, 7rem); }
.hero__content .eyebrow { color: rgb(255 255 255 / .85); }
.hero__content h1 { color: #fff; margin-bottom: var(--sp-6); }
.hero__content .lead { color: rgb(255 255 255 / .86); margin-bottom: var(--sp-8); }
.hero .btn--secondary { --btn-fg: #fff; --btn-bd: rgb(255 255 255 / .7); --btn-bg-h: rgb(255 255 255 / .12); }
.hero__title { font-size: var(--fs-hero); letter-spacing: -.025em; line-height: 1.02; }
.hero--full .hero__content h1 { font-size: var(--fs-hero); letter-spacing: -.025em; line-height: 1.02; }
.hero--simple { min-height: 0; color: var(--text); background: var(--surface); align-items: start; }
.hero--simple .hero__content h1, .hero--simple .hero__content .eyebrow { color: inherit; }
.hero--simple .hero__content .lead { color: var(--text-muted); }
.hero--simple .hero__content .eyebrow { color: var(--primary); }
.hero__credit { position: absolute; right: var(--gutter); bottom: .75rem; z-index: 1; font-size: .7rem; color: rgb(255 255 255 / .6); }
.hero--full .hero__credit { bottom: auto; top: .75rem; }

/* ---------- 14. Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6) var(--sp-4); }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: grid; gap: var(--sp-1); align-content: start; }
.stat__value { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.5rem, 2rem + 2.2vw, 4rem); line-height: 1; letter-spacing: -.03em; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.stat__value small { font-size: .5em; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.stat__label { font-size: var(--fs-small); font-weight: 600; color: var(--text-muted); letter-spacing: .02em; }
.stats--card {
  position: relative; z-index: 2; padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 3rem);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.stats--overlap { margin-top: calc(-1 * clamp(2.5rem, 6vw, 4.5rem)); }
.stats--card .stat { padding-inline: var(--sp-2); }
.stats--card .stat + .stat { border-left: 1px solid var(--border); }
.stats--card .stat:nth-child(3) { border-left: 0; }
@media (min-width: 768px) { .stats--card .stat:nth-child(3) { border-left: 1px solid var(--border); } }
.section--dark .stat__value, .theme-dark .stat__value { color: var(--primary-strong); }

/* ---------- 15. Prose ---------- */
.prose { max-width: 68ch; font-size: var(--fs-body); line-height: 1.7; text-wrap: pretty; }
.prose > * + * { margin-top: 1.15em; }
.prose > h2, .prose > h3, .prose > h4 { margin-top: 1.8em; margin-bottom: .5em; }
.prose > h2 + *, .prose > h3 + *, .prose > h4 + * { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--primary); font-weight: 700; }
.prose strong { font-weight: 700; color: var(--text); }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 45%, transparent); text-underline-offset: .2em; transition: text-decoration-color var(--dur-fast); }
.prose a:hover { text-decoration-color: currentColor; }
.prose blockquote { margin: 1.5em 0; padding: .25em 0 .25em 1.25em; border-left: 3px solid var(--primary); font-family: var(--font-display); font-size: 1.15em; font-style: italic; color: var(--text); }
.prose blockquote cite { display: block; margin-top: .5em; font-family: var(--font-body); font-style: normal; font-size: var(--fs-small); color: var(--text-muted); }
.prose figure { margin: 1.5em 0; }
.prose figcaption { font-size: var(--fs-small); color: var(--text-muted); margin-top: .5em; }
.prose img { border-radius: var(--radius); }
.prose hr { margin: 2em 0; }
.prose .lead { font-size: var(--fs-lead); }
.prose--lg { font-size: 1.125rem; }
.dropcap::first-letter { float: left; font-family: var(--font-display); font-size: 3.6em; line-height: .82; padding: .08em .12em 0 0; color: var(--primary-strong); font-weight: 600; }

/* ---------- 16. Toast ---------- */
.toast-region { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: var(--z-toast); transform: translateX(-50%); display: grid; gap: .5rem; width: min(calc(100% - 2rem), 28rem); pointer-events: none; }
.toast {
  padding: .875rem 1.25rem; border-radius: var(--radius); background: var(--text); color: var(--bg);
  font-size: var(--fs-small); font-weight: 600; text-align: center; box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toast-in .3s var(--ease-out);
}
.toast--error { background: var(--danger); color: #fff; }
.toast--success { background: var(--success); color: #fff; }
.toast.is-leaving { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- 17. Formularios ---------- */
.form { display: grid; gap: var(--sp-4); }
.form__row { display: grid; gap: var(--sp-4); align-items: start; }
@media (min-width: 600px) { .form__row--2 { grid-template-columns: 1fr 1fr; } }
.form-field { display: grid; gap: .4rem; }
.form-field__label, .form-field > label { font-size: var(--fs-small); font-weight: 700; color: var(--text); }
.form-field__label .req { color: var(--danger); margin-left: .15em; }
.form-field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.form-field__error { display: none; font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.form-field.is-invalid .form-field__error, .form-field:has([aria-invalid="true"]) .form-field__error { display: block; }
.input, .form-field input:not([type="checkbox"]):not([type="radio"]), .form-field textarea, .form-field select {
  width: 100%; min-height: 3rem; padding: .75rem 1rem;
  background: var(--bg); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; line-height: 1.4;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
}
.section--alt .form-field input, .section--alt .form-field textarea, .section--alt .form-field select, .section--alt .input { background: var(--bg); }
.form-field textarea { min-height: 8rem; resize: vertical; }
.form-field select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'><path d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%234B5573' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right .875rem center; padding-right: 2.5rem; }
[data-theme="dark"] .form-field select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'><path d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%23A9B1CC' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.input::placeholder, .form-field input::placeholder, .form-field textarea::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
.input:hover, .form-field input:hover, .form-field textarea:hover, .form-field select:hover { border-color: var(--border-strong); }
.input:focus-visible, .form-field input:focus-visible, .form-field textarea:focus-visible, .form-field select:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.form-field [aria-invalid="true"], .form-field.is-invalid input, .form-field.is-invalid textarea { border-color: var(--danger); }
.form-field input:user-invalid, .form-field textarea:user-invalid { border-color: var(--danger); }
.form-field--check { grid-template-columns: auto 1fr; align-items: center; gap: .625rem; }
.form-field--check input { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); margin: 0; }
.form-field--check label { font-weight: 600; font-size: var(--fs-small); }
.search {
  position: relative; display: flex; align-items: center;
}
.search__icon { position: absolute; left: .875rem; width: 1.125rem; height: 1.125rem; color: var(--text-muted); pointer-events: none; }
.search .input { padding-left: 2.75rem; border-radius: var(--radius-full); }
.search__clear { position: absolute; right: .35rem; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: 50%; color: var(--text-muted); }
.search__clear:hover { background: var(--surface-2); color: var(--text); }
.switch { display: inline-flex; align-items: center; gap: .75rem; min-height: 2.75rem; font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.switch__track { position: relative; width: 2.75rem; height: 1.625rem; border-radius: 999px; background: var(--border-strong); transition: background-color var(--dur-fast); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform var(--dur-fast) var(--ease-out); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(1.125rem); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- 18. Tabla ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.table caption { caption-side: top; text-align: left; padding: .875rem 1rem; font-weight: 700; color: var(--text-muted); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; }
.table th, .table td { padding: .8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table thead th { position: sticky; top: 0; z-index: 1; vertical-align: middle; background: var(--surface); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface); }
.table th[aria-sort] button { display: inline-flex; align-items: center; gap: .35rem; line-height: 1.2; min-height: 1.5rem; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.table th[aria-sort] button::after { content: "↕"; opacity: .45; font-size: .9em; }
.table th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; color: var(--primary); }
.table th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; color: var(--primary); }
.table .num { text-align: right; }
.table--compact th, .table--compact td { padding: .5rem .75rem; }
.table td .emoji { display: inline-block; margin-right: .35rem; }

/* ---------- 19. Timeline ---------- */
.timeline { position: relative; display: grid; gap: var(--sp-8); padding-left: 2.25rem; }
.timeline::before { content: ""; position: absolute; left: .6875rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--border); border-radius: 2px; }
.timeline__item { position: relative; }
.timeline__item::before { content: ""; position: absolute; left: -2.25rem; top: .35rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--bg); border: 3px solid var(--c, var(--primary)); box-shadow: 0 0 0 4px var(--bg); }
.timeline__item--done::before { background: var(--c, var(--primary)); }
.timeline__date { display: block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); margin-bottom: var(--sp-2); }
.timeline__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-h3); letter-spacing: -.01em; line-height: 1.2; margin-bottom: var(--sp-3); }
.timeline__body { max-width: 68ch; color: var(--text-muted); }
.timeline__body > * + * { margin-top: var(--sp-3); }
@media (min-width: 768px) { .timeline { padding-left: 3rem; } .timeline::before { left: 1rem; } .timeline__item::before { left: -3rem; width: 2.125rem; height: 2.125rem; top: .1rem; } }

/* ---------- 20. Header ---------- */
.header {
  position: sticky; top: 0; z-index: var(--z-header); height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
/* El blur va en un pseudo-elemento: backdrop-filter en .header crearía un containing block y rompería el panel fixed del menú móvil */
.header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
}
html.nav-open .header::before { background: var(--bg); }
.header.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 24px -18px rgb(15 22 51 / .35); }
[data-theme="dark"] .header.is-scrolled { box-shadow: 0 10px 30px -18px rgb(0 0 0 / .8); }
.header__inner { position: relative; height: 100%; max-width: 90rem; margin-inline: auto; padding-inline: var(--gutter); display: flex; align-items: center; gap: var(--sp-4); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; min-height: 2.75rem; flex: none; border-radius: var(--radius); }
/* El azul del archivo del sello (#6078FE) queda pálido junto al azul institucional: se lo densifica
   apenas, sin cambiar de tono. Sobre fondo oscuro se pasa a blanco, igual que en el pie. */
.brand__logo { width: 2.75rem; height: 2.75rem; object-fit: contain; flex: none; filter: saturate(1.35) brightness(.86); }
[data-theme="dark"] .brand__logo { filter: brightness(0) invert(1); opacity: .94; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; letter-spacing: -.01em; white-space: nowrap; }
.brand__sub { font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; margin-top: .2rem; }
@media (max-width: 419px) { .brand__sub { display: none; } .brand__name { white-space: normal; font-size: .9375rem; line-height: 1.02; max-width: 8.5rem; } }
.header__actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.header__cta { display: none; }
.theme-toggle, .nav-toggle {
  position: relative; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--text);
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.theme-toggle:hover, .nav-toggle:hover { background: var(--surface-2); }
.theme-toggle svg, .nav-toggle svg { position: absolute; transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.theme-toggle .icon--sun { opacity: 0; transform: rotate(-60deg) scale(.6); }
[data-theme="dark"] .theme-toggle .icon--sun { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle .icon--moon { opacity: 0; transform: rotate(60deg) scale(.6); }
.nav-toggle svg:last-child { opacity: 0; transform: rotate(-90deg) scale(.6); }
html.nav-open .nav-toggle svg:first-child { opacity: 0; transform: rotate(90deg) scale(.6); }
html.nav-open .nav-toggle svg:last-child { opacity: 1; transform: none; }

/* Nav: móvil (overlay) */
.nav { display: none; }
.nav__list { display: flex; flex-direction: column; gap: .25rem; }
.nav__item > a, .nav__btn {
  display: flex; align-items: center; gap: .4rem; min-height: 2.75rem; padding: .5rem .75rem;
  font-weight: 600; font-size: .9375rem; color: var(--text); text-decoration: none; border-radius: var(--radius-sm);
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.nav__item > a:hover, .nav__btn:hover { background: var(--surface-2); color: var(--text); }
.nav__item > a[aria-current="page"] { color: var(--primary-strong); }
.nav__group { display: block; padding: 1rem .75rem .35rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.nav__menu a { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; padding: .5rem .75rem; font-weight: 600; font-size: .9375rem; color: var(--text); text-decoration: none; border-radius: var(--radius-sm); transition: background-color var(--dur-fast); }
.nav__menu a:hover { background: var(--surface-2); color: var(--text); }
.nav__menu a[aria-current="page"] { color: var(--primary-strong); background: var(--primary-soft); }
.nav__menu .dot { width: .625rem; height: .625rem; border-radius: 50%; background: var(--c, var(--primary)); flex: none; }
.nav__menu .dot--icon { width: 1.125rem; height: 1.125rem; border-radius: 0; background: none; color: var(--primary); display: grid; place-items: center; }
.nav__item--cta { margin-top: var(--sp-4); }
.nav__item--cta .btn { width: 100%; }
html.nav-open .nav {
  display: block; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: var(--z-header);
  background: var(--bg); overflow-y: auto; padding: var(--sp-4) var(--gutter) var(--sp-8); border-top: 1px solid var(--border);
}
html.nav-open .nav__item > a, html.nav-open .nav__btn, html.nav-open .nav__menu a { font-size: 1.125rem; min-height: 3.25rem; }
html.nav-open .nav__item > a[aria-current="page"] { background: var(--primary-soft); }
html.nav-open .nav__btn { display: none; }
html.nav-open .nav__list > li { animation: nav-in .45s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
html.nav-open .nav__list > li:nth-child(1) { --i: 0; } html.nav-open .nav__list > li:nth-child(2) { --i: 1; } html.nav-open .nav__list > li:nth-child(3) { --i: 2; } html.nav-open .nav__list > li:nth-child(4) { --i: 3; } html.nav-open .nav__list > li:nth-child(5) { --i: 4; } html.nav-open .nav__list > li:nth-child(6) { --i: 5; } html.nav-open .nav__list > li:nth-child(7) { --i: 6; } html.nav-open .nav__list > li:nth-child(8) { --i: 7; } html.nav-open .nav__list > li:nth-child(9) { --i: 8; }
@keyframes nav-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.nav__btn { display: none; }

/* Nav: escritorio */
@media (min-width: 1024px) {
  .nav { display: block; margin-left: auto; }
  .nav__list { flex-direction: row; align-items: center; gap: .125rem; }
  .nav__item { position: relative; }
  .nav__item > a, .nav__btn { min-height: 2.5rem; padding: .5rem .625rem; font-size: .875rem; white-space: nowrap; }
  .nav__item > a::after { content: ""; position: absolute; left: .625rem; right: .625rem; bottom: .2rem; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform var(--dur-base) var(--ease-out); }
  .nav__item > a { position: relative; }
  .nav__item > a[aria-current="page"]::after, .nav__item > a:hover::after { transform: scaleX(1); }
  .nav__item > a[aria-current="page"] { color: var(--text); }
  .nav__btn { display: inline-flex; }
  .nav__btn .icon--chevron { transition: transform var(--dur-base) var(--ease-out); opacity: .7; }
  .nav__item.is-open > .nav__btn .icon--chevron { transform: rotate(180deg); }
  .nav__item.is-current > .nav__btn { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .nav__group { display: none; }
  .nav__menu {
    position: absolute; top: calc(100% + .5rem); left: 0; min-width: 15rem; padding: .5rem; z-index: 2;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
  }
  .nav__item.is-open > .nav__menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .nav__item--menu::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .6rem; }
  .nav__menu a { font-size: .9375rem; min-height: 2.75rem; }
  .nav__item--cta { display: none; }
  .header__cta { display: inline-flex; }
  .header__actions { margin-left: 0; }
  .nav-toggle { display: none; }
  .brand__text { display: none; }
}
@media (min-width: 1360px) {
  .brand__text { display: flex; }
  .nav__item > a, .nav__btn { padding: .5rem .75rem; font-size: .9375rem; }
  .header__inner { gap: var(--sp-6); }
}

/* ---------- 21. Footer ---------- */
.footer {
  color-scheme: dark;
  --bg: #0B1020; --surface: #141B36; --surface-2: #1C2547; --text: #E7EAF6; --text-muted: #A9B1CC;
  --primary: #8FA0FF; --primary-strong: #A9B8FF; --accent: #6F84FF; --border: #2A3457; --border-strong: #3B4775;
  background: var(--bg); color: var(--text); margin-top: auto; padding-block: clamp(3rem, 7vw, 5.5rem) 2rem; border-top: 1px solid var(--border);
}
[data-theme="dark"] .footer { --bg: #070B18; }
.footer a { color: var(--text); text-decoration: none; }
.footer a:hover { color: var(--primary-strong); text-decoration: underline; }
.footer__grid { display: grid; gap: var(--sp-8) var(--sp-8); grid-template-columns: 1fr; }
@media (min-width: 600px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer__grid { grid-template-columns: 1.6fr .8fr 1fr 1.2fr; } }
/* El sello es azul de marca sobre fondo casi negro: se pasa a blanco para que se lea el dibujo. */
.footer__brand img { width: 4rem; height: 4rem; margin-bottom: var(--sp-4); filter: brightness(0) invert(1); opacity: .9; }
.footer__name { font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; line-height: 1.2; letter-spacing: -.01em; max-width: 24ch; text-wrap: balance; }
.footer__since { margin-top: .5rem; font-size: var(--fs-small); color: var(--primary-strong); font-weight: 600; letter-spacing: .02em; }
.footer__address { margin-top: var(--sp-4); display: grid; gap: .3rem; font-size: var(--fs-small); color: var(--text-muted); }
.footer__address a { color: var(--text);  padding-block: .18rem; display: inline-block; }
.footer__title { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--sp-4); }
.footer__nav ul { list-style: none; padding: 0; display: grid; gap: .25rem; font-size: var(--fs-small); font-weight: 600; }
/* Área de toque de 24 px (WCAG 2.5.8) sin agrandar la tipografía del pie. */
.footer__nav ul a { display: inline-block; padding-block: .28rem; }
.footer__label { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: .5rem; }
.footer__social .footer__label + .social { margin-bottom: var(--sp-4); }
.social { display: flex; flex-wrap: wrap; gap: .5rem; }
.social a { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast); }
.social a:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-2px); color: var(--primary-strong); }
.social svg { width: 1.25rem; height: 1.25rem; }
.footer__data p { font-size: var(--fs-small); color: var(--text-muted); }
.footer__data p + p { margin-top: .6rem; }
.footer__data a { color: var(--text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text) 40%, transparent);  padding-block: .18rem; display: inline-block; }
.footer__credits { font-size: var(--fs-xs) !important; }
.footer__bottom { margin-top: clamp(2rem, 5vw, 3.5rem); padding-top: var(--sp-6); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- 22. Motion (apoyo CSS para js/motion.js) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.no-motion) [data-reveal]:not(.is-in) { opacity: 0; }
  html.js:not(.no-motion) [data-stagger]:not(.is-in) > * { opacity: 0; }
}
[data-reveal].is-in, [data-stagger].is-in > * { opacity: 1; }
.hover-lift { transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.hover-lift:hover { transform: translateY(-4px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
  .badge--live::before { animation: none; }
}

/* ---------- 23. Print ---------- */
@media print {
  .header, .footer, .skip-link, .btn, .theme-toggle, .nav-toggle, .toast-region, .chip-row--scroll, dialog { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: underline; }
  .section { padding-block: 1.5rem; }
  .card, .table-wrap { box-shadow: none; border-color: #999; break-inside: avoid; }
  [data-reveal], [data-stagger] > * { opacity: 1 !important; transform: none !important; }
  .table thead { display: table-header-group; }
  .table th, .table td { border-bottom: 1px solid #ccc; }
}


/* ==========================================================================
   Leaflet: tema del mapa, pines con emoji y clusters
   Compartido por mapa.html, index.html (mapa de la portada) y contacto.html.
   ========================================================================== */
.leaflet-container {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  background: var(--surface-2);
}
.leaflet-container a { color: var(--primary); }
.leaflet-bar,
.leaflet-touch .leaflet-bar { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  width: 2.75rem; height: 2.75rem; line-height: 2.75rem;
  color: var(--text); background: var(--bg); border-bottom-color: var(--border);
  font-size: 1.25rem;
}
/* leaflet.css se inyecta en <head> DESPUÉS de base.css (lo hace js/vendor-loader.js), así que su
   `.leaflet-touch .leaflet-bar a { width:30px }` le gana por orden a la regla de arriba. Estas dos
   repiten la medida con un selector más específico para que el zoom mida los 44 px de la guía y
   quede alineado con los botones propios del mapa (.mapa-fit, también de 2.75rem). */
.leaflet-container .leaflet-bar a,
.leaflet-container.leaflet-touch .leaflet-bar a {
  width: 2.75rem; height: 2.75rem; line-height: 2.75rem; font-size: 1.25rem;
}
.leaflet-bar a:hover { background: var(--surface); color: var(--primary); }
/* Botón de zoom al límite: Leaflet lo deja en #f4f4f4/#bbb (un parche claro sobre el mapa oscuro). */
.leaflet-bar a.leaflet-disabled,
.leaflet-touch .leaflet-bar a.leaflet-disabled,
.leaflet-bar a.leaflet-disabled:hover,
.leaflet-touch .leaflet-bar a.leaflet-disabled:hover {
  background: var(--surface); color: color-mix(in srgb, var(--text-muted) 55%, transparent); cursor: default;
}
.leaflet-bar a:focus-visible { outline: none; box-shadow: inset var(--ring); }
.leaflet-control-attribution {
  padding: .2rem .5rem; font-size: .6875rem;
  color: var(--text-muted); background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-radius: var(--radius-sm) 0 0 0;
}
.leaflet-control-attribution a { color: var(--text-muted); }

/* Pin (divIcon) */
.leaflet-marker-icon.pin-wrap { background: none; border: 0; }
.pin-wrap .pin { position: absolute; inset: 0; display: block; }
.pin-wrap .pin__glyph { pointer-events: none; }
.leaflet-marker-icon.pin-wrap.is-selected { z-index: 650 !important; }

/* Cluster */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large,
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: none; }
.mapa-cluster { background: none; border: 0; }
.mapa-cluster__b {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-family: var(--font-body); font-weight: 700; font-variant-numeric: tabular-nums; font-size: .875rem;
  color: #fff; background: var(--primary-strong);
  border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 2px 8px rgb(15 22 51 / .35);
  transition: transform var(--dur-fast) var(--ease-out);
}
.mapa-cluster--md .mapa-cluster__b { font-size: .9375rem; }
.mapa-cluster--lg .mapa-cluster__b { font-size: 1rem; }
.mapa-cluster:hover .mapa-cluster__b { transform: scale(1.08); }
[data-theme="dark"] .mapa-cluster__b { color: var(--primary-contrast); border-color: color-mix(in srgb, #fff 80%, var(--primary-strong)); }

/* Tooltip */
.leaflet-tooltip.mapa-tip {
  max-width: 16rem; padding: .3rem .55rem; font-size: var(--fs-xs); font-weight: 600;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.leaflet-tooltip.mapa-tip::before { display: none; }


/* La banderita que Leaflet agrega junto a su enlace no pinta nada institucional y, por el reset
   global (svg { display:block }), encima se estiraba a todo el ancho del mapa: se oculta. */
.leaflet-control-attribution .leaflet-attribution-flag { display: none !important; }

/* Los controles de zoom viven en la misma esquina que la atribución: se les da aire. */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin-bottom: 1.75rem; }

/* Enlaces utilitarios del pie y de las fichas de contacto: 24 px de alto de toque (WCAG 2.5.8). */
.footer__bottom a,
.contact-item__value a { display: inline-block; padding-block: .2rem; }
