:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2f2a24;
  --muted: #7a7269;
  --accent: #9c7a4f;      /* warm gold */
  --accent-dark: #7d6039;
  --line: #e7e0d5;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(60, 50, 35, 0.08);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
/* The [hidden] attribute must win over any element's own display rule
   (e.g. .radio { display:flex }), otherwise JS toggling hidden has no effect. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 760px; margin: 0 auto; padding: 0 20px 80px; }

/* HERO */
.hero { text-align: center; padding: 72px 0 48px; }
.hero__eyebrow { color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.78rem; margin: 0 0 18px; }
.hero__names { font-family: var(--serif); font-weight: 500; font-size: clamp(3rem, 12vw, 5.5rem); line-height: 1.02; margin: 0; color: var(--accent-dark); }
.hero__tagline { font-family: var(--serif); font-style: italic; font-size: 1.5rem; color: var(--muted); margin: 8px 0 20px; }
.hero__date { font-size: 1.1rem; letter-spacing: 0.04em; margin: 0 0 24px; }
.countdown { font-family: var(--serif); font-size: 1.2rem; color: var(--accent-dark); margin-bottom: 24px; }

/* GREETING */
.greeting { text-align: center; font-family: var(--serif); font-size: 1.35rem; color: var(--accent-dark); margin: 0 0 28px; }

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 30px;
  margin: 22px 0;
}
.card h2 {
  font-family: var(--serif); font-weight: 600; font-size: 2rem;
  margin: 0 0 20px; color: var(--accent-dark); text-align: center;
}
.card h3 { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin: 0 0 6px; }
.muted { color: var(--muted); }
address { font-style: normal; line-height: 1.7; margin-bottom: 12px; }
.venue-name { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 6px; text-align: center; }
#location { text-align: center; }

/* ACCOMMODATION */
#accommodation { text-align: center; }
#accommodation p { margin: 0 0 12px; }
#accommodation .acc-price { font-family: var(--serif); font-size: 1.5rem; color: var(--accent-dark); margin: 4px 0 16px; }
#accommodation ul { list-style: none; padding: 0; margin: 16px 0 0; color: var(--muted); }
#accommodation ul li { margin: 6px 0; }
.acc-password {
  display: inline-block; font-family: var(--sans); font-weight: 700;
  letter-spacing: 0.18em; color: var(--accent-dark);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 1px 8px;
}

/* BUTTONS */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  font-family: var(--sans); font-size: 0.95rem; letter-spacing: 0.03em;
  padding: 11px 22px; border-radius: 999px; border: 1px solid var(--accent);
  color: var(--accent-dark); background: transparent; transition: all 0.15s ease;
  margin-top: 10px;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); width: 100%; padding: 14px; font-size: 1rem; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--primary:disabled { opacity: 0.6; cursor: default; }
.btn--ghost { border-color: var(--line); color: var(--muted); }

/* TIMELINE */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 18px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline__time { flex: 0 0 90px; font-weight: 500; color: var(--accent-dark); text-align: right; }
.timeline__body strong { display: block; font-weight: 500; }
.timeline__body em { color: var(--muted); font-style: normal; font-size: 0.95rem; }

/* MENU */
.menu { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 16px 0 20px; }
.menu__course ul { margin: 6px 0 0; padding-left: 18px; }
.menu__course li { margin: 4px 0; }
.drinks { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }

/* NOTES */
#notesList { margin: 0; padding-left: 20px; }
#notesList li { margin: 6px 0; }

/* RSVP FORM */
.rsvp form { display: grid; gap: 18px; margin-top: 18px; }
.rsvp label { display: block; font-size: 0.95rem; }
.rsvp input[type="text"], .rsvp input[type="number"], .rsvp select, .rsvp textarea {
  width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 1rem; background: #fff;
}
.rsvp textarea { resize: vertical; }
fieldset.attendance { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
fieldset.attendance legend { font-size: 0.95rem; margin-bottom: 6px; padding: 0; }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.radio input { accent-color: var(--accent); }
.attending-only { display: grid; gap: 16px; }

/* Named additional guests */
.field-label { font-size: 0.95rem; margin: 0 0 8px; }
.additionals-list { display: grid; gap: 10px; }
.checkbox { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.checkbox input { accent-color: var(--accent); width: auto; margin: 0; }
.checkbox span { font-size: 1rem; }
.additionals-total { font-family: var(--serif); color: var(--accent-dark); font-size: 1.05rem; margin: 10px 0 0; }

.form-status { text-align: center; color: var(--accent-dark); font-family: var(--serif); font-size: 1.1rem; min-height: 1.4em; margin: 4px 0 0; }

/* FOOTER */
.footer { text-align: center; padding: 48px 0 0; }
.footer p { margin: 2px 0; }
.footer p:first-child { font-family: var(--serif); font-size: 1.6rem; color: var(--accent-dark); }

@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .timeline__time { flex-basis: 74px; }
}

/* ===========================================================================
   SEALED ENVELOPE INTRO
   A full-screen envelope shown on load; clicking the wax seal opens the flap
   and dissolves the envelope to reveal the page beneath.
   =========================================================================== */
.envelope {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 820px at 50% 28%, #f4ede1, #e6dbc9);
  /* fade the whole overlay out AFTER the flap has opened */
  transition: opacity 0.6s ease 0.55s, visibility 0s linear 1.15s;
}
.envelope.is-open { opacity: 0; visibility: hidden; pointer-events: none; }
html.envelope-locked, html.envelope-locked body { overflow: hidden; }

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

.envelope__card {
  position: relative;
  width: min(86vw, 540px);
  aspect-ratio: 3 / 2;
  background: #fbf6ee;
  border: 1px solid #e3d8c6;
  border-radius: 10px;
  box-shadow: 0 30px 60px rgba(70, 55, 35, 0.28), inset 0 0 0 1px rgba(255,255,255,0.5);
  transform-style: preserve-3d;
  transition: transform 0.6s ease 0.45s, opacity 0.6s ease 0.45s;
}
.envelope.is-open .envelope__card { transform: translateY(-18px) scale(1.04); opacity: 0; }

/* front pocket: two seams rising from the bottom centre to the sides */
.envelope__pocket {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 64%;
  background: linear-gradient(180deg, #f1e7d6, #f8f2e7);
  clip-path: polygon(0 16%, 50% 100%, 100% 16%, 100% 100%, 0 100%);
  z-index: 3;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6);
}

/* top flap: a downward triangle, hinged at the top edge so it swings open */
.envelope__flap {
  position: absolute; top: 0; left: 0; width: 100%; height: 60%;
  background: linear-gradient(180deg, #f7f0e4, #ece0cd);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center; transform: rotateX(0deg);
  backface-visibility: hidden; z-index: 4;
  filter: drop-shadow(0 3px 3px rgba(120, 95, 60, 0.18));
  transition: transform 0.6s cubic-bezier(.6,.05,.3,1) 0.15s;
}
.envelope.is-open .envelope__flap { transform: rotateX(-172deg); }

/* wax seal */
.wax-seal {
  position: absolute; left: 50%; top: 57%; transform: translate(-50%, -50%);
  width: clamp(66px, 16vw, 98px); height: clamp(66px, 16vw, 98px);
  padding: 0; border: none; border-radius: 50%; cursor: pointer; z-index: 5;
  display: grid; place-items: center; color: #f3d9c9; font-family: var(--serif);
  background: radial-gradient(circle at 35% 30%, #a94d44, #7e2b28 55%, #5c1c1a 100%);
  box-shadow: 0 6px 16px rgba(80, 20, 18, 0.5),
              inset 0 2px 4px rgba(255,255,255,0.35),
              inset 0 -5px 9px rgba(0,0,0,0.38);
  animation: seal-pulse 2.6s ease-in-out infinite;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.wax-seal::before {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  border: 1px dashed rgba(243, 217, 201, 0.4);
}
.wax-seal__text { font-size: clamp(1.3rem, 5vw, 2rem); font-weight: 600; text-shadow: 0 1px 1px rgba(0,0,0,0.3); }
.wax-seal:hover { transform: translate(-50%, -50%) scale(1.05); }
.wax-seal:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 5px; }
.envelope.is-open .wax-seal { opacity: 0; transform: translate(-50%, -50%) scale(0.3); transition-delay: 0s; }

.envelope__hint {
  margin-top: 26px; color: #8a7d68; font-size: 0.82rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  animation: hint-fade 2.6s ease-in-out infinite;
}
.envelope.is-open .envelope__hint { opacity: 0; transition: opacity 0.3s ease; }

@keyframes seal-pulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(80,20,18,0.5), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -5px 9px rgba(0,0,0,0.38); }
  50%      { box-shadow: 0 6px 22px rgba(80,20,18,0.62), 0 0 0 7px rgba(126,43,40,0.12), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -5px 9px rgba(0,0,0,0.38); }
}
@keyframes hint-fade { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .envelope, .envelope__flap, .envelope__card, .wax-seal, .envelope__hint {
    transition-duration: 0.01ms !important; animation: none !important;
  }
}
