/* Audiolibro accesible — WCAG 2.2 AA */
:root {
  --fondo: #ffffff;
  --texto: #1a1a1a;
  --suave: #4a4a4a;
  --acento: #0b4f8a;      /* contraste 8.6:1 sobre blanco */
  --acento-texto: #ffffff;
  --borde: #6b6b6b;
  --resalte: #fff3c4;
  --foco: #c2410c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #121212;
    --texto: #f2f2f2;
    --suave: #c9c9c9;
    --acento: #8cc8ff;
    --acento-texto: #0b0b0b;
    --borde: #9a9a9a;
    --resalte: #3a3214;
    --foco: #ffb347;
  }
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
}
.saltar {
  position: absolute; left: -9999px; top: 0;
  background: var(--acento); color: var(--acento-texto);
  padding: .75rem 1rem; z-index: 100; font-weight: 700;
}
.saltar:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 4px solid var(--foco); outline-offset: 3px; }

header, main, footer { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }
header { padding-top: 1.5rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 .25rem; }
.autor { margin: 0 0 1rem; color: var(--suave); font-size: 1.05rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: 0; }
p { margin: 0 0 1rem; }
.aviso { border-left: 6px solid var(--acento); padding: .5rem 1rem; background: color-mix(in srgb, var(--acento) 8%, transparent); }

/* Reproductor (no fijo: no tapa el contenido al ampliar la pantalla) */
.reproductor { border: 3px solid var(--acento); border-radius: 14px; padding: 1rem; margin: 1.5rem 0 1rem; }
.reproductor h2 { margin-top: 0; }
.ahora { font-weight: 700; }
.controles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.controles button, .velocidad select, .b-pista, .retomar {
  min-height: 56px; font: inherit; font-weight: 700;
  border: 2px solid var(--acento); border-radius: 12px;
  background: var(--fondo); color: var(--acento);
  cursor: pointer; padding: .5rem .75rem; line-height: 1.25;
}
.controles button { display: flex; align-items: center; justify-content: center; gap: .5rem; text-align: center; }
.controles .principal { grid-column: 1 / -1; background: var(--acento); color: var(--acento-texto); font-size: 1.2rem; min-height: 64px; }
.controles button:disabled, .barra input:disabled { opacity: .45; cursor: not-allowed; }
.icono { font-size: 1.2em; line-height: 1; }
.barra, .velocidad { display: flex; flex-direction: column; gap: .25rem; margin-top: 1rem; }
.barra label, .velocidad label { font-weight: 700; }
.barra input[type=range] { width: 100%; height: 2.75rem; accent-color: var(--acento); }
.retomar { width: 100%; background: var(--acento); color: var(--acento-texto); margin: .5rem 0; }
.intro { font-size: 1.05rem; }

/* Índice de pistas */
.capitulo { list-style: none; padding: 0; margin: 0; }
.pista { border: 2px solid var(--borde); border-radius: 12px; padding: .75rem; margin-bottom: .75rem; }
.pista.actual { border-color: var(--acento); background: var(--resalte); }
.b-pista { width: 100%; margin-top: .5rem; }
.pista h3 { margin: 0; }
details { margin-top: .5rem; }
summary { cursor: pointer; font-weight: 700; color: var(--acento); padding: .5rem 0; min-height: 44px; }
.texto { padding-top: .5rem; }
.nota { font-size: .95rem; color: var(--suave); border-top: 1px solid var(--borde); padding-top: .5rem; }
.nota-et { font-weight: 700; }
footer { padding-bottom: 2rem; color: var(--suave); font-size: .95rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* iOS: respeta el tamaño de letra elegido en Ajustes > Accesibilidad */
@supports (font: -apple-system-body) { html { font: -apple-system-body; } body { font-size: 1.125rem; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Índice de capítulos y materiales */
.indice, .lista-mat { padding-left: 1.25rem; }
.indice li, .lista-mat li { margin: .35rem 0; }
.indice a, .lista-mat a, header a, footer a { color: var(--acento); font-weight: 700; display: inline-block; min-height: 44px; padding: .5rem 0; }
.material { border-top: 3px solid var(--borde); margin-top: 2rem; padding-top: .5rem; }
.ident { color: var(--suave); }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; }
th, td { border: 1px solid var(--borde); padding: .4rem; text-align: left; vertical-align: top; }
a { color: var(--acento); }
a:visited { color: var(--acento); }

/* Enlaces sueltos con área táctil de al menos 44 px */
.intro a, .texto p > a:only-child, .material > p > a, .lista-mat a, .indice a, header a, footer a {
  display: inline-flex; align-items: center; min-height: 44px; padding: .4rem 0; font-weight: 700;
}
caption { text-align: left; font-weight: 700; padding: .4rem 0; }
th[scope="row"] { font-weight: 400; }

/* Botones del reproductor: se ajustan a cualquier ancho y responden al toque */
.controles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.controles button { flex-direction: column; gap: .2rem; padding: .5rem .25rem; min-height: 64px; }
.controles .principal { flex-direction: row; gap: .6rem; }
.controles .etq { font-size: .95rem; line-height: 1.15; }
.controles button, .b-pista, .retomar, .velocidad select { transition: background-color .12s, transform .08s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.controles button:not(:disabled):active, .b-pista:active, .retomar:active { transform: scale(.97); }
.controles button:not(.principal):not(:disabled):active, .b-pista:active { background: color-mix(in srgb, var(--acento) 18%, var(--fondo)); }
.controles .principal:active { filter: brightness(1.15); }
.controles button:disabled { opacity: .55; border-style: dashed; }
@media (hover: hover) {
  .controles button:not(:disabled):hover, .b-pista:hover { background: color-mix(in srgb, var(--acento) 10%, var(--fondo)); }
  .controles .principal:hover { filter: brightness(1.1); background: var(--acento); }
}
.pista.actual .b-pista { background: var(--acento); color: var(--acento-texto); }
@media (max-width: 360px) {
  header, main, footer { padding: 0 .75rem; }
  .reproductor { padding: .75rem; }
  .controles .etq { font-size: .9rem; }
}
.controles .principal .etq { font-size: 1.15rem; }
.controles .principal .icono { font-size: 1.05rem; letter-spacing: -.1em; }
