/* ============================================================
   INVITACIÓN PIM PIM — estilos
   1 reset/base · 2 shell · 3 mundo/decoración · 4 personajes
   5 escenas · 6 animaciones · 7 hud/portada · 8 rsvp
   9 responsive · 10 reduced motion
   ============================================================ */

/* ---------- 1. RESET / BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #ff4b57;   --yellow: #ffc233; --blue: #3aa7ee; --green: #48c78e;
  --pink: #ff9ec2;  --orange: #ff8a3d; --violet: #a77bff;
  --ink: #2b2b46;   --soft: #6c7791;
  --radius: 1.6rem;
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; height: 100%; }

body {
  height: 100%;
  font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: #e7eef7;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; touch-action: manipulation; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: .18rem solid var(--blue); outline-offset: .12rem; border-radius: .7rem; }

/* ---------- 2. SHELL ---------- */
.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  background: linear-gradient(180deg, #bfe9ff 0%, #dff3ff 44%, #fff7dd 100%);
}

/* ---------- 3. MUNDO / DECORACIÓN ---------- */
.world { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sky { position: absolute; inset: 0; background: radial-gradient(120% 55% at 50% 0%, rgba(255,255,255,.8), transparent 70%); }
.glow {
  position: absolute; left: -25%; top: 2%; width: 150%; height: 48%;
  background: radial-gradient(closest-side, rgba(255,246,190,.85), transparent);
  animation: glowPulse 9s ease-in-out infinite;
}
.rainbow {
  position: absolute; left: 50%; bottom: 33%; width: 23rem; margin-left: -11.5rem;
  visibility: hidden; opacity: 0;
}

.clouds { position: absolute; inset: 0; }
.cloud {
  position: absolute; top: var(--t); left: var(--l);
  width: calc(7rem * var(--s)); height: calc(2.6rem * var(--s));
  border-radius: 99rem; background: #fff; opacity: .95;
  transition: opacity 1.2s ease;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: calc(3.4rem * var(--s)); height: calc(3.4rem * var(--s)); top: calc(-1.6rem * var(--s)); left: calc(.9rem * var(--s)); }
.cloud::after  { width: calc(2.2rem * var(--s)); height: calc(2.2rem * var(--s)); top: calc(-1.1rem * var(--s)); right: calc(1rem * var(--s)); }

.stars { position: absolute; inset: 0; opacity: .8; }
.star {
  position: absolute;
  width: calc(.85rem * var(--s, 1)); height: calc(.85rem * var(--s, 1));
  background: #fff;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.star.y { background: var(--yellow); }

.balloons { position: absolute; inset: 0; }
.balloon {
  position: absolute; top: 106%;
  width: 2.6rem; height: 3.2rem;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.9), rgba(255,255,255,0) 42%),
    var(--c);
  opacity: .95;
  transition: opacity 1.2s ease;
}
.balloon::after {
  content: ""; position: absolute; left: 50%; bottom: -1.9rem;
  width: .08rem; height: 1.9rem; background: rgba(255,255,255,.9); transform: translateX(-50%);
}
.balloon::before {
  content: ""; position: absolute; left: 50%; bottom: -.35rem; transform: translateX(-50%);
  border-left: .3rem solid transparent; border-right: .3rem solid transparent;
  border-top: .45rem solid var(--c);
}

.deco { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.deco-img { position: absolute; height: auto; }
.deco-rainbow  { left: 50%; bottom: 33%; width: 80%; transform: translateX(-50%); }
.deco-clouds   { top: 3%; left: -8%; width: 62%; opacity: .95; }
.deco-stars    { top: 7%; left: -12%; width: 30%; opacity: .8; }
.deco-balloons { top: 0; right: -5%; width: 36%; }
.deco-gifts    { bottom: 0; left: -5%; width: 40%; }
.deco-bunting  { top: -.6rem; left: 5%; width: 90%; }
.deco-logo     { left: 50%; bottom: 1rem; width: 3rem; margin-left: -1.5rem; opacity: .9; }
.has-rainbow #rainbow, .has-clouds #clouds,
.has-stars #stars, .has-balloons #balloons { display: none; }
.deco-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }

/* ---------- 4. PERSONAJES ---------- */
.char { display: flex; align-items: flex-end; justify-content: center; visibility: hidden; pointer-events: none; }
.cover .char { visibility: visible; }
.char-inner { display: flex; align-items: flex-end; justify-content: center; will-change: transform; }
.char-img { width: 100%; height: auto; object-fit: contain; filter: drop-shadow(0 1rem 1.4rem rgba(40,80,130,.22)); }
.clown { width: 100%; height: auto; filter: drop-shadow(0 1rem 1.4rem rgba(40,80,130,.16)); }
.char-intro { width: 10.5rem; margin-bottom: .5rem; }
.char-intro2 { position: absolute; right: .2rem; bottom: 5%; width: 5.2rem; }
.char-bday { position: absolute; left: -.3rem; bottom: 7%; width: 5.4rem; }
.char-side  { position: absolute; right: -.4rem; bottom: 11%; width: 6.4rem; }
.char-side-l { position: absolute; left: -.4rem; bottom: 8%; width: 6rem; }
.char-cheer { width: 8rem; margin-top: .3rem; }
.char-final-l { position: absolute; left: -.2rem; bottom: 5%; width: 4.8rem; }
.char-final-r { position: absolute; right: -.2rem; bottom: 5%; width: 4.8rem; }
.char-cover { width: 8.4rem; }

/* ---------- 5. ESCENAS ---------- */
.scene {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 4.6rem 1.5rem calc(2.6rem + env(safe-area-inset-bottom));
  visibility: hidden; opacity: 0; pointer-events: none;
}

.t-hello { font-size: 2.6rem; font-weight: 800; color: #fff; letter-spacing: .02em;
  text-shadow: 0 .22rem 0 rgba(58,167,238,.4), 0 .9rem 1.3rem rgba(40,80,130,.2); }
.t-soft  { font-size: 1.45rem; font-weight: 600; color: #3d4a6b; line-height: 1.35; max-width: 18rem; }
.t-name  { font-size: 3rem; font-weight: 800; color: var(--red); line-height: 1; letter-spacing: .02em;
  text-shadow: 0 .2rem 0 #fff, 0 .7rem 1.1rem rgba(40,80,130,.18); }
.t-line  { font-size: 1.55rem; font-weight: 800; color: var(--blue); letter-spacing: .05em; text-shadow: 0 .15rem 0 #fff; }
.t-line b { color: var(--red); font-size: 1.9rem; }
.t-big   { font-size: 1.85rem; font-weight: 800; color: #2f3f66; line-height: 1.3; max-width: 18rem;
  text-shadow: 0 .15rem 0 rgba(255,255,255,.9); }
.t-final { font-size: 2.3rem; font-weight: 800; color: var(--red);
  text-shadow: 0 .18rem 0 #fff, 0 .8rem 1.2rem rgba(40,80,130,.2); }

.photo-wrap { position: relative; margin: 1.3rem 0 1.1rem; }
.photo-frame {
  width: 12.5rem; height: 12.5rem; overflow: hidden; background: #fff;
  border: .5rem solid #fff;
  border-radius: 46% 54% 52% 48% / 52% 46% 54% 48%;
  box-shadow: 0 1rem 2rem rgba(40,80,130,.22);
  display: grid; place-items: center;
}
.photo-el { width: 100%; height: 100%; object-fit: cover; }
.ph { display: flex; flex-direction: column; align-items: center; gap: .1rem;
  background: linear-gradient(160deg, #fff3d1, #ffe0e8); color: #8a6f52; }
.ph span { font-size: 2.4rem; }
.ph small { font-size: .82rem; font-weight: 600; }

.one-badge {
  position: absolute; right: -1rem; bottom: -.7rem;
  width: 4.5rem; height: 4.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #ffe45c, #ffb703);
  box-shadow: 0 .5rem 1rem rgba(190,130,10,.35), inset 0 -.25rem 0 rgba(255,255,255,.55);
}
.one-badge span { font-size: 2.5rem; font-weight: 800; color: #fff; line-height: 1;
  -webkit-text-stroke: .13rem #e08800; paint-order: stroke fill; }
.one-badge.as-image {
  right: -1.4rem; bottom: -1rem; width: auto; height: auto;
  background: none; box-shadow: none; border-radius: 0;
}
.one-badge.as-image span { display: none; }
.one-badge.as-image .badge-img { width: 5.4rem; height: auto; filter: drop-shadow(0 .5rem .9rem rgba(40,80,130,.28)); }

.sparkles { position: absolute; inset: -1.8rem; pointer-events: none; }
.sparkles .star { width: calc(1rem * var(--s, 1)); height: calc(1rem * var(--s, 1)); }

.card {
  width: 100%; max-width: 19.5rem; text-align: left;
  background: rgba(255,255,255,.97); border: .18rem solid #fff;
  border-radius: var(--radius); padding: 1.3rem 1.1rem 1.1rem;
  box-shadow: 0 1.1rem 2.2rem rgba(40,80,130,.18);
  display: flex; flex-direction: column; gap: .5rem;
}
.card-kicker { text-align: center; font-size: .78rem; font-weight: 800; letter-spacing: .2em; color: var(--blue); margin-bottom: .1rem; }
.row { display: flex; align-items: center; gap: .7rem; }
.ico { width: 2.3rem; height: 2.3rem; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; background: #eef6ff; font-size: 1.05rem; }
.row-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.row-label { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #8d98b3; }
.row-txt strong { font-size: 1.12rem; font-weight: 700; }
.addr { font-size: .9rem; font-weight: 500; color: var(--soft); padding-left: 3rem; line-height: 1.3; }

/* Tarjeta con marco de circo (cuando existe assets/decorations/circo) */
.card.has-frame {
  width: 100%; max-width: 19.5rem; aspect-ratio: 480 / 663;
  padding: 30% 12% 17%;
  border: 0; border-radius: 1.4rem;
  background-color: #fff; background-position: center; background-size: 100% 100%; background-repeat: no-repeat;
  justify-content: center; gap: .3rem;
  box-shadow: 0 1.2rem 2.2rem rgba(40,80,130,.22);
}
.card.has-frame .card-kicker { font-size: .68rem; letter-spacing: .16em; }
.card.has-frame .row { gap: .55rem; }
.card.has-frame .ico { width: 2.1rem; height: 2.1rem; font-size: .95rem; }
.card.has-frame .row-txt strong { font-size: 1rem; }
.card.has-frame .row-label { font-size: .64rem; }
.card.has-frame .addr { padding-left: 2.65rem; font-size: .8rem; }
.card.has-frame .btn-map { min-height: 2.4rem; font-size: .85rem; margin-top: .3rem; }

.wishes { list-style: none; display: flex; flex-direction: column; gap: .45rem; margin: .9rem 0; }
.wish { font-size: 1.6rem; font-weight: 800; color: #fff; padding: .4rem 1.4rem; border-radius: 99rem;
  background: var(--blue); box-shadow: 0 .5rem 1rem rgba(40,80,130,.2); }
.wish:nth-child(2) { background: var(--green); }
.wish:nth-child(3) { background: var(--orange); }

.confetti { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -1rem; width: .5rem; height: .8rem; border-radius: .15rem; will-change: transform; }

.calm .cloud, .calm .balloon { opacity: .45; }
.scene .btn-map { pointer-events: auto; }
.rsvp.show { visibility: visible; opacity: 1; }

/* ---------- 6. BOTONES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 3rem; padding: .65rem 1.3rem; border-radius: 99rem;
  font-weight: 800; font-size: 1.05rem; text-align: center;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: scale(.96); }
.btn-launch {
  width: 100%; max-width: 17.5rem; padding: 1rem 1.6rem; font-size: 1.2rem;
  letter-spacing: .04em; color: #fff;
  background: linear-gradient(180deg, #ff6a72, #e83e4b);
  box-shadow: 0 .7rem 1.4rem rgba(200,50,60,.35), inset 0 -.2rem 0 rgba(0,0,0,.12);
}
.btn-map {
  align-self: center; margin-top: .6rem; min-height: 2.7rem; padding: .45rem 1.1rem;
  font-size: .92rem; color: #2a7fc0; background: #eaf5ff; box-shadow: inset 0 0 0 .12rem #cbe6ff;
}

/* ---------- 7. HUD + PORTADA ---------- */
.hud {
  position: absolute; z-index: 6; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: .6rem;
  padding: calc(.7rem + env(safe-area-inset-top)) .9rem 0;
  visibility: hidden; opacity: 0;
}
.bar { flex: 1; height: .34rem; border-radius: 99rem; overflow: hidden;
  background: rgba(255,255,255,.6); box-shadow: inset 0 0 0 .06rem rgba(255,255,255,.75); }
.bar span { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--yellow), var(--red)); border-radius: 99rem; }
.pill {
  min-height: 2.75rem; min-width: 2.75rem; padding: .3rem .85rem; border-radius: 99rem;
  font-size: .9rem; font-weight: 700; color: #40507a;
  background: rgba(255,255,255,.85); box-shadow: 0 .3rem .8rem rgba(40,80,130,.18);
}

.cover {
  position: absolute; inset: 0; z-index: 7; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2.5rem 1.6rem calc(2.5rem + env(safe-area-inset-bottom));
  text-align: center;
  background: radial-gradient(125% 85% at 50% 0%, #fff8cf 0%, #ffe7a9 32%, #ffd8c9 66%, #c9e9ff 100%);
}
.cover-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: .65rem; }
.cover-bunting { position: absolute; top: -.5rem; left: 6%; width: 88%; z-index: 1; pointer-events: none; }
.cover-logo { width: 4rem; height: auto; margin-bottom: -.3rem; pointer-events: none; }
.cover-kicker { font-size: 1.02rem; font-weight: 700; color: #c2563f; max-width: 16rem; line-height: 1.3; }
.cover-title { font-size: 2.05rem; font-weight: 800; line-height: 1.2; }
.cover-title .hl {
  font-style: normal; display: inline-grid; place-items: center;
  width: 2.15rem; height: 2.15rem; border-radius: 50%;
  color: #fff; background: var(--red); font-size: 1.5rem;
  box-shadow: 0 .3rem .7rem rgba(200,50,60,.4); vertical-align: middle;
}
.cover-hint { font-size: .9rem; font-weight: 600; color: #8a6f52; animation: hintPulse 1.9s ease-in-out infinite; }
.cover-balloons { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cover-balloons .balloon { top: 12%; animation: coverFloat 6.5s ease-in-out infinite; }
.cover-balloons .balloon:nth-child(2) { top: 8%; animation-delay: -1.5s; }
.cover-balloons .balloon:nth-child(3) { top: 16%; animation-delay: -3s; }
.cover-balloons .balloon:nth-child(4) { top: 6%; animation-delay: -4.5s; }

/* ---------- 8. RSVP ---------- */
.rsvp {
  position: absolute; inset: 0; z-index: 5;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(2.8rem + env(safe-area-inset-top)) 1.3rem calc(1.6rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,250,235,.97));
  visibility: hidden; opacity: 0;
}
.rsvp-inner { max-width: 19.5rem; margin: 0 auto; display: flex; flex-direction: column; gap: .8rem; }
.rsvp-title { font-size: 1.85rem; font-weight: 800; color: var(--red); text-align: center; line-height: 1.1; }
.rsvp-sub { font-size: 1rem; font-weight: 600; color: var(--soft); text-align: center; margin-top: -.45rem; }

.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8d98b3; }
.field input {
  min-height: 3rem; padding: .55rem .95rem; border-radius: 1rem;
  border: .14rem solid #dde7f2; background: #fff;
  font-size: max(16px, 1.05rem); font-weight: 600;
}
.field input::placeholder { color: #aab4c8; font-weight: 500; }

.choice { border: 0; display: flex; flex-direction: column; gap: .4rem; }
.choice-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.btn-yes, .btn-no { background: #fff; box-shadow: inset 0 0 0 .16rem #e3ebf5; color: #5a6581; font-size: 1rem; }
.btn-yes[aria-pressed="true"] { background: var(--green); color: #fff; box-shadow: 0 .5rem 1rem rgba(72,199,142,.35); }
.btn-no[aria-pressed="true"]  { background: #eef1f7; color: #4a5570; box-shadow: inset 0 0 0 .16rem #c2cddd; }

.counters { display: flex; flex-direction: column; gap: .5rem; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: #fff; border-radius: 1.1rem; padding: .45rem .75rem; box-shadow: 0 .3rem .8rem rgba(40,80,130,.09); }
.counter-label { font-size: 1rem; font-weight: 700; color: #4a5570; }
.stepper { display: flex; align-items: center; gap: .15rem; }
.step { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center;
  background: #eaf5ff; color: #2a7fc0; font-size: 1.5rem; font-weight: 800; line-height: 1;
  user-select: none; -webkit-user-select: none; }
.step[aria-disabled="true"] { opacity: .45; background: #f3f6fa; color: #b3bdcd; }
.stepper output { display: inline-block; min-width: 2.2rem; text-align: center; font-size: 1.2rem; font-weight: 800; }
.stepper output.tick { animation: tickPop .28s ease; }

.btn-primary { width: 100%; color: #fff; background: linear-gradient(180deg, #58d69c, #35b57e);
  box-shadow: 0 .6rem 1.2rem rgba(60,170,120,.35); }
.btn-primary.decline { background: linear-gradient(180deg, #ff8fa3, #ef6b83); box-shadow: 0 .6rem 1.2rem rgba(230,110,130,.35); }

.error { min-height: 1.15rem; text-align: center; font-size: .9rem; font-weight: 700; color: #d9534f; }
.error.shake { animation: shake .4s ease; }
.rsvp-links { display: flex; flex-direction: column; align-items: center; gap: .1rem; margin-top: .2rem; }
.link { min-height: 2.6rem; padding: .35rem .6rem; font-size: .9rem; font-weight: 700;
  color: #2a7fc0; text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- 6b. KEYFRAMES ---------- */
@keyframes glowPulse { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes hintPulse { 0%, 100% { opacity: .5; transform: translateY(0); } 50% { opacity: 1; transform: translateY(.18rem); } }
@keyframes coverFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-1.3rem) rotate(2deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-.4rem); } 75% { transform: translateX(.4rem); } }
@keyframes tickPop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* ---------- 9. RESPONSIVE / DESKTOP ---------- */
@media (min-width: 600px) and (min-height: 560px) {
  body { display: grid; place-items: center; background: radial-gradient(130% 100% at 50% 0%, #f4f9fd, #dde7f2); }
  .stage {
    height: min(calc(100dvh - 40px), 820px);
    width: auto; aspect-ratio: 9 / 16;
    border-radius: 2rem;
    box-shadow: 0 2rem 4rem rgba(30,60,100,.22), 0 0 0 .12rem rgba(255,255,255,.7);
  }
}

/* ---------- 10. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .glow, .cover-hint, .cover-balloons .balloon { animation: none; }
  .btn, .cloud, .balloon { transition: none; }
}

/* ---------- 11. FALLBACK SIN GSAP (CDN no disponible) ---------- */
.no-gsap .char, .no-gsap #rainbow, .no-gsap #stars, .no-gsap #balloons { visibility: visible; opacity: 1; }
.no-gsap #s3Btn { visibility: visible; opacity: 1; }
.no-gsap .scene { padding: 4.6rem 1.5rem calc(2.6rem + env(safe-area-inset-bottom)); }
.no-gsap .scene.show { visibility: visible; opacity: 1; transition: opacity .5s ease; }
.no-gsap .hud.show { visibility: visible; opacity: 1; }
.no-gsap .cover.fade { visibility: hidden; opacity: 0; transition: opacity .6s ease, visibility .6s; }

