/* XtraPass — estilos. Solo usa los tokens de tokens.css. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; /* sin el recuadro gris al tocar: cada enlace tiene su :active */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-on-bg);
  font-family: var(--font);
  font-size: var(--step-body);
  font-weight: var(--weight-text);
  line-height: var(--leading-text);
  letter-spacing: var(--tracking-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, figure, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

h1, h2, h3 {
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
  text-wrap: balance;
  overflow-wrap: break-word; /* una palabra que no cabe en la línea se parte en vez de salirse */
}

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }

button { font: inherit; color: inherit; }

/* En el móvil: el toque responde al instante (sin esperar un posible doble toque) y se nota
   al apoyar el dedo, no al levantarlo. Los botones tienen su propio :active. */
a, button, summary { touch-action: manipulation; }
a:not(.boton):active, summary:active { opacity: 0.7; }
/* Mantener pulsado un control no selecciona su texto. El contenido se sigue pudiendo copiar. */
.boton, summary, .video__placa { -webkit-user-select: none; user-select: none; }

.seccion-titulo { font-size: var(--step-head); }

/* Texto que solo leen los lectores de pantalla (avisos de estado). */
.visualmente-oculto {
  position: absolute; width: 1px; height: 1px; overflow: hidden; /* taste-skill-ignore */
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Botones y enlaces ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: var(--weight-strong);
  text-decoration: none;
  transition: transform 160ms var(--ease);
}
.boton:active { transform: scale(0.97); }
.boton--ancho { display: flex; width: 100%; }

.enlace {
  font-weight: var(--weight-strong);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* El movimiento al pasar el ratón, solo en pantallas con ratón (en el móvil se quedaría pegado). */
@media (hover: hover) and (pointer: fine) {
  .boton:hover { transform: translateY(-2px); }
  .boton:hover:active { transform: translateY(0) scale(0.97); }
  .enlace:hover { text-underline-offset: 0.35em; }
}

.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }

/* ---------- Cabecera ---------- */
.cabecera { padding: var(--gutter) var(--gutter) 0; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--step-lead);
  font-weight: var(--weight-display);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.marca img { width: 48px; height: 48px; border-radius: var(--r-pill); }

/* Con el texto muy ampliado, los enlaces bajan de línea en vez de salirse de la pantalla.
   La medida va en em para que siga al tamaño del texto: con el texto normal, incluso a 320 px,
   se quedan en una línea (apurando el margen, como siempre). */
.nav { container-type: inline-size; }
.nav__enlaces {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 clamp(16px, 2.5vw, 36px);
  font-weight: var(--weight-strong);
}
@container (min-width: 14em) {
  .nav__enlaces { flex-wrap: nowrap; }
}
.nav__enlaces a { text-decoration: none; padding: 8px 0; }
@media (hover: hover) and (pointer: fine) {
  .nav__enlaces a:hover { text-decoration: underline; }
}

@media (max-width: 520px) {
  /* En el móvil el nombre se oculta a la vista, pero lo siguen leyendo los lectores de pantalla. */
  .marca__nombre {
    position: absolute; width: 1px; height: 1px; overflow: hidden; /* taste-skill-ignore */
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .marca img { width: 40px; height: 40px; }
}

/* ---------- 1. Estudio destacado + pizarra ---------- */
.portada {
  display: grid;
  gap: var(--gutter);
  padding: var(--gutter);
}

/* La tarjeta del estudio: su foto a sangre y el título en una placa negra.
   Sin foto, la tarjeta se queda en el azul de la marca. */
.destacado {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 68svh;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--field-5);
}

.destacado__foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.destacado__credito { color: var(--ink-2-on-bg); font-size: var(--step-small); }

/* Sin estudios: el balón del logo ocupa el espacio libre de la tarjeta azul, encima de la
   placa y sin taparse con ella, a cualquier tamaño de pantalla. */
.destacado__marca {
  flex: 1 1 0;
  align-self: center;
  width: min(60%, 340px);
  min-height: 96px;
  max-height: 340px;
  margin-block: var(--pad);
  object-fit: contain;
}

.destacado__placa {
  position: relative;
  display: grid;
  gap: 16px;
  padding: var(--pad);
  background: var(--bg);
  color: var(--ink-on-bg);
}
/* Con un título largo, la placa crece pero siempre deja ver una franja de la foto encima. */
.destacado__foto ~ .destacado__placa { margin-top: var(--section-gap); }
.destacado__titulo { font-size: var(--step-lead); line-height: 1.1; }
.destacado--vacio .destacado__titulo { font-size: var(--step-head); line-height: var(--leading-display); }

@media (min-width: 600px) {
  .destacado__titulo { font-size: var(--step-head); line-height: var(--leading-display); }
}
/* En la portada, el título del último estudio es el cartel de la página. Cabe en dos líneas
   porque los títulos tienen 40 caracteres como mucho (ver avisos en articulos.11tydata.js). */
.portada .destacado__titulo { font-size: var(--step-head); line-height: var(--leading-display); }
@media (min-width: 600px) {
  .portada .destacado__titulo { font-size: var(--step-display); }
}
.destacado__titulo a { text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .destacado__titulo a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
}
.destacado__meta { color: var(--ink-2-on-bg); font-size: var(--step-small); }
.destacado .acciones { margin-top: 8px; }

/* El vídeo vertical del estudio. Hasta que se pulsa es un enlace con su miniatura;
   al pulsarlo, el script pone el reproductor de YouTube en su sitio. */
.video {
  position: relative;
  justify-self: center;
  width: min(100%, calc(80svh * 9 / 16));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--bg);
}
.video__enlace { position: absolute; inset: 0; display: block; color: var(--ink-on-bg); text-decoration: none; }
.video__poster { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease); }
.video__placa {
  position: absolute;
  left: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: var(--bg);
  font-weight: var(--weight-strong);
}
.video__icono {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent currentColor;
}
.video__enlace:focus-visible { outline-offset: -6px; }
/* Aviso de cookies sobre la miniatura, antes de pulsar: una placa negra pequeña arriba. */
.video__aviso {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--ink-on-bg);
  font-size: var(--step-small);
  line-height: 1.4;
}
/* El reproductor entra invisible encima de la miniatura y se funde cuando YouTube ha cargado. */
.video__reproductor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.video__reproductor--listo { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .video__enlace:hover .video__poster { transform: scale(1.03); }
  .video__enlace:hover .video__placa { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
}

@media (min-width: 900px) {
  /* La altura manda: el vídeo ocupa la altura de la pantalla y la tarjeta, el resto del ancho. */
  .portada { grid-template-columns: minmax(0, 1fr) auto; }
  .portada .video { width: auto; height: calc(100svh - 48px - 3 * var(--gutter)); }
  .portada--sin-video { grid-template-columns: minmax(0, 1fr); }
  .portada--sin-video .destacado { min-height: calc(100svh - 48px - 3 * var(--gutter)); }
  .destacado { min-height: 0; }
  .destacado__placa { margin-right: var(--pad); max-width: 60rem; }
  .destacado--vacio .destacado__titulo { font-size: var(--step-display); }
}

/* ---------- Jugadas (pizarra) ---------- */
.jugada .pista * ,
.tablero__pista .pista * {
  fill: none;
  stroke: var(--court-line);
  stroke-width: var(--stroke-court);
  vector-effect: non-scaling-stroke;
}

.jugada .trazo {
  fill: none;
  stroke: var(--ink);
  stroke-width: var(--stroke-play);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.jugada .trazo--pase { stroke-dasharray: 10 8; stroke-linecap: butt; }
.jugada .trazo--clave { stroke: var(--accent); }
.jugada .punta { fill: var(--ink); }
.jugada .punta--clave { fill: var(--accent); }

.jugada .defensa path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.jugada .balon {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

/* Máscara que "dibuja" cada trazo. Por defecto, la jugada está dibujada entera. */
.jugada .revelar {
  fill: none;
  stroke: #fff;
  stroke-width: 9;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

@keyframes trazar { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes aparecer { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .jugada--animar .revelar {
    animation: trazar var(--dur-trazo) var(--ease) backwards;
    animation-delay: calc(400ms + var(--i) * (var(--dur-trazo) + 150ms));
  }
  .jugada--animar .punta {
    animation: aparecer 160ms ease-out backwards;
    animation-delay: calc(400ms + var(--i) * (var(--dur-trazo) + 150ms) + var(--dur-trazo) - 60ms);
  }
}

/* ---------- 2. Libro de jugadas: pizarra de pista entera con los estudios a rotulador ---------- */
.estudios {
  display: grid;
  gap: clamp(32px, 5vh, 56px);
  padding: var(--section-gap) var(--gutter) 0;
}

.estudios__cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 32px;
}
.estudios__cabecera p { color: var(--ink-2-on-bg); max-width: 40ch; }
.estudios__todos { padding-inline: var(--pad); }
@media (min-width: 900px) {
  .estudios__todos { padding-inline: 0; }
}

/* Capas de la pizarra, de atrás adelante: foto del estudio (al pasar por encima),
   pista con las jugadas de fondo y, delante, los títulos. */
.tablero {
  position: relative;
  isolation: isolate;
  display: grid;
  aspect-ratio: 150 / 280;
  min-width: 0; /* con notas largas o texto grande, crece hacia abajo y no a lo ancho de la pantalla */
  overflow: clip; /* recorta la foto de fondo sin impedir que la pizarra crezca con sus notas */
  padding: var(--pad);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
}

.tablero__pista {
  position: absolute;
  z-index: 1;
  inset: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - 2 * var(--pad));
  pointer-events: none;
}
.tablero__pista--ancha { display: none; }
/* Las jugadas de fondo, apagadas; solo el trazo decisivo (rojo) va a opacidad completa. */
.tablero__jugadas .defensa,
.tablero__jugadas .ataque,
.tablero__jugadas .trazo:not(.trazo--clave),
.tablero__jugadas .punta:not(.punta--clave) { opacity: 0.3; }

.notas {
  display: grid;
  align-content: space-evenly;
  gap: 40px;
  padding: 8px;
}

.nota { display: grid; justify-items: start; }

/* La foto del estudio cubre toda la pizarra, muy suave, mientras el ratón está sobre su título. */
.nota__foto {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease);
}
/* Con el teclado sí; con un toque no, para que al volver atrás no se quede la foto puesta. */
.nota:has(:focus-visible) .nota__foto { opacity: 0.35; }
@media (hover: hover) and (pointer: fine) {
  .nota:hover .nota__foto { opacity: 0.35; }
}

.nota__papel { position: relative; z-index: 2; display: grid; gap: 6px; rotate: -1.5deg; }
.nota:nth-child(4n + 2) .nota__papel { rotate: 1deg; }
.nota:nth-child(4n + 3) .nota__papel { rotate: -0.5deg; }
.nota:nth-child(4n + 4) .nota__papel { rotate: 1.5deg; }

.nota__enlace {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-decoration: none;
  transition: transform var(--dur) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  a.nota__enlace:hover { transform: translateY(-3px); }
  a.nota__enlace:hover .nota__titulo { text-decoration: underline; text-decoration-thickness: 3px; }
}

/* Quien pide menos movimiento: se quita todo lo que desplaza o cambia de tamaño y se conservan
   los fundidos, que no mueven nada. El subrayado de aterrizaje aparece ya dibujado. */
@media (prefers-reduced-motion: reduce) {
  .boton, .nota__enlace, .video__poster { transition: none; }
  .indice--animable::details-content { transition: opacity 220ms var(--ease), content-visibility 220ms allow-discrete; }
  .texto h2:target::after, :target .seccion-titulo::after { animation: none; }
}

.nota__titulo {
  font-family: var(--font-marker);
  font-size: var(--step-lead);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.icono {
  flex: none;
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icono .icono__pase { stroke-dasharray: 3 4; }

.nota__fecha { padding-left: 56px; color: var(--ink-2); font-size: var(--step-small); }

@media (min-width: 900px) {
  .tablero { aspect-ratio: 280 / 150; }
  .tablero__pista--ancha { display: block; }
  .tablero__pista--alta { display: none; }
  /* Las notas se leen en orden, de la más reciente a la más antigua, fila a fila. */
  .notas--pista {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    gap: clamp(32px, 5vh, 56px) clamp(24px, 3vw, 48px);
    padding: clamp(16px, 2vw, 32px);
  }
}
@media (min-width: 1200px) {
  .notas--pista { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
  .notas--pista { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* En el móvil la pizarra enseña 5 estudios; debajo, "Ver todos los estudios". */
@media (max-width: 899px) {
  .notas--pista .nota:nth-child(n + 6) { display: none; }
}

/* ---------- Todos los estudios: la lista completa en una pizarra, con el buscador ---------- */
/* "Todos los estudios" y las páginas legales comparten la cabecera sobre el negro. */
.todos, .legal { display: grid; gap: clamp(32px, 5vh, 56px); padding: clamp(48px, 8vh, 96px) var(--gutter) var(--gutter); }
.todos__cabecera, .legal__cabecera { display: grid; gap: 12px; padding-inline: var(--pad); }
.todos__cabecera p, .legal__cabecera p { color: var(--ink-2-on-bg); }

/* Páginas legales: el texto en una hoja, con la misma letra y medida que los estudios. */
.legal { grid-template-columns: minmax(0, 1fr); }
.legal__hoja { padding: var(--pad); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
.legal__hoja .texto { margin-inline: auto; }
.legal__hoja .texto a { overflow-wrap: anywhere; }

.tablero--lista { aspect-ratio: auto; }
.notas--lista {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  align-content: start;
  gap: clamp(32px, 5vh, 48px) clamp(24px, 3vw, 48px);
  padding: clamp(8px, 2vw, 24px);
}

/* Buscador (Pagefind) con los colores de la pizarra */
.buscador {
  padding: var(--pad);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  --pagefind-ui-scale: 1;
  --pagefind-ui-primary: var(--ink);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--surface);
  --pagefind-ui-border: var(--ink);
  --pagefind-ui-tag: var(--field-3a);
  --pagefind-ui-border-width: 2px;
  --pagefind-ui-border-radius: 0px;
  --pagefind-ui-image-border-radius: 0px;
  --pagefind-ui-font: var(--font);
}
.buscador:empty { display: none; }
/* El foco del buscador, como el del resto de la web (Pagefind trae uno naranja). */
.buscador .pagefind-ui .pagefind-ui__search-input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.buscador__etiqueta { display: block; margin-bottom: 12px; font-weight: var(--weight-display); }
/* Texto de ejemplo legible (Pagefind lo deja al 20 %) y resaltado con un tono de la pizarra. */
.buscador .pagefind-ui .pagefind-ui__search-input::placeholder { color: var(--ink-2); opacity: 1; }
.buscador .pagefind-ui mark { padding: 0 2px; background: var(--field-3b); color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- 3. Método: el texto sobre el negro y, al lado, gráficos de verdad de un estudio ---------- */
.metodo {
  display: grid;
  gap: 48px var(--gutter);
  padding: var(--section-gap) var(--gutter) 0;
}
.metodo__texto { display: grid; gap: 20px; align-content: start; }
.metodo__texto p { max-width: var(--measure); }
.metodo__sugerencia a { overflow-wrap: anywhere; }

.metodo__graficos { display: grid; gap: 12px; margin: 0; }
.metodo__lista { display: grid; gap: var(--gutter); }
.metodo__lista img { width: 100%; height: auto; }
.metodo__graficos figcaption { color: var(--ink-2-on-bg); font-size: var(--step-small); }

/* El primer gráfico grande y los otros dos, uno al lado del otro debajo. */
@media (min-width: 600px) {
  .metodo__lista { grid-template-columns: 1fr 1fr; }
  .metodo__lista img:first-child { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .metodo--con-graficos { grid-template-columns: 5fr 7fr; align-items: start; }
}

/* ---------- 4. Te toca tirar ---------- */
.videos {
  display: grid;
  gap: 32px var(--gutter);
  margin-top: var(--section-gap);
  padding: calc(var(--section-gap) * 0.75) var(--gutter) 0;
  background: var(--field-5);
  color: var(--ink-on-bg);
}
.videos__texto { display: grid; gap: 24px; align-content: end; }
.videos__texto p { font-size: var(--step-lead); line-height: 1.35; max-width: 34ch; }

@media (min-width: 900px) {
  .videos { grid-template-columns: 5fr 7fr; align-items: end; }
}

/* Botón sobre el azul de la marca: en claro, porque el rojo nunca va directamente sobre el azul. */
.boton--claro { background: var(--surface); color: var(--ink); }

/* ---------- 5. Cierre (pie): el lema a todo el ancho sobre el azul ---------- */
.reverso {
  display: grid;
  gap: 48px;
  padding: var(--section-gap) var(--gutter) var(--gutter);
  background: var(--field-5);
  color: var(--ink-on-bg);
}
.reverso__lema {
  font-size: var(--step-head);
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
  text-wrap: balance;
}
@media (min-width: 600px) {
  .reverso__lema { font-size: var(--step-display); }
}

.reverso__base { display: flex; flex-wrap: wrap; align-items: center; gap: 24px 40px; }
.reverso__enlaces { display: flex; flex-wrap: wrap; gap: 12px 32px; font-weight: var(--weight-strong); }
.reverso__enlaces a { text-decoration: none; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) {
  .reverso__enlaces a:hover { text-decoration: underline; }
}
.reverso__sello { width: 56px; height: 56px; margin-left: auto; border-radius: var(--r-pill); }
.reverso__pie { display: flex; flex-wrap: wrap; gap: 8px 24px; width: 100%; font-size: var(--step-small); }
.reverso__legal { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.reverso__legal a { display: inline-block; padding-block: 4px; }

/* En pantallas estrechas, el texto que va directamente sobre un campo de color se alinea
   con el texto de dentro de las piezas, para que los dos márgenes queden iguales. */
@media (max-width: 899px) {
  .estudios__cabecera,
  .metodo__texto,
  .metodo__graficos figcaption { padding-inline: var(--pad); }
  .cabecera,
  .videos,
  .reverso { padding-inline: calc(var(--gutter) + var(--pad)); }
}

/* ---------- Página de un estudio ---------- */
/* minmax(0, 1fr): una palabra larga con el texto ampliado no ensancha la página. */
.estudio { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gutter); padding: var(--gutter); }

.estudio__portada { min-height: 60svh; }
.estudio__resumen { font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; }

/* La hoja de lectura: índice, texto, vídeo y cierre. En el móvil, uno debajo de otro. */
.estudio__hoja {
  display: grid;
  grid-template-areas: "indice" "texto" "video" "cierre" "fuentes";
  gap: clamp(32px, 5vw, 56px);
  padding: var(--pad);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
}
.indice { grid-area: indice; }
.texto { grid-area: texto; min-width: 0; }
.estudio__video { grid-area: video; }
.estudio__cierre { grid-area: cierre; }
.fuentes { grid-area: fuentes; }
.texto, .estudio__cierre, .fuentes { justify-self: center; width: 100%; max-width: var(--measure); }

/* Índice */
.indice { padding: 16px 20px; background: var(--field-3a); }
.indice summary { padding: 4px 0; font-weight: var(--weight-display); cursor: pointer; }

/* Abrir y cerrar el índice sin saltos: la altura y el contenido se despliegan en 220 ms.
   Los navegadores que no lo soportan lo abren de golpe, como antes. */
.indice--animable { interpolate-size: allow-keywords; }
.indice--animable::details-content {
  block-size: 0;
  overflow: clip;
  opacity: 0;
  transition: block-size 220ms var(--ease), opacity 220ms var(--ease), content-visibility 220ms allow-discrete;
}
.indice--animable[open]::details-content { block-size: auto; opacity: 1; }
.indice ol { display: grid; gap: 10px; margin-top: 12px; }
.indice a { text-decoration: none; line-height: 1.3; }
@media (hover: hover) and (pointer: fine) {
  .indice a:hover { text-decoration: underline; }
}

/* El texto del .docx */
.texto { font-size: var(--step-body); line-height: 1.6; }
.texto > * + * { margin-top: 1.1em; }
.texto > :first-child { margin-top: 0; }
.texto h2 {
  margin-top: 2.2em;
  font-size: var(--step-lead);
  letter-spacing: -0.02em;
  line-height: 1.15;
  scroll-margin-top: var(--gutter);
}
.texto h3 { margin-top: 1.8em; font-size: var(--step-body); letter-spacing: -0.01em; line-height: 1.3; }
.texto h2 + *, .texto h3 + * { margin-top: 0.6em; }

/* Aterrizaje: al saltar a un apartado (índice, menú o un enlace con #), su título recibe un
   subrayado de rotulador que se dibuja una vez, para saber dónde has caído. */
.texto h2:target,
:target .seccion-titulo { width: fit-content; }
.texto h2:target::after,
:target .seccion-titulo::after {
  content: "";
  display: block;
  height: 5px;
  margin-top: 0.18em;
  border-radius: var(--r-pill);
  background: currentColor;
  transform-origin: left center;
  rotate: -0.6deg;
  animation: subrayar 300ms var(--ease) 100ms both;
}
@keyframes subrayar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.texto strong { font-weight: var(--weight-display); }
.texto ul, .texto ol { padding-left: 1.3em; }
.texto li + li { margin-top: 0.4em; }
.texto__meta { color: var(--ink-2); font-size: var(--step-small); }

.texto figure { margin: 2em 0 0; }
.texto figure img { width: 100%; height: auto; }
.texto .ampliar { display: block; cursor: zoom-in; }
.texto figcaption { margin-top: 10px; color: var(--ink-2); font-size: var(--step-small); line-height: 1.45; }

/* Al deslizar la tabla hasta su borde, el gesto no pasa a la página ni al "atrás" del navegador. */
.tabla { margin-top: 1.6em; overflow-x: auto; overscroll-behavior-x: contain; }
.tabla table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
}
.tabla th, .tabla td { padding: 10px 12px; text-align: left; vertical-align: top; }
.tabla thead th { background: var(--ink); color: var(--surface); font-weight: var(--weight-strong); }
.tabla tbody tr:nth-child(odd) { background: var(--field-3a); }
.tabla p { margin: 0; }
.tabla tbody th { font-weight: var(--weight-strong); }
.texto__nota { margin-top: 10px; color: var(--ink-2); font-size: var(--step-small); line-height: 1.45; }

.texto__clave { margin: 2em 0 0; padding: 20px 24px; background: var(--field-3b); font-size: var(--step-lead); line-height: 1.4; }

/* Fuentes del estudio, plegadas: a la vista solo "Fuentes (N)". */
.fuentes { padding: 16px 20px; background: var(--field-3a); }
.fuentes summary { padding: 4px 0; font-weight: var(--weight-display); cursor: pointer; }
.fuentes__lista { display: grid; gap: 0.8em; margin-top: 16px; color: var(--ink-2); font-size: var(--step-small); line-height: 1.5; }
.fuentes__lista h3 { color: var(--ink); font-size: var(--step-small); }
.fuentes__lista p { overflow-wrap: anywhere; }
.fuentes__lista a { text-decoration-thickness: 1px; }

/* Vídeo y redes */
.estudio__video .video { width: min(100%, calc(70svh * 9 / 16)); }
.estudio__redes { margin-top: 12px; color: var(--ink-2); font-size: var(--step-small); text-align: center; }
.estudio__redes a { color: var(--ink); font-weight: var(--weight-strong); }

/* Cierre: comentar en el vídeo y "Más jugadas", otros estudios escritos en una pizarra. */
.estudio__cierre { display: grid; gap: 32px; }
.estudio__comentar { font-size: var(--step-lead); font-weight: var(--weight-display); letter-spacing: -0.02em; line-height: 1.25; }

.mini-pizarra {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 24px;
  overflow: clip;
  padding: var(--pad);
  background: var(--field-3a);
}
.mini-pizarra__pista {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.mini-pizarra__pista .pista * {
  fill: none;
  stroke: var(--court-line);
  stroke-width: var(--stroke-court);
  vector-effect: non-scaling-stroke;
}
.mini-pizarra__titulo { position: relative; z-index: 2; font-size: var(--step-lead); letter-spacing: -0.02em; line-height: 1.15; }
.notas--mini {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 28px 32px;
  padding: 0;
}
.mini-pizarra__todos { position: relative; z-index: 2; }

/* Página de error: la misma pizarra pequeña, a pantalla completa. */
.error { display: grid; padding: var(--gutter); min-height: calc(100svh - 48px - var(--gutter)); }
.error__pizarra { align-content: center; gap: 28px; background: var(--surface); color: var(--ink); }
.error__titulo { position: relative; z-index: 2; font-size: var(--step-head); max-width: 16ch; }
.error__texto { position: relative; z-index: 2; max-width: 44ch; font-size: var(--step-lead); line-height: 1.35; }
.error__acciones { position: relative; z-index: 2; }

@media (min-width: 900px) {
  .estudio__portada { min-height: 64svh; }
  .estudio__ir-video { display: none; }
  .estudio__hoja {
    grid-template-columns: minmax(0, 1fr) 280px;
    grid-template-areas: "indice video" "texto video" "cierre video" "fuentes video";
    align-items: start;
    column-gap: var(--pad);
  }
  .estudio__hoja--sin-video { grid-template-columns: minmax(0, 1fr); grid-template-areas: "indice" "texto" "cierre" "fuentes"; }
  .estudio__video { position: sticky; top: var(--gutter); }
  .estudio__video .video { width: 100%; }
  .indice { justify-self: center; width: 100%; max-width: var(--measure); }
}

@media (min-width: 1200px) {
  .estudio__hoja {
    grid-template-columns: 220px minmax(0, 1fr) 300px;
    grid-template-areas: "indice texto video" "indice cierre video" "indice fuentes video";
  }
  .estudio__hoja--sin-video { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "indice texto" "indice cierre" "indice fuentes"; }
  .indice { position: sticky; top: var(--gutter); align-self: start; padding: 0; background: none; font-size: var(--step-small); }
  .indice summary { list-style: none; cursor: default; }
  .indice summary::-webkit-details-marker { display: none; }
}

/* ---------- Entradas al hacer scroll (solo con JS y si se permite movimiento) ---------- */
/* Lo que aún no ha entrado se ve tenue, nunca invisible: si algo no llega a animarse, se sigue leyendo. */
@media (prefers-reduced-motion: no-preference) {
  .por-entrar { opacity: 0.35; transform: translateY(24px); }
  .entrando {
    transition: opacity 600ms var(--ease), transform 600ms var(--ease);
    transition-delay: calc(var(--orden, 0) * 80ms);
  }
}

/* ---------- Solo en local y en la versión de prueba: marcas de contenido pendiente o de ejemplo ---------- */
.con-avisos .pendiente,
.con-avisos .ejemplo {
  background: var(--dev-marca);
  color: var(--ink);
}
.con-avisos .pendiente { padding: 12px 16px; }
.avisos { display: grid; gap: 8px; }
.con-avisos .pendiente::before { content: "PENDIENTE · "; font-weight: var(--weight-display); }
.con-avisos .ejemplo { padding: 2px 8px; font-size: var(--step-small); font-weight: var(--weight-strong); }
