/* Adrián Idiomas — biblioteca de noche bajo la lámpara.
   Una sola idea fuerte (los libros en la repisa) y todo lo demás tranquilo. */

@font-face { font-family: "Fraunces"; src: url("fuentes/fraunces-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; src: url("fuentes/fraunces-latin-ext-opsz-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson"; src: url("fuentes/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fuentes/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fuentes/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --noche: #1e1915;        /* madera de nogal a oscuras */
  --estante: #2b231d;      /* la repisa */
  --veta: #3a2f26;         /* bordes y vetas */
  --papel: #ece0c8;        /* el texto: papel envejecido */
  --papel-tenue: #b9ab92;
  --lampara: #f0b754;      /* la luz de la lámpara: foco y estados activos */
  --fr-cuero: #6e1d2b;  --fr-oro: #d4ad5a;
  --en-tela: #1d3150;   --en-bronce: #d39c66;
  --acento: var(--lampara);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Atkinson", "Segoe UI", system-ui, sans-serif;
  --paso: clamp(16px, 4vw, 28px);
  --ancho: 68rem;
  color-scheme: dark;
}
body[data-tema="fr"] { --acento: var(--fr-oro); }
body[data-tema="en"] { --acento: var(--en-bronce); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--noche); color: var(--papel);
  font: 400 1.0625rem/1.6 var(--sans);
  /* la luz de la lámpara cae desde arriba a la izquierda */
  background-image: radial-gradient(ellipse 80% 55% at 22% -8%, rgba(240, 183, 84, .16), transparent 70%);
  background-attachment: fixed;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--lampara); outline-offset: 3px; border-radius: 4px; }

.saltar { position: absolute; left: -999px; top: 8px; background: var(--lampara); color: var(--noche); padding: 8px 14px; border-radius: 6px; z-index: 10; }
.saltar:focus { left: 12px; }

/* ---------- barra ---------- */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: var(--ancho); margin: 0 auto; padding: 14px var(--paso); }
.marca { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; }
.marca-nombre { font: 600 1.6rem/1 var(--serif); font-variation-settings: "opsz" 48; letter-spacing: .01em; }
.marca-logo { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 0 10px rgba(240, 183, 84, .25)); }
@media (max-width: 560px) { .marca-logo { width: 48px; height: 48px; } .marca-nombre { font-size: 1.3rem; } }

.musica { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  font: 700 .95rem/1 var(--sans); color: var(--papel); background: transparent;
  border: 1.5px solid var(--veta); border-radius: 999px; cursor: pointer; touch-action: manipulation; }
.musica svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.musica[hidden] { display: none; }
.musica:hover { border-color: var(--papel-tenue); }
.musica[aria-pressed="true"] { color: var(--noche); background: var(--lampara); border-color: var(--lampara); }
.musica-ondas { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.musica[aria-pressed="true"] .musica-ondas { display: inline-flex; }
.musica-ondas i { width: 3px; background: currentColor; border-radius: 1px; animation: onda 1.1s ease-in-out infinite; }
.musica-ondas i:nth-child(2) { animation-delay: -.4s; } .musica-ondas i:nth-child(3) { animation-delay: -.8s; }
@keyframes onda { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* volumen de la música: botón redondo junto a «Música» y una barra que se abre debajo */
.sonido { position: relative; display: flex; align-items: center; gap: 8px; flex: none; }
.volumen[hidden], .volumen-panel[hidden] { display: none; }
.volumen-boton { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--papel);
  background: transparent; border: 1.5px solid var(--veta); border-radius: 50%; cursor: pointer; touch-action: manipulation; }
.volumen-boton:hover, .volumen-boton[aria-expanded="true"] { border-color: var(--lampara); color: var(--lampara); }
.volumen-boton svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.volumen-boton .vol-parlante { fill: currentColor; }
.volumen-boton .vol-x { display: none; }
.volumen-boton.mudo .vol-ondas { display: none; }
.volumen-boton.mudo .vol-x { display: inline; }
.volumen-panel { position: absolute; top: calc(100% + 10px); right: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: #2a231d; border: 1px solid var(--veta); border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.volumen-barra { width: 160px; height: 28px; margin: 0; accent-color: var(--lampara); cursor: pointer; touch-action: manipulation; }
.volumen-valor { min-width: 3.2em; text-align: right; font: 700 .95rem/1 var(--sans); color: var(--papel); font-variant-numeric: tabular-nums; }
/* en el celular, «Música» queda solo con su ícono para que quepan el logo, el nombre y el volumen */
@media (max-width: 560px) { .musica-texto { display: none; } .musica { padding: 0 13px; } }

/* ---------- migas ---------- */
.migas { width: 100%; max-width: var(--ancho); margin: 0 auto; padding: 0 var(--paso); }
.migas ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; color: var(--papel-tenue); font-size: .95rem; }
.migas li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.migas a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--veta); }
.migas a:hover { text-decoration-color: currentColor; }

main { flex: 1; width: 100%; max-width: var(--ancho); margin: 0 auto; padding: clamp(20px, 5vw, 48px) var(--paso) 56px; }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.08; margin: 0; }

/* ---------- portada ---------- */
.portada-sobre { margin: 0 0 6px; color: var(--papel-tenue); }
.portada-titulo { font-size: clamp(2.6rem, 9vw, 4.75rem); font-variation-settings: "opsz" 144; letter-spacing: -.015em; }
.portada-lema { margin: 14px 0 0; max-width: 34rem; color: var(--papel-tenue); font-size: 1.1rem; }

/* la repisa con los dos libros: el elemento memorable */
.puertas { display: grid; grid-template-columns: repeat(2, minmax(0, 15rem)); gap: clamp(14px, 4vw, 36px);
  margin-top: clamp(28px, 6vw, 56px); padding-bottom: 18px; position: relative; }
.puertas::after { /* la tabla de la repisa */
  content: ""; position: absolute; left: -12px; right: -12px; bottom: 0; height: 18px;
  background: linear-gradient(#4a3a2d, #2e241c); border-radius: 3px; box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
@media (min-width: 720px) { .puertas::after { right: auto; width: calc(30rem + 72px + 24px); } }

.puerta { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0;
  aspect-ratio: 3 / 4.2; padding: 16px 14px 18px; text-decoration: none; border-radius: 4px 10px 10px 4px;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .28), inset -1px 0 0 rgba(255, 255, 255, .06), 0 6px 0 rgba(0, 0, 0, .25);
  transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.puerta:hover { transform: translateY(-8px) rotate(-1.2deg); }
.puerta:active { transform: translateY(-3px); }
.puerta-fr { background: var(--fr-cuero); color: var(--fr-oro);
  background-image: linear-gradient(105deg, rgba(255, 255, 255, .05), transparent 30%), radial-gradient(circle at 70% 20%, rgba(212, 173, 90, .12), transparent 60%); }
.puerta-en { background: var(--en-tela); color: var(--en-bronce);
  background-image: linear-gradient(105deg, rgba(255, 255, 255, .05), transparent 30%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.puerta-escena { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 4px 0 12px; }
.puerta-escena .escena { max-height: 100%; }
.puerta-nombre { font: 600 clamp(1.5rem, 5.4vw, 2.1rem)/1 var(--serif); font-variation-settings: "opsz" 72; }
.puerta-en .puerta-nombre { letter-spacing: .02em; }
.puerta-es { margin-top: 6px; font-size: .9rem; color: var(--papel); opacity: .85; }

/* ---------- ilustraciones ---------- */
.escena { width: 100%; height: 100%; max-height: 13rem; overflow: visible; }
.escena .trazo { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.escena .esfera { fill: rgba(236, 224, 200, .08); stroke: currentColor; stroke-width: 1.6; }
.escena .aguja { stroke: var(--papel); stroke-width: 1.8; stroke-linecap: round; transform-box: view-box; transform-origin: 60px 66px; }
.escena .acento { font: italic 600 13px var(--serif); fill: currentColor; opacity: .7; }
.escena-en .acento { font: 700 10px var(--sans); font-style: normal; letter-spacing: .04em; }

/* el único momento orquestado: la torre se dibuja, los acentos se entintan, el reloj gira a la hora */
@media (prefers-reduced-motion: no-preference) {
  .anima .escena-fr .trazo { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dibujar 2.2s .35s cubic-bezier(.45, 0, .2, 1) forwards; }
  .anima .escena .acento { opacity: 0; animation: entintar .5s forwards; }
  .anima .escena .a1 { animation-delay: 1.9s; } .anima .escena .a2 { animation-delay: 2.1s; }
  .anima .escena .a3 { animation-delay: 2.3s; } .anima .escena .a4 { animation-delay: 2.5s; }
  .anima .escena-en .trazo { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dibujar 1.6s .35s ease-out forwards; }
  .anima .escena-en .aguja { transition: transform 1.6s 1.4s cubic-bezier(.3, 1.4, .5, 1); }
  .anima body, body.anima { animation: encender .9s ease-out both; }
}
@keyframes dibujar { to { stroke-dashoffset: 0; } }
@keyframes entintar { from { opacity: 0; transform: scale(.6); } to { opacity: .7; transform: scale(1); } }
@keyframes encender { from { background-color: #120e0b; } }

/* ---------- página de idioma ---------- */
.cabecera-idioma { display: grid; grid-template-columns: 6.5rem 1fr; gap: 6px 22px; align-items: center; }
.cabecera-escena { grid-row: span 3; color: var(--acento); height: 9rem; }
.cabecera-idioma h1 { font-size: clamp(2.4rem, 8vw, 4rem); font-variation-settings: "opsz" 144; }
.cabecera-idioma .lema { margin: 0; font: italic 500 1.2rem/1.3 var(--serif); color: var(--acento); min-height: 1.3em; }
.cabecera-idioma p:last-child { grid-column: 1 / -1; margin: 14px 0 0; max-width: 40rem; color: var(--papel-tenue); }
@media (min-width: 640px) { .cabecera-idioma p:last-child { grid-column: 2; margin-top: 4px; } }

/* los tres lomos */
.niveles { display: grid; grid-template-columns: repeat(3, minmax(0, 11rem)); gap: clamp(10px, 3vw, 24px);
  align-items: end; margin-top: clamp(28px, 6vw, 48px); padding-bottom: 18px; position: relative; }
.niveles::after { content: ""; position: absolute; left: -12px; right: -12px; bottom: 0; height: 18px;
  background: linear-gradient(#4a3a2d, #2e241c); border-radius: 3px; box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
@media (min-width: 720px) { .niveles::after { right: auto; width: calc(33rem + 48px + 24px); } }
.nivel { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 18px 8px 16px; text-align: center; text-decoration: none; border-radius: 4px;
  background: var(--fr-cuero); color: var(--fr-oro); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  box-shadow: inset 0 10px 0 rgba(0, 0, 0, .18), inset 0 -10px 0 rgba(0, 0, 0, .18), 0 6px 0 rgba(0, 0, 0, .25); }
body[data-tema="en"] .nivel { background: var(--en-tela); color: var(--en-bronce); }
.nivel[data-nivel="a1"] { height: 13.5rem; } .nivel[data-nivel="a2"] { height: 15.5rem; } .nivel[data-nivel="b1"] { height: 17.5rem; }
.nivel:hover { transform: translateY(-10px); }
.nivel-sigla { font: 700 clamp(2rem, 7vw, 2.8rem)/1 var(--serif); font-variation-settings: "opsz" 144; }
.nivel-etiqueta { font: italic 500 1rem/1.2 var(--serif); }
.nivel-cuenta { font-size: .85rem; line-height: 1.3; color: var(--papel); opacity: .85; }

/* ---------- página de nivel: el índice del libro ---------- */
.cabecera-nivel .cabecera-idioma-mini { margin: 0 0 4px; font: italic 500 1.15rem var(--serif); color: var(--acento); }
.cabecera-nivel h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); font-variation-settings: "opsz" 144; }
.cabecera-nivel h1 .sigla { color: var(--acento); }
.cabecera-nivel p:last-child { margin: 12px 0 0; max-width: 40rem; color: var(--papel-tenue); }

.unidades { margin-top: clamp(26px, 5vw, 44px); max-width: 46rem; padding: clamp(18px, 4vw, 30px);
  background: var(--estante); border: 1px solid var(--veta); border-radius: 6px; }
.unidades::before { content: "Table des matières"; display: block; margin-bottom: 10px;
  font: italic 500 1.25rem var(--serif); color: var(--acento); }
body[data-tema="en"] .unidades::before { content: "Contents"; }
.unidad { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 4px 12px; padding: 12px 0;
  border-bottom: 1px dashed var(--veta); text-decoration: none; }
.unidad:last-child { border-bottom: 0; }
.unidad-numero { font: 600 1.1rem var(--serif); white-space: nowrap; }
.unidad-pronto { color: var(--papel-tenue); }
.unidad-pronto::after { /* línea de puntos hasta «Próximamente», como en un índice */
  content: ""; grid-column: 2; grid-row: 1; align-self: end; margin-bottom: .45em; border-bottom: 2px dotted var(--veta); }
.unidad-pronto-texto { grid-column: 3; font-style: italic; font-size: .95rem; }

.unidad-lista { grid-template-columns: auto 1fr; padding: 16px 16px 18px; margin: 4px -16px;
  border-radius: 6px; border: 1px solid transparent; background: linear-gradient(90deg, rgba(240, 183, 84, .10), transparent 75%); }
.unidad-lista .unidad-numero { color: var(--acento); }
.unidad-tema { font: 600 clamp(1.25rem, 4vw, 1.5rem)/1.2 var(--serif); }
.unidad-sub { grid-column: 1 / -1; font: italic 400 1.05rem var(--serif); color: var(--papel-tenue); }
.unidad-resumen { grid-column: 1 / -1; max-width: 36rem; margin-top: 4px; }
.unidad-accion { grid-column: 1 / -1; justify-self: start; margin-top: 10px; display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 20px; border-radius: 999px; font-weight: 700; background: var(--acento); color: var(--noche); }
.unidad-lista:hover { border-color: var(--veta); }
.unidad-lista:hover .unidad-accion { filter: brightness(1.08); }

/* ---------- texto (privacidad) ---------- */
.texto { max-width: 40rem; }
.texto h1 { font-size: clamp(2.2rem, 7vw, 3.2rem); margin-bottom: 18px; }
.texto h2 { font-size: 1.4rem; margin: 30px 0 8px; color: var(--lampara); }
.texto li { margin-bottom: 8px; }

/* ---------- pie ---------- */
.pie { width: 100%; max-width: var(--ancho); margin: 0 auto; padding: 22px var(--paso) 30px; border-top: 1px solid var(--veta);
  color: var(--papel-tenue); font-size: .92rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; }
.pie p { margin: 0; max-width: 46rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
