@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Cinzel:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the HTML `hidden` attribute always wins over any CSS display rule */
[hidden] { display: none !important; }

:root {
  --cream: #faf6ef;
  --gold: #b8975a;
  --gold-light: #d4b37a;
  --dark: #2c2416;
  --muted: #7a6e5f;
}

/* No fixed height: the body must grow with the form, or its bottom padding
   stays pinned to the viewport and tall screens end flush against the edge. */
body {
  background-color: var(--cream);
  color: var(--dark);
  font-family: 'Cormorant Garamond', Georgia, serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

/* ── Photo backdrop (pages that carry class="photo") ── */
body.photo::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('../chateau.jpeg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.32;
  z-index: 0;
  pointer-events: none;
}

/* ── Card ── */
.card {
  max-width: 620px;
  width: 100%;
  border: 1px solid var(--gold);
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.4rem, 4vw, 3rem);
  position: relative;
  text-align: center;
  background: var(--cream);
  z-index: 1;
  margin: auto;
}

.card::before {
  content: '';
  position: absolute;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border: 1px solid var(--gold-light);
  top: 7px; left: 7px;
  pointer-events: none;
  opacity: 0.5;
}

.corner {
  position: absolute;
  width: 28px; height: 28px;
  border-color: var(--gold);
  border-style: solid;
}
.corner.tl { top: -1px;    left: -1px;  border-width: 2px 0 0 2px; }
.corner.tr { top: -1px;    right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px;  border-width: 0 0 2px 2px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ── Save the date link (top-left, mirrors lang switcher) ── */
/* ── Links to the other pages, top left (the language switcher is top right) ── */
.top-nav {
  position: absolute;
  top: 1rem; left: 1.2rem;
  display: flex;
  gap: 0.9rem;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 2;
}
.top-nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.top-nav a:hover { color: var(--gold); border-bottom-color: var(--gold-light); }


/* ── Lang switcher ── */
.lang-switcher {
  position: absolute;
  top: 1rem; right: 1.2rem;
  display: flex;
  gap: 0.8rem;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lang-switcher a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.lang-switcher a:hover { color: var(--gold); border-bottom-color: var(--gold-light); }

/* ── Header ── */
.rsvp-header { margin-bottom: 2rem; }

.rsvp-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}

.rsvp-names {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--dark);
  line-height: 1.25;
}
.rsvp-names .ampersand {
  display: block;
  color: var(--gold);
  font-size: 0.8em;
  margin: 0.1em 0;
}

.rsvp-date {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.rsvp-venue {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.4rem;
  line-height: 1.45;
}

.rsvp-venue-label {
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  font-style: normal;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-right: 0.45rem;
}

.rsvp-venue-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-light);
  transition: color 0.2s, border-color 0.2s;
}
.rsvp-venue-link:hover { color: var(--gold); border-bottom-color: var(--gold); }

/* Sets the couple's names apart from the date and places below */
.divider.header-divider { margin: 1.3rem auto 1.1rem; }

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.4rem auto;
  max-width: 260px;
  width: 100%;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gold-light);
}
/* Drawn, not typed: ✦ comes from whatever fallback font happens to carry
   U+2726, and the glyph sits at a different height in each one, so it never
   quite lines up with the rules. This shape is centred on its own box. */
.divider-symbol {
  display: block;
  width: 16px;            /* the glyph's old footprint, so spacing is unchanged */
  height: 16px;
  font-size: 0;
  line-height: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0Q13.8 10.2 24 12Q13.8 13.8 12 24Q10.2 13.8 0 12Q10.2 10.2 12 0Z' fill='%23b8975a'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

/* ── Screens ── */
.screen { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Loading */
.loading-text {
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  padding: 2rem 0;
}

/* Question */
.screen-title {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.screen-greeting {
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  font-weight: 300;
  font-style: italic;
  color: var(--dark);
  margin-bottom: 2rem;
  line-height: 1.35;
}

.btn-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Equal-width buttons sized to the widest, centered */
.btn-row.equal {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.btn-row.equal .btn { width: 100%; }

@media (max-width: 420px) {
  .btn-row.equal {
    grid-auto-flow: row;
    width: 100%;
  }
}

/* Quiet "← Back" under the accept / decline pair */
.back-row { margin-top: 1.2rem; }
.back-row .btn-link { margin-bottom: 0; }

/* ── Buttons ── */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.65rem 1.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--gold); color: var(--cream); }

.btn-primary {
  background: var(--gold);
  color: var(--cream);
}
.btn-primary:hover { background: var(--gold-light); }

.btn-ghost {
  border-color: var(--muted);
  color: var(--muted);
}
.btn-ghost:hover { background: var(--muted); color: var(--cream); }

/* ── Dietary form ── */
.dietary-intro {
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.4rem;
  line-height: 1.5;
}

/* ── Attendance rows (one line per person on the invitation) ── */
.guest-rows {
  max-width: 400px;
  margin: 0 auto 1rem;
  text-align: left;
}

.guest-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  /* Gutter reserved for the remove button so every toggle lines up */
  padding: 0.55rem 1.6rem 0.55rem 0;
  border-bottom: 1px solid rgba(184, 151, 90, 0.25);
}
.guest-row:last-child { border-bottom: none; }

.guest-row-name {
  flex: 1;
  font-size: 1.02rem;
  font-style: italic;
  color: var(--dark);
  min-width: 0;
  overflow-wrap: anywhere;
}

.guest-row-input {
  flex: 1 1 150px;
  min-width: 0;
  border: 1px solid var(--gold-light);
  background: var(--cream);
  padding: 0.35rem 0.6rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.95rem;
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s;
}
.guest-row-input:focus { border-color: var(--gold); }
.guest-row-input::placeholder { color: var(--muted); font-style: italic; }

.guest-row-remove {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
  transition: color 0.2s;
}
.guest-row-remove:hover { color: #a04040; }

/* Someone the invitees add: name and adult / child share one line, even on phones */
.guest-row.is-added { flex-wrap: nowrap; }
.guest-row.is-added .guest-row-input { flex: 1 1 0; }

/* Segmented coming / not coming control */
.toggle {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--gold-light);
}

.toggle-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--gold-light); }
.toggle-btn:hover { color: var(--gold); }
.toggle-btn.is-on {
  background: var(--gold);
  color: var(--cream);
}

@media (max-width: 420px) {
  .guest-row { flex-wrap: wrap; }
  .toggle { margin-left: auto; }
}

/* Phones: a tighter selector leaves room to type the name */
@media (max-width: 420px) {
  .guest-row.is-added { gap: 0.4rem; }
  .age-choice .toggle-btn { padding: 0.4rem 0.4rem; letter-spacing: 0.04em; }
}

/* The narrowest phones cannot fit both: the selector drops below the name */
@media (max-width: 340px) {
  .guest-row.is-added { flex-wrap: wrap; }
  .guest-row.is-added .guest-row-input { flex: 1 0 100%; }
}

/* Text-only button ("+ add someone") */
.btn-link {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--gold);
  cursor: pointer;
  padding: 0.2rem 0;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s;
}
.btn-link:hover { border-bottom-color: var(--gold-light); }

/* ── Per-person meal block ── */
.guest-detail {
  max-width: 400px;
  margin: 0 auto 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(184, 151, 90, 0.25);
}
.guest-detail:last-child { border-bottom: none; padding-bottom: 0; }

.guest-detail-name {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  justify-content: center;
  margin-bottom: 0.9rem;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--dark);
  cursor: pointer;
}

.radio-item input[type="radio"] {
  appearance: none;
  width: 13px; height: 13px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: var(--cream);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}
.radio-item input[type="radio"]:checked { border-color: var(--gold); }
.radio-item input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--gold);
}

.dietary-other {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--gold-light);
  background: var(--cream);
  padding: 0.55rem 0.8rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.95rem;
  color: var(--dark);
  outline: none;
  margin-bottom: 1.6rem;
  transition: border-color 0.2s;
}
.dietary-other::placeholder { color: var(--muted); font-style: italic; }
.dietary-other:focus { border-color: var(--gold); }
.guest-detail .dietary-other { margin-bottom: 0; }

.dietary-comments {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--gold-light);
  background: var(--cream);
  padding: 0.55rem 0.8rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.95rem;
  color: var(--dark);
  outline: none;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 1.6rem;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.dietary-comments::placeholder { color: var(--muted); font-style: italic; }
.dietary-comments:focus { border-color: var(--gold); }

/* ── Choir sign-up (one line per person, or a single line when alone) ── */
.choir-list {
  max-width: 400px;
  margin: 0 auto 1.6rem;
  text-align: left;
}

.choir-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  font-size: 1rem;
  color: var(--dark);
  cursor: pointer;
}
.choir-item + .choir-item { border-top: 1px solid rgba(184, 151, 90, 0.25); }

.choir-item input[type="checkbox"] {
  appearance: none;
  width: 15px; height: 15px;
  border: 1px solid var(--gold-light);
  background: var(--cream);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.choir-item input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.choir-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 1.5px solid var(--cream);
  border-left: none; border-top: none;
  transform: rotate(40deg);
}

.field-heading {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

/* ── Result screens ── */
.result-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.result-message {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 300;
  font-style: italic;
  color: var(--dark);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.result-note {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.4rem;
}

/* ── Summary (already responded + result screens) ── */
.summary {
  margin: 1.2rem auto;
  max-width: 400px;
  width: 100%;
  text-align: left;
}

.summary-row { margin-bottom: 0.9rem; }

.summary-label {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.summary-value {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  font-style: italic;
  color: var(--dark);
}

/* ── After replying: the information page, and changing the answer ── */
.btn-row.equal.after-reply {
  grid-auto-flow: row;
  width: 76%;
  max-width: 380px;
  gap: 0.7rem;
  margin-top: 1.6rem;
}
.after-reply .btn { padding-left: 0.5rem; padding-right: 0.5rem; }
.after-reply a.btn { padding-top: 1.2rem; padding-bottom: 1.2rem; }   /* the one not to miss */
a.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

/* ── Key screen (inline, no modal) ── */
.key-prompt {
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--dark);
  margin-bottom: 1.4rem;
  line-height: 1.5;
}

.key-input {
  width: 100%;
  max-width: 280px;
  border: 1px solid var(--gold-light);
  background: var(--cream);
  padding: 0.6rem 0.9rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  color: var(--dark);
  text-align: center;
  letter-spacing: 0.08em;
  outline: none;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.key-input:focus { border-color: var(--gold); }
.key-input::placeholder { color: var(--muted); font-style: italic; }

.key-error {
  font-size: 0.82rem;
  color: #a04040;
  font-style: italic;
  margin-bottom: 0.8rem;
  min-height: 1.2em;
}

/* Phones: both corners share one line, so make them smaller */
@media (max-width: 480px) {
  .top-nav, .lang-switcher { top: 0.85rem; font-size: 0.55rem; letter-spacing: 0.06em; gap: 0.6rem; }
  .top-nav { left: 0.95rem; }
  .lang-switcher { right: 0.95rem; }
}
