/* ==========================================================================
   Tango Data Science - sistema de diseño común a todo el sitio
   Paleta del sitio: naranja (acento), azul y azul marino, sobre gris claro.
   ========================================================================== */

:root {
  color-scheme: light;
  --page: #f3f2ee;
  --surface: #fcfcfb;
  --surface-2: #f7f6f2;
  --ink: #12161f;
  --ink-2: #4b5161;
  --muted: #6a6f7a;
  --grid: #e3e1da;
  --axis: #c6c4bb;
  --border: rgba(18, 22, 31, 0.10);
  --border-strong: rgba(18, 22, 31, 0.18);
  --navy: #1d3557;
  --navy-ink: #ffffff;
  --hero-bg: #1d3557;
  --hero-ink: #ffffff;
  --accent: #eb6834;          /* acento (Gardel, lo más importante) */
  --accent-soft: rgba(235, 104, 52, 0.12);
  --accent-fuerte: #b8461a;   /* fondo de chips con texto blanco (contraste AA) */
  --practica: #2a78d6;        /* azul de foco y bordes activos */
  --seq-0: #e8f1fc; --seq-1: #b7d3f6; --seq-2: #86b6ef; --seq-3: #5598e7;
  --seq-4: #2a78d6; --seq-5: #1c5cab; --seq-6: #104281;
  /* categorías (ciudades, sellos, géneros…): orden fijo, cada valor conserva su color */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100;
  --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #6250d6; --cat-8: #e34948;
  --otros: #9a988f;
  --verbo: #0f7a55;            /* verbos en las nubes de palabras */
  --shadow: 0 1px 2px rgba(18, 22, 31, .05), 0 4px 16px rgba(18, 22, 31, .05);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e1014; --surface: #171a20; --surface-2: #1d2128;
    --ink: #eef0f3; --ink-2: #b8beca; --muted: #8a8f99;
    --grid: #2a2e36; --axis: #3a3f49;
    --border: rgba(255, 255, 255, .09); --border-strong: rgba(255, 255, 255, .16);
    --navy: #9fb7d9; --navy-ink: #0e1014; --hero-bg: #1f3a5f; --hero-ink: #f3f6fb;
    --accent: #d95926; --accent-soft: rgba(217, 89, 38, .18); --practica: #3987e5;
    --seq-0: #1b2533; --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #2a78d6;
    --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
    --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
    --otros: #6f6e68;
  --verbo: #3fc394;
    --verbo: #3fc394;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e1014; --surface: #171a20; --surface-2: #1d2128;
  --ink: #eef0f3; --ink-2: #b8beca; --muted: #8a8f99;
  --grid: #2a2e36; --axis: #3a3f49;
  --border: rgba(255, 255, 255, .09); --border-strong: rgba(255, 255, 255, .16);
  --navy: #9fb7d9; --navy-ink: #0e1014; --hero-bg: #1f3a5f; --hero-ink: #f3f6fb;
  --accent: #d95926; --accent-soft: rgba(217, 89, 38, .18); --practica: #3987e5;
  --seq-0: #1b2533; --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #2a78d6;
  --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
  --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  --otros: #6f6e68;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
}

/* --- Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.contenedor { width: min(1240px, 100% - 32px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--practica); outline-offset: 2px; border-radius: 4px; }

/* --- Encabezado del sitio ------------------------------------------------------ */
.sitio-header {
  position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.sitio-header .contenedor { display: flex; align-items: center; gap: 16px; height: 100%; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.marca svg { width: 28px; height: 32px; flex: none; }
.marca span small { display: block; font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
.sitio-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.sitio-nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2);
}
.sitio-nav a:hover, .sitio-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.boton-icono {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
}
.boton-icono:hover { border-color: var(--border-strong); }
.boton-icono svg { width: 18px; height: 18px; }
.boton-icono .icono-sol { display: none; }
:root[data-theme="dark"] .boton-icono .icono-sol { display: block; }
:root[data-theme="dark"] .boton-icono .icono-luna { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .boton-icono .icono-sol { display: block; }
  :root:not([data-theme="light"]) .boton-icono .icono-luna { display: none; }
}

/* --- Portada -------------------------------------------------------------------- */
.portada-hero { padding: 72px 0 40px; }
.portada-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 800; max-width: 16ch; }
.portada-hero p { font-size: 18px; color: var(--ink-2); max-width: 60ch; margin: 0; }
.proyectos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 20px; padding-bottom: 72px; }
.tarjeta-proyecto {
  display: flex; flex-direction: column; text-decoration: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.tarjeta-proyecto:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(18, 22, 31, .12); }
.tarjeta-proyecto .portada-img { height: 160px; background: var(--navy); position: relative; overflow: hidden; }
.tarjeta-proyecto .portada-img svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tarjeta-proyecto .cuerpo { padding: 20px 22px 22px; }
.tarjeta-proyecto h2 { margin: 6px 0 6px; font-size: 21px; letter-spacing: -.01em; }
.tarjeta-proyecto p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.etiqueta { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.tarjeta-proyecto.proximamente { opacity: .6; pointer-events: none; box-shadow: none; }
.tarjeta-proyecto.proximamente .portada-img { background: var(--surface-2); color: var(--ink-2); }
.tarjeta-proyecto.sobre-mi .portada-img { background: linear-gradient(135deg, #f6e3d6, #f3efe6); }
/* Foto vertical: se recorta al ancho de la tarjeta mostrando la parte de arriba (las caras) */
.tarjeta-proyecto .portada-img img.foto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 30% 25%; }
/* Sobre mí: acercamiento a la pareja (la foto es apaisada y la pareja está a la izquierda) */
.tarjeta-proyecto.sobre-mi .portada-img img.foto {
  object-position: 24% 4%; transform: scale(1.65); transform-origin: 24% 12%; transition: transform .4s;
}
.tarjeta-proyecto.sobre-mi:hover .portada-img img.foto { transform: scale(1.72); }
.tarjeta-proyecto.sobre-mi .portada-img::after {   /* leve degradé para integrar la foto con la tarjeta */
  content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(18, 22, 31, .18));
}
:root[data-theme="dark"] .tarjeta-proyecto.sobre-mi .portada-img { background: linear-gradient(135deg, #3a2a20, #22262e); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tarjeta-proyecto.sobre-mi .portada-img { background: linear-gradient(135deg, #3a2a20, #22262e); }
}

/* --- Sobre mí --------------------------------------------------------------- */
.sobre-mi-pagina { padding: 64px 0 24px; }
.sobre-mi-pagina h1 { font-size: clamp(32px, 4.5vw, 48px); letter-spacing: -.025em; margin: 10px 0 8px; font-weight: 800; }
.sobre-mi-pagina .bajada { font-size: 19px; color: var(--ink-2); margin: 0 0 32px; }
.sobre-mi-cabeza { display: flex; align-items: center; gap: 32px; margin-bottom: 8px; }
.sobre-mi-foto { width: 180px; height: 240px; object-fit: cover; object-position: 30% 40%; border-radius: var(--radius); box-shadow: var(--shadow); flex: none; }
@media (max-width: 640px) { .sobre-mi-cabeza { flex-direction: column; align-items: flex-start; } }
.sobre-mi-grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sobre-mi-grilla .tarjeta p { color: var(--ink-2); margin: 8px 0 4px; }

/* --- Cabecera del dashboard ----------------------------------------------------- */
.dash-hero { padding: 40px 0 20px; }
.dash-hero .etiqueta { display: inline-flex; align-items: center; gap: 8px; }
.dash-hero h1 { margin: 10px 0 10px; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -.025em; font-weight: 800; }
.dash-hero .bajada { margin: 0; font-size: 17px; color: var(--ink-2); max-width: 70ch; }
/* Retrato de Gardel junto al título: el texto rodea el contorno del busto (no el rectángulo de la imagen) */
.dash-hero-texto { max-width: 1000px; display: flow-root; }
.retrato-portada {
  float: right; width: 220px; height: auto; margin: -20px 0 -40px 8px;
  shape-outside: url("../img/gardel-retrato.png"); shape-image-threshold: .4; shape-margin: 14px;
}
.dash-hero .bajada { max-width: none; }
@media (max-width: 760px) { .retrato-portada { display: none; } }
.dash-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip-meta {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--ink-2);
}
.chip-meta b { color: var(--ink); font-weight: 700; }
.enlace-fuente { color: inherit; text-decoration: none; }
.enlace-fuente:hover b, a.enlace-fuente:hover { text-decoration: underline; }
.notas a, .sitio-pie a { color: inherit; text-underline-offset: 2px; }
.solo-movil { display: none; }
.deslizar { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }

/* --- Pestañas --------------------------------------------------------------- */
.barra-pestanas { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 14px; flex-wrap: wrap; }
.pestanas { display: inline-flex; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; gap: 2px; }
.pestanas button {
  border: 0; background: transparent; padding: 12px 26px; border-radius: 999px; font-weight: 800; font-size: 16px;
  color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.pestanas button svg { width: 20px; height: 20px; }
.pestanas button[aria-selected="true"] { background: var(--navy); color: var(--navy-ink); }

/* --- Filtros ------------------------------------------------------------------ */
.filtros {
  position: sticky; top: var(--header-h); z-index: 900; margin: 0 -16px; padding: 12px 16px;
  background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.filtros.pegado { border-bottom-color: var(--border); }
.filtros-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dias { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.dias button {
  border: 0; background: transparent; min-width: 38px; height: 32px; padding: 0 8px; border-radius: 999px;
  font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.dias button:hover { background: var(--surface-2); color: var(--ink); }
.dias button[aria-pressed="true"] { background: var(--accent-fuerte); color: #fff; }
.desplegable { position: relative; }
.desplegable > button, .toggle {
  height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.desplegable > button:hover, .toggle:hover { border-color: var(--border-strong); color: var(--ink); }
.desplegable > button .cuenta {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-fuerte); color: #fff;
  font-size: 12px; display: inline-grid; place-items: center;
}
.desplegable > button svg { width: 14px; height: 14px; opacity: .6; }
.desplegable > button .cuenta[hidden] { display: none; }
.desplegable.activo > button, .toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.toggle .tilde { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.toggle[aria-pressed="true"] .tilde { background: var(--accent-fuerte); border-color: var(--accent-fuerte); }
.toggle .tilde svg { width: 11px; height: 11px; opacity: 0; color: #fff; }
.toggle[aria-pressed="true"] .tilde svg { opacity: 1; }
.panel-desplegable {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 950; width: 280px; max-height: 360px; display: none;
  flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(18, 22, 31, .18); overflow: hidden;
}
.desplegable.abierto .panel-desplegable { display: flex; }
.panel-desplegable input[type="search"] {
  margin: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2);
}
.panel-desplegable ul { list-style: none; margin: 0; padding: 4px 6px 8px; overflow: auto; }
.panel-desplegable li label {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.panel-desplegable li label:hover { background: var(--surface-2); }
.panel-desplegable input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.panel-desplegable .pie { display: flex; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--border); }
.boton-texto { border: 0; background: none; color: var(--ink-2); font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.boton-texto:hover { background: var(--surface-2); color: var(--ink); }
.limpiar { margin-left: auto; }
.limpiar[hidden] { display: none; }

/* --- Paneles ------------------------------------------------------------------ */
.panel[hidden] { display: none !important; }
.cargando { opacity: .45; transition: opacity .2s; pointer-events: none; }

/* KPIs */
.kpis { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.kpi .rotulo { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi .valor { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 6px; }
.kpi .nota { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* Dos números bajo un mismo título, con una división corta solo a la altura de las cifras */
.par-valores { display: flex; align-items: flex-start; gap: 18px; }
.par-valores > div { min-width: 0; }
.par-valores .valor { white-space: nowrap; font-size: clamp(22px, 2.2vw, 30px); }
.par-valores .separador { width: 1px; height: 30px; margin-top: 12px; background: var(--axis); flex: none; }
.kpi .valor small { font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: 0; }
.kpi.heroe .heroe-pares { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: 14px; }
.kpi.heroe .heroe-pares b { font-size: 18px; font-weight: 800; color: var(--hero-ink); margin-right: 4px; }
.kpi.heroe { grid-row: span 2; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--hero-bg); color: var(--hero-ink); border-color: transparent; position: relative; overflow: hidden; }
.kpi.heroe .rotulo, .kpi.heroe .nota { color: color-mix(in srgb, var(--hero-ink) 78%, transparent); }
.kpi.heroe .valor { font-size: clamp(56px, 7vw, 84px); line-height: 1; margin-top: 18px; }
.kpi.heroe .mini-dias { display: flex; gap: 6px; align-items: flex-end; height: 64px; margin-top: 20px; position: relative; z-index: 1; }
.kpi.heroe .mini-dias div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.kpi.heroe .mini-dias i { display: block; width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.kpi.heroe .mini-dias span { font-size: 11px; font-weight: 700; opacity: .8; }
.kpi.heroe .patron { position: absolute; right: -30px; top: -30px; width: 180px; opacity: .08; }

/* Tarjetas de gráficos */
.grilla { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: 16px; }
.tarjeta {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 20px 14px;
  box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column;
}
.tarjeta h2 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.005em; }
.tarjeta .sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.tarjeta .cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.grafico { width: 100%; height: 280px; flex: 1 0 auto; }
.grafico.alto { height: 360px; }
.c-8 { grid-column: span 8; } .c-7 { grid-column: span 7; } .c-6 { grid-column: span 6; }
.c-5 { grid-column: span 5; } .c-4 { grid-column: span 4; } .c-12 { grid-column: span 12; }
.vacio { display: grid; place-items: center; height: 100%; min-height: 120px; color: var(--muted); font-size: 14px; }

/* Rankings (barras HTML) */
.ranking { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ranking li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; }
.ranking .nombre { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking .nombre small { font-weight: 600; color: var(--muted); margin-left: 6px; }
.ranking .num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); }
.ranking .barra { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ranking .barra i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Tabla */
.tabla-envoltura { overflow-x: auto; margin-top: 6px; }
table.datos { width: 100%; border-collapse: collapse; font-size: 14px; }
table.datos th {
  text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--axis); white-space: nowrap; cursor: pointer; user-select: none;
}
table.datos th.num, table.datos td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.datos th[aria-sort]::after { content: " ↕"; opacity: .4; }
table.datos th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; }
table.datos th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }
table.datos td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.datos td.lugar { color: var(--ink-2); font-size: 13.5px; min-width: 260px; max-width: 480px; }
table.datos td.lugar b { color: var(--ink); font-size: 14px; }
table.datos tr:hover td { background: var(--surface-2); }
.barrita { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--seq-4); margin-right: 8px; vertical-align: middle; }

/* Notas metodológicas */
.notas { margin: 28px 0 8px; padding: 22px 24px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--ink-2); }
.notas h2 { font-size: 15px; margin: 0 0 8px; color: var(--ink); }
.notas ul { margin: 0; padding-left: 18px; }
.notas li { margin: 4px 0; }

/* --- Dashboard de Gardel ------------------------------------------------------ */
.rango-anios {
  height: 40px; padding: 0 6px 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.rango-anios.activo { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.rango-anios select {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 4px 8px;
  font-weight: 700; font-size: 13.5px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.panel-desplegable.a-la-derecha { left: auto; right: 0; }
.kpi.heroe .mini-anios { gap: 3px; }
.kpi.heroe .mini-anios span { font-size: 10px; white-space: nowrap; min-height: 13px; }
.grafico.muy-alto { height: 480px; }
.grafico.autores { height: 640px; }
.grafico[data-vacio] { position: relative; }
.grafico[data-vacio]::after {
  content: attr(data-vacio); position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px;
}
.ranking li { font-size: 13.5px; }
table.datos td.texto { color: var(--ink-2); font-size: 13.5px; min-width: 160px; }
table.datos td.vacio-tabla { color: var(--muted); text-align: center; padding: 24px; }
#tabla-anios td.lugar, #tabla-musicos td.lugar { min-width: 0; }

/* Palabras de los títulos y de las letras */
.provisorio {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; vertical-align: 2px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em; color: var(--accent-fuerte);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
:root[data-theme="dark"] .provisorio { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .provisorio { color: var(--accent); } }
.grafico.nube { height: 520px; }
.formas button { min-width: 0; padding: 0 10px; }
.ranking.palabras { gap: 9px; }
.ranking .es-verbo { font-style: italic; color: var(--verbo); }
.leyenda-verbos { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.leyenda-verbos i { font-style: italic; font-weight: 800; color: var(--verbo); }
.ranking.palabras li { font-size: 14px; }
.ranking .puesto { display: inline-block; min-width: 24px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking.palabras .barra { height: 6px; }
.paginador-palabras { margin-top: auto; padding: 14px 0 4px; border-top: 0; }
.ranking.palabras .puesto { min-width: 34px; }

/* Buscador */
.buscador { max-width: 920px; margin: 8px auto 0; }
.caja-busqueda {
  display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 56px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.caja-busqueda:focus-within { border-color: var(--practica); }
.caja-busqueda svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.caja-busqueda input { flex: 1; min-width: 0; border: 0; background: none; font-size: 17px; outline: none; }
.buscador-sub { margin: 12px 4px; font-size: 14px; color: var(--ink-2); }
.lista-grabaciones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lista-grabaciones > li.vacio { min-height: 160px; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border-strong); padding: 16px; text-align: center; }
.grabacion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.grabacion-cabeza { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.grabacion h3 { margin: 0; font-size: 17px; letter-spacing: -.005em; }
.grabacion .alternativos { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-style: italic; }
.grabacion .donde { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.grabacion .anio-grande { font-size: 22px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.grabacion-datos { margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 24px; font-size: 13.5px; }
.grabacion-datos div { min-width: 0; }
.grabacion-datos dt { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.grabacion-datos dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.insignias { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.insignia { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.insignia.especial { color: var(--accent-fuerte); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.buscador .paginador { margin-top: 12px; border-top: 0; padding: 10px 0; }
.paginador { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--ink-2); }
.paginador button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 700; cursor: pointer; }
.paginador button:disabled { opacity: .4; cursor: default; }
:root[data-theme="dark"] .insignia.especial { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .insignia.especial { color: var(--accent); } }


/* Aviso flotante (errores, límite de consultas) */
.aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 2000;
  background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px);
}
.aviso.visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Pie del sitio ------------------------------------------------------------- */
.sitio-pie { margin-top: 48px; padding: 28px 0 40px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.sitio-pie .contenedor { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* --- Página de error ----------------------------------------------------------- */
.error-pagina { padding: 120px 0; text-align: center; }
.error-pagina h1 { font-size: 64px; margin: 0; }

/* --- Responsive ----------------------------------------------------------------- */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.heroe { grid-column: 1 / -1; grid-row: auto; }
  .c-8, .c-7, .c-6, .c-5, .c-4 { grid-column: span 12; }
  .panel-desplegable li label { padding-top: 11px; padding-bottom: 11px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  /* Tarjetas de a dos; la principal ocupa todo el ancho */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi.heroe { grid-column: 1 / -1; }
  .kpi .nota { font-size: 12px; }
  .kpi.heroe .valor { font-size: 64px; margin-top: 10px; }
  .kpi.heroe .mini-dias { height: 52px; margin-top: 14px; }
  .chip-meta { display: inline-block; border-radius: 12px; line-height: 1.45; }
  .tarjeta { padding: 16px 14px 10px; }
  .tarjeta .cabeza { flex-direction: column; gap: 6px; }
  .solo-movil { display: block !important; }
  /* Tablas: la primera columna queda fija al deslizar hacia el costado */
  table.datos { font-size: 13px; }
  table.datos th, table.datos td { padding: 9px 10px; }
  table.datos td.lugar { min-width: 150px; max-width: 190px; font-size: 12.5px; }
  table.datos th:first-child, table.datos td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--grid);
  }
  table.datos tr:hover td:first-child { background: var(--surface-2); }
  .pestanas { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .pestanas button { padding: 9px 13px; font-size: 14px; white-space: nowrap; gap: 6px; }
  .pestanas button svg { width: 17px; height: 17px; }
  .kpi { padding: 14px 16px; }
  .kpi .valor { font-size: 26px; }
  .filtros-fila { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .filtros-fila::-webkit-scrollbar { display: none; }
  /* la barra se desliza de costado: el borde derecho se desvanece para que se note que hay más */
  .filtros-fila { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 40px; }
  .panel-desplegable, .panel-desplegable.a-la-derecha { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-height: 60vh; z-index: 2000; }
  /* El desenfoque de fondo convierte a la barra en el "marco" de los paneles fijos y los saca de la
     pantalla en celulares: en pantallas chicas la barra va con fondo sólido. */
  .filtros { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--page); }
  .sitio-nav a.ocultar-movil { display: none; }
  /* encabezado angosto: marca sin subtítulo y enlaces en una sola línea */
  .marca span small { display: none; }
  .marca span { font-size: 14.5px; line-height: 1.15; }
  .sitio-nav a { padding: 8px 10px; white-space: nowrap; }
  .grafico { height: 250px; }
  .grafico.alto { height: 320px; }
  .grafico.muy-alto { height: 440px; }
  .grafico.nube { height: 400px; }
  .grafico.torta { height: 300px; }
  .grafico.autores { height: 600px; }
  .caja-busqueda { height: 50px; }
  .caja-busqueda input { font-size: 16px; }
  .grabacion { padding: 14px 16px; }
  .dash-hero { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
