:root {
  --paper: #dfe4ea;
  --paper-light: #e9edf2;
  --navy: #1b4a72;
  --navy-soft: #3a6488;
  --frame: #a9bdd3;
  --green: #7f9a43;
  --green-soft: #e3ead2;
  --rose: #a5483f;
  --ink: #23384d;
  --serif: "Libre Baskerville", Baskerville, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 28px;
  font: 700 14px/1 var(--serif); letter-spacing: .16em; text-transform: uppercase;
  border-radius: 2px; border: 1.5px solid var(--navy);
  text-decoration: none; cursor: pointer; transition: background .2s, color .2s, opacity .2s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #143a5b; }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: rgba(27, 74, 114, .07); }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ---------- Welcome page: the artwork, exactly ---------- */
.welcome-stage {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}
/* The link is the sized box (so it can't stretch wider than the artwork); the image fills it. */
.card-link {
  display: block; line-height: 0; cursor: pointer; transition: transform .25s ease;
  flex: 0 0 auto;
  width: min(100%, calc((100svh - 32px) * 0.8), 900px); /* image is 4:5 */
  margin: 0 auto;
}
.card-link:hover { transform: translateY(-2px); }
.card-link:focus-visible { outline: 3px solid var(--navy); outline-offset: 4px; }
.std-card {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 10px 40px rgba(27, 74, 114, .14);
  animation: fadeIn .9s ease both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- RSVP page ---------- */

.rsvp-wrap {
  position: relative; z-index: 1;
  max-width: 640px; margin: 0 auto;
  padding: 48px 22px calc(64px + env(safe-area-inset-bottom));
}
.rsvp-head { text-align: center; margin-bottom: 26px; position: relative; }
.back {
  position: absolute; left: 0; top: -22px;
  color: var(--navy-soft); text-decoration: none; font-size: 14px; letter-spacing: .05em;
}
.back:hover { text-decoration: underline; }
.rsvp-head h1 {
  margin: 0; color: var(--navy);
  font-weight: 700; font-size: clamp(34px, 8vw, 48px); letter-spacing: .14em;
}
.sub, .rsvp-by { margin: 6px 0 0; color: var(--navy); font-style: italic; font-size: 17px; letter-spacing: .02em; }
.rsvp-by { font-size: 16px; color: var(--navy-soft); }

.demo {
  margin: 0 0 18px; padding: 10px 14px; font-size: 14px; text-align: center;
  background: rgba(255, 244, 214, .85); border: 1px solid #e3cf95; border-radius: 3px;
}

.panel {
  background: rgba(244, 247, 250, .72);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(169, 189, 211, .7);
  border-radius: 4px;
  padding: 30px clamp(18px, 5vw, 38px);
  box-shadow: 0 8px 30px rgba(27, 74, 114, .08);
  animation: fadeIn .5s ease both;
}
.panel h2 {
  margin: 0 0 6px; text-align: center; color: var(--navy);
  font-weight: 700; font-size: 23px; letter-spacing: .03em;
}
.panel h3 {
  margin: 0 0 4px; color: var(--navy); font-weight: 700; font-size: 17px; letter-spacing: .02em;
}
.hint { margin: 0 0 18px; text-align: center; font-style: italic; color: var(--navy-soft); font-size: 15px; line-height: 1.5; }
.block .hint { text-align: left; margin-bottom: 12px; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); }
.field em { text-transform: none; letter-spacing: 0; color: var(--navy-soft); }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%; padding: 12px 14px;
  font: 16px/1.4 var(--serif); color: var(--ink);
  background: rgba(255, 255, 255, .85);
  border: 1px solid var(--frame); border-radius: 2px;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27, 74, 114, .14); }
textarea { resize: vertical; }

#findForm { margin-top: 20px; }
#findForm .btn { width: 100%; margin-top: 4px; }
.field > span.plain { text-transform: none; letter-spacing: .01em; font-size: 15px; font-weight: 400; }

.error { color: var(--rose); font-size: 15px; text-align: center; margin: 4px 0 14px; }

/* Event cards */
.event {
  margin: 0 0 18px; padding: 18px 18px 8px;
  background: rgba(255, 255, 255, .55);
  border: 0; min-width: 0;
}
.event .when, .event .where { margin: 0; font-size: 15px; color: var(--navy-soft); }
/* Date/time: each comma-separated part stays together, so if the line is too long for a phone
   it breaks after the comma rather than mid-phrase. One line on wider screens. */
.event .when .date, .event .when .part { white-space: nowrap; }
.event .where { font-style: italic; }
.event p:last-of-type { margin-bottom: 12px; }
.event .note { margin-top: 4px; font-size: 13.5px; line-height: 1.45; color: var(--navy-soft); }

.guest-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid rgba(169, 189, 211, .5);
}
.guest-name { font-size: 16px; }
.choice { display: inline-flex; border: 1px solid var(--frame); border-radius: 2px; overflow: hidden; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 9px 14px; font-size: 13px; letter-spacing: .02em; cursor: pointer;
  background: rgba(255, 255, 255, .8); color: var(--navy); transition: background .15s, color .15s;
  user-select: none;
}
.choice label + input + label { border-left: 1px solid var(--frame); }
.choice input:focus-visible + label { outline: 2px solid var(--navy); outline-offset: -2px; }
.choice input.yes:checked + label { background: var(--navy-soft); color: #fff; }
.choice input.no:checked + label { background: var(--navy-soft); color: #fff; }
.guest-row.missing .choice { border-color: var(--rose); box-shadow: 0 0 0 2px rgba(165, 72, 63, .15); }

.block { margin: 24px 0 0; }
/* Dietary needs and contact details each sit in their own box, like the event cards. */
.block.card { margin-top: 18px; padding: 18px 18px 4px; background: rgba(255, 255, 255, .55); }
.block.card h3 { margin-bottom: 12px; }
.diet-row .field > span { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 15px; }

.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.actions .btn-primary { flex: 1 1 auto; }

.summary { list-style: none; padding: 0; margin: 0 0 6px; }
.summary li { padding: 10px 0; border-top: 1px solid rgba(169, 189, 211, .5); font-size: 16px; }
.summary li:first-child { border-top: 0; }
.summary strong { color: var(--navy); font-weight: 700; }
.summary .yes { color: var(--navy); }
.summary .no { color: var(--navy-soft); }

@media (max-width: 480px) {
  .guest-row { flex-direction: column; align-items: flex-start; }
  .choice { width: 100%; }
  .choice label { flex: 1; }
  .event .when .sep { display: none; }
  .event .when .date, .event .when .time { display: block; }
  .event { padding: 16px 14px 6px; }
  .event .when { font-size: 14px; }
  .event .note { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Password screen ---------- */
html.locked body > :not(.gate):not(script) { display: none !important; }
.gate {
  min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
}
.gate-card {
  width: min(100%, 420px); text-align: center;
  background: rgba(244, 247, 250, .72);
  border: 1px solid rgba(169, 189, 211, .7); border-radius: 4px;
  padding: 36px clamp(20px, 6vw, 40px) 30px;
  box-shadow: 0 8px 30px rgba(27, 74, 114, .08);
  animation: fadeIn .5s ease both;
}
.gate-card h1 { margin: 0; color: var(--navy); font-weight: 700; font-size: 30px; letter-spacing: .04em; }
.gate-card .sub { margin: 8px 0 24px; font-size: 16px; }
.gate-card .field { text-align: left; }
.gate-card .btn { width: 100%; margin-top: 4px; }
