:root {
  --cream: #FBF6EC;
  --ink: #3A2E2E;
  --muted: #8A7A68;
  --maroon: #7A2E2E;
  --gold: #CBA857;
  --line: #E4D7B0;
  --border: #D8C7A1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Lora', serif;
}

a { color: var(--maroon); }
a:hover { color: #5C2222; }

.serif { font-family: 'Playfair Display', serif; }
.script { font-family: 'Playfair Display', serif; font-style: italic; }

.page {
  min-height: 100vh;
  width: 100%;
  padding-bottom: 70px;
  position: relative;
  overflow: hidden;
}

.corner {
  position: absolute;
  top: 0;
  opacity: 0.9;
}
.corner--left { left: 0; }
.corner--right { right: 0; transform: scaleX(-1); }

.wrap {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 38px;
  position: relative;
}

.hero {
  padding-top: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.monogram-row { display: flex; align-items: center; gap: 6px; }
.monogram {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: var(--gold);
}

.kicker { font-size: 12.5px; letter-spacing: 3px; color: var(--gold); text-transform: uppercase; }
.lead { font-size: 16px; color: #5a4a3a; }

.name-chip {
  padding: 9px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: var(--maroon);
}

.couple-names {
  margin: 0;
  font-size: 36px;
  line-height: 1.32;
  color: var(--ink);
  font-weight: 600;
}
.amp { font-size: 22px; color: var(--gold); }

.intro { margin: 0; font-size: 14.5px; line-height: 1.75; color: #5a4a3a; max-width: 310px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 24px;
  position: relative;
}

.date-card { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.section-label { font-size: 12px; letter-spacing: 2px; color: var(--gold); text-transform: uppercase; }
.date-main { font-size: 23px; color: var(--maroon); font-weight: 600; }
.date-sub { font-size: 13.5px; color: var(--muted); }

.icon-row { display: flex; align-items: center; justify-content: center; gap: 7px; }

.corner-mark { position: absolute; width: 18px; height: 18px; }
.corner-mark--tl { top: 8px; left: 8px; }
.corner-mark--br { bottom: 8px; right: 8px; }

.countdown { display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.countdown-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; }
.countdown-cell { border: 1px solid var(--border); border-radius: 4px; padding: 14px 4px; }
.countdown-num { font-size: 22px; color: var(--maroon); font-weight: 600; }
.countdown-unit { font-size: 10.5px; color: var(--muted); letter-spacing: 1px; }

.event-card {
  background: var(--maroon);
  border-radius: 4px;
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--cream);
  position: relative;
}
.event-title { font-size: 19px; font-weight: 600; color: #E8D9B8; }
.event-details { display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; }
.event-address { color: #E8D9B8; }
.map-link {
  margin-top: 4px;
  align-self: flex-start;
  padding: 10px 20px;
  border: 1px solid var(--gold);
  color: #E8D9B8;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.gallery { display: flex; flex-direction: column; gap: 18px; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
.gallery-tile {
  aspect-ratio: 4/5;
  background: #fff;
  border: 1px solid var(--gold);
  border-radius: 46% 46% 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; }
.gallery-note { font-size: 12px; color: #9a8a76; text-align: center; font-style: italic; }

.rsvp-card { display: flex; flex-direction: column; gap: 18px; padding: 28px 22px; }
.rsvp-heading { text-align: center; }
.rsvp-title { font-size: 19px; color: var(--ink); font-weight: 600; }
.rsvp-deadline { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.toggle-row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 14px 0;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: transparent;
  color: var(--maroon);
  border: 1.5px solid var(--border);
}
.btn.is-active { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.btn--submit { background: var(--maroon); color: var(--cream); border: none; font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: #5a4a3a; }
.field input, .field textarea {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Lora', serif;
  box-sizing: border-box;
}
.field input { width: 110px; }
.field textarea { resize: none; }
.message-count { font-size: 11px; color: var(--muted); text-align: right; }

.rsvp-status { font-size: 13px; min-height: 18px; }
.rsvp-status--success { color: #3F7A4D; }
.rsvp-status--error { color: #B3362C; }

.footer { text-align: center; padding-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.footer-name { font-size: 18px; color: var(--gold); }
.footer-note { font-size: 12px; color: var(--muted); }

@media (max-width: 380px) {
  .couple-names { font-size: 30px; }
}

/* ---------- Additions for the live site ---------- */

/* `.field { display:flex }` would otherwise override the hidden attribute */
[hidden] { display: none !important; }

.btn--submit { width: 100%; }

/* FR-8: loading placeholder while the guest name is fetched */
#guest-name.is-loading {
  display: inline-block;
  min-width: 140px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f3ead6 25%, #fbf6ec 50%, #f3ead6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
.gallery-tile.is-loading {
  background: linear-gradient(90deg, #fff 25%, #f6efdf 50%, #fff 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* FR-10: name field for guests without a personal link */
.field--wide input { width: 100%; }

.btn--submit:disabled { opacity: 0.6; cursor: progress; }
.rsvp-status--info { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  #guest-name.is-loading, .gallery-tile.is-loading { animation: none; }
}

/* ---------- Thank-you popup ---------- */
.thanks-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(58, 46, 46, 0.45);
  animation: fade-in 0.25s ease-out;
}
.thanks-card {
  width: 100%;
  max-width: 360px;
  background: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 30px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(58, 46, 46, 0.25);
  animation: pop-in 0.45s cubic-bezier(.2, 1.4, .4, 1);
}
.thanks-heart { animation: heartbeat 1.3s ease-in-out infinite; }
.thanks-title { font-size: 24px; font-weight: 600; color: var(--maroon); }
.thanks-message { margin: 0; font-size: 14.5px; line-height: 1.75; color: #5a4a3a; }
.thanks-sign { font-size: 18px; color: var(--gold); }
.thanks-card .btn--submit { margin-top: 4px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.8) translateY(20px); } }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.12); }
}

/* ---------- Hearts effect ---------- */
.hearts-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}
.heart {
  position: absolute;
  width: var(--size);
  height: var(--size);
  color: var(--color);
  opacity: 0;
  will-change: transform, opacity;
}
.heart svg { width: 100%; height: 100%; display: block; animation: sway var(--sway-dur) ease-in-out infinite alternate; }

/* rain: falls from above the screen to below it */
.heart--rain {
  top: -8vh;
  left: var(--x);
  animation: heart-rain var(--dur) linear var(--delay) forwards;
}
@keyframes heart-rain {
  0% { opacity: 0; transform: translateY(0) rotate(var(--rot)); }
  8% { opacity: var(--alpha); }
  85% { opacity: var(--alpha); }
  100% { opacity: 0; transform: translateY(118vh) rotate(calc(var(--rot) * -1)); }
}

/* blow: bursts out of the popup centre and floats up */
.heart--blow {
  top: 50%;
  left: 50%;
  animation: heart-blow var(--dur) cubic-bezier(.15, .8, .3, 1) var(--delay) forwards;
}
@keyframes heart-blow {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); }
}
@keyframes sway { from { transform: translateX(-10px); } to { transform: translateX(10px); } }

@media (prefers-reduced-motion: reduce) {
  .thanks-modal, .thanks-card, .thanks-heart { animation: none; }
  .hearts-layer { display: none; }
}
