:root {
  --letra-titulo: "Fredoka", system-ui, sans-serif;
  --letra-firma: "Fredoka", system-ui, sans-serif;
  --suave: #55654F;
  --linea: #DCE6D2;
  --sombra: rgba(34, 48, 31, .14);
  --arena: #F3E3C3;
}

body { font-family: "Nunito", system-ui, sans-serif; font-size: 1.08rem; }
body.cerrado { overflow: hidden; height: 100vh; height: 100svh; }
h2 { font-weight: 500; letter-spacing: .06em; }
.lead { font-style: normal; }
.firma { font-weight: var(--nombres-peso, 600); }
.pase .num { font-weight: 600; }

#escena { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: #FFFFFF; }
#escena > * { position: absolute; }
.capa { inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
#d-fondo { z-index: 0; object-position: 50% 40%; transform-origin: 50% 45%; }
#d-medio { z-index: 2; object-position: 50% 100%; transform-origin: 50% 100%; }

/* Humo del volcán: tres bocanadas que suben despacio. */
#humo { z-index: 1; left: 47%; top: 31%; width: 18%; height: 14%; pointer-events: none; }
#humo i { position: absolute; left: 30%; bottom: 0; width: 40%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0)); animation: humo 7s linear infinite; opacity: 0; }
#humo i:nth-child(2) { animation-delay: -2.3s; }
#humo i:nth-child(3) { animation-delay: -4.6s; }
@keyframes humo { 0% { transform: translate(0, 0) scale(.5); opacity: 0; } 20% { opacity: .9; } 100% { transform: translate(60%, -170%) scale(1.8); opacity: 0; } }

#ptero { z-index: 1; left: 4%; top: 7%; width: 17%; height: auto; will-change: transform; }

/* Huellas que se meten a la selva por el claro de en medio. */
#huellas { z-index: 1; inset: 0; pointer-events: none; }
#huellas svg { position: absolute; width: 9%; height: auto; fill: #8A6A44; opacity: 0; mix-blend-mode: multiply; }

/* ---------- Letrero de piedra con la foto ---------- */
#escena { --alto-letrero: min(38svh, calc(var(--ancho) * .66 / .806)); }
#letrero { z-index: 5; top: calc(7svh + 1.5rem); height: var(--alto-letrero); width: calc(var(--alto-letrero) * .806); left: calc(50% - var(--alto-letrero) * .403); transform-origin: 50% 0; will-change: transform; }
#letrero .piedra { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(34, 48, 31, .22)); }
#letrero .hueco { position: absolute; left: 24.4%; right: 24.4%; top: 16.6%; bottom: 17.4%; overflow: hidden; border-radius: 50% 50% 0 0 / 22% 22% 0 0; background: radial-gradient(ellipse at 50% 35%, #FFFFFF, #E4F0DA 70%, #CFE3C2); }
#letrero .retrato { position: absolute; inset: 0; }
#letrero .retrato img { width: 100%; height: 100%; object-fit: cover; }
#letrero .monograma { display: none; position: absolute; inset: 0; place-items: center; font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; color: var(--acento); font-size: min(4.2rem, calc(var(--ancho) * .17)); line-height: 1; text-shadow: 0 2px 0 #FFFFFF; }
#letrero .monograma::after { content: ""; position: absolute; left: 50%; bottom: 12%; width: 26%; aspect-ratio: 40 / 48; transform: translateX(-50%) rotate(-8deg); background: currentColor; opacity: .35; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 48'%3E%3Cpath d='M20 2C23 10 24 16 22 22H18C16 16 17 10 20 2ZM6 8C11 13 14 18 15 24L12 26C8 21 6 15 6 8ZM34 8C29 13 26 18 25 24L28 26C32 21 34 15 34 8ZM10 33A10 12 0 1 0 30 33A10 12 0 1 0 10 33Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 48'%3E%3Cpath d='M20 2C23 10 24 16 22 22H18C16 16 17 10 20 2ZM6 8C11 13 14 18 15 24L12 26C8 21 6 15 6 8ZM34 8C29 13 26 18 25 24L28 26C32 21 34 15 34 8ZM10 33A10 12 0 1 0 30 33A10 12 0 1 0 10 33Z'/%3E%3C/svg%3E") center / contain no-repeat; }
#letrero:has([data-seccion="retrato"][hidden]) .monograma { display: grid; }
/* El cuello asoma por detrás de la esquina del letrero. */
#cuello { position: absolute; z-index: -1; left: 55%; top: -12%; height: 110%; width: auto; max-width: none; -webkit-mask-image: linear-gradient(#000 70%, transparent 92%); mask-image: linear-gradient(#000 70%, transparent 92%); will-change: transform; }

/* ---------- Nido con el huevo ---------- */
#nido { --w: min(90%, 46svh); z-index: 8; bottom: calc(.5rem + env(safe-area-inset-bottom)); width: var(--w); left: calc(50% - var(--w) / 2); aspect-ratio: 1 / .886; transform-origin: 50% 100%; will-change: transform; }
#nido > img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
#nido .nido-frente { z-index: 2; clip-path: polygon(0 45%, 18% 44%, 30% 56%, 50% 62%, 70% 56%, 82% 44%, 100% 45%, 100% 100%, 0 100%); }
#huevo { position: absolute; z-index: 1; left: 25%; width: 50%; bottom: 22.6%; aspect-ratio: 400 / 549; transform-origin: 50% 92%; }
#huevo .pieza { position: absolute; inset: 0; background: url("/disenos/dinosaurs/huevo.webp") center / 100% 100% no-repeat; will-change: transform; }
#p-arriba { clip-path: polygon(0 0, 100% 0, 100% 46%, 89% 52%, 78% 45%, 67% 53%, 56% 44%, 45% 54%, 33% 45%, 22% 53%, 12% 44%, 0 50%); transform-origin: 60% 40%; }
#p-izq { clip-path: polygon(0 50%, 12% 44%, 22% 53%, 33% 45%, 45% 54%, 50% 49%, 46% 66%, 53% 80%, 48% 100%, 0 100%); transform-origin: 30% 95%; }
#p-der { clip-path: polygon(50% 49%, 56% 44%, 67% 53%, 78% 45%, 89% 52%, 100% 46%, 100% 100%, 48% 100%, 53% 80%, 46% 66%); transform-origin: 70% 95%; }
#huevo .grieta { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
#huevo .grieta path { fill: none; stroke: #2F4A35; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#huevo .grieta { opacity: 0; }
#huevo .bebe { position: absolute; left: 13%; width: 74%; height: auto; bottom: 6%; opacity: 0; will-change: transform; }
#trozos { position: absolute; inset: 0; pointer-events: none; }
#trozos i { position: absolute; left: 50%; top: 48%; width: 9%; aspect-ratio: 1; background: #BFE0CC; clip-path: polygon(0 20%, 60% 0, 100% 55%, 40% 100%); opacity: 0; }

/* ---------- Helechos: cierran la portada y luego enmarcan ---------- */
.helecho { z-index: 7; top: -2%; bottom: -2%; pointer-events: none; will-change: transform; }
.helecho img { height: 100%; width: auto; max-width: none; }
/* Cerrados tapan la portada; abiertos dejan solo la orilla. */
#hel-izq { left: 0; transform: translateX(-20%); }
#hel-der { right: 0; transform: translateX(20%); }
.abierta #hel-izq { transform: translateX(-62%); }
.abierta #hel-der { transform: translateX(62%); }
/* Sin movimiento: todo quieto en una pantalla, el nombre debajo del letrero. */
.quieta #t1, .quieta #t3 { display: none; }
.quieta #t2 { top: calc(7svh + 2.2rem + var(--alto-letrero)); opacity: 1; }
.quieta #nido { transform: scale(.7); }
.quieta #huevo .bebe { opacity: 1; transform: translateY(-30%); }
.quieta #p-arriba { display: none; }
#hel-der img { transform: scaleX(-1); }

/* ---------- Textos ---------- */
.texto-escena { z-index: 9; left: 0; right: 0; text-align: center; padding: 0 1.2rem; pointer-events: none; }
.velo { display: inline-block; padding: 1rem 1.6rem; background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 255, 255, .8) 62%, rgba(255, 255, 255, 0)); }
#t1 { top: calc(7svh + 2.2rem + var(--alto-letrero)); opacity: 0; }
#t1 .ornato { display: block; font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: 1.45rem; line-height: 1.2; color: var(--tinta); }
#t1 p { font-size: 1.15rem; color: var(--suave); }
#t2 { top: 42%; opacity: 0; }
#t2 .nombre { display: block; font-family: var(--nombres-letra, "Fredoka", system-ui, sans-serif); font-weight: var(--nombres-peso, 600); font-style: var(--nombres-estilo, normal); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); font-size: min(4.2rem, calc(var(--ancho) * 1.6 / (var(--letras) * var(--nombres-ancho, 1)))); line-height: 1; color: var(--tinta); overflow-wrap: anywhere; }
#t2 .nombre .linea { display: block; }
#t2 .nombre .palabra { display: inline-block; white-space: nowrap; }
#t2 .nombre .l { display: inline-block; }
#t2 .nombre .y { font-size: .6em; color: var(--acento); }
#t2 .sub { display: block; margin-top: .5rem; font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: 1.1rem; letter-spacing: .08em; color: var(--acento); }
#t3 { top: 64%; opacity: 0; }
#edad { display: grid; place-items: center; width: 5.2rem; aspect-ratio: 1; margin: 0 auto .5rem; border-radius: 46% 54% 50% 50% / 55% 48% 52% 45%; background: var(--acento); color: #FFFFFF; font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 2.9rem; line-height: 1; box-shadow: 0 5px 0 color-mix(in oklab, var(--acento) 65%, #000); }
#t3 .fecha { display: block; font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: 1.3rem; color: var(--tinta); }
#t3 p { font-size: 1.15rem; color: var(--suave); }
#desliza { z-index: 9; bottom: calc(1.2rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); font-size: 1rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: .2rem; opacity: 0; text-shadow: 0 0 8px #fff, 0 0 14px #fff; }
#desliza i { width: 2px; height: 26px; border-radius: 2px; background: linear-gradient(var(--tinta), transparent); animation: gota 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes gota { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Portada ---------- */
#tapiz { z-index: 6; inset: 0; background: radial-gradient(ellipse 70% 40% at 50% 32%, #FFFFFF 40%, rgba(255, 255, 255, 0)), radial-gradient(ellipse 90% 60% at 50% 100%, #E3F0D6, rgba(227, 240, 214, 0)), #FFFFFF; }
#portada { z-index: 10; inset: 0; pointer-events: none; }
#portada .tarjeta { pointer-events: auto; position: absolute; left: 50%; top: calc(5svh + 1.5rem); transform: translateX(-50%); width: min(80%, 19rem); text-align: center; background: rgba(255, 255, 255, .96); border-radius: 22px; padding: 1.5rem 1.3rem 1.3rem; box-shadow: 0 14px 36px rgba(34, 48, 31, .2); animation: aparece .8s ease-out backwards; }
#portada .tarjeta::before { content: ""; position: absolute; inset: 6px; border: 1.5px dashed color-mix(in oklab, var(--acento) 45%, #FFFFFF); border-radius: 17px; pointer-events: none; }
@keyframes aparece { from { opacity: 0; } }
#portada .para { font-family: "Fredoka", system-ui, sans-serif; font-weight: 500; font-size: .95rem; color: var(--acento); overflow-wrap: anywhere; }
#portada .nombre { font-family: var(--nombres-letra, "Fredoka", system-ui, sans-serif); font-weight: var(--nombres-peso, 600); font-style: var(--nombres-estilo, normal); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); font-size: min(2.8rem, calc(var(--ancho) * .95 / (var(--letras) * var(--nombres-ancho, 1)))); line-height: 1.1; margin: .3rem 0 .2rem; overflow-wrap: anywhere; }
#portada .nombre b { font-weight: 500; color: var(--acento); font-size: .7em; }
#portada .sub { color: var(--suave); }
#abrir { position: relative; margin-top: 1.1rem; width: 100%; min-height: 48px; padding: .8rem 1rem; border: 0; border-radius: 999px; background: var(--acento); color: #FFFFFF; font-family: "Fredoka", system-ui, sans-serif; font-size: 1.05rem; font-weight: 500; letter-spacing: .04em; cursor: pointer; box-shadow: 0 5px 0 color-mix(in oklab, var(--acento) 60%, #000); transition: transform .12s, box-shadow .12s; }
#abrir:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in oklab, var(--acento) 60%, #000); }
#abrir:focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; }

#musica { position: fixed; z-index: 20; right: max(1rem, calc(50vw - var(--col) / 2 + 1rem)); top: calc(1rem + env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(34, 48, 31, .2); background: rgba(255, 255, 255, .92); display: none; place-items: center; cursor: pointer; }
#musica.ver { display: grid; }
#musica svg { width: 20px; height: 20px; }
#musica .barras { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
#musica .barras i { width: 3px; background: var(--tinta); height: 30%; animation: barra 1s ease-in-out infinite; }
#musica .barras i:nth-child(2) { animation-delay: -.3s; }
#musica .barras i:nth-child(3) { animation-delay: -.6s; }
@keyframes barra { 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { #humo i, #desliza i, #musica .barras i { animation: none; } #portada .tarjeta { animation: none; } }
