/* La Granja de Totó y Lucho · estilos */
:root {
  --cielo: #8fd3f4;
  --cielo-claro: #d9f1fb;
  --hierba: #7cc35c;
  --hierba-osc: #4f9a3a;
  --crema: #fff6e5;
  --papel: #fffdf8;
  --rojo: #d9452b;
  --rojo-osc: #b2321c;
  --tierra: #6b4423;
  --tinta: #3b2a1e;
  --suave: #7a6656;
  --sombra: 0 10px 30px rgba(80, 50, 20, .15);
  --redondo: 22px;
  --letra-titulo: ui-rounded, "Arial Rounded MT Bold", "Segoe UI Black", "Segoe UI", system-ui, sans-serif;
  --letra: ui-rounded, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; overflow-x: clip; }
main, .seccion { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--letra);
  font-size: 18px;
  line-height: 1.6;
  color: var(--tinta);
  background: var(--crema);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--letra-titulo); line-height: 1.1; margin: 0 0 .5em; }
h2 { font-size: clamp(2rem, 5vw, 3rem); }
h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 2.2em; }
p { margin: 0 0 1em; }
a { color: var(--rojo-osc); }

.saltar { position: absolute; left: -999px; }
.saltar:focus { left: 16px; top: 16px; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 10px; }

.contenedor { width: min(1120px, 100% - 32px); margin-inline: auto; position: relative; z-index: 2; }
.centrado { text-align: center; }
.antetitulo { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--rojo); margin-bottom: .6em; }
.entradilla { font-size: 1.2rem; max-width: 34em; }
.centrado .entradilla, .entradilla.centrado { margin-inline: auto; }
.pequeno { font-size: .9rem; color: var(--suave); }
.nota { color: var(--suave); max-width: 36em; margin-inline: auto; }

/* Botones */
.botones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4em; }
.centrado .botones { justify-content: center; }
.boton {
  display: inline-block; padding: 14px 26px; border-radius: 999px;
  background: var(--rojo); color: #fff; font-weight: 800; text-decoration: none;
  box-shadow: 0 5px 0 var(--rojo-osc); transition: transform .15s, box-shadow .15s;
}
.boton:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--rojo-osc); }
.boton:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--rojo-osc); }
.boton-claro { background: #fff; color: var(--tinta); box-shadow: 0 5px 0 #d8c7ae; }
.boton-claro:hover { box-shadow: 0 7px 0 #d8c7ae; }
.boton-apagado { background: #e9dfcf; color: var(--suave); box-shadow: none; cursor: default; }
.boton-apagado:hover { transform: none; box-shadow: none; }
.boton-peq { padding: 8px 16px; font-size: .9rem; box-shadow: 0 3px 0 var(--rojo-osc); }

/* Cabecera */
.cabecera {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; background: rgba(255, 253, 248, .88);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(107, 68, 35, .08);
}
.marca { display: flex; align-items: center; gap: 8px; font-family: var(--letra-titulo); font-weight: 900; font-size: 1.3rem; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.marca img { height: 44px; width: auto; }
.cabecera nav { display: flex; align-items: center; gap: 20px; }
.cabecera nav a:not(.boton) { color: var(--tinta); text-decoration: none; font-weight: 700; font-size: .95rem; }
.cabecera nav a:not(.boton):hover { color: var(--rojo); }
@media (max-width: 760px) {
  .cabecera { padding: 8px 16px; }
  .cabecera nav a:not(.boton) { display: none; }
  .pagina-colores .cabecera nav a:not(.boton) { display: inline; font-size: .85rem; }
}

/* Pájaros */
.cielo { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.pajaro { position: absolute; left: 0; top: 0; width: 90px; will-change: transform; opacity: 0; transition: opacity .4s; }
.pajaro.peq { width: 54px; }
.pajaro.listo { opacity: 1; }
@media (max-width: 760px) { .pajaro { width: 56px; } .pajaro:nth-child(n+4) { display: none; } }

/* Portada de la web */
.portada-web {
  position: relative; min-height: 92vh; overflow: hidden;
  background: linear-gradient(180deg, var(--cielo) 0%, var(--cielo-claro) 70%, #f3fbe9 100%);
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  padding: 40px max(16px, calc((100% - 1120px) / 2)) 0;
}
.portada-texto { position: relative; z-index: 3; padding-bottom: 120px; }
.portada-web h1 { font-size: clamp(2.6rem, 7vw, 5rem); color: var(--tinta); }
.portada-web h1 span { color: var(--rojo); }
.colina { position: relative; align-self: end; height: 100%; min-height: 460px; z-index: 2; }
.colina::before {
  content: ""; position: absolute; left: -40%; right: -60%; bottom: -120px; height: 300px;
  background: radial-gradient(ellipse at 50% 0, var(--hierba) 60%, var(--hierba-osc) 100%);
  border-radius: 50% 50% 0 0;
}
.heroe { position: absolute; bottom: 70px; filter: drop-shadow(0 8px 6px rgba(40, 60, 20, .25)); }
.heroe.toto { left: 6%; height: 420px; width: auto; animation: respira 4s ease-in-out infinite; }
.heroe.lucho { left: 38%; height: 270px; width: auto; animation: menea 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
.heroe.perico { left: 72%; height: 240px; width: auto; animation: respira 5s ease-in-out infinite .5s; }
@keyframes respira { 50% { transform: translateY(-6px); } }
@keyframes menea { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.portada-web::after { /* hierba delante */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: 3;
  background: linear-gradient(180deg, transparent, var(--crema) 85%);
}

.nube { position: absolute; background: #fff; border-radius: 999px; opacity: .9; z-index: 1; will-change: transform; }
.nube::before, .nube::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.n1 { width: 200px; height: 60px; top: 14%; left: 8%; }
.n1::before { width: 90px; height: 90px; top: -45px; left: 30px; }
.n1::after { width: 70px; height: 70px; top: -30px; left: 100px; }
.n2 { width: 260px; height: 70px; top: 26%; right: 6%; }
.n2::before { width: 110px; height: 110px; top: -55px; left: 50px; }
.n2::after { width: 80px; height: 80px; top: -35px; left: 140px; }
.n3 { width: 140px; height: 44px; top: 52%; left: 46%; opacity: .7; }
.n3::before { width: 60px; height: 60px; top: -30px; left: 25px; }
.n3::after { width: 50px; height: 50px; top: -22px; left: 70px; }
.sol { position: absolute; width: 130px; height: 130px; top: 7%; right: 22%; border-radius: 50%; background: radial-gradient(#ffe680, #ffc93c); box-shadow: 0 0 60px 20px rgba(255, 214, 90, .5); z-index: 0; }

@media (max-width: 860px) {
  .portada-web { grid-template-columns: 1fr; padding-top: 30px; min-height: auto; }
  .portada-texto { padding-bottom: 0; text-align: center; }
  .portada-texto .entradilla { margin-inline: auto; }
  .portada-texto .botones { justify-content: center; }
  .colina { min-height: 330px; }
  .heroe.toto { height: 290px; left: 8%; }
  .heroe.lucho { height: 185px; left: 40%; }
  .heroe.perico { height: 165px; left: 72%; }
  .heroe { bottom: 40px; }
  .sol { width: 80px; height: 80px; right: 8%; }
  .n2 { display: none; }
}

/* Secciones */
.seccion { position: relative; padding: 90px 0; }
.dos-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center; }
@media (max-width: 860px) { .dos-col { grid-template-columns: 1fr; gap: 30px; } .seccion { padding: 60px 0; } }

.historia { background: var(--crema); }
.lucho-corre-caja { position: relative; }
.lucho-corre-caja > img:first-child { width: 100%; max-width: 440px; margin-inline: auto; }
.gorra-robada { position: absolute; right: 0; top: -40px; width: 30%; max-width: 140px; transform: rotate(6deg); }

/* Fotos de Lucho */
.fotos { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px; margin-top: 30px; }
.polaroid {
  background: #fff; padding: 12px 12px 14px; width: 250px; box-shadow: var(--sombra);
  border-radius: 6px; transform: rotate(var(--giro, -2deg)); transition: transform .3s; margin: 0;
}
.polaroid:hover { transform: rotate(0) scale(1.03); }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; background: #f0e7d8; }
.polaroid figcaption { text-align: center; font-weight: 700; font-size: .95rem; margin-top: 8px; }
.polaroid.vacia img { object-fit: contain; padding: 30px; opacity: .55; }

/* Personajes */
.personajes { background: linear-gradient(180deg, var(--crema), #eaf6dd); }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; margin-top: 40px; }
.ficha {
  background: var(--papel); border-radius: var(--redondo); padding: 20px 18px 18px; text-align: center;
  box-shadow: var(--sombra); transition: transform .25s;
}
.ficha:hover { transform: translateY(-6px) rotate(-1deg); }
.ficha img { height: 150px; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto 12px; transition: transform .3s; }
.ficha:hover img { transform: scale(1.08) rotate(3deg); }
.ficha h4 { font-family: var(--letra-titulo); font-size: 1.3rem; margin: 0; }
.ficha .que { color: var(--rojo); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 2px 0 8px; }
.ficha p { font-size: .95rem; margin: 0; color: var(--suave); line-height: 1.45; }
.muestras-color { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.muestras-color span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }

/* Libro */
.libro { background: linear-gradient(180deg, #eaf6dd 0%, #dff0fb 12%, #cfe6f7 100%); overflow: hidden; }
.libro-tapa img { border-radius: var(--redondo); box-shadow: 0 25px 50px rgba(30, 50, 80, .3); transform: rotate(-2deg); }
.cifras { list-style: none; padding: 0; margin: 1.2em 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cifras li { background: #fff; border-radius: 16px; padding: 10px 6px; text-align: center; font-size: .85rem; font-weight: 700; line-height: 1.2; box-shadow: var(--sombra); }
.cifras b { display: block; font-family: var(--letra-titulo); font-size: 2rem; color: var(--rojo); }
@media (max-width: 520px) { .cifras { grid-template-columns: repeat(2, 1fr); } }
.cuentos { counter-reset: c; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 24px; }
.cuentos li { counter-increment: c; background: #fff; border-radius: 16px; padding: 14px 16px 14px 60px; position: relative; font-weight: 700; box-shadow: var(--sombra); }
.cuentos li::before { content: counter(c); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: var(--rojo); color: #fff; display: grid; place-items: center; font-family: var(--letra-titulo); }
.muestras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 24px; }
.muestras img { background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--sombra); aspect-ratio: 3 / 4; object-fit: contain; width: 100%; }
.muestras img:nth-child(odd) { transform: rotate(-1.5deg); }
.muestras img:nth-child(even) { transform: rotate(1.5deg); }
@media (max-width: 760px) { .muestras { grid-template-columns: repeat(2, 1fr); } }
.coleccion { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.tomo { background: rgba(255, 255, 255, .7); border-radius: 18px; padding: 18px; text-align: center; border: 3px dashed #b9cfe0; }
.tomo.activo { background: #fff; border: 3px solid var(--rojo); }
.tomo .num { display: block; font-family: var(--letra-titulo); font-size: 2.2rem; color: var(--rojo); }
.tomo b { display: block; }
.tomo small { color: var(--suave); }
@media (max-width: 620px) { .coleccion { grid-template-columns: 1fr; } }

/* Copos de nieve */
.copos { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.copo { position: absolute; top: -20px; color: #fff; font-size: 18px; text-shadow: 0 0 4px rgba(120, 160, 200, .6); animation: cae linear infinite; animation-play-state: paused; }
.libro.visible .copo { animation-play-state: running; }
@keyframes cae { to { transform: translateY(var(--alto, 1600px)) translateX(var(--viento, 40px)) rotate(360deg); } }

/* Colorear */
.colorear { background: var(--crema); }
.descargas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 36px; }
.descarga { background: #fff; border-radius: var(--redondo); padding: 16px; text-decoration: none; color: var(--tinta); box-shadow: var(--sombra); text-align: center; font-weight: 800; transition: transform .2s; }
.descarga:hover { transform: translateY(-5px); }
.descarga img { aspect-ratio: 4 / 3; object-fit: contain; width: 100%; margin-bottom: 10px; }
.descarga span::after { content: " ⬇"; color: var(--rojo); }
@media (max-width: 760px) { .descargas { grid-template-columns: 1fr; } }
.guia-aviso { display: flex; gap: 24px; align-items: center; background: #fff; border-radius: var(--redondo); padding: 26px; margin-top: 50px; box-shadow: var(--sombra); }
.guia-aviso h3 { margin-top: 0; }
.guia-aviso img { width: 120px; flex: none; }
@media (max-width: 620px) { .guia-aviso { flex-direction: column; text-align: center; } }

/* Pie */
.pie { position: relative; background: var(--hierba-osc); color: #fff; text-align: center; padding: 70px 16px 110px; margin-top: 60px; }
.pie .pequeno { color: #e3f3d8; }
.hierba { position: absolute; left: 0; right: 0; top: -40px; height: 42px;
  background: radial-gradient(circle at 20px 42px, var(--hierba-osc) 22px, transparent 23px) 0 0 / 40px 42px repeat-x; }

/* Lucho corriendo abajo */
.carrera { position: fixed; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: none; z-index: 45; }
.carrera img { position: absolute; bottom: 4px; left: 0; height: 56px; width: auto; will-change: transform; }
.carrera img.saltando { animation: brinco .35s ease-in-out infinite; }
@keyframes brinco { 50% { bottom: 12px; } }

/* Aparecer al hacer scroll */
.aparece { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.aparece.desde-derecha { transform: translateX(40px); }
.aparece.visto { opacity: 1; transform: none; }
.muestras img.aparece.visto:nth-child(odd) { transform: rotate(-1.5deg); }
.muestras img.aparece.visto:nth-child(even) { transform: rotate(1.5deg); }

/* Página de la guía de colores */
.colores-cab { background: linear-gradient(180deg, var(--cielo-claro), var(--crema)); padding-bottom: 30px; }
.colores-cab h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.rejilla-colores { margin-top: 0; }
.rejilla-colores .ficha img { height: 190px; }
.feria-img { border-radius: var(--redondo); box-shadow: var(--sombra); margin: 30px auto 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .aparece { opacity: 1; transform: none; }
  .cielo, .carrera, .copos { display: none; }
}
