/* =========================================================
   Escena de «Los tres cerditos»: paisaje y detalles
   (los colores de los dibujos están dentro del propio HTML)
   ========================================================= */

/* Cielo: se tiñe un poquito con la emoción de Nina (--tinte) */
.escena.escena--cerditos {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tinte) 24%, #EAF3FF) 0%,
    #EEF6FD 58%, #F4F8FB 100%);
}

.cer-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Fondo: sol, nubes, colinas y árboles (no se puede tocar) */
.cer-paisaje { position: absolute; inset: 0; pointer-events: none; }
.cer-paisaje svg { position: absolute; display: block; height: auto; overflow: visible; }
.cer-sol { right: 5%; top: 6%; width: min(12%, 17vh, 120px); }
.cer-nube-1 { left: 24%; top: 9%; width: min(15%, 150px); }
.cer-nube-2 { left: 55%; top: 19%; width: min(10%, 100px); opacity: .9; }
.cer-nube-3 { left: 74%; top: 30%; width: min(7%, 70px); opacity: .8; }
.cer-pajaros { left: 40%; top: 12%; width: min(5%, 50px); }
.cer-paisaje .cer-colinas { left: 0; bottom: 12%; width: 100%; height: 36%; }
.cer-arbol-1 { left: 74%; bottom: 33%; width: min(2.4%, 4vh); opacity: .8; }
.cer-arbol-2 { left: 24.2%; bottom: 31%; width: min(3.2%, 5vh); opacity: .9; }
.cer-arbol-3 { left: 79%; bottom: 35%; width: min(2%, 3.4vh); opacity: .75; }
.cer-arbol-4 { left: 93%; bottom: 17%; width: min(8%, 12vh); }
.cer-arbol-5 { left: 48.6%; bottom: 33%; width: min(2.2%, 3.4vh); opacity: .8; }

/* Suelo con caminito, hierbas y flores */
.escena--cerditos .suelo {
  background: linear-gradient(180deg, #B6E6C9 0%, #93D4AE 100%);
  border-top: 0; overflow: hidden;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, .45);
}
.suelo .cer-camino { position: absolute; left: 0; top: 18%; width: 100%; height: 60%; }
.suelo .cer-deco { position: absolute; height: auto; }
.suelo .cer-flor { width: min(1.7%, 2.6vh); }
.suelo .cer-mariposa { width: min(1.8%, 2.8vh); }

/* Movimiento suave (solo si la persona no ha pedido menos movimiento) */
@media (prefers-reduced-motion: no-preference) {
  .cer-nube-1 { animation: cer-flotar 14s ease-in-out infinite alternate; }
  .cer-nube-2 { animation: cer-flotar 11s ease-in-out -4s infinite alternate-reverse; }
  .cer-nube-3 { animation: cer-flotar 9s ease-in-out -2s infinite alternate; }
  .cer-rayos { transform-origin: 50px 50px; animation: cer-latir 3.2s ease-in-out infinite alternate; }
  .suelo .cer-mariposa { animation: cer-revolotear 5s ease-in-out infinite; }
}
@keyframes cer-flotar { to { transform: translateX(26px); } }
@keyframes cer-latir { to { transform: scale(1.08); opacity: 1; } }
@keyframes cer-revolotear {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); }
  50% { transform: translate(14px, -10px) rotate(8deg); }
}

/* Pantallas verticales (móvil) */
@media (max-aspect-ratio: 4/5) {
  .cer-sol { width: 24%; right: 6%; top: 5%; }
  .cer-nube-1 { left: 36%; top: 11%; width: 30%; }
  .cer-nube-2 { left: 8%; top: 28%; width: 22%; }
  .cer-nube-3 { left: 64%; top: 33%; width: 16%; }
  .cer-pajaros { left: 52%; top: 22%; width: 12%; }
  .cer-paisaje .cer-colinas { height: 30%; }
  .cer-arbol-1 { left: 12%; bottom: 31%; width: 4.5%; }
  .cer-arbol-2 { left: 78%; bottom: 31%; width: 11%; }
  .cer-arbol-3 { left: 20%; bottom: 33%; width: 5%; }
  .cer-arbol-4 { left: 88%; bottom: 29%; width: 10%; }
  .cer-arbol-5 { left: 50%; bottom: 35%; width: 4%; }
  .suelo .cer-flor { width: 3.4%; }
  .suelo .cer-mariposa { width: 4%; }
}

/* =========================================================
   Fondo ilustrado de los usuarios (img/fondos/cerditos.webp, 21-10-2026).
   Sustituye al paisaje dibujado: el cielo, el sol, las nubes, las colinas,
   los árboles y el camino ya vienen en la imagen. Las casas, los cerditos,
   el lobo y Nina siguen siendo dibujos encima.
   ========================================================= */
.escena.escena--cerditos { background: #F3E7C9 url("../img/fondos/cerditos.webp") center bottom / cover no-repeat; }
.cer-paisaje > svg { display: none; }
.escena--cerditos .suelo { background: none; box-shadow: none; }
.escena--cerditos .suelo .cer-camino, .escena--cerditos .suelo .cer-deco:not(.cer-mariposa) { display: none; }
/* Brillo del sol de la imagen, que late despacio */
.cer-paisaje::before {
  content: ""; position: absolute; left: 65.5%; top: 23%; width: 22%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 243, 205, .75), rgba(255, 243, 205, 0) 65%);
  opacity: .5;
}
@media (prefers-reduced-motion: no-preference) {
  .cer-paisaje::before { animation: cer-sol-late 6s ease-in-out infinite alternate; }
}
@keyframes cer-sol-late { from { opacity: .3; transform: translate(-50%, -50%) scale(.94); } to { opacity: .7; transform: translate(-50%, -50%) scale(1.06); } }
@media (max-aspect-ratio: 4/5) {
  .cer-paisaje::before { display: none; } /* en vertical el sol queda en el borde */
}

