/* =========================================================
   Invitación Manuel — 1 añito · Plim Plim
   Mobile first. Sección 1 (portada).
   ========================================================= */

/* ---------- Tipografías (subir los .woff2 a /fonts, ver LEEME.txt) ---------- */
@font-face { font-family: 'Fredoka'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/fredoka-600.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/fredoka-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/nunito-400.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/nunito-600.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/nunito-700.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-style: normal; font-display: swap; src: url('../fonts/nunito-800.woff2') format('woff2'); }

/* ---------- Variables ---------- */
:root {
  --azul: #2b6fd6;
  --azul-oscuro: #1d4f9f;
  --azul-boton: #1f6bd0;
  --rojo: #e0302f;
  --rojo-oscuro: #b01f22;
  --amarillo: #ffc82c;
  --amarillo-oscuro: #e39a08;
  --verde: #62bd45;

  --fuente-titulo: 'Fredoka', 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --fuente-texto: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-snap-type: y proximity;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #cfe8fb;
  color: var(--azul-oscuro);
  font-family: var(--fuente-texto);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: none; }

.tarjeta {
  max-width: 440px;
  margin: 0 auto;
  background: #fff;
  overflow-x: clip;
}

@media (min-width: 480px) {
  .tarjeta { box-shadow: 0 0 40px rgba(29, 79, 159, .22); }
}

/* ---------- Pantalla (cada sección) ---------- */
.pantalla {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  overflow: hidden;
  scroll-snap-align: start;
}

.pantalla > *:not(.cielo) { position: relative; z-index: 1; }

.portada {
  background: linear-gradient(180deg, #8fd0f6 0%, #b6dffa 26%, #e2f2fd 58%, #f4faff 100%);
}

/* ---------- Fondo ---------- */
.cielo {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.nube { position: absolute; opacity: .95; animation: deriva 12s ease-in-out infinite alternate; }
.nube--a { top: 4%;  left: -9%;  width: 44%; }
.nube--b { top: 9%;  right: -8%; width: 48%; animation-duration: 15s; animation-delay: -4s; }
.nube--c { top: 56%; left: -12%; width: 30%; opacity: .8; animation-duration: 18s; animation-delay: -8s; }

.confeti { position: absolute; inset: 0; overflow: hidden; --caida: 900px; }
.confeti i {
  position: absolute;
  top: -20px;
  opacity: .9;
  animation: cae linear infinite;
}

/* Pasto */
.pasto { position: absolute; left: 0; right: 0; bottom: 0; height: 170px; overflow: hidden; }
.colina { position: absolute; bottom: -78px; height: 170px; border-radius: 50%; }
.colina--izq { left: -34%; width: 100%; background: radial-gradient(ellipse at 50% 20%, #a7e07a, #67bf49 70%); }
.colina--der { right: -38%; width: 105%; background: radial-gradient(ellipse at 50% 20%, #8fd466, #58b53f 70%); bottom: -92px; }
.arbusto { position: absolute; bottom: 22px; transform-origin: 50% 100%; animation: mece 5s ease-in-out infinite alternate; }
.arbusto--izq { left: -7%; width: 40%; height: 60%;}
.arbusto--der { right: -9%; width: 50%; height: 70%; animation-delay: -2.5s; bottom: 34px; }

/* ---------- Marca ---------- */
.marca {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--fuente-texto);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--azul);
}
.marca__logo { width: 30px; height: 30px; filter: drop-shadow(0 2px 3px rgba(29, 79, 159, .25)); }

/* ---------- Escena ---------- */
.escena {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  height: clamp(230px, 37svh, 300px);
  margin-top: 8px;
}

/* Payaso: cada pieza se ubica en % del lienzo de 300 x 420 */
.payaso {
  position: relative;
  height: 100%;
  aspect-ratio: 300 / 420;
  animation: entra .9s cubic-bezier(.2, 1.5, .4, 1) both, flota 3s ease-in-out .9s infinite;
}
.payaso img { position: absolute; height: auto; user-select: none; -webkit-user-drag: none; }

.p-pierna-izq { left: 28%; top: 76.67%; width: 20.67%; }
.p-pierna-der { left: 54%; top: 76.67%; width: 20.67%; }
.p-cuerpo     { left: 20%;    top: 57.14%; width: 63.33%; }
.p-cabeza     { left: 10%;    top: 1%;      width: 80.67%; transform-origin: 50% 92%; animation: cabeceo 3.4s ease-in-out infinite; }
.p-brazo-der  { left: 62%; top: 58%; width: 24%; transform-origin: 9% 94%;  transform: rotate(18deg);  animation: saludo-der 1.3s ease-in-out infinite alternate; z-index: 30;}
.p-brazo-izq  { left: 18.5%;    top: 58%; width: 24%; transform-origin: 91% 94%; transform: rotate(-18deg); animation: saludo-izq 1.3s ease-in-out -.65s infinite alternate; z-index: 30;}

/* Globos */
.globo { position: absolute; height: auto; filter: drop-shadow(0 4px 5px rgba(29, 79, 159, .18)); transform-origin: 50% 55%; animation: globo 5s ease-in-out infinite alternate; }
.globo--amarillo { color: #ffc82c; left: -3%;  top: -2%; width: 19%; }
.globo--rojo     { color: #e0302f; right: -3%; top: 0;   width: 22%; animation-duration: 6s;   animation-delay: -2s; }
.globo--azul     { color: #2f86e8; right: -5%; top: 44%; width: 18%; animation-duration: 4.4s; animation-delay: -1s; }

/* Gatita */
.gatita {
  position: absolute;
  left: 0;
  bottom: 3%;
  width: 25%;
  max-width: 104px;
  height: auto;
  transform-origin: 50% 100%;
  animation: gatita 2.6s ease-in-out infinite;
}

/* Corazones */
.corazon { position: absolute; color: var(--rojo); height: auto; animation: sube 4.2s ease-in-out infinite; }
.corazon--1 { left: 22%;  top: 24%; width: 5%;   }
.corazon--2 { right: 24%; top: 6%;  width: 4.5%; animation-delay: -1.4s; }
.corazon--3 { left: 31%;  top: 4%;  width: 3.6%; animation-delay: -2.4s; }
.corazon--4 { right: 20%; top: 58%; width: 5.5%; animation-delay: -.8s; }

/* ---------- Título ---------- */
.bloque-titulo {
  position: relative;
  isolation: isolate;
  width: 100%;
  margin-top: -14px;
  text-align: center;
}
.nube-fondo {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: -22%;
  width: 120%;
  transform: translateX(-50%);
  opacity: .96;
}

.bloque-titulo h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nombre {
  font-family: var(--fuente-titulo);
  font-weight: 700;
  font-size: clamp(58px, 20vw, 84px);
  line-height: 1;
  color: var(--azul);
  -webkit-text-stroke: .1em #fff;
  paint-order: stroke fill;
  text-shadow: 0 .06em 0 rgba(29, 79, 159, .32), 0 .1em .14em rgba(29, 79, 159, .22);
  animation: cae-titulo .7s cubic-bezier(.2, 1.4, .4, 1) .25s both;
}

/* Cinta roja */
.cinta {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: baseline;
  gap: .28em;
  margin-top: -2px;
  padding: .3em 1.5em .34em;
  background: var(--rojo);
  border-radius: 6px;
  box-shadow: 0 4px 0 var(--rojo-oscuro), 0 10px 14px rgba(150, 20, 30, .25);
  color: #fff;
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: clamp(24px, 7.6vw, 31px);
  line-height: 1;
  animation: cae-titulo .7s cubic-bezier(.2, 1.4, .4, 1) .45s both;
}
.cinta::before,
.cinta::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: .42em;
  width: 1.5em;
  height: 100%;
  background: var(--rojo-oscuro);
}
.cinta::before { left: -1em;  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 34% 50%); }
.cinta::after  { right: -1em; clip-path: polygon(0 0, 100% 0, 66% 50%, 100% 100%, 0 100%); }

.uno {
  font-weight: 700;
  font-size: 1.95em;
  line-height: .8;
  color: var(--amarillo);
  -webkit-text-stroke: .09em #fff;
  paint-order: stroke fill;
  text-shadow: 0 .05em 0 var(--amarillo-oscuro);
  transform: translateY(.05em);
}

/* ---------- Lema ---------- */
.lema {
  max-width: 17em;
  margin: 18px 0 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(17px, 5.2vw, 21px);
  line-height: 1.3;
  text-wrap: balance;
}

/* ---------- Cuenta regresiva ---------- */
.cuenta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 18px;
}
.unidad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 0 9px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(36, 100, 180, .16), inset 0 0 0 1.5px #dcecfb;
}
.num {
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: clamp(26px, 8.4vw, 34px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rot { font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.num.tic { animation: tic .35s ease-out; }

/* ---------- Fecha y lugar ---------- */
.datos {
  width: 100%;
  margin: 18px 0 0;
  padding: 0 4px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.datos li { display: flex; align-items: center; gap: 12px; }
.ico { flex: none; width: 26px; height: 26px; color: var(--azul); }
.dato { font-weight: 700; font-size: 16px; line-height: 1.3; }
.dato strong { display: block; font-weight: 800; font-size: 17px; }
.dato small { display: block; font-size: 14px; font-weight: 600; opacity: .85; }
.dato small:empty { display: none; }

/* ---------- Botón deslizar ---------- */
.deslizar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin-top: auto;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a86e6, var(--azul-boton));
  color: #fff;
  font-family: var(--fuente-texto);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 0 #14498f, 0 14px 22px rgba(20, 73, 143, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.portada .deslizar { margin-top: 22px; }
.deslizar:active { transform: translateY(4px); box-shadow: 0 2px 0 #14498f, 0 6px 12px rgba(20, 73, 143, .3); }
.deslizar:focus-visible, .musica:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }

.deslizar__flecha {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  animation: rebota 1.4s ease-in-out infinite;
}
.deslizar__flecha svg { width: 18px; height: 18px; }

/* ---------- Botón de música ---------- */
.musica {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: max(12px, calc((100vw - 440px) / 2 + 12px));
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--azul);
  box-shadow: 0 4px 12px rgba(29, 79, 159, .25);
  cursor: pointer;
}
.musica[hidden] { display: none; }
.musica svg { width: 22px; height: 22px; }
.musica .tachado { display: none; }
.musica[aria-pressed="false"] .tachado { display: block; }
.musica[aria-pressed="true"] svg { animation: balanceo 1.2s ease-in-out infinite; }

/* ---------- Animaciones ---------- */
@keyframes entra     { from { transform: translateY(40px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flota     { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes cabeceo   { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@keyframes saludo-der{ from { transform: rotate(6deg); }  to { transform: rotate(32deg); } }
@keyframes saludo-izq{ from { transform: rotate(-6deg); } to { transform: rotate(-32deg); } }
@keyframes globo     { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-12px) rotate(3deg); } }
@keyframes gatita    { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes sube      { 0%, 100% { transform: translateY(0) scale(1); opacity: .9; } 50% { transform: translateY(-14px) scale(1.2); opacity: 1; } }
@keyframes deriva    { from { transform: translateX(-10px); } to { transform: translateX(14px); } }
@keyframes mece      { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
@keyframes cae       { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--deriva, 0), var(--caida)) rotate(var(--giro, 360deg)); } }
@keyframes cae-titulo{ from { transform: translateY(-26px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rebota    { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(4px); } }
@keyframes tic       { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes balanceo  { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }

/* ---------- Accesibilidad: menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confeti { display: none; }
  html { scroll-behavior: auto; }
}
