:root {
  --ivory: #f6efe3;
  --paper: #fbf7ef;
  --ink: #2a1f24;
  --wine: #7a1f33;
  --rose: #c58b94;
  --gold: #b8924a;
  --line: rgba(184, 146, 74, .45);
  --script: "Pinyon Script", "Brush Script MT", cursive;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --seal-hi: #a62c46; --seal-lo: #4d1220; --seal-ink: #f3d9a8; --seal-ring: rgba(243,217,168,.25); --seal-r: 50%;
  --env-bg: linear-gradient(160deg, #efe3d0, #e4d3ba); --flap: linear-gradient(180deg, #f1e6d3, #e8d9bf); --glow: rgba(255,226,160,.95);
  --frame-r: 999px 999px 8px 8px; --frame-r-in: 999px 999px 4px 4px; --btn-ink: #fbf0dc; --field: #fff;
  --h2-size: 2.6rem; --names-size: 2.9rem; --head-tt: none; --head-ls: 0; --body-fw: 400;
  --foil-a: #d9b35f; --foil-b: #f3dc9c; --foil-c: #c79a45; --map-filter: none; --clip-r: 22px;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: var(--body-fw);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }
section { min-height: 100svh; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; max-width: 520px; margin: 0 auto; }
h2 { font-family: var(--script); font-weight: 400; font-size: var(--h2-size); color: var(--wine); line-height: 1.1; margin-bottom: 10px; text-transform: var(--head-tt); letter-spacing: var(--head-ls); }
.sub { color: var(--gold); letter-spacing: .18em; text-transform: uppercase; font-size: .8rem; margin-bottom: 20px; }
.rule { width: 90px; height: 1px; background: var(--gold); margin: 18px auto; position: relative; }
.rule::after { content: ""; position: absolute; left: 50%; top: -3px; width: 7px; height: 7px; background: var(--gold); transform: translateX(-50%) rotate(45deg); }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Sobre */
#envelope { position: fixed; inset: 0; z-index: 50; background: var(--env-bg); display: flex; align-items: center; justify-content: center; transition: opacity .9s ease .7s, visibility 0s linear 1.6s; perspective: 1200px; cursor: pointer; }
#envelope.open { opacity: 0; visibility: hidden; }
#envelope .glow { position: absolute; width: 140%; height: 140%; background: radial-gradient(circle, var(--glow), transparent 55%); opacity: 0; transition: opacity .8s ease; }
#envelope.open .glow { opacity: 1; }
.env { position: relative; width: min(86vw, 380px); aspect-ratio: 3 / 4.4; background: var(--paper); box-shadow: 0 30px 70px rgba(80, 45, 20, .35); border: 1px solid var(--line); overflow: hidden; }
.env .petals { position: absolute; inset: 0; opacity: .5; background:
  radial-gradient(circle at 20% 82%, var(--rose) 0 3px, transparent 4px),
  radial-gradient(circle at 78% 86%, var(--rose) 0 4px, transparent 5px),
  radial-gradient(circle at 34% 90%, var(--gold) 0 2px, transparent 3px),
  radial-gradient(circle at 70% 18%, var(--rose) 0 2px, transparent 3px); }
.env .fold-l, .env .fold-r { position: absolute; top: 0; bottom: 0; width: 50%; background: linear-gradient(135deg, rgba(184,146,74,.10), rgba(255,255,255,0)); }
.env .fold-l { left: 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.env .fold-r { right: 0; clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.env .flap { position: absolute; left: 0; right: 0; top: 0; height: 56%; background: var(--flap); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform 1s cubic-bezier(.5,0,.2,1); }
#envelope.open .flap { transform: rotateX(180deg); }
.seal { position: absolute; left: 50%; top: 56%; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: var(--seal-r); background: radial-gradient(circle at 35% 30%, var(--seal-hi), var(--wine) 60%, var(--seal-lo)); display: flex; align-items: center; justify-content: center; color: var(--seal-ink); font-family: var(--script); font-size: 1.9rem; box-shadow: 0 6px 16px rgba(60,10,25,.5), inset 0 0 0 4px var(--seal-ring); transition: transform .5s ease, opacity .4s ease; animation: pulse 2.2s ease-in-out infinite; }
#envelope.open .seal { transform: scale(1.5); opacity: 0; animation: none; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.hint { position: absolute; bottom: 9vh; width: 100%; text-align: center; color: var(--wine); letter-spacing: .2em; text-transform: uppercase; font-size: .78rem; }

/* Portada */
.arch { width: min(78vw, 330px); aspect-ratio: 3 / 4.3; border: 2px solid var(--gold); border-radius: var(--frame-r); padding: 10px; position: relative; }
.arch-in { width: 100%; height: 100%; border-radius: var(--frame-r-in); overflow: hidden; background: linear-gradient(180deg, #f7e7d2 0%, #f3d8c0 55%, #ead3b6 100%); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; }
.arch-in .names { position: absolute; top: 18%; left: 0; right: 0; color: var(--wine); font-family: var(--script); font-size: 2.5rem; line-height: 1.05; }
.arch-in .names small { display: block; font-family: var(--serif); font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.arch-in svg { width: 70%; margin-bottom: 8%; }
.scroll { margin-top: 26px; color: var(--wine); letter-spacing: .2em; text-transform: uppercase; font-size: .75rem; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* Fecha */
.scratch { display: flex; gap: 12px; margin-top: 18px; }
.card { position: relative; width: 28vw; max-width: 120px; aspect-ratio: 1; border: 1px solid var(--gold); background: var(--paper); border-radius: 8px; overflow: hidden; }
.card .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--script); font-size: 2rem; color: var(--wine); }
.card .val small { font-family: var(--serif); font-size: .65rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.card canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; transition: opacity .8s ease; }
.card.done canvas { opacity: 0; pointer-events: none; }

/* Programa */
.timeline { position: relative; width: 100%; margin-top: 18px; }
.timeline::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--gold); }
.tl { display: grid; grid-template-columns: 1fr 34px 1fr; align-items: center; margin: 26px 0; }
.tl .dot { width: 9px; height: 9px; background: var(--wine); border-radius: 50%; justify-self: center; box-shadow: 0 0 0 4px var(--ivory); z-index: 1; }
.tl .ico { color: var(--gold); display: flex; justify-content: flex-end; padding-right: 12px; }
.tl .ico svg { width: 46px; height: 46px; }
.tl .txt { text-align: left; padding-left: 12px; }
.tl .txt b { display: block; font-family: var(--script); font-weight: 400; font-size: 1.6rem; color: var(--wine); }
.tl:nth-child(even) .ico { order: 3; justify-content: flex-start; padding: 0 0 0 12px; }
.tl:nth-child(even) .txt { order: 1; text-align: right; padding: 0 12px 0 0; }
.tl:nth-child(even) .dot { order: 2; }

/* Cuenta regresiva */
.count { display: flex; gap: 10px; margin-top: 10px; }
.count div { min-width: 64px; border: 1px solid var(--gold); border-radius: 8px; padding: 10px 6px; background: var(--paper); }
.count b { display: block; font-size: 2rem; font-weight: 600; color: var(--wine); font-variant-numeric: tabular-nums; }
.count span { font-size: .65rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }

/* Lugar */
.venue { width: 100%; }
.venue .art { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(180deg, #f6dcc0, #efe0c8); overflow: hidden; margin-bottom: 14px; }
.venue .art svg { width: 100%; height: 100%; display: block; }
.map { filter: var(--map-filter); width: 100%; height: 220px; border: 1px solid var(--gold); border-radius: 8px; margin: 16px 0 12px; }
.btn { display: inline-block; border: 1px solid var(--wine); color: var(--wine); background: transparent; padding: 11px 26px; border-radius: 999px; font-family: var(--serif); font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; cursor: pointer; }
.btn.fill { background: var(--wine); color: var(--btn-ink); }

/* Vestimenta */
.swatches { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.swatches i { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.dress svg { width: 80%; max-width: 320px; }

/* RSVP */
.rsvp-seal { width: 130px; height: 130px; border-radius: var(--seal-r); border: 0; cursor: pointer; background: radial-gradient(circle at 35% 30%, var(--seal-hi), var(--wine) 60%, var(--seal-lo)); color: var(--seal-ink); font-family: var(--script); font-size: 2.1rem; box-shadow: 0 10px 24px rgba(60,10,25,.45), inset 0 0 0 5px var(--seal-ring); margin: 18px 0 8px; animation: pulse 2.2s ease-in-out infinite; }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(42,31,36,.55); display: none; align-items: flex-end; justify-content: center; }
.modal.show { display: flex; }
.sheet { width: 100%; max-width: 520px; background: var(--paper); border-radius: 22px 22px 0 0; padding: 26px 24px calc(28px + env(safe-area-inset-bottom)); }
.sheet h3 { font-family: var(--script); font-weight: 400; font-size: 2.1rem; color: var(--wine); text-align: center; margin-bottom: 14px; }
.sheet label { display: block; font-size: .8rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); margin: 14px 0 6px; }
.sheet input[type=text], .sheet input[type=number] { width: 100%; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); }
.opts { display: grid; gap: 8px; }
.opts label { margin: 0; letter-spacing: 0; text-transform: none; font-size: 1rem; color: var(--ink); display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.err { color: #a11; min-height: 1.4em; font-size: .95rem; margin-top: 8px; text-align: center; }
.sheet .row { display: flex; gap: 10px; margin-top: 16px; }
.sheet .row .btn { flex: 1; text-align: center; }
.thanks { font-family: var(--script); font-size: 2rem; color: var(--wine); }

.footer { padding: 36px 24px calc(90px + env(safe-area-inset-bottom)); text-align: center; font-size: .9rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); }
.footer b { color: var(--wine); }

#music { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--wine); color: var(--seal-ink); font-size: 1rem; cursor: pointer; box-shadow: 0 4px 12px rgba(60,10,25,.4); display: none; }
#music.on { display: block; }

/* Inicio AIX */
.home h1 { font-family: var(--script); font-weight: 400; font-size: 3.2rem; color: var(--wine); }
.home p { max-width: 380px; margin: 12px 0 24px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01s !important; }
}

[hidden] { display: none !important; }

.gallery { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.gallery figure { flex: 0 0 88%; scroll-snap-align: center; border: 1px solid var(--gold); border-radius: 8px; overflow: hidden; background: var(--paper); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery figcaption { padding: 6px; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); }

.arch-in img { width: 100%; height: 100%; object-fit: cover; display: block; }
.names2 { font-family: var(--script); font-size: var(--names-size); line-height: 1.1; color: var(--wine); text-transform: var(--head-tt); letter-spacing: var(--head-ls); }

.gift { color: var(--gold); margin: 6px 0 14px; }
.gift svg { width: 64px; height: 64px; }

.clip { min-height: auto; padding: 20px 24px; }
.clipbox { width: min(84vw, 340px); aspect-ratio: 9 / 16; border-radius: var(--clip-r, 22px); overflow: hidden; border: 1px solid var(--gold); box-shadow: 0 18px 44px rgba(60, 30, 20, .25); background: var(--paper); }
.clipbox video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Efectos de entrada por tema */
.rv-zoom .reveal { transform: scale(.9); }
.rv-zoom .reveal.in { transform: none; }
.rv-blur .reveal { transform: none; filter: blur(12px); transition: opacity 1.1s ease, filter 1.1s ease; }
.rv-blur .reveal.in { filter: none; }
.rv-rise .reveal { transform: translateY(60px); transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.2,.8,.2,1); }
.rv-rise .reveal.in { transform: none; }

.small { font-size: .9rem; opacity: .85; margin-top: 10px; }

/* Sobre con foto real */
#envelope.foto { background: var(--env-bg); }
#envelope.foto .sobre-img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .7s ease; }
#envelope.foto.listo .sobre-img { opacity: 1; }
#envelope.foto.open .sobre-img { transform: scale(2.6); opacity: 0; transition: transform 1.7s cubic-bezier(.55,0,.35,1), opacity 1s ease .7s; }
#envelope.foto .mono, #envelope.foto .anillo { position: absolute; left: 50%; top: 49.8%; transform: translate(-50%, -50%); pointer-events: none; }
#envelope.foto .mono { font-family: var(--script); font-size: calc(max(100vw, 55.2svh) * .1); line-height: 1; white-space: nowrap; color: #f0d9a0; text-shadow: 0 1px 1px rgba(60,10,20,.7), 0 -1px 0 rgba(255,255,255,.28); opacity: 0; transition: opacity .7s ease .3s, transform .6s ease; }
#envelope.foto.listo .mono { opacity: 1; }
#envelope.foto.open .mono { opacity: 0; transform: translate(-50%, -50%) scale(1.5); transition: opacity .4s ease, transform .6s ease; }
#envelope.foto .anillo { width: calc(max(100vw, 55.2svh) * .3); height: calc(max(100vw, 55.2svh) * .3); border-radius: 50%; border: 2px solid rgba(240,217,160,.8); animation: anillo 2.4s ease-out infinite; opacity: 0; }
#envelope.foto.listo .anillo { opacity: 1; }
#envelope.foto.open .anillo { display: none; }
@keyframes anillo { 0% { transform: translate(-50%, -50%) scale(.75); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }
#envelope.foto .hint { color: #fff; text-shadow: 0 1px 6px rgba(80, 20, 40, .7); z-index: 2; }
