/* ═══════════════════ Royal theme tokens ═══════════════════ */
:root {
  --royal: #1e3a8a;
  --royal-deep: #16295f;
  --royal-mid: #3558c0;
  --sky: #a8c4e8;
  --gold: #c9a227;
  --gold-light: #e8c96a;
  --gold-deep: #a07f1f;
  --gold-pale: #f3e3b3;
  --parchment: #f1f1f3;
  --parchment-dark: #e6e6ea;
  --ink: #34342f;
  --ink-soft: #6b6a63;
  --nav-h: 54px;
  --font-script: "Great Vibes", "Snell Roundhand", cursive;
  --font-serif: "Cormorant Garamond", "Georgia", serif;
  --shadow-soft: 0 12px 30px rgba(30,58,138,.16);
  --shadow-art: drop-shadow(0 12px 20px rgba(30,58,138,.22));
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  color: var(--ink);
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
  background:
    radial-gradient(ellipse 90% 60% at 20% 8%, rgba(168,196,232,.20), transparent 60%),
    radial-gradient(ellipse 80% 50% at 85% 38%, rgba(201,162,39,.12), transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% 96%, rgba(168,196,232,.16), transparent 65%),
    url("../assets/art/parchment.jpg") center / 560px repeat,
    var(--parchment);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 540px; margin: 0 auto; position: relative; }

section { position: relative; padding: 58px 24px; text-align: center; scroll-margin-top: var(--nav-h); }

/* ═══════════════════ Envelope intro ═══════════════════ */
#envelope-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 120% 90% at 50% 30%, rgba(168,196,232,.30), transparent 70%),
    url("../assets/art/parchment.jpg") center / 560px repeat, var(--parchment-dark);
  transition: opacity .8s ease;
}
#envelope-overlay.fade-out { opacity: 0; pointer-events: none; }

.env-stage { perspective: 1400px; text-align: center; }

.envelope {
  position: relative;
  width: min(360px, 86vw);
  height: min(238px, 56.8vw);
  margin: 0 auto;
  transform-style: preserve-3d;
  filter: drop-shadow(0 22px 34px rgba(30,58,138,.26));
}
.env-back, .env-pocket, .env-flap { position: absolute; inset: 0; border-radius: 12px; }

.env-back { z-index: 1; background: linear-gradient(160deg, #fffdf8, #ece7db); }

.env-card {
  position: absolute; z-index: 2; left: 7%; right: 7%; top: 6%; bottom: 9%;
  border-radius: 8px;
  background: linear-gradient(170deg, #fffef9, #f5f0e4);
  border: 1.5px solid var(--gold-light);
  box-shadow: 0 4px 14px rgba(30,58,138,.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  opacity: 0;
  transition: transform 1s cubic-bezier(.2,.85,.3,1.05) .55s, opacity .4s ease .5s;
}
.env-card-crown { font-size: 26px; line-height: 1; }
.env-card-script { font-family: var(--font-script); font-size: 34px; color: var(--royal); line-height: 1; }
.env-card-caps { font-size: 12px; letter-spacing: .34em; text-transform: uppercase; color: var(--gold-deep); margin-top: 4px; }
.env-card-rule { width: 46px; height: 1px; background: var(--gold-light); margin: 5px 0; }
.env-card-sub { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-soft); }

.env-pocket {
  z-index: 3;
  background:
    linear-gradient(to bottom right, transparent 49.6%, #f1eee4 50%) top left / 50.5% 100% no-repeat,
    linear-gradient(to bottom left,  transparent 49.6%, #f1eee4 50%) top right / 50.5% 100% no-repeat,
    linear-gradient(to top, #faf8f2 0 40%, transparent 62%) bottom / 100% 100% no-repeat;
  box-shadow: inset 0 -2px 8px rgba(30,58,138,.07);
}
.env-flap {
  z-index: 4;
  clip-path: polygon(0 0, 100% 0, 50% 60%);
  background: linear-gradient(to bottom, #f7f5ed, #e7e2d3);
  transform-origin: top center; backface-visibility: hidden;
  transition: transform .85s cubic-bezier(.6,.02,.28,1);
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
.envelope.open .env-flap { transform: rotateX(-172deg); }
.envelope.open .env-card { transform: translateY(-128%) scale(1.06); z-index: 6; opacity: 1; }

.wax-seal {
  position: absolute; z-index: 5; left: 50%; top: 47%;
  width: min(112px, 29vw); height: min(112px, 29vw);
  transform: translate(-50%, -50%);
  background: none; border: none; cursor: pointer;
  animation: seal-pulse 2.4s ease-in-out infinite;
  transition: transform .5s ease, opacity .5s ease;
  filter: drop-shadow(0 5px 8px rgba(22,41,95,.4));
}
.wax-seal svg { width: 100%; height: 100%; overflow: visible; }
.envelope.open .wax-seal { transform: translate(-50%, -85%) scale(1.5) rotate(-12deg); opacity: 0; pointer-events: none; }
@keyframes seal-pulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.05); } }

.tap-hint {
  margin-top: 30px; font-size: 14px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink-soft); animation: hint-fade 2.4s ease-in-out infinite;
}
.envelope.open ~ .tap-hint { opacity: 0; transition: opacity .3s; }
@keyframes hint-fade { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ═══════════════════ Sticky nav ═══════════════════ */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 16px;
  background: rgba(244,243,247,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,162,39,.32);
  transform: translateY(-100%); transition: transform .5s ease;
}
.site-nav[hidden] { display: none; }
.site-nav.show { transform: translateY(0); }
.nav-brand { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--royal); }
.nav-crown { font-size: 18px; }
.nav-name { font-family: var(--font-script); font-size: 24px; line-height: 1; color: var(--royal); }
.nav-links { display: flex; gap: clamp(10px, 3.4vw, 22px); }
.nav-links a {
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  color: var(--ink-soft); padding: 4px 2px; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.nav-links a.active, .nav-links a:hover { color: var(--royal); border-color: var(--gold); }
.nav-share {
  font-family: var(--font-serif); font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: #fffdf6; background: linear-gradient(160deg, var(--royal-mid), var(--royal));
  border: 1px solid var(--gold-light); border-radius: 999px; padding: 7px 14px; cursor: pointer;
}
@media (max-width: 400px) { .nav-share { display: none; } }

/* ═══════════════════ Scroll reveals / motion ═══════════════════ */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s cubic-bezier(.2,.7,.3,1), transform 1s cubic-bezier(.2,.7,.3,1); }
.reveal.revealed { opacity: 1; transform: none; }
.floaty { animation: floaty 4.6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.parallax { translate: 0 var(--px, 0px); will-change: translate; }

/* ═══════════════════ Sparkles ═══════════════════ */
.sparkle-field { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sparkle { position: absolute; color: var(--gold-light); text-shadow: 0 0 8px rgba(232,201,106,.9); animation: twinkle 3s ease-in-out infinite; opacity: 0; }
@keyframes twinkle { 0%,100% { opacity: 0; transform: scale(.5) rotate(0); } 50% { opacity: .95; transform: scale(1.15) rotate(25deg); } }

/* ═══════════════════ Divider ═══════════════════ */
.divider { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 24px; opacity: .9; }
.divider::before, .divider::after { content: ""; height: 1px; width: min(80px, 22vw); background: linear-gradient(to var(--d, right), transparent, var(--gold-light)); }
.divider::after { --d: left; }
.divider span { color: var(--gold); font-size: 18px; }

/* ═══════════════════ Hero ═══════════════════ */
.hero { padding-top: 40px; min-height: 90vh; display: flex; flex-direction: column; align-items: center; }
.hero-title { margin: 0; width: min(94%, 470px); }
.title-art { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(30,58,138,.18)); }
.hero-chars { width: min(102%, 530px); height: auto; display: block; margin: -4% auto 0; filter: var(--shadow-art); }

.countdown {
  display: inline-block; margin-top: 26px; padding: 9px 22px;
  border: 1px solid var(--gold-light); border-radius: 999px; background: rgba(255,253,246,.78);
  font-size: 14px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-deep);
}
.scroll-cue { display: inline-block; margin-top: 26px; font-size: 26px; color: var(--gold); text-decoration: none; animation: cue-bob 1.8s ease-in-out infinite; }
@keyframes cue-bob { 0%,100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(8px); opacity: 1; } }

/* ═══════════════════ Details ═══════════════════ */
.details { padding-top: 26px; }
.balloons { position: absolute; top: 40%; width: clamp(74px, 21vw, 108px); height: auto; opacity: .96; pointer-events: none; filter: drop-shadow(0 8px 12px rgba(30,58,138,.18)); z-index: -1; }
.balloons-left  { left: -12px; animation-duration: 5.5s; }
.balloons-right { right: -12px; top: 44%; animation-duration: 6.2s; animation-direction: reverse; }
.details-cake { display: block; width: clamp(120px, 34vw, 168px); height: auto; margin: 0 auto 6px; filter: drop-shadow(0 10px 16px rgba(30,58,138,.20)); }

.eyebrow { font-size: 15px; letter-spacing: .3em; text-transform: uppercase; line-height: 2; color: var(--ink); }
.name-script { font-family: var(--font-script); font-size: clamp(64px, 19vw, 96px); color: var(--gold-deep); line-height: 1.1; margin-top: 8px; }
.first-birthday { font-size: clamp(22px, 6.4vw, 30px); letter-spacing: .24em; text-transform: uppercase; margin-bottom: 32px; }

.date-row { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 18px; }
.date-side { font-size: 22px; letter-spacing: .22em; text-transform: uppercase; padding: 8px 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.date-num { font-size: 64px; color: var(--gold); line-height: 1; }
.detail-line { font-size: 20px; letter-spacing: .2em; text-transform: uppercase; line-height: 1.9; }
.venue-name { margin-top: 14px; font-weight: 600; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 32px; }
.royal-btn {
  display: inline-block; font-family: var(--font-serif); font-size: 16px; letter-spacing: .14em;
  text-transform: uppercase; text-decoration: none; color: #fffdf6;
  background: linear-gradient(160deg, var(--royal-mid), var(--royal) 60%, var(--royal-deep));
  border: 1.5px solid var(--gold-light); border-radius: 999px; padding: 13px 24px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(30,58,138,.28); transition: transform .2s ease, box-shadow .2s ease;
}
.royal-btn:active { transform: scale(.97); }
.royal-btn.ghost { color: var(--royal); background: rgba(255,253,248,.9); box-shadow: 0 3px 10px rgba(30,58,138,.14); }

/* ═══════════════════ Section titles ═══════════════════ */
.section-title { font-weight: 400; margin-bottom: 22px; }
.script-gold {
  font-family: var(--font-script); font-size: clamp(40px, 11vw, 54px);
  background: linear-gradient(120deg, var(--gold-deep), var(--gold-light) 50%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ═══════════════════ Video ═══════════════════ */
.video-frame { border: 3px solid var(--gold-light); border-radius: 18px; overflow: hidden; box-shadow: 0 10px 30px rgba(30,58,138,.22); background: var(--royal-deep); }
.video-frame video { display: block; width: 100%; }

/* ═══════════════════ Hosts ═══════════════════ */
.hosts { padding-top: 40px; }
.hosts .eyebrow { margin-bottom: 6px; }
.hosts .section-title { margin-bottom: 26px; }
.host-featured { margin: 0 auto 8px; }
.host-names { font-size: clamp(22px, 5.6vw, 28px); color: var(--gold-deep); font-weight: 500; line-height: 1.3; }
.host-featured .host-names { font-size: clamp(25px, 6.8vw, 32px); }
.host-role { font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--royal); margin-top: 7px; }
.host-divider { font-size: 22px; color: var(--gold); margin: 20px 0 26px; }
.host-grid { display: grid; grid-template-columns: 1fr; gap: 30px; max-width: 460px; margin: 0 auto; }
@media (min-width: 480px) { .host-grid { grid-template-columns: 1fr 1fr; } }

/* ═══════════════════ Royal cards (RSVP / dress code) ═══════════════════ */
.card-section { padding-top: 28px; padding-bottom: 28px; }
.card-section.has-scene { position: relative; }
.card-section.has-scene::before {
  content: ""; position: absolute; inset: 0;
  background: url("../assets/art/cards_soft.jpg") center / cover no-repeat;
  opacity: .5;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  pointer-events: none;
}
.card-section.has-scene > * { position: relative; z-index: 1; }

.royal-card {
  position: relative; border: 3px solid var(--royal); border-radius: 28px;
  background: rgba(255,253,248,.94);
  box-shadow: 0 0 0 6px rgba(255,253,248,.6), var(--shadow-soft);
  padding: 40px 26px;
}
.card-title { font-family: var(--font-serif); font-weight: 500; font-size: clamp(34px, 9vw, 42px); color: var(--royal); margin-bottom: 14px; }
.card-body { font-size: 18px; letter-spacing: .14em; text-transform: uppercase; line-height: 2; }
.card-body strong { color: var(--gold-deep); }

/* ═══════════════════ RSVP form ═══════════════════ */
#rsvp-form { margin-top: 28px; text-align: left; }
.field { display: block; margin-bottom: 20px; }
.field-label { display: block; font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--royal); margin-bottom: 8px; }
.field-label small { text-transform: none; letter-spacing: .04em; color: var(--ink-soft); font-size: 13px; }
input[type="text"], input[type="email"], textarea {
  width: 100%; font-family: var(--font-serif); font-size: 18px; color: var(--ink);
  background: #fffef9; border: 1.5px solid #cfc7ae; border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.18); }
textarea { resize: vertical; }

.attend-toggle { display: grid; grid-template-columns: 1fr; gap: 10px; }
.attend-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.attend-toggle label { display: block; text-align: center; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; padding: 13px 10px; border: 1.5px solid #cfc7ae; border-radius: 12px; background: #fffef9; cursor: pointer; transition: all .2s; }
.attend-toggle input:checked + label { background: linear-gradient(160deg, var(--royal-mid), var(--royal)); border-color: var(--gold-light); color: #fffdf6; box-shadow: 0 4px 12px rgba(30,58,138,.25); }
.attend-toggle input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }

.counts-row { display: flex; gap: 18px; }
.count-field { flex: 1; }
.counts-row.hidden-soft { display: none; }
.stepper { display: flex; align-items: stretch; border: 1.5px solid #cfc7ae; border-radius: 12px; overflow: hidden; background: #fffef9; }
.stepper input { width: 100%; text-align: center; font-family: var(--font-serif); font-size: 20px; border: none; background: transparent; outline: none; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.step-btn { width: 44px; font-size: 22px; border: none; background: var(--gold-pale); color: #7c6516; cursor: pointer; transition: background .15s; }
.step-btn:active { background: var(--gold-light); }

.submit-btn { width: 100%; font-size: 18px; padding: 16px; margin-top: 4px; }
.submit-btn[disabled] { opacity: .6; cursor: default; }
.form-status { min-height: 24px; margin-top: 12px; text-align: center; font-size: 16px; color: #a03e3e; }
.form-status.ok { color: #2e6b3f; }

.rsvp-done { padding: 26px 6px 6px; animation: done-pop .6s cubic-bezier(.3,1.4,.5,1); text-align: center; }
.done-crown { font-size: 46px; display: inline-block; animation: floaty 3s ease-in-out infinite; }
.done-title { font-family: var(--font-script); font-size: 36px; color: var(--royal); margin: 10px 0 8px; }
.done-body { font-size: 17px; letter-spacing: .06em; margin-bottom: 18px; }
.share-inline { font-size: 15px; }
@keyframes done-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ═══════════════════ Wishes wall ═══════════════════ */
.wishes { padding-top: 40px; }
.wishes .eyebrow { margin-bottom: 4px; }
.wishes-list { display: flex; flex-direction: column; gap: 16px; max-width: 480px; margin: 24px auto 0; }
.wish-card {
  position: relative; text-align: left; background: rgba(255,253,248,.95);
  border: 1.5px solid var(--gold-light); border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 6px 16px rgba(30,58,138,.10);
}
.wish-msg { font-size: 18px; line-height: 1.5; color: var(--ink); }
.wish-name { margin-top: 10px; font-family: var(--font-script); font-size: 26px; color: var(--gold-deep); }
.wish-name::before { content: "— "; }

/* ═══════════════════ Closing ═══════════════════ */
.closing { padding-top: 40px; padding-bottom: 44px; }
.closing-crown { font-size: 34px; display: inline-block; margin-bottom: 6px; animation: floaty 4.5s ease-in-out infinite; }
.closing-title { line-height: 1.08; }

/* ═══════════════════ Footer ═══════════════════ */
.site-footer { text-align: center; padding: 40px 24px 40px; background: linear-gradient(to top, rgba(168,196,232,.30), transparent); }
.foot-crown { font-size: 30px; }
.foot-title { font-family: var(--font-script); font-size: 34px; color: var(--royal); margin-top: 6px; }
.foot-line { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-top: 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 10px; }
.foot-links a { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--royal); }
.foot-links span { color: var(--gold); }
.foot-note { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.foot-top { display: inline-block; margin-top: 16px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); text-decoration: none; }

/* ═══════════════════ Motion preferences ═══════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .25s !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

@media (min-width: 480px) { .attend-toggle { grid-template-columns: 1fr 1fr; } }
