:root {
  color-scheme: dark;
  --navy: #061a3b;
  --navy-soft: #0c2751;
  --ink: #f9f0df;
  --muted: #b7bfd8;
  --gold: #f1ce93;
  --lavender: #c4afe3;
  --line: rgba(241, 206, 147, 0.34);
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--sans);
  min-width: 320px;
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.opening,
.hero {
  min-height: 100svh;
  background-color: var(--navy);
  background-image: url("assets/moonlit-sky.webp");
  background-size: cover;
  background-position: center top;
  position: relative;
  overflow: hidden;
}

.opening {
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  padding: 9svh 24px 28px;
  transition: opacity 1s ease, visibility 1s ease;
  z-index: 10;
}
.opening.is-open { opacity: 0; visibility: hidden; pointer-events: none; }
.opening-copy { text-align: center; z-index: 2; }
.opening h1,
.opening-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 10vw, 4.5rem);
  line-height: 0.95;
  margin: 12px 0 0;
  color: var(--ink);
  text-shadow: 0 4px 24px #061a3b;
}
.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  line-height: 1.6;
  margin: 0 0 12px;
}
.moon-trigger {
  align-self: center;
  width: min(70vw, 360px);
  aspect-ratio: 1;
  margin-top: -10svh;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  text-shadow: 0 2px 12px #061a3b;
  animation: breathe 2.6s ease-in-out infinite;
}
.moon-trigger span {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 26, 59, 0.72);
}
.opening-note { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; margin: 0; }

.invitation { display: none; background: var(--navy); }
.invitation.is-visible { display: block; }
.hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  text-align: center;
  padding: 39svh 22px 8svh;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 43%;
  background: rgba(6, 26, 59, 0.9);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; max-width: 680px; }
.hero h1,
.hero h2,
.story-section h3,
.rsvp-panel h2 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
}
.hero h1,
.hero h2 {
  font-size: clamp(3rem, 12vw, 6.5rem);
  line-height: 0.87;
  margin: 8px 0 24px;
  letter-spacing: -0.045em;
}
.hero h1 em,
.hero h2 em { color: var(--gold); font-size: 0.55em; font-weight: 400; }
.intro { color: var(--muted); font-family: var(--serif); font-size: clamp(1.05rem, 4.5vw, 1.45rem); line-height: 1.55; margin: 0 auto 26px; }
.event-summary { padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); width: 100%; }
.event-summary p { margin: 5px 0; font-size: 0.82rem; letter-spacing: 0.06em; }

.primary-button,
.secondary-button {
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  margin-top: 28px;
  padding: 0 26px;
  background: var(--gold);
  border: 1px solid #fff0ce;
  color: #071b3b;
  font-family: var(--serif);
  font-size: 1.06rem;
  box-shadow: 0 12px 34px rgba(241, 206, 147, 0.2);
}
.primary-button:hover,
.secondary-button:hover { transform: translateY(-2px); }
.primary-button:focus-visible,
.secondary-button:focus-visible,
.moon-trigger:focus-visible,
.text-link:focus-visible { outline: 3px solid var(--lavender); outline-offset: 4px; }
.text-link { color: var(--lavender); margin-top: 22px; font-size: 0.78rem; letter-spacing: 0.13em; text-transform: uppercase; text-underline-offset: 5px; }

.story-section {
  padding: 100px max(24px, calc((100vw - 760px) / 2));
  text-align: center;
  border-top: 1px solid var(--line);
  background-color: var(--navy);
}
.story-section h3 { font-size: clamp(2.3rem, 9vw, 4.8rem); line-height: 0.98; letter-spacing: -0.035em; margin: 8px 0 34px; }
.section-copy { color: var(--muted); font-family: var(--serif); font-size: 1.1rem; line-height: 1.65; max-width: 560px; margin: 0 auto 26px; }
.countdown-section { background-color: #0b234a; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.countdown span { padding: 22px 4px; color: var(--muted); text-transform: uppercase; font-size: 0.56rem; letter-spacing: 0.12em; border-right: 1px solid var(--line); }
.countdown span:last-child { border-right: 0; }
.countdown strong { display: block; color: var(--ink); font-family: var(--serif); font-size: clamp(1.6rem, 7vw, 3rem); font-weight: 400; margin-bottom: 4px; }
.detail-lines { text-align: left; border-top: 1px solid var(--line); max-width: 620px; margin: 0 auto; }
.detail-lines article { display: grid; grid-template-columns: 100px 1fr; gap: 18px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.detail-lines p { margin: 0; color: var(--muted); line-height: 1.65; }
.detail-lines .detail-label { color: var(--gold); text-transform: uppercase; letter-spacing: 0.13em; font-size: 0.7rem; padding-top: 4px; }
.button-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.secondary-button { min-height: 48px; padding: 13px 20px; color: var(--gold); background: transparent; border: 1px solid var(--line); }
.wish-section { background-color: #0b234a; }
.wish-form { max-width: 560px; margin: 32px auto 0; text-align: left; }
label, legend { display: block; color: var(--gold); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; margin: 18px 0 8px; }
label span { color: var(--muted); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #061a3b;
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(241, 206, 147, 0.12); }
.wish-form .primary-button, .rsvp-panel .primary-button { width: 100%; }
.form-success { color: var(--gold); font-family: var(--serif); font-size: 1.1rem; line-height: 1.5; margin-top: 26px; }
.closing-section {
  min-height: 82svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--navy);
  background-image: url("assets/moonlit-sky.webp");
  background-size: cover;
  background-position: center bottom;
}
.closing-signature { color: var(--muted); font-family: var(--serif); margin-top: 44px; line-height: 1.8; }
.closing-signature em { color: var(--gold); font-size: 1.4rem; }

.rsvp-dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; background: rgba(2, 12, 30, 0.82); padding: 0; }
.rsvp-dialog::backdrop { background: rgba(2, 12, 30, 0.8); }
.rsvp-panel { width: min(100%, 560px); min-height: 100%; margin-left: auto; padding: 34px 24px 60px; background: var(--navy-soft); color: var(--ink); overflow-y: auto; }
.rsvp-panel h2 { font-size: 2.6rem; margin: 4px 0 28px; }
.close-button { float: right; border: 0; background: transparent; color: var(--muted); padding: 8px; text-decoration: underline; text-underline-offset: 4px; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; }
.choice { display: flex; align-items: center; gap: 10px; color: var(--ink); background: #061a3b; border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-transform: none; letter-spacing: 0; font-size: 0.95rem; margin: 9px 0; }
.choice input { width: auto; margin: 0; accent-color: var(--gold); }

.reveal { opacity: 0; transform: translateY(18px); }
.invitation.is-revealed .reveal { animation: rise 0.75s ease forwards; }
.invitation.is-revealed .reveal:nth-child(2) { animation-delay: 0.12s; }
.invitation.is-revealed .reveal:nth-child(3) { animation-delay: 0.24s; }
.invitation.is-revealed .reveal:nth-child(4) { animation-delay: 0.36s; }
.invitation.is-revealed .reveal:nth-child(5) { animation-delay: 0.48s; }
.invitation.is-revealed .reveal:nth-child(6) { animation-delay: 0.6s; }

.demo-notice {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(246, 226, 170, 0.55);
  background: rgba(6, 26, 59, 0.92);
  color: var(--ivory);
  font-size: 0.88rem;
}

.demo-notice a {
  color: var(--gold);
  font-weight: 800;
}

@keyframes breathe { 50% { transform: scale(1.035); } }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

@media (min-width: 720px) {
  .opening,
  .hero {
    background-size: cover;
    background-repeat: no-repeat;
  }
  .opening { background-position: center 42%; }
  .hero { background-position: center 42%; padding-top: 41svh; }
  .hero::after { height: 48%; }
  .closing-section { background-position: center 70%; }
  .rsvp-panel { min-height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
