:root {
  --navy: #00338c;
  --navy-deep: #00153b;
  --ink: #0f1a33;
  --slate: #334155;
  --muted: #94a3b8;
  --mauve: #804b5b;
  --mauve-2: #a8788a;
  --rose-soft: #fff3f6;
  --rose-line: rgba(201, 118, 142, 0.28);
  --gold: #cfa24f;
  --gold-light: #e8c26e;
  --paper: #fffdfb;
  --line: #e2e8f0;
  --soft: #f6f8fb;

  --script: 'Bad Script', cursive;
  --serif: 'EB Garamond', Georgia, serif;
  --display: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mongol: 'Noto Sans Mongolian', serif;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(circle at 50% 0, #ecf4ff 0%, #f8fbff 38%, #fff 75%) fixed;
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }

button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; }

/* ============ COVER ============ */
.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 22px 22px,
    radial-gradient(120% 70% at 50% 0%, #0b49b8 0%, #00338c 45%, #001a4d 100%);
  transition: opacity 0.7s ease 0.25s, visibility 0s linear 0.95s;
}
.cover.is-leaving { opacity: 0; visibility: hidden; }

.cover-card {
  width: min(100%, 370px);
  padding: 40px 24px 28px;
  text-align: center;
  background: #f1f4f9;
  border-radius: 30px;
  box-shadow: 0 30px 80px rgba(0, 8, 35, 0.55);
  animation: cardIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: transform 0.6s cubic-bezier(0.5, 0, 0.2, 1), opacity 0.5s ease;
}
.cover.is-leaving .cover-card { transform: translateY(-24px) scale(0.95); opacity: 0; }

.cover-media {
  position: relative;
  width: 188px;
  aspect-ratio: 1;
  margin: 0 auto 26px;
  overflow: hidden;
  border-radius: 50%;
  border: 6px solid #fff;
  background: var(--navy);
  box-shadow: 0 10px 30px rgba(0, 30, 80, 0.18);
}
.cover-media > img,
.cover-media > svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-media > img { transform: scale(var(--cover-zoom, 1)); transform-origin: 50% 40%; }

.cover-guest {
  margin: 0 0 6px;
  font-family: var(--script);
  font-size: 19px;
  color: var(--mauve);
}
.cover-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 31px;
  line-height: 1.15;
  color: #0e1b3d;
  text-wrap: balance;
}
.cover-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 14px;
  font-size: 13px;
  color: #8aa0c8;
}
.cover-divider span { width: 70px; height: 1px; background: #cfd8e6; }
.cover-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 15px;
  font-weight: 600;
  color: #334a73;
}
.cover-date .ic { color: #8aa0c8; }

.cover-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 51, 140, 0.35);
  transition: transform 0.15s;
}
.cover-btn:active { transform: scale(0.98); }
.cover-btn .ic { position: absolute; right: 22px; }
.cover-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 3.4s ease-in-out 1.2s infinite;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } }
@keyframes shimmer { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ============ PAGE ============ */
.page {
  position: relative;
  max-width: 450px;
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: clip;
  text-align: center;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(0, 30, 80, 0.08);
}
section { position: relative; padding: 48px 28px; }

.script {
  margin: 0 0 18px;
  font-family: var(--script);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.25;
  color: var(--navy);
}

/* gold corner flourish */
.corner {
  position: absolute;
  z-index: 1;
  width: 96px;
  height: 96px;
  color: var(--gold);
  pointer-events: none;
}
.c-tl { top: 0; left: 0; }
.c-tr { top: 0; right: 0; transform: scaleX(-1); }
.c-bl { bottom: 0; left: 0; transform: scaleY(-1); }
.c-br { bottom: 0; right: 0; transform: scale(-1); }

/* lotus decoration */
.lotus {
  position: absolute;
  z-index: 2;
  width: 100px;
  height: 70px;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(201, 118, 142, 0.25));
  animation: sway 7s ease-in-out infinite;
}
.lotus--a { top: 4px; left: -30px; --r: 32deg; }
.lotus--b { bottom: 40px; right: -34px; width: 120px; height: 84px; --r: -28deg; animation-delay: -2s; }
.lotus--c { top: 70px; left: -38px; --r: 24deg; animation-delay: -4s; }
.lotus--d { top: 330px; right: -36px; --r: -22deg; animation-delay: -1s; }
.lotus--e { top: -10px; right: -38px; --r: -26deg; animation-delay: -3s; }
@keyframes sway {
  0%, 100% { transform: rotate(var(--r)) translateY(0); }
  50% { transform: rotate(calc(var(--r) + 5deg)) translateY(-6px); }
}

/* ============ HERO ============ */
.hero { padding: 56px 22px 28px; }
.hero-frame { position: relative; padding: 30px 22px; }
.hero-frame::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(207, 162, 79, 0.55);
  pointer-events: none;
}
.hero-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 22px;
  background: var(--navy);
  box-shadow: 0 18px 40px rgba(0, 25, 70, 0.22);
}
.hero-media,
.hero-media > img,
.hero-media > svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body.is-open .hero-media > img,
body.is-open .hero-media > svg { animation: settle 9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes settle { from { transform: scale(1.1); } }
@keyframes settle-photo { from { transform: scale(calc(var(--hero-zoom, 1) * 1.1)); } }
body.is-open .hero-media > img { animation-name: settle-photo; }

.art-mongol {
  position: absolute;
  top: 10%;
  left: 7%;
  max-height: 58%;
  writing-mode: vertical-lr;
  font-family: var(--mongol);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(232, 194, 110, 0.4);
}

.hero-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 80px 22px 22px;
  font-family: var(--script);
  font-size: 25px;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  background: linear-gradient(transparent, rgba(0, 10, 35, 0.55) 40%, rgba(0, 10, 35, 0.88));
}
.hero-caption.is-long { padding-top: 110px; font-size: 21px; }
.hero-media > img { object-position: 50% 30%; transform: scale(var(--hero-zoom, 1)); }

/* ============ INTRO ============ */
.intro { margin: 0 14px; padding: 48px 30px 36px; }
.intro .corner { width: 116px; height: 116px; }
.intro p {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.75;
  color: var(--navy);
  white-space: pre-line;
  text-wrap: pretty;
}

/* ============ WHEN ============ */
.when-month {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mauve);
}
.when-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 290px;
  margin: 0 auto 20px;
  font-family: var(--serif);
}
.when-row span {
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mauve);
}
.when-row strong {
  padding: 0 26px;
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  color: var(--navy);
  border-left: 1px solid var(--rose-line);
  border-right: 1px solid var(--rose-line);
}
.countdown {
  display: inline-block;
  margin: 0 0 44px;
  padding: 8px 22px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  background: var(--rose-soft);
  border: 1px solid var(--rose-line);
  border-radius: 999px;
}
.countdown b { font-weight: 600; }

/* calendar */
.cal {
  position: relative;
  max-width: 340px;
  margin: 0 auto 40px;
  padding: 34px 20px 28px;
  border: 1.5px solid var(--gold);
  border-radius: 44px;
}
.cal::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(207, 162, 79, 0.6);
  border-radius: 38px;
  pointer-events: none;
}
.cal-crest {
  position: absolute;
  left: 50%;
  width: 96px;
  height: 38px;
  padding: 0 8px;
  color: var(--gold);
  background: var(--paper);
}
.cal-crest.top { top: -20px; transform: translateX(-50%); }
.cal-crest.bottom { bottom: -20px; transform: translateX(-50%) rotate(180deg); }
.cal-side {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 72px;
  padding: 4px 0;
  color: var(--gold);
  background: var(--paper);
}
.cal-side.left { left: -8px; transform: translateY(-50%); }
.cal-side.right { right: -8px; transform: translateY(-50%); }

.cal-title {
  margin: 0 0 12px;
  padding-bottom: 12px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--mauve);
  border-bottom: 1px solid var(--rose-line);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 12px;
  font-family: var(--serif);
}
.cal-wd { font-size: 13px; color: var(--mauve-2); }
.cal-line { grid-column: 1 / -1; height: 2px; margin: -2px 0 4px; background: var(--navy); }
.cal-day { position: relative; font-size: 16px; line-height: 32px; color: var(--mauve); }
.cal-day.is-event { color: #fff; font-weight: 700; }
.cal-day.is-event svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 37px;
  fill: var(--navy);
  filter: drop-shadow(0 4px 8px rgba(0, 51, 140, 0.35));
  transform: translate(-50%, -50%);
  animation: beat 2s ease-in-out infinite;
}
.cal-day.is-event b { position: relative; font-size: 14.5px; }
@keyframes beat {
  0%, 100%, 40% { transform: translate(-50%, -50%) scale(1); }
  12% { transform: translate(-50%, -50%) scale(1.13); }
  26% { transform: translate(-50%, -50%) scale(1.06); }
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 30px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.2s, background-color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; pointer-events: none; }
.btn-navy { color: #fff; background: var(--navy); box-shadow: 0 8px 20px rgba(0, 51, 140, 0.25); }
.btn-outline {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  background: #fff;
  border-color: var(--navy);
}
.btn-soft { color: var(--ink); background: #fff; border-color: #edf0f5; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); }
.btn-ghost { color: var(--slate); background: var(--soft); border-color: var(--line); }
.btn-block { width: 100%; }
.text-btn {
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
}

/* ============ LOCATION ============ */
.venue-name { margin: 0; font-family: var(--serif); font-size: 20px; color: var(--mauve); }
.venue-address { margin: 6px 0 0; font-size: 14px; color: var(--mauve-2); }
.stack { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.stack .btn { min-width: 250px; }

.divider { display: block; width: 190px; height: 36px; margin: 4px auto; color: var(--gold); }

/* ============ WISHES ============ */
.wishes { padding-top: 32px; }
.wish-list { display: grid; gap: 14px; margin-bottom: 14px; text-align: left; }
.wish {
  padding: 18px 20px 12px;
  background: #fff;
  border: 1px solid var(--rose-line);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(128, 75, 91, 0.06);
  animation: fadeUp 0.5s both;
}
.wish header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.wish strong { font-size: 15.5px; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.wish time { flex: none; font-size: 12.5px; color: var(--mauve-2); }
.wish p {
  margin: 10px 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--mauve);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.wish footer { display: flex; justify-content: flex-end; padding-top: 10px; border-top: 1px solid #e8eaf3; }
.replies {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding-left: 14px;
  border-left: 2px solid rgba(207, 162, 79, 0.5);
}
.reply strong { font-size: 14px; }
.reply p { margin: 4px 0 0; font-size: 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
  background: var(--soft);
  border: 0;
  border-radius: 999px;
}
.chip .ic { width: 15px; height: 15px; }
.wish-empty {
  margin: 0;
  padding: 6px 0 10px;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  text-align: center;
  color: var(--mauve-2);
}
#wish-more { display: block; margin: -4px auto 16px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* ============ RSVP ============ */
.rsvp-card {
  padding: 26px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}
.rsvp-q,
.sheet-q {
  margin: 0 0 20px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: balance;
}
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice button {
  height: 56px;
  font-size: 15px;
  font-weight: 700;
  color: var(--slate);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.choice button:hover { color: var(--navy); background: #eef3fc; border-color: var(--navy); }

.form { display: grid; gap: 14px; text-align: left; }
.form label,
.form .field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--slate); }
.form em { font-style: normal; font-weight: 500; color: var(--muted); }
.form input,
.form textarea {
  width: 100%;
  padding: 12px 14px;
  font: 500 16px var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form input:focus,
.form textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0, 51, 140, 0.12); }
.form .is-invalid { border-color: #e11d48; }
.form-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 4px; }
.form-actions .btn { padding: 0 22px; }

.stepper {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.stepper button { width: 46px; height: 44px; font-size: 20px; color: var(--navy); background: var(--soft); border: 0; }
.stepper output { min-width: 54px; font-size: 16px; font-weight: 700; text-align: center; color: var(--ink); }

.rsvp-done { display: grid; justify-items: center; gap: 8px; }
.rsvp-done p { margin: 0; font-weight: 700; color: var(--ink); }
.done-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  color: #16a34a;
  background: #e9f7ef;
  border-radius: 50%;
}
.done-icon .ic { width: 24px; height: 24px; }

/* ============ FOOTER ============ */
.footer { padding: 24px 28px 72px; }
.footer .script { margin: 14px 0 6px; font-size: 28px; }
.host-name { margin: 0; font-family: var(--display); font-size: 23px; font-weight: 700; color: var(--navy); }

/* ============ MUSIC ============ */
.music-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, calc(50% - 225px + 14px));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(207, 162, 79, 0.6);
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(0, 30, 80, 0.15);
}
.music-btn.is-playing .ic { animation: spin 4s linear infinite; }
.music-btn:not(.is-playing)::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
}
@keyframes spin { to { transform: rotate(360deg); } }
.yt-hidden { position: fixed; bottom: 0; left: 0; z-index: -1; width: 200px; height: 200px; border: 0; opacity: 0; pointer-events: none; }

/* ============ SHEET ============ */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s;
}
.sheet-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 450px;
  max-height: 92dvh;
  overflow: auto;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 28px 28px 0 0;
  transform: translate(-50%, 100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet.is-open .sheet-panel { transform: translate(-50%, 0); }
.sheet-close {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--slate);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.sheet-head {
  margin-bottom: 12px;
  padding: 26px 22px 22px;
  text-align: center;
  background: var(--soft);
  border-radius: 22px;
}
.sheet-head .sheet-q { margin: 0; padding: 0 24px; }
.sheet-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  color: #fff;
  background: #0f172a;
  border-radius: 12px;
}
.sheet-icon .ic { width: 22px; height: 22px; }
.sheet-card { padding: 18px; border: 1px solid var(--line); border-radius: 22px; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 70;
  width: max-content;
  max-width: min(380px, calc(100% - 32px));
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: #fff;
  background: #0f172a;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ REVEAL ============ */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
