*, *::before, *::after { box-sizing: border-box; }
:root {
  --ink: #0e0e0e;
  --accent: #fbca25;
  --paper: #f6f4ee;
  --card: #ffffff;
  --line: #e7e3d8;
  --muted: #74716a;
  --display: 'Marcellus', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.stage-details { overflow-y: auto; }
button { font: inherit; cursor: pointer; }
.leaf { display: block; fill: var(--accent); }

.logo { display: block; width: min(320px, 72vw); height: auto; margin: 0 auto; }
.logo.small { width: 150px; }
.wordmark { font-family: var(--display); font-weight: 400; font-size: clamp(2.4rem, 10vw, 4rem); letter-spacing: .12em; text-transform: uppercase; margin: 0; }
.wordmark.small { font-size: 1.4rem; }

/* ---------- 1. Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; text-align: center;
  background: var(--paper); padding: 24px 16px; overflow: hidden;
  transition: opacity .9s ease, visibility .9s;
}
.sun {
  position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent) 0%, transparent 60%);
  top: -45vmax; right: -40vmax; pointer-events: none;
  animation: sunIn 2.4s ease forwards; opacity: 0;
}
@keyframes sunIn { to { opacity: 1; } }

.intro-content { position: relative; z-index: 1; max-width: 520px; width: 100%; }
.intro-leaf { width: 34px; margin: 0 auto 26px; animation: leafFall 1.6s cubic-bezier(.3,.9,.3,1) forwards; opacity: 0; }
@keyframes leafFall {
  0% { opacity: 0; transform: translate(40px, -120px) rotate(-40deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.intro-content .logo, .intro-content .wordmark {
  clip-path: inset(0 100% 0 0); animation: wipe 1.3s .9s cubic-bezier(.7,0,.2,1) forwards;
}
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }
.intro-content > .rule, .intro-content > p, .intro-content > button { opacity: 0; animation: rise .9s ease forwards; }
.rule { width: 0; height: 1px; background: var(--ink); margin: 34px auto 26px; }
.intro-content > .rule { animation: rise .6s 2.1s ease forwards, grow 1s 2.1s ease forwards; }
@keyframes grow { to { width: 56px; } }
.intro-kicker { animation-delay: 2.3s !important; font-size: .78rem; letter-spacing: .45em; text-transform: uppercase; margin: 0; color: var(--muted); }
.intro-guest { animation-delay: 2.5s !important; font-family: var(--display); font-size: clamp(1.6rem, 6vw, 2.2rem); margin: 10px 0 0; }
.btn-open { animation-delay: 2.8s !important; }
.intro-hint { animation-delay: 3s !important; font-size: .75rem; color: var(--muted); margin-top: 16px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.btn-open {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 32px;
  padding: 16px 30px 16px 24px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-weight: 500; letter-spacing: .22em; text-transform: uppercase; font-size: .74rem;
  transition: transform .25s, box-shadow .25s;
}
.btn-open:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); }
.btn-open .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent); animation: ping 1.8s 3.5s infinite;
}
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

body:not(.stage-intro) .intro { opacity: 0; visibility: hidden; }

/* ---------- 2. Video ---------- */
.video-stage {
  position: fixed; inset: 0; z-index: 20; background: #000;
  opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility .8s;
}
body.stage-video .video-stage { opacity: 1; visibility: visible; }
.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); }
.video-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.video-controls { position: absolute; right: 16px; bottom: 20px; display: flex; gap: 8px; }
.chip {
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.45); color: #fff; border-radius: 999px;
  padding: 8px 16px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; backdrop-filter: blur(6px);
}
.tap-to-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); cursor: pointer; }
.tap-to-play span { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--ink); font-size: 1.4rem; }
.tap-to-play[hidden] { display: none; }

/* ---------- 3. Details ---------- */
.details {
  min-height: 100%; padding: 40px 16px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 40%),
    var(--paper);
  opacity: 0; transition: opacity 1s ease;
}
body.stage-details .details { opacity: 1; }
.card {
  width: 100%; max-width: 540px; background: var(--card);
  padding: 40px 32px 30px; border-radius: 28px; text-align: center;
  box-shadow: 0 1px 0 var(--line), 0 30px 70px -30px rgba(40, 32, 0, .25);
}
.card-top { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.dear { margin: 0 0 4px; font-size: 1rem; color: var(--muted); }
.dear b { color: var(--ink); font-weight: 500; }
.invite-line { margin: 0; font-size: .74rem; letter-spacing: .35em; text-transform: uppercase; color: var(--muted); }
.event-title { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.1; margin: 12px 0 10px; letter-spacing: .02em; }
.event-desc { color: var(--muted); line-height: 1.65; margin: 0 auto 26px; max-width: 400px; font-weight: 300; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.info { background: var(--paper); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.info.wide { grid-column: 1 / -1; }
.info small { font-size: .64rem; text-transform: uppercase; letter-spacing: .24em; color: var(--muted); font-weight: 500; }
.info small::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.info b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; margin-top: 4px; }
.info span { font-size: .85rem; color: var(--muted); }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 0; }
.countdown div { background: var(--ink); color: #fff; border-radius: 16px; padding: 14px 0 12px; }
.countdown b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--accent); line-height: 1; }
.countdown small { font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; opacity: .6; }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; margin: 22px 0 12px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; border-radius: 16px; text-decoration: none; border: 1px solid var(--line);
  color: var(--ink); font-size: .7rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  transition: background .2s, border-color .2s, transform .2s;
}
.action svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.action:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); transform: translateY(-2px); }
.contact-line { font-size: .82rem; color: var(--muted); }
.contact-line a { color: var(--ink); }

.rsvp-status {
  margin: 18px 0 0; padding: 12px 16px; border-radius: 14px; font-size: .9rem; font-weight: 500;
  background: color-mix(in srgb, var(--accent) 25%, #fff);
}
.rsvp-status::before { content: '✓  '; }
.rsvp-status.no { background: var(--paper); color: var(--muted); }
.rsvp-status.no::before { content: ''; }
.rsvp-status[hidden] { display: none; }
.bottom-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.deadline { font-size: .78rem; color: var(--muted); margin: 14px 0 0; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin: 26px 0 0; }
.footer-brand .leaf { width: 9px; }

.btn-primary, .btn-ghost {
  padding: 15px 26px; border-radius: 999px; font-weight: 500; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase;
  border: 1px solid var(--ink); transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
button:disabled { opacity: .6; cursor: wait; }

/* ---------- 4. Modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(14, 14, 14, .55); backdrop-filter: blur(6px); animation: fade .3s ease;
}
.modal[hidden] { display: none; }
.modal-box {
  position: relative; width: 100%; max-width: 400px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--card); padding: 34px 26px 26px; border-radius: 28px; text-align: center;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.45);
  animation: pop .5s cubic-bezier(.2,1.2,.4,1);
}
.modal-leaf { width: 22px; margin: 0 auto 14px; }
.modal-box h3 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 0 0 6px; }
.modal-sub { color: var(--muted); margin: 0 0 20px; font-size: .92rem; }
.guest-name {
  font-family: var(--display); font-size: 1.5rem; margin: -6px 0 22px; padding: 14px 16px;
  background: var(--paper); border-radius: 16px;
}
.modal-close { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 1.6rem; color: #aaa; line-height: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(24px); } }

.name-input {
  display: block; width: 100%; padding: 16px 18px; margin-bottom: 18px; text-align: center;
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
  font-family: var(--display); font-size: 1.2rem; color: var(--ink);
}
.name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.form-error { color: #b3261e; font-size: .85rem; margin: 12px 0 0; }
.form-error[hidden] { display: none; }

.thanks .check {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent);
}
.thanks .check svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .5s .3s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (max-width: 420px) {
  .card { padding: 32px 18px 24px; border-radius: 22px; }
  .countdown { gap: 6px; }
  .countdown b { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
}
