: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;
  --tinta: #1d2a44;
  --tinta-suave: #5a6680;
  --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);
}
.marca { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.marca img { width: 56px; height: 56px; }
.marca span {
  font-family: var(--marca); font-size: 1.6rem; letter-spacing: .02em;
  color: var(--rojo); text-shadow: 3px 3px 0 var(--azul);
}
.menu { display: flex; gap: 4px; }
.menu a { text-decoration: none; font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.menu a:hover { background: var(--fondo-2); }

/* ---------- 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(--azul); }
.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 18px; color: var(--azul);
}
.filtros { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 26px; }
.chip {
  --c: var(--tinta);
  font: 700 .95rem var(--texto); color: var(--tinta); cursor: pointer;
  padding: 9px 16px; border-radius: 999px; border: 0;
  background: #fff; box-shadow: 0 3px 0 rgba(29, 42, 68, .1);
  transition: transform .12s;
}
.chip small { opacity: .55; font-weight: 800; margin-left: 2px; }
.chip:hover { transform: translateY(-1px); }
.chip[aria-selected="true"] { background: var(--c); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 70%, #000); }

.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 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); }
.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 { 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 img { width: 96px; height: 96px; }
.pie-lema { margin: 0; font-family: var(--marca); font-size: 1.3rem; color: var(--azul); }
.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: 46px; height: 46px; }
  .marca span { font-size: 1.3rem; text-shadow: 2px 2px 0 var(--azul); }
  .menu a { padding: 8px 10px; }
  .aula { border-radius: 18px; }
  .portada { gap: 20px; }
  .seccion { padding-top: 56px; }
  .filtros { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .chip { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boton, .libro, .chip { transition: none; }
  .puntos i { animation: none; opacity: 1; }
}
