:root {
  /* Palette pulled from the castle poster & videos */
  --cream: #FFF8FB;
  --blush: #F9DCE7;
  --pink: #EBA3C0;
  --rose: #D46F9A;
  --lavender: #D9CCF4;
  --lilac: #A48BDB;
  --sky: #B3C8F6;
  --gold: #C4943A;
  --gold-soft: #E9CC85;
  --gold-deep: #9C6E22;
  --plum: #4B2E66;
  --plum-soft: #7D5F98;

  --font-display: 'Cinzel Decorative', 'Cinzel', serif;
  --font-caps: 'Cinzel', serif;
  --font-script: 'Parisienne', cursive;
  --font-body: 'Quicksand', system-ui, sans-serif;

  --stage-h: 100vh;
}
@supports (height: 100svh) { :root { --stage-h: 100svh; } }

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--plum);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(217,204,244,.55), transparent 60%),
    radial-gradient(900px 700px at 100% 40%, rgba(249,220,231,.75), transparent 60%),
    linear-gradient(180deg, #FBEAF2 0%, #F3E9FB 45%, #EAF0FD 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
::selection { background: var(--pink); color: #fff; }

/* ============ AMBIENT LAYERS ============ */
#sparkle-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 40;
}
#butterfly-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 35;
  overflow: hidden;
}
.butterfly svg { width: 100%; height: 100%; overflow: visible; }

/* ============ STAGE (phone-shaped video frame, blurred backdrop on wide screens) ============ */
.stage-section {
  position: relative;
  height: var(--stage-h);
  overflow: hidden;
  background: #2E2142;
}
.stage-backdrop {
  position: absolute; inset: -40px;
  background: var(--backdrop) center / cover no-repeat;
  filter: blur(28px) saturate(1.15) brightness(.9);
  transform: scale(1.1);
}
.stage-frame {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(46,33,66,.45);
}
.stage-video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #2E2142;
}

/* ============ ENVELOPE INTRO ============ */
#envelope-screen {
  position: fixed; inset: 0;
  z-index: 100;
  background: #2E2142;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 1s ease, visibility 1s ease;
  -webkit-tap-highlight-color: transparent;
}
#envelope-screen .stage-frame { height: 100%; }
#envelope-screen.crossfade { opacity: 0; }
#envelope-screen.gone { visibility: hidden; pointer-events: none; opacity: 0; }

.envelope-glow {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,248,251,.82) 0%, rgba(255,248,251,.55) 22%, rgba(255,248,251,0) 44%),
    linear-gradient(0deg, rgba(75,46,102,.38) 0%, rgba(75,46,102,0) 22%);
  transition: opacity .8s ease;
}
.envelope-copy {
  position: absolute;
  top: max(5.5vh, env(safe-area-inset-top));
  left: 0; right: 0;
  padding: 0 22px;
  text-align: center;
  transition: opacity .7s ease, transform .9s ease;
}
.env-kicker {
  margin: 0;
  font-family: var(--font-caps);
  font-weight: 500;
  font-size: clamp(.82rem, 3.6vw, 1rem);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--plum-soft);
}
.env-adventure {
  margin: .2rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 6.6vw, 1.9rem);
  line-height: 1.15;
  color: var(--plum);
  text-shadow: 0 1px 0 rgba(255,255,255,.8), 0 0 18px rgba(255,255,255,.9);
}
.env-name {
  margin: .35rem 0 0;
  font-family: var(--font-script);
  font-size: clamp(3.6rem, 17vw, 5rem);
  line-height: 1.05;
  background: linear-gradient(180deg, #E58AB0 0%, #C2507F 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.9)) drop-shadow(0 4px 14px rgba(255,255,255,.8));
}
.env-occasion {
  margin: .1rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 6vw, 1.7rem);
  letter-spacing: .04em;
  color: var(--plum);
  text-shadow: 0 0 16px rgba(255,255,255,.95);
}
.env-one { color: var(--rose); }
.env-one sup { font-size: .55em; }

.envelope-tap {
  position: absolute;
  left: 0; right: 0;
  bottom: max(6vh, calc(env(safe-area-inset-bottom) + 24px));
  display: flex; justify-content: center;
  transition: opacity .6s ease;
}
.tap-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .95rem 1.8rem;
  border-radius: 999px;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--plum);
  background: linear-gradient(180deg, rgba(255,250,252,.92), rgba(249,220,231,.88));
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 8px 26px rgba(75,46,102,.35), inset 0 1px 0 #fff;
  backdrop-filter: blur(6px);
  overflow: hidden;
  animation: tapPulse 2.4s ease-in-out infinite;
}
.tap-pill::after {
  content: '';
  position: absolute; top: 0; bottom: 0; width: 40%;
  left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.85), transparent);
  animation: shimmer 3.2s ease-in-out infinite;
}
.tap-wand { width: 20px; height: 20px; color: var(--gold); }
@keyframes tapPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 26px rgba(75,46,102,.35), 0 0 0 0 rgba(233,204,133,.55), inset 0 1px 0 #fff; }
  50% { transform: scale(1.045); box-shadow: 0 10px 30px rgba(75,46,102,.4), 0 0 0 12px rgba(233,204,133,0), inset 0 1px 0 #fff; }
}
@keyframes shimmer { 0%, 55% { left: -60%; } 100% { left: 130%; } }

#envelope-screen.opening .envelope-copy { opacity: 0; transform: translateY(-14px); }
#envelope-screen.opening .envelope-tap,
#envelope-screen.opening .envelope-glow { opacity: 0; }

/* ============ MUSIC TOGGLE ============ */
#music-toggle {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-soft);
  background: rgba(255,248,251,.85);
  backdrop-filter: blur(6px);
  color: var(--rose);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 4px 14px rgba(75,46,102,.2);
  transition: transform .3s ease, opacity .3s ease;
}
#music-toggle[hidden] { display: none; }
#music-toggle:hover { transform: scale(1.08); }
#music-toggle.muted { color: var(--plum-soft); opacity: .65; }
#music-toggle.muted::after {
  content: ''; position: absolute; width: 26px; height: 1.6px;
  background: currentColor; transform: rotate(-45deg);
}
#music-toggle svg { width: 20px; height: 20px; }

/* ============ STORYBOOK SECTIONS ============ */
.storybook { position: relative; z-index: 10; }
.section-block {
  position: relative;
  padding: 5.5rem 1.25rem;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.section-eyebrow {
  margin: 0 0 .7rem;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
}
.section-title {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  line-height: 1.2;
  color: var(--plum);
}
.crown-mini { width: 54px; height: 34px; display: block; margin: 0 auto .9rem; filter: drop-shadow(0 4px 8px rgba(196,148,58,.35)); }

/* ============ COUNTDOWN ============ */
#countdown { min-height: var(--stage-h); display: flex; flex-direction: column; justify-content: center; }
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(.45rem, 2.4vw, .9rem);
  margin-top: .6rem;
}
.countdown-cell {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.1rem .3rem .95rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(249,220,231,.7));
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 10px 24px rgba(164,139,219,.25), inset 0 1px 0 #fff;
}
.countdown-num {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(1.6rem, 7.5vw, 2.4rem);
  line-height: 1;
  color: var(--rose);
  font-variant-numeric: tabular-nums;
}
.countdown-label {
  margin-top: .45rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--plum-soft);
}
.countdown-date {
  margin: 1.4rem 0 0;
  font-family: var(--font-caps);
  font-size: .95rem;
  letter-spacing: .06em;
  color: var(--plum-soft);
}
.countdown-done {
  font-family: var(--font-script);
  font-size: 2.2rem;
  color: var(--rose);
  margin: 1rem 0 0;
}

/* ============ INVITE CARD ============ */
.invite-card {
  position: relative;
  padding: 3rem 1.6rem 2.4rem;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.95), rgba(255,255,255,0) 60%),
    linear-gradient(180deg, #FFFBFD 0%, #FCEAF2 55%, #F1EAFB 100%);
  border: 1.5px solid var(--gold-soft);
  box-shadow:
    0 0 0 6px rgba(255,255,255,.6),
    0 0 0 7.5px rgba(233,204,133,.7),
    0 24px 60px rgba(125,95,152,.28);
}
.card-corner {
  position: absolute;
  width: 34px; height: 34px;
  border-color: var(--gold);
  border-style: solid;
  opacity: .7;
}
.card-corner-tl { top: 12px; left: 12px; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 14px; }
.card-corner-tr { top: 12px; right: 12px; border-width: 1.5px 1.5px 0 0; border-top-right-radius: 14px; }
.card-corner-bl { bottom: 12px; left: 12px; border-width: 0 0 1.5px 1.5px; border-bottom-left-radius: 14px; }
.card-corner-br { bottom: 12px; right: 12px; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 14px; }

.crown-hero { width: 76px; height: 48px; display: block; margin: -4.6rem auto 1.2rem; filter: drop-shadow(0 6px 10px rgba(196,148,58,.4)); }
.card-tagline {
  margin: 0;
  font-family: var(--font-caps);
  font-weight: 500;
  font-size: clamp(.95rem, 4vw, 1.1rem);
  line-height: 1.6;
  letter-spacing: .06em;
  color: var(--plum-soft);
}
.sparkle-divider {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  margin: 1.5rem auto;
  max-width: 220px;
  color: var(--gold);
}
.sparkle-divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-soft), transparent); }
.sparkle-divider i { font-style: normal; font-size: .9rem; }

.card-lead {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--plum-soft);
}
.card-name {
  margin: .1rem 0 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(3.8rem, 19vw, 5.2rem);
  line-height: 1.15;
  background: linear-gradient(180deg, #EC93B8, #BF4C7C);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  padding: 0 .2em;
}
.card-turning {
  margin: .2rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 5.4vw, 1.6rem);
  color: var(--plum);
}
.card-one {
  background: linear-gradient(180deg, #E8BE5E, #A97A27);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.card-message {
  margin: 1.3rem auto 0;
  max-width: 380px;
  font-size: 1.04rem;
  line-height: 1.75;
  color: var(--plum-soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.detail-tile {
  padding: 1rem .6rem;
  border-radius: 16px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(233,204,133,.85);
}
.detail-wide { grid-column: 1 / -1; }
.detail-label {
  margin: 0 0 .3rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}
.detail-value {
  margin: 0;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  color: var(--plum);
}
.detail-sub { margin: .2rem 0 0; font-size: .9rem; color: var(--plum-soft); }

/* ============ VENUE ============ */
.venue-address { margin: -.6rem 0 1.6rem; font-size: 1.02rem; color: var(--plum-soft); }
.map-frame {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 0 0 5px rgba(255,255,255,.65), 0 18px 40px rgba(125,95,152,.25);
  aspect-ratio: 4 / 3.4;
  background: var(--lavender);
}
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .95rem 1.6rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn-outline {
  margin-top: 1.5rem;
  color: var(--plum);
  background: rgba(255,255,255,.8);
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 6px 16px rgba(125,95,152,.18);
}

/* ============ RSVP ============ */
.rsvp-card {
  text-align: left;
  padding: 1.8rem 1.4rem 1.6rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(249,220,231,.65));
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 18px 40px rgba(125,95,152,.22);
}
.field { display: block; margin-bottom: 1.25rem; }
.field-label {
  display: block;
  margin-bottom: .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--plum-soft);
}
.field input[type="text"] {
  width: 100%;
  padding: .9rem 1rem;
  border-radius: 14px;
  border: 1.5px solid rgba(164,139,219,.45);
  background: #fff;
  font: 500 1rem var(--font-body);
  color: var(--plum);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input[type="text"]:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(235,163,192,.3); }
.field input.invalid { border-color: #D2556F; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px;
  padding: .6rem .5rem;
  text-align: center;
  border-radius: 14px;
  border: 1.5px solid rgba(164,139,219,.45);
  background: #fff;
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.25;
  color: var(--plum-soft);
  transition: all .2s ease;
}
.choice input:checked + span {
  border-color: var(--rose);
  background: linear-gradient(180deg, #FDEFF5, #F7D3E2);
  color: var(--plum);
  box-shadow: 0 4px 12px rgba(212,111,154,.25);
}
.choice input:focus-visible + span { outline: 2px solid var(--lilac); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: .9rem; }
.step-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-soft);
  background: #fff;
  font: 600 1.4rem var(--font-body);
  color: var(--rose);
  cursor: pointer;
  line-height: 1;
}
.step-btn:disabled { opacity: .4; cursor: default; }
#guests-count {
  min-width: 2ch;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 1.6rem;
  text-align: center;
  color: var(--plum);
}
#guests-field[hidden] { display: none; }
.field-error { margin: -.4rem 0 1rem; font-size: .9rem; font-weight: 600; color: #C2456A; }

.btn-whatsapp {
  width: 100%;
  margin-top: .3rem;
  padding: 1.05rem 1.2rem;
  color: #fff;
  background: linear-gradient(180deg, #2FD36B, #1EAE55);
  box-shadow: 0 10px 22px rgba(30,174,85,.35), inset 0 1px 0 rgba(255,255,255,.35);
}
.rsvp-contact {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: .95rem;
  color: var(--plum-soft);
}
.rsvp-contact a { color: var(--rose); font-weight: 700; text-decoration: none; }

/* ============ CLOSING ============ */
#closing { padding-bottom: 6.5rem; }
.closing-text { margin: 0; font-family: var(--font-caps); font-size: 1.05rem; letter-spacing: .06em; color: var(--plum-soft); }
.closing-name {
  margin: .2rem 0 .4rem;
  font-family: var(--font-script);
  font-size: 3.2rem;
  line-height: 1.2;
  color: var(--rose);
}
.closing-ornament { font-size: 1.4rem; letter-spacing: .3em; }

/* ============ SMALL SCREENS ============ */
@media (max-width: 380px) {
  .section-block { padding: 4.5rem 1rem; }
  .countdown-label { font-size: .58rem; letter-spacing: .1em; }
  .invite-card { padding: 2.8rem 1.1rem 2rem; }
  .choice span { font-size: .85rem; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

a:focus-visible, button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 3px;
}
