:root {
  --bg: #E6F2F8;
  --ink: #221838;
  --letter-ink: #2E2248;
  --blue: #A8D0E2;
  --blue-soft: #BFDEEC;
  --blue-pale: #E1F0F6;
  --blue-mist: #CFE6EE;
  --blue-btn: #8CC0DC;
  --blue-mid: #4891B4;
  --blue-strong: #22739E;
  --blue-salute: #1B5E82;
  --blue-text: #164E6C;
  --blue-deep: #0F3E57;
  --purple: #68296C;
  --purple-deep: #432461;
  --purple-pale: #EFE4F0;
  --purple-soft: #F3EAF3;
  --purple-line: #D7BFD9;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body { font-family: var(--sans); }

main {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Reveal on scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Header ---------- */
.hero {
  background: var(--blue);
  color: var(--blue-deep);
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(72px, 12vw, 150px) clamp(20px, 5vw, 48px) clamp(56px, 9vw, 110px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2.5vw, 24px);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--blue-text);
  font-weight: 600;
  white-space: nowrap;
}
.rule {
  width: 28px;
  height: 1px;
  background: var(--blue-text);
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 11vw, 136px);
  line-height: .95;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero h1 em { color: var(--purple); }
.hero-sub {
  margin: 0;
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--blue-text);
}
.dots {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-purple { background: var(--purple); }
.dot-blue { background: var(--blue-strong); }

/* ---------- Film strips ---------- */
.photos {
  padding: clamp(48px, 8vw, 100px) 0 clamp(56px, 9vw, 120px);
}
.film-wrap {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.5vw, 28px);
  transform: rotate(-2deg);
  margin: 0 -4vw;
}
.film {
  position: relative;
  overflow: hidden;
  padding: 22px 0;
}
.film-a { background: var(--blue-soft); }
.film-b { background: var(--blue); }
/* Sprocket holes */
.film::before,
.film::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--bg) 0 12px, transparent 12px 26px);
}
.film::before { top: 7px; }
.film::after { bottom: 7px; }

.film-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.film-track img {
  display: block;
  height: clamp(180px, 28vw, 300px);
  width: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 12px;
}
.film-a img { background: var(--bg); }
.film-b img { background: var(--blue-mist); }

/* ---------- Letter ---------- */
.letter-section {
  padding: 0 clamp(16px, 4vw, 40px) clamp(72px, 12vw, 140px);
}
.letter {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  padding: clamp(32px, 7vw, 72px) clamp(24px, 7vw, 72px);
  box-shadow: 0 30px 70px -30px rgba(22, 78, 108, .45);
  border-top: 10px solid var(--purple);
  border-bottom: 10px solid var(--blue-mid);
}
.letter-frame {
  position: absolute;
  inset: 10px;
  border: 1.5px solid var(--blue);
  border-radius: 4px;
  pointer-events: none;
}
.letter-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5vw, 44px);
}
.letter-text {
  font-family: var(--serif);
  font-size: clamp(19px, 2.3vw, 23px);
  line-height: 1.6;
  color: var(--letter-ink);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.letter-text p { margin: 0; text-wrap: pretty; }
.salutation {
  font-style: italic;
  font-size: 1.25em;
  color: var(--blue-salute);
}
.signoff { font-style: italic; }

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.detail {
  background: var(--blue);
  color: var(--blue-deep);
  border-radius: 6px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-purple {
  background: var(--purple-pale);
  color: var(--purple-deep);
}
.detail-label {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--blue-text);
  font-weight: 600;
}
.detail-purple .detail-label { color: var(--purple); }
.detail-value {
  font-family: var(--serif);
  font-size: 22px;
}

/* ---------- RSVP ---------- */
.rsvp-pick,
.rsvp-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  margin: 0;
}
.rsvp-pick[hidden],
.rsvp-done[hidden] { display: none; }

.rsvp-heading {
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--blue-text);
  font-weight: 600;
}
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
}
.slot {
  min-height: 52px;
  padding: 0 12px;
  border-radius: 12px;
  border: 2px solid var(--blue);
  background: var(--blue-pale);
  color: var(--blue-text);
  font: 600 14px var(--sans);
  cursor: pointer;
  transition: background .3s, color .3s, transform .3s, border-color .3s;
}
.slot.is-purple {
  border-color: var(--purple-line);
  background: var(--purple-soft);
  color: var(--purple-deep);
}
.slot[aria-pressed="true"] {
  border-color: var(--blue-strong);
  background: var(--blue-strong);
  color: #fff;
}
.slot.is-purple[aria-pressed="true"] {
  border-color: var(--purple);
  background: var(--purple);
}
.slot:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.slot:focus-visible,
.confirm:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}

.confirm {
  margin-top: 6px;
  width: 100%;
  max-width: 320px;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--blue-btn);
  color: var(--blue-deep);
  font: 600 16px var(--sans);
  cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(22, 78, 108, .55);
  transition: transform .3s var(--ease), box-shadow .3s, opacity .3s;
}
.confirm:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.confirm.is-sending { cursor: progress; }

@media (hover: hover) {
  .slot:not(:disabled):hover { transform: translateY(-2px); }
  .confirm:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px -12px rgba(22, 78, 108, .65);
  }
}

.rsvp-error {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--purple);
}

.rsvp-done {
  width: 100%;
  gap: 10px;
  background: var(--blue);
  color: var(--blue-deep);
  border-radius: 14px;
  padding: 32px 20px;
}
.rsvp-done.is-popping { animation: pop .6s var(--ease); }
.done-title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.1;
}
.done-text {
  margin: 0;
  font-size: 16px;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 36px 20px 120px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--blue-deep);
  background: var(--blue);
}

/* ---------- Confirmation modal ---------- */
.modal {
  padding: 0;
  border: 0;
  background: transparent;
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  overflow: visible;
}
.modal::backdrop {
  background: rgba(15, 62, 87, .45);
  backdrop-filter: blur(3px);
}
.modal[open] { animation: pop .5s var(--ease); }
.modal[open]::backdrop { animation: fade .4s ease; }

.modal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  background: #fff;
  color: var(--letter-ink);
  border-radius: 8px;
  border-top: 10px solid var(--purple);
  border-bottom: 10px solid var(--blue-mid);
  padding: 40px clamp(24px, 6vw, 40px) 32px;
  box-shadow: 0 30px 70px -30px rgba(15, 62, 87, .6);
}
.modal-dots { display: flex; gap: 8px; }
.modal-title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(38px, 8vw, 48px);
  line-height: 1.05;
  color: var(--blue-deep);
}
.modal-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--blue-text);
  text-wrap: pretty;
}
.modal-text strong { color: var(--purple); font-weight: 600; }
.modal form { margin: 6px 0 0; width: 100%; display: flex; justify-content: center; }
.modal-close {
  width: 100%;
  max-width: 240px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--blue-strong);
  color: #fff;
  font: 600 16px var(--sans);
  cursor: pointer;
  transition: transform .3s var(--ease), background .3s;
}
@media (hover: hover) {
  .modal-close:hover { transform: translateY(-2px); background: var(--blue-deep); }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .rsvp-done.is-popping,
  .modal[open],
  .modal[open]::backdrop { animation: none; }
  .film { overflow-x: auto; }
}
