:root {
  --accent: #173f86;
  --overlay-opacity: .5;
  --ivory: #f8f3e8;
  --ink: #173f86;
  --shadow: 0 22px 52px rgba(3, 15, 36, .28);
  --hero-w: min(31vw, 372px, calc((100svh - 112px) * .53));
  --side-w: min(16.65vw, 202px, calc(var(--hero-w) * .56));
  --rsvp-w: min(26vw, 310px, calc(var(--hero-w) * .83));
  --overlap: calc(var(--hero-w) * .02);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--accent); }
body {
  min-height: 100vh;
  margin: 0;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.background-photo,
.background-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.background-photo {
  z-index: -3;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: #52677f;
}
.background-overlay {
  z-index: -2;
  background: var(--accent);
  opacity: var(--overlay-opacity);
}

.site-shell {
  position: relative;
  width: 100%;
  min-height: 100svh;
  padding: clamp(10px, 2vh, 24px) 14px;
}

.countdown-section {
  position: relative;
  z-index: 20;
  width: min(560px, 94vw);
  margin: 0 auto 6px;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0,0,0,.42);
}
.countdown-heading {
  margin: 0 0 4px;
  font-family: 'Parisienne', cursive;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
}
.countdown {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 38px);
}
.countdown-unit { min-width: 52px; }
.countdown-unit strong {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown-unit span {
  display: block;
  margin-top: 3px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.collage {
  position: relative;
  width: min(1080px, 98vw);
  height: calc(var(--hero-w) * 1.83);
  margin: 0 auto;
}

.card {
  position: absolute;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(var(--shadow));
  transition: filter .22s ease, transform .22s ease;
}
.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.card:hover,
.card:focus-visible {
  filter: drop-shadow(0 28px 58px rgba(3,15,36,.36));
  outline: none;
}

.card-hero {
  z-index: 12;
  left: 50%;
  top: calc(var(--hero-w) * .03);
  width: var(--hero-w);
  aspect-ratio: 1410 / 2000;
  transform: translateX(-50%) rotate(.4deg);
}
.card-hero:hover,
.card-hero:focus-visible { transform: translateX(-50%) translateY(-5px) rotate(.4deg) scale(1.012); }

.card-side {
  z-index: 7;
  width: var(--side-w);
  aspect-ratio: 1410 / 2000;
}
.card-details,
.card-entourage {
  left: calc(50% - (var(--hero-w) / 2) - var(--side-w) + var(--overlap));
}
.card-dresscode {
  left: calc(50% + (var(--hero-w) / 2) - var(--overlap));
}
.card-details { top: calc(var(--hero-w) * .13); transform: rotate(-4deg); }
.card-dresscode { top: calc(var(--hero-w) * .13); transform: rotate(4deg); }
.card-entourage { top: calc(var(--hero-w) * 1.03); transform: rotate(-3deg); }
.card-side:hover,
.card-side:focus-visible { transform: translateY(-5px) rotate(0deg) scale(1.015); }

.card-label {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 47%;
  transform: translateY(-50%);
  padding: 12px 8px 10px;
  border: 1px solid rgba(23,63,134,.18);
  background: rgba(250,247,239,.9);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 6px 20px rgba(23,63,134,.08);
  pointer-events: none;
}
.card-label .card-title {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 40px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
}
.card-label small {
  display: block;
  margin-top: 6px;
  font-size: 7px;
  font-weight: 400;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.card-rsvp {
  z-index: 13;
  left: calc(50% + (var(--hero-w) / 9) - var(--overlap));
  top: calc(var(--hero-w) * 1.4);
  width: var(--rsvp-w);
  aspect-ratio: 1701 / 1075;
  transform: rotate(3deg);
}
.card-rsvp:hover,
.card-rsvp:focus-visible { transform: translateY(-5px) rotate(1deg) scale(1.012); }
.rsvp-card-label {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 15%;
  color: var(--ivory);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(30px, 3vw, 44px);
  font-style: italic;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 12px;
}
.viewer.is-open { display: grid; }
.viewer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(7, 18, 39, .9);
}
.viewer-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 1;
  overflow: hidden;
}
.viewer-close {
  position: fixed;
  z-index: 10;
  top: 14px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 50%;
  background: rgba(8,18,39,.55);
  color: #fff;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}
.viewer-content {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: transparent;
}
.single-image-view,
.entourage-view {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.full-card-image {
  display: block;
  max-width: min(100%, 94vw);
  max-height: calc(100svh - 28px);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: none;
}
.entourage-view { position: relative; }
.entourage-view .full-card-image { max-width: calc(100vw - 150px); }
.viewer-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 62px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
}
.viewer-nav:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.viewer-nav-prev { left: clamp(0px, 2vw, 30px); }
.viewer-nav-next { right: clamp(0px, 2vw, 30px); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rsvp-view {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(400px, 1.15fr);
  align-items: stretch;
  gap: 16px;
  width: min(1050px, calc(100vw - 64px));
  max-height: calc(100svh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #182846;
}
.rsvp-invitation-panel,
.rsvp-form-panel {
  padding: clamp(20px, 2.5vw, 34px);
  border: 1px solid rgba(23,63,134,.25);
  border-radius: 5px;
  background: rgba(248,246,239,.99);
  box-shadow: 0 20px 56px rgba(0,0,0,.2);
}
.rsvp-invitation-panel { min-width: 0; }
.rsvp-eyebrow {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.rsvp-invitation-panel h3,
.rsvp-form-panel h3 {
  margin: 0;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(30px, 3.5vw, 38px);
  font-weight: 400;
  line-height: 1.1;
}
.rsvp-guest-count {
  margin: 14px 0 16px;
  color: #765c48;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
}
.rsvp-invited-list { display: grid; gap: 9px; }
.rsvp-invited-guest,
.rsvp-result-guest {
  padding: 13px 16px;
  border: 1px solid rgba(23,63,134,.23);
  border-radius: 5px;
  background: rgba(255,255,255,.8);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 21px;
}
.rsvp-plus-one-note {
  margin: 15px 0 0;
  color: #586783;
  font-size: 13px;
  line-height: 1.5;
}
.rsvp-intro {
  margin: 13px 0 20px;
  color: #765c48;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  line-height: 1.25;
}
.rsvp-form { display: grid; gap: 16px; }
.rsvp-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.rsvp-status-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rsvp-status-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 12px 13px;
  border: 1px solid rgba(23,63,134,.25);
  border-radius: 5px;
  background: rgba(255,255,255,.8);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
}
.rsvp-status-option:has(input:checked) {
  border-color: var(--accent);
  background: #f2f5fb;
}
.rsvp-status-option input,
.rsvp-attendee-option input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}
.rsvp-attendees legend {
  margin-bottom: 12px;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}
.rsvp-attendee-list { display: grid; gap: 10px; }
.rsvp-attendee-option {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
}
.rsvp-field {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.rsvp-field textarea {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 9px;
  padding: 12px 13px;
  border: 1px solid rgba(23,63,134,.25);
  border-radius: 5px;
  background: rgba(255,255,255,.85);
  color: #182846;
  font: 15px/1.4 Arial, sans-serif;
  resize: vertical;
}
.rsvp-submit {
  justify-self: start;
  margin-top: 5px;
  padding: 13px 22px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}
.rsvp-error {
  margin: 0;
  color: #a22929;
  font-size: 13px;
  line-height: 1.4;
}
.rsvp-demo-notice {
  margin: 0;
  color: #7b5a25;
  font-size: 12px;
  line-height: 1.4;
}
.rsvp-result > p:not(.rsvp-eyebrow) {
  color: #586783;
  line-height: 1.6;
  font-size: 14px;
}
.rsvp-result-guest-list { display: grid; gap: 8px; margin: 18px 0; }
.rsvp-contact-note {
  margin-top: 20px;
  padding: 13px;
  border-left: 3px solid var(--accent);
  background: #eef2f8;
}
.hidden { display: none !important; }

@media (max-width: 820px) {
  :root {
    --mobile-available: calc(100svh - 110px);
    --hero-w: min(58vw, 250px, calc(var(--mobile-available) * .31));
    --side-w: min(36vw, 160px, calc(var(--mobile-available) * .19));
    --rsvp-w: min(42vw, 176px, calc(var(--mobile-available) * .28));
  }
  .site-shell { padding: 10px 10px 12px; }
  .countdown-section { margin-bottom: 6px; }
  .collage {
    width: min(620px, 96vw);
    height: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    align-items: start;
    justify-items: center;
    padding-bottom: 0;
  }
  .card-hero { order: 1; }
  .card-details { order: 2; }
  .card-dresscode { order: 3; }
  .card-entourage { order: 4; }
  .card-rsvp { order: 5; }
  .card {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
  }
  .card-hero {
    grid-column: 1 / -1;
    width: var(--hero-w);
    transform: none;
    z-index: 12;
    margin-bottom: 0;
  }
  .card-details,
  .card-dresscode,
  .card-entourage {
    width: var(--side-w);
    transform: none;
  }
  .card-rsvp {
    grid-column: 2;
    width: var(--rsvp-w);
    align-self: center;
    transform: none;
  }
  .card:hover,
  .card:focus-visible,
  .card-hero:hover,
  .card-hero:focus-visible,
  .card-side:hover,
  .card-side:focus-visible,
  .card-rsvp:hover,
  .card-rsvp:focus-visible { transform: translateY(-3px) scale(1.01); }
  .card-label { left: 5%; right: 5%; padding: 6px 3px; }
  .card-label .card-title { font-size: clamp(21px, 5vw, 30px); }
  .card-label small { font-size: 5px; }
  .rsvp-card-label { font-size: clamp(22px, 5vw, 30px); }
  .viewer { padding: 6px; }
  .entourage-view .full-card-image { max-width: calc(100vw - 95px); }
  .viewer-nav { width: 38px; height: 48px; font-size: 34px; }
  .viewer-nav-prev { left: 0; }
  .viewer-nav-next { right: 0; }
}

@media (max-width: 900px) {
  .rsvp-view {
    grid-template-columns: 1fr;
    width: min(650px, calc(100vw - 24px));
    max-height: calc(100svh - 24px);
    gap: 12px;
  }
  .rsvp-invitation-panel,
  .rsvp-form-panel { padding: 22px; }
}

@media (max-width: 480px) {
  .countdown { gap: 12px; }
  .countdown-unit { min-width: 46px; }
  .countdown-unit strong { font-size: 30px; }
  .countdown-unit span { font-size: 8px; }
  .collage { gap: 4px; }
  .card-label .card-title { font-size: clamp(18px, 5.5vw, 23px); }
  .rsvp-invitation-panel,
  .rsvp-form-panel { padding: 18px; }
  .rsvp-status-options { grid-template-columns: 1fr; }
  .rsvp-status-option { min-height: 52px; }
  .rsvp-field textarea { min-height: 62px; }
}

@media (max-height: 620px) {
  .rsvp-view { max-height: calc(100svh - 12px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
