:root {
  --fondo: #fff6e6;       /* crema, como la pared del aula */
  --fondo-2: #fdeccd;
  --azul: #3566c9;
  --azul-osc: #24479a;
  --rojo: #e5534b;
  --rojo-osc: #b8362f;
  --amarillo: #f7c531;
  --amarillo-osc: #c9970d;
  --pizarra: #1f4a3b;
  /* textos: una sola tinta azul noche + un acento azul + resaltador amarillo */
  --tinta: #24304d;
  --tinta-suave: #69708a;
  --acento: #3566c9;
  --resaltador: #ffd95a;
  --radio: 22px;
  --sombra: 0 10px 30px rgba(29, 42, 68, 0.12);
  --texto: "Outfit", system-ui, sans-serif;
  --marca: "Bungee", "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--texto);
  color: var(--tinta);
  background: var(--fondo);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.cargando { overflow: hidden; }
img, video { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- pantalla de carga ---------- */
.carga {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 4px;
  background: var(--fondo);
  transition: opacity .5s ease, visibility .5s;
}
body:not(.cargando) .carga { opacity: 0; visibility: hidden; }
.carga img { width: 160px; height: 160px; }
.carga p { margin: 0; font-weight: 800; font-size: 1.1rem; color: var(--tinta-suave); }
.puntos i { font-style: normal; animation: punto 1.2s infinite; opacity: 0; }
.puntos i:nth-child(2) { animation-delay: .2s; }
.puntos i:nth-child(3) { animation-delay: .4s; }
@keyframes punto { 30%, 70% { opacity: 1; } }

/* ---------- barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 6px max(16px, calc((100% - 1160px) / 2));
  background: color-mix(in srgb, var(--fondo) 88%, transparent);
  backdrop-filter: blur(10px);
}
.barra-izq { display: flex; align-items: center; gap: 12px; }
.marca { display: flex; align-items: center; text-decoration: none; }

/* botón de idioma: píldora con una perilla que se desliza entre ES y EN */
.idioma {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; border-radius: 999px; background: #fff;
  box-shadow: 0 3px 0 #ead6b0, inset 0 0 0 2px #f1e3c6;
}
.idioma button {
  position: relative; z-index: 1; min-width: 46px; padding: 7px 10px; border: 0; border-radius: 999px;
  background: none; cursor: pointer; font: 800 .9rem var(--texto); letter-spacing: .04em; color: var(--tinta-suave);
  transition: color .25s ease;
}
.idioma button[aria-pressed="true"] { color: #fff; }
.idioma button:hover:not([aria-pressed="true"]) { color: var(--tinta); }
.idioma button:focus-visible { outline: 3px solid var(--resaltador); outline-offset: 2px; }
.idioma-fondo {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: var(--acento); box-shadow: 0 3px 0 var(--azul-osc);
  transition: transform .35s cubic-bezier(.34, 1.4, .64, 1);
}
.idioma[data-activo="en"] .idioma-fondo { transform: translateX(100%); }
.marca img { width: 60px; height: 60px; transition: transform .2s ease; }
.marca:hover img { transform: rotate(-8deg) scale(1.06); }
.menu { display: flex; gap: 4px; }
.menu a { text-decoration: none; font-weight: 700; color: var(--tinta); padding: 8px 14px; border-radius: 999px; }
.menu a:hover { background: var(--fondo-2); color: var(--acento); }

/* ---------- botones tipo plastilina ---------- */
.boton {
  --b: var(--azul); --bo: var(--azul-osc); --t: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 16px; border: 0;
  font: 800 1rem var(--texto); color: var(--t); text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--b) 82%, #fff) 0%, var(--b) 60%);
  box-shadow: 0 5px 0 var(--bo), inset 0 2px 0 rgba(255, 255, 255, .35);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.boton:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 0 var(--bo), inset 0 2px 0 rgba(255,255,255,.35); }
.boton:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--bo), inset 0 2px 0 rgba(255,255,255,.35); }
.boton:focus-visible, .chip:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }
.boton svg { width: 22px; height: 22px; fill: currentColor; }
.boton-youtube { --b: #ff2b2b; --bo: #b31414; }
.boton-instagram { --b: #d6337a; --bo: #8f1f52; background: linear-gradient(135deg, #fdb045 0%, #f2584a 35%, #d6337a 65%, #7b3fd0 100%); }
.boton-tiktok { --b: #1d2a44; --bo: #000; }
.boton-ver { --b: var(--amarillo); --bo: var(--amarillo-osc); --t: var(--tinta); font-size: 1.1rem; padding: 14px 28px; }
.boton-comprar { --b: var(--rojo); --bo: var(--rojo-osc); }
.boton-pronto { --b: #e3dccd; --bo: #c2b8a3; --t: #6b6555; cursor: default; }
.boton-pronto:hover, .boton-pronto:active { transform: none; filter: none; box-shadow: 0 5px 0 var(--bo), inset 0 2px 0 rgba(255,255,255,.35); }

/* ---------- portada: el aula ---------- */
.portada {
  max-width: 1160px; margin: 8px auto 0; padding: 0 16px;
  display: grid; gap: 28px; justify-items: center; text-align: center;
}
.aula {
  /* en pantallas anchas se achica para que el título y el botón se vean sin bajar */
  width: min(100%, calc((100svh - 380px) * 16 / 9));
  min-width: min(100%, 560px);
  aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 28px; background: #f3e2c2 url("img/aula-poster.webp") center / cover;
  box-shadow: 0 8px 0 #ead6b0, var(--sombra);
}
.aula video { width: 100%; height: 100%; object-fit: cover; }
h1 {
  margin: 0 0 10px; font-weight: 800; line-height: 1.08;
  font-size: clamp(2rem, 5.2vw, 3.4rem);
}
h1 span {
  color: var(--acento);
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--resaltador) 70%, transparent) 62%, color-mix(in srgb, var(--resaltador) 70%, transparent) 92%, transparent 92%);
  padding: 0 .08em;
}
.portada-texto p { margin: 0 auto 24px; max-width: 560px; color: var(--tinta-suave); font-size: 1.12rem; }

/* ---------- infolibros ---------- */
.seccion { max-width: 1160px; margin: 0 auto; padding: 72px 16px 24px; }
h2 {
  font-family: var(--marca); font-weight: 400; text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 6px; color: var(--tinta);
}
.subtitulo-seccion { margin: 0 0 26px; text-align: center; color: var(--tinta-suave); font-size: 1.08rem; font-weight: 600; }

/* temas grandes */
.temas { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.tema {
  --c: var(--acento);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 22px 30px; border: 0; border-radius: 26px; cursor: pointer; text-align: center;
  font-family: var(--texto); color: var(--tinta);
  background: #fff;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 28%, #eadfca), var(--sombra);
  transition: transform .2s ease, box-shadow .2s ease, background .25s ease, color .25s ease, opacity .25s ease;
}
.tema:hover { transform: translateY(-4px); box-shadow: 0 11px 0 color-mix(in srgb, var(--c) 35%, #eadfca), var(--sombra); }
.tema:active { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 35%, #eadfca), var(--sombra); }
.tema:focus-visible { outline: 3px solid var(--resaltador); outline-offset: 4px; }
.tema-emoji {
  display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%;
  font-size: 2.6rem; background: color-mix(in srgb, var(--c) 14%, #fff);
  box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--c) 22%, #fff);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), background .25s;
}
.tema-emoji img { width: 92px; height: 92px; filter: drop-shadow(0 4px 3px rgba(36, 48, 77, .18)); }
.tema:hover .tema-emoji { transform: scale(1.08) rotate(-6deg); }
.tema-texto { display: grid; gap: 4px; }
.tema-texto strong { font-size: 1.35rem; font-weight: 800; line-height: 1.15; }
.tema-texto span { color: var(--tinta-suave); font-size: .98rem; transition: color .25s; }
.tema-texto em {
  justify-self: center; margin-top: 6px; font-style: normal; font-weight: 800; font-size: .85rem;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); padding: 4px 12px; border-radius: 999px;
  transition: background .25s, color .25s;
}
.tema-flecha {
  position: absolute; left: 50%; bottom: -13px; width: 26px; height: 26px; translate: -50% 0;
  rotate: 45deg; background: var(--c); border-radius: 4px;
  opacity: 0; scale: .4; transition: opacity .25s, scale .3s cubic-bezier(.34, 1.56, .64, 1);
}
/* tema elegido: se pinta de su color; los demás se apagan un poco */
.tema[aria-expanded="true"] {
  background: var(--c); color: #fff; transform: translateY(-4px);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 65%, #000), var(--sombra);
}
.tema[aria-expanded="true"] .tema-texto span { color: rgba(255, 255, 255, .88); }
.tema[aria-expanded="true"] .tema-texto em { background: rgba(255, 255, 255, .22); color: #fff; }
.tema[aria-expanded="true"] .tema-emoji { background: rgba(255, 255, 255, .9); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .12); }
.tema[aria-expanded="true"] .tema-flecha { opacity: 1; scale: 1; }
.temas.hay-abierto .tema[aria-expanded="false"] { opacity: .62; }
.temas.hay-abierto .tema[aria-expanded="false"]:hover { opacity: 1; }

/* cajón que se despliega con los infolibros del tema */
.cajon {
  --c: var(--acento);
  display: grid; grid-template-rows: 0fr; margin-top: 0;
  transition: grid-template-rows .55s cubic-bezier(.2, .8, .2, 1), margin-top .55s cubic-bezier(.2, .8, .2, 1);
}
.cajon.abierto { grid-template-rows: 1fr; margin-top: 30px; }
.cajon-interior {
  overflow: hidden; min-height: 0; border-radius: 28px;
  background: color-mix(in srgb, var(--c) 9%, var(--fondo));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
.cajon .catalogo { padding: 28px; }

.catalogo {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 300px));
  justify-content: center; gap: 22px;
}
.libro {
  position: relative; display: flex; flex-direction: column;
  background: #fff; border-radius: var(--radio); overflow: hidden;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 30%, #eadfca), var(--sombra);
  transition: transform .18s ease;
}
.libro:hover { transform: translateY(-4px); }
.cajon.abierto .libro { animation: brotar .55s cubic-bezier(.34, 1.4, .64, 1) backwards; animation-delay: calc(.15s + var(--i, 0) * .09s); }
@keyframes brotar {
  from { opacity: 0; transform: translateY(26px) scale(.9); }
  to { opacity: 1; transform: none; }
}
.nuevo {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: var(--amarillo); color: var(--tinta); font-weight: 800; font-size: .75rem;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 3px 0 var(--amarillo-osc);
}
.portada-libro { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; }
.portada-libro.auto {
  position: relative; display: grid; place-items: center; align-content: center; gap: 6px;
  padding: 18px 18px 18px 40px; text-align: center; color: #fff;
  background:
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.35) 0, transparent 35%),
    linear-gradient(150deg, color-mix(in srgb, var(--c) 75%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 75%, #000) 100%);
}
.lomo { position: absolute; left: 0; top: 0; bottom: 0; width: 22px; background: rgba(0,0,0,.18); box-shadow: inset -3px 0 0 rgba(255,255,255,.25); }
.emoji { font-size: 2.6rem; filter: drop-shadow(0 4px 0 rgba(0,0,0,.18)); }
.titulo-portada { font-family: var(--marca); font-size: 1.05rem; line-height: 1.15; text-shadow: 2px 2px 0 rgba(0,0,0,.2); }
.firma { font-family: var(--marca); font-size: .7rem; letter-spacing: .15em; opacity: .85; }
.libro-cuerpo { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 20px; flex: 1; }
.etiqueta img { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; }
.etiqueta { align-self: flex-start; font-size: .8rem; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); padding: 3px 10px; border-radius: 999px; }
.libro h3 { margin: 0; font-size: 1.2rem; line-height: 1.2; }
.libro p { margin: 0; color: var(--tinta-suave); font-size: .96rem; flex: 1; }
.libro-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.precio { font-size: 1.35rem; font-weight: 800; display: flex; flex-direction: column; line-height: 1.1; }
.precio small { font-size: .78rem; font-weight: 600; color: var(--tinta-suave); }

/* ---------- pie con redes ---------- */
.pie {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  margin-top: 72px; padding: 40px 16px 44px; background: var(--fondo-2);
}
.pie-conversa { width: min(100%, 400px); height: auto; margin-bottom: -6px; }
.pie-lema { margin: 0; font-family: var(--marca); font-size: 1.3rem; color: var(--tinta); }
.botones-redes { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 6px 0 10px; }
.pequeno { margin: 0; font-size: .85rem; color: var(--tinta-suave); }

/* ---------- celular ---------- */
@media (max-width: 700px) {
  .marca img { width: 50px; height: 50px; }
  .barra-izq { gap: 8px; }
  .idioma button { min-width: 40px; padding: 6px 8px; font-size: .82rem; }
  .menu a { padding: 8px 10px; }
  .aula { border-radius: 18px; }
  .portada { gap: 20px; }
  .seccion { padding-top: 56px; }
  /* en celular los temas van en filas: emoji a la izquierda, texto a la derecha */
  .temas { grid-template-columns: 1fr; gap: 14px; }
  .tema { flex-direction: row; text-align: left; gap: 16px; padding: 18px 18px; border-radius: 22px; }
  .tema-emoji { width: 70px; height: 70px; font-size: 2rem; flex: none; }
  .tema-emoji img { width: 68px; height: 68px; }
  .tema-texto strong { font-size: 1.18rem; }
  .tema-texto span { font-size: .92rem; }
  .tema-texto em { justify-self: start; margin-top: 4px; }
  .tema-flecha { left: 50px; bottom: -11px; width: 22px; height: 22px; }
  .cajon.abierto { margin-top: 22px; }
  .cajon .catalogo { padding: 16px; grid-template-columns: 1fr; }
  .cajon-interior { border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boton, .libro, .tema, .tema-emoji, .cajon, .idioma-fondo { transition: none; }
  .cajon.abierto .libro { animation: none; }
  .puntos i { animation: none; opacity: 1; }
}
