:root {
  --pearl-ivory: #f8f6f1;
  --warm-white: #f1ede5;
  --section-surface: #e4e2d9;
  --section-paper: #ece9e2;
  --soft-linen: #e5ded2;
  --champagne: #cbbba3;
  --muted-taupe: #5b524a;
  --charcoal-ink: #282521;
  --secondary-ink: #514b43;
  --champagne-hover: #b7a990;
  --paper-edge: rgba(203, 187, 163, .62);
  --paper-inset: rgba(203, 187, 163, .42);
  --paper-grain: repeating-linear-gradient(0deg, rgba(203, 187, 163, .018) 0 1px, transparent 1px 4px);
  --invitation-max: 620px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html.scroll-locked {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--charcoal-ink);
  color: var(--pearl-ivory);
  font-family: 'Amiri', serif;
}

body.scroll-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.film {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(ellipse at 45% 30%, #625b53, var(--charcoal-ink) 82%);
}

.film video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.9) saturate(.72);
}

.film:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(24, 23, 21, .65) 0%,
    rgba(24, 23, 21, .35) 50%,
    rgba(24, 23, 21, .65) 100%
  );
}

/* Opening cover and envelope */
.stage {
  position: relative;
  display: block;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 0 14px;
}

.landing {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
  text-align: center;
  transition: opacity .65s ease, transform .8s ease;
}

.cover-monogram-frame {
  position: relative;
  display: block;
  flex: 0 0 auto;
  aspect-ratio: 2 / 3;
  height: clamp(92px, 15svh, 124px);
  overflow: hidden;
}

.cover-monogram {
  position: absolute;
  top: 7.5%;
  left: 0;
  display: block;
  width: 120%;
  height: 120%;
  object-fit: contain;
  transform: scale(1.3);
  transform-origin: center;
  filter: brightness(1.12) saturate(.62);
}

.cover-names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1.3vw, 18px);
  margin: 13px 0 0;
  color: var(--pearl-ivory);
  direction: ltr;
  font: 400 clamp(25px, 3.8vw, 44px)/1 'Forum', serif;
  letter-spacing: .10em;
  text-shadow: 0 3px 22px rgba(18, 18, 17, .5);
  white-space: nowrap;
}

.cover-ampersand {
  display: block;
  flex: 0 0 auto;
  width: clamp(22px, 2.35vw, 32px);
  height: auto;
  object-fit: contain;
  filter: brightness(1.08) saturate(.72) drop-shadow(0 2px 8px rgba(203, 187, 163, .2));
}

.cover-date {
  margin-top: 9px;
  color: var(--pearl-ivory);
  direction: ltr;
  font: 400 clamp(18px, 1.8vw, 23.5px)/1.15 'Forum', serif;
  letter-spacing: .22em;
  text-shadow: 0 2px 9px rgba(18, 18, 17, .88);
}

#coverDate a[x-apple-data-detectors] {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  text-decoration: none !important;
}

.envelope-stack {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  width: min(94vw, 580px, max(240px, calc((100svh - 250px) * 1.43)));
  margin-top: 16px;
  container-type: inline-size;
}

.cover-separator,
.section-separator {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 80%;
  height: 1.5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(203, 187, 163, .48) 18%, var(--champagne) 44%, var(--pearl-ivory) 50%, var(--champagne) 56%, rgba(203, 187, 163, .48) 82%, transparent);
  box-shadow: 0 0 7px rgba(203, 187, 163, .2);
}

.cover-separator {
  margin-bottom: 0;
  transform-origin: center;
}

.section-separator {
  margin: clamp(14px, 2.4vw, 24px) auto;
}

.cover-separator::after,
.section-separator::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  height: 5px;
  border-radius: 50%;
  background: rgba(248, 246, 241, .32);
  content: "";
  filter: blur(3px);
  transform: translate(-50%, -50%);
}

.save-the-date {
  width: 100%;
  margin: 3px 0 0;
  padding: .04em .18em .06em;
  color: var(--pearl-ivory);
  direction: ltr;
  font: 400 clamp(40px, 16.5cqw, 113px)/.9 'Alex Brush', cursive;
  text-align: center;
  text-shadow: 0 3px 17px rgba(18, 18, 17, .78);
  white-space: nowrap;
  overflow: visible;
  clip-path: inset(-12% -22% -20% -22%);
}

.open-cue {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin: 2px 0 0;
  color: rgba(248, 246, 241, .88);
  font: 400 12px/1.2 'Amiri', serif;
  text-shadow: 0 2px 8px rgba(18, 18, 17, .78);
}

.open-cue-arrow {
  color: var(--champagne);
  font: 400 14px/1 'Cormorant Garamond', serif;
  animation: open-cue-nudge 1.8s ease-in-out infinite;
}

body[data-opening-state="opening"] .open-cue-arrow,
body[data-opening-state="opened"] .open-cue-arrow { animation: none; }

.opening-status {
  max-width: min(320px, 90vw);
  margin: 6px auto 0;
  color: rgba(248, 246, 241, .88);
  font: 400 12px/1.2 'Amiri', serif;
  text-shadow: 0 2px 8px rgba(18, 18, 17, .78);
}

.opening-status:empty { display: none; }

.opening-retry {
  margin: 8px auto 0;
  padding: 5px 16px;
  border: 1px solid rgba(248, 246, 241, .7);
  border-radius: 999px;
  background: rgba(40, 37, 33, .72);
  color: var(--pearl-ivory);
  font: 400 14px/1.5 'Amiri', serif;
}

.opening-retry:focus-visible {
  outline: 2px solid var(--pearl-ivory);
  outline-offset: 3px;
}

@keyframes open-cue-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.envelope-animation-stage {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1.43;
  margin-top: -5cqw;
  overflow: visible;
  isolation: isolate;
  transition: transform .55s cubic-bezier(.2, .7, .25, 1);
}

.envelope-animation-stage.is-ready:hover:not(.v2-opening) {
  transform: translateY(-4px);
}

.envelope-animation-stage.v2-opening { transition: none; }

.envelope-button {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  outline-offset: 8px;
  background: transparent;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  perspective-origin: 50% 12%;
  -webkit-perspective-origin: 50% 12%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  isolation: isolate;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.envelope-button:disabled { cursor: wait; }

.envelope-button:focus-visible { outline: 2px solid var(--champagne); }

.envelope-button.v2-opening {
  pointer-events: none;
  transition: none;
  cursor: default;
}

.envelope-scene {
  position: absolute;
  inset: 0;
  display: block;
  overflow: visible;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.canvas-layer {
  position: absolute;
  top: 50.5%;
  left: 50%;
  display: block;
  width: 96.9%;
  height: auto;
  aspect-ratio: 1434 / 1083;
  transform: translate(calc(-50% - 1.395%), calc(-50% + 1.65%)) scaleY(1.15) translateZ(var(--layer-depth, 0px));
  transform-origin: 50% 50%;
  pointer-events: none;
  user-select: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.envelope-back {
  --layer-depth: -1px;
  filter: drop-shadow(0 28px 24px rgba(18, 18, 17, .42));
}

.invitation-mask {
  position: absolute;
  z-index: 2;
  top: 50.5%;
  left: 50%;
  width: 96.9%;
  aspect-ratio: 1434 / 1245.45;
  transform: translate(calc(-50% - 1.395%), -48.5652%);
  transform-origin: 50% 50%;
  pointer-events: none;
}

.invitation-clip-window {
  position: absolute;
  top: -220%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: 120%;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
}

.invitation-mask .invitation {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform-origin: 50% 0%;
  will-change: transform;
  pointer-events: none;
  user-select: none;
}

.front-pocket {
  --layer-depth: 0px;
  clip-path: inset(0 3.14% 19.21% 5.93%);
  -webkit-clip-path: inset(0 3.14% 19.21% 5.93%);
  filter: drop-shadow(0 2px 4px rgba(40, 37, 33, .14));
}

.flap-contact-shadow {
  --layer-depth: .25px;
  clip-path: inset(0 .14% 0 .70%);
  -webkit-clip-path: inset(0 .14% 0 .70%);
  opacity: .28;
  filter: drop-shadow(0 3px 4px rgba(40, 37, 33, .18));
}

.flap-pivot {
  position: absolute;
  top: 50.5%;
  left: 50%;
  width: 96.9%;
  height: auto;
  aspect-ratio: 1434 / 1083;
  transform: translate(calc(-50% - 1.395%), calc(-50% + 1.65%)) scaleY(1.15) translateZ(0px);
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  pointer-events: none;
}

.flap-rotor {
  position: absolute;
  inset: 0;
  transform-origin: 50% 16.34%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  will-change: transform;
}

.flap-face {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.flap-front {
  clip-path: inset(0 .14% 0 .70%);
  -webkit-clip-path: inset(0 .14% 0 .70%);
  transform: translateZ(.5px);
}

.flap-back { transform: translateX(2.75%) rotateY(180deg) translateZ(.5px) translateY(.37%); }

.seal-wrap {
  position: absolute;
  top: 80%;
  left: 50%;
  width: clamp(61px, 13.7%, 85px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) translateZ(.75px);
  pointer-events: none;
  will-change: transform, opacity;
}

.seal-spin {
  display: block;
  width: 100%;
  height: 100%;
  animation: wedding-seal-spin 9s linear infinite;
  transform-origin: 50% 50%;
}

.seal {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  animation: seal-ambient-glow 3.2s ease-in-out 3s infinite alternate backwards;
}

.seal-wrap::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(203, 187, 163, .24) 0%, rgba(203, 187, 163, .14) 40%, rgba(203, 187, 163, 0) 72%);
  filter: blur(8px);
  opacity: .25;
  pointer-events: none;
  animation: seal-aura-pulse 3.8s ease-in-out 3s infinite alternate backwards;
}

@keyframes wedding-seal-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes seal-ambient-glow {
  from { filter: drop-shadow(0 0 2px rgba(203, 187, 163, .12)); }
  to { filter: drop-shadow(0 0 5px rgba(203, 187, 163, .26)); }
}

@keyframes seal-aura-pulse {
  from { opacity: .25; transform: scale(.88); }
  to { opacity: .62; transform: scale(1.02); }
}

.envelope-button:hover:not(.v2-opening):not(:disabled) .seal-wrap,
.envelope-button:focus-visible:not(.v2-opening):not(:disabled) .seal-wrap {
  transform: translate(-50%, -50%) translateZ(.75px) scale(1.05);
  filter: drop-shadow(0 8px 16px rgba(18, 18, 17, .4)) drop-shadow(0 0 9px rgba(203, 187, 163, .28));
}

/* Invitation reveal and post-opening stationery */
.invitation {
  display: none;
  width: min(100%, var(--invitation-max));
  margin: 0 auto;
  opacity: 0;
}

.invitation.visible {
  display: block;
  opacity: 1;
}

.invitation.is-flying, .invitation.visible { transition: none !important; }

.stage.reading {
  min-height: 0;
  padding: 28px 14px 0;
}

.stage.reading .landing { display: none !important; }

.stage.reading .invitation.visible {
  position: relative;
  inset: auto;
  display: block;
  width: min(100%, var(--invitation-max));
  max-width: var(--invitation-max);
  margin: 0 auto;
  transform: none;
  filter: none;
  clip-path: none;
  opacity: 1;
  pointer-events: auto;
}

.card.image-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50% 50% 6px 6px / 3.5% 3.5% 6px 6px;
  background: transparent;
  box-shadow: 0 18px 46px rgba(40, 37, 33, .24);
  filter: none;
}

.card.image-card:before, .card.image-card:after { display: none; }

.card.image-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  background: var(--warm-white);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.full-invitation-card {
  width: 100%;
  margin: 0 auto;
}

.cinema-window {
  display: flex;
  min-height: clamp(48px, 6vh, 64px);
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cinema-window .section-separator {
  margin: 0 auto;
}

.countdown-wrap {
  max-width: 480px;
  margin: 0 auto clamp(23px, 4vw, 34px);
  padding: 0 0 clamp(18px, 3vw, 25px);
  border-bottom: 1px solid transparent;
  background: transparent;
  text-align: center;
}

.countdown-heading {
  position: relative;
  margin: 0 0 6px;
  color: var(--charcoal-ink);
  font: 400 clamp(39px, 7vw, 52px)/1.1 'Alex Brush', cursive;
}

.countdown-subtitle {
  margin: 0 0 12px;
  color: var(--muted-taupe);
  text-align: center;
  font: 400 16px/1.6 'Readex Pro', Tahoma, Arial, sans-serif;
}

.countdown {
  display: flex;
  max-width: 480px;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 auto;
  direction: ltr;
}

.count-item {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 3px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.count-separator {
  flex: 0 0 .45em;
  align-self: flex-start;
  margin-top: 0;
  color: var(--secondary-ink);
  font: 400 clamp(30px, 5.7vw, 43px)/1 'Forum', Georgia, serif;
}

.count-item strong {
  display: block;
  color: var(--charcoal-ink);
  font: 400 clamp(29px, 7.2vw, 48px)/1.05 'Forum', Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .01em;
}

.count-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted-taupe);
  font: 400 clamp(11px, 2.6vw, 13px)/1.3 'Forum', Georgia, serif;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding-top: 7px;
}

.action {
  min-width: 130px;
  padding: 10px 20px;
  border: 1px solid var(--champagne);
  border-radius: 2px;
  background: var(--champagne);
  color: var(--charcoal-ink);
  text-decoration: none;
  font: 500 16px/1.5 'Readex Pro', Tahoma, Arial, sans-serif;
  letter-spacing: 0;
  box-shadow: 0 4px 10px rgba(40, 37, 33, .1);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.action.outline {
  background: transparent;
  color: var(--charcoal-ink);
}

.action:hover { transform: translateY(-1px); }

.action:hover:not(.outline) { background: var(--champagne-hover); }

.action.outline:hover {
  background: rgba(203, 187, 163, .16);
}

.action:focus-visible {
  outline: 2px solid var(--secondary-ink);
  outline-offset: 3px;
}

.round:focus-visible {
  outline: 2px solid var(--pearl-ivory);
  outline-offset: 3px;
}

/* Guestbook and closing details */
.below {
  display: none;
  width: min(calc(100% - 28px), var(--invitation-max));
  margin: 0 auto 72px;
  position: relative;
  isolation: isolate;
}

.below.visible { display: block; }

.below-content {
  position: relative;
  z-index: 1;
  width: 100%;
  font-family: 'Readex Pro', Tahoma, Arial, sans-serif;
}

.editorial-panel {
  position: relative;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 36px) clamp(22px, 4vw, 36px) 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--charcoal-ink);
  box-shadow: none;
}

.editorial-panel:before {
  display: none;
}

.editorial-panel > * { position: relative; }

.venue-panel {
  padding-top: clamp(25px, 4vw, 36px);
  text-align: center;
}

.venue-intro {
  margin: clamp(19px, 3.2vw, 28px) 0 5px;
  text-align: center;
}

.venue-location-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  color: var(--charcoal-ink);
  font: 500 clamp(18px, 3.2vw, 21px)/1.55 'Readex Pro', Tahoma, Arial, sans-serif;
}

.venue-location-heading:before,
.venue-location-heading:after {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--champagne);
}

.venue-name {
  max-width: 100%;
  margin: 4px auto 0;
  padding: 0 8px;
  color: var(--charcoal-ink);
  text-align: center;
  font: italic 700 clamp(19px, 4.8vw, 28px)/1.45 'Amiri', serif;
}

.venue-illustration {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  opacity: .84;
}

.venue-map-link {
  display: block;
  width: min(100%, 500px);
  margin: 12px auto 0;
  border-radius: 6px;
  text-decoration: none;
}

.venue-map-link:focus-visible {
  outline: 2px solid var(--secondary-ink);
  outline-offset: 4px;
}

.venue-map-hint {
  margin: 8px auto 18px;
  color: var(--secondary-ink);
  text-align: center;
  font: 400 clamp(18px, 3.4vw, 20px)/1.5 'Lateef', serif;
}

.editorial-intro {
  margin: 0 0 17px;
  color: var(--charcoal-ink);
  text-align: center;
}

.editorial-heading {
  margin: 5px 0 0;
  color: var(--charcoal-ink);
  font: 600 clamp(22px, 3.8vw, 29px)/1.5 'Readex Pro', Tahoma, Arial, sans-serif;
}

.editorial-heading--latin {
  font: 400 clamp(40px, 6.2vw, 50px)/1.08 'Alex Brush', cursive;
  letter-spacing: .01em;
}

.editorial-heading:after {
  content: "";
  display: block;
  width: 84px;
  height: 1px;
  margin: 7px auto 0;
  background: linear-gradient(90deg, transparent, var(--champagne), transparent);
}

.venue-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.venue-actions .action {
  flex: 0 1 210px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  white-space: nowrap;
}

.venue-actions .action svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.share-status {
  min-height: 1.6em;
  margin: 10px 0 0;
  color: var(--muted-taupe);
  text-align: center;
  font: 400 15px/1.7 'Readex Pro', Tahoma, Arial, sans-serif;
}

.share-status a { color: var(--secondary-ink); text-underline-offset: 3px; }

.schedule-panel { padding-bottom: 38px; }

.timeline {
  max-width: 680px;
  margin: 24px auto 0;
  padding: 0;
  list-style: none;
  direction: ltr;
}

.timeline-date {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(100%, 260px);
  margin: 16px auto 22px;
  padding: 4px 12px 0;
  color: var(--charcoal-ink);
  text-align: center;
}

.timeline-date img {
  display: block;
  width: 114px;
  height: 100px;
  object-fit: contain;
  opacity: .78;
}

.timeline-date-day {
  color: var(--muted-taupe);
  font: italic 400 clamp(23px, 4vw, 28px)/1.35 'Amiri', serif;
}

.timeline-date time {
  color: var(--charcoal-ink);
  font: 500 clamp(22px, 4vw, 27px)/1.25 'Forum', Georgia, serif;
  letter-spacing: .06em;
}

.timeline-item {
  position: relative;
  display: grid;
  min-height: 148px;
  grid-template-columns: minmax(0, 1fr) clamp(24px, 3vw, 34px) minmax(0, 1fr);
  align-items: center;
  direction: ltr;
}

.timeline-item:not(:last-child):after {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, var(--champagne), rgba(203, 187, 163, .65));
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.timeline-icon {
  z-index: 1;
  display: block;
  grid-row: 1;
  width: clamp(96px, 8vw, 116px);
  height: clamp(92px, 7.8vw, 112px);
  justify-self: center;
  object-fit: contain;
  opacity: .8;
}

.timeline-item:nth-child(odd) .timeline-icon { grid-column: 1; }
.timeline-item:nth-child(even) .timeline-icon { grid-column: 3; }
.timeline-item:nth-child(2) .timeline-icon { clip-path: inset(2%); }

.timeline-text {
  z-index: 1;
  grid-row: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  direction: rtl;
  text-align: center;
}

.timeline-item:nth-child(odd) .timeline-text {
  grid-column: 3;
  justify-self: stretch;
}

.timeline-item:nth-child(even) .timeline-text {
  grid-column: 1;
  justify-self: stretch;
}

.timeline-item:nth-child(4) { min-height: 164px; }
.timeline-item:nth-child(4) .timeline-icon {
  width: min(144px, 100%);
  height: 144px;
  object-fit: cover;
}

.timeline-text time {
  display: block;
  color: var(--muted-taupe);
  font: 500 clamp(19px, 3vw, 21px)/1.45 'Forum', Georgia, serif;
  letter-spacing: .02em;
}

.timeline-text h3 {
  margin: 0 0 4px;
  color: var(--charcoal-ink);
  font: italic 400 clamp(22px, 3.4vw, 27px)/1.45 'Amiri', serif;
}

.timeline-item:nth-child(n+4) .timeline-text h3 {
  font-size: clamp(19px, 2.8vw, 23px);
  line-height: 1.4;
}

.timeline-node {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  border: 1px solid var(--champagne);
  border-radius: 50%;
  background: var(--warm-white);
  box-shadow: 0 0 0 4px var(--section-surface), 0 2px 8px rgba(40, 37, 33, .12);
  transform: translate(-50%, -50%);
}

.guestbook {
  position: relative;
  max-width: var(--invitation-max);
  container-type: inline-size;
  margin: 0 auto;
  padding: clamp(28px, 3.2vw, 34px) clamp(24px, 5vw, 42px) 28px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--charcoal-ink);
  box-shadow: none;
  font-family: 'Amiri', serif;
  font-style: italic;
  font-weight: 400;
}

.guestbook:before {
  display: none;
}

.wedding-section {
  position: relative;
  isolation: isolate;
  background: transparent;
}

.editorial-panel,
.guestbook {
  border-radius: 8px;
  background-color: var(--section-paper);
  background-image: url("./assets/section-bg/paper-texture.png");
  background-repeat: repeat;
  background-size: 160px 160px;
}

.wedding-section > :not(.section-ornaments) {
  position: relative;
  z-index: 1;
}

.section-ornaments {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.section-ornament {
  position: absolute;
  z-index: 0;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.section-ornament--left,
.section-ornament--right {
  top: 10%;
  width: clamp(22px, 4vw, 36px);
  -webkit-mask-image: linear-gradient(to right, #000 40%, transparent 100%);
  mask-image: linear-gradient(to right, #000 40%, transparent 100%);
}

.section-ornament--left { left: 0; }

.section-ornament--right {
  right: 0;
  transform: scaleX(-1);
}

.section-ornament--subtle { width: clamp(24px, 5vw, 42px); }

.guestbook-intro {
  position: relative;
  margin: 0 0 14px;
  color: var(--charcoal-ink);
  text-align: center;
}

.guestbook-intro h2 {
  margin: 0 0 3px;
  color: var(--charcoal-ink);
  font: italic 400 clamp(38px, 3vw, 42px)/1.28 'Amiri', serif;
}

.guestbook-intro p {
  margin: 0;
  color: var(--muted-taupe);
  font: italic 400 clamp(21px, 1.7vw, 23px)/1.45 'Amiri', serif;
}

.guestbook form { position: relative; }

.guestbook .honeypot {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.guestbook label {
  display: block;
  margin: 12px 0 5px;
  color: var(--charcoal-ink);
  text-align: right;
  font: italic 400 clamp(23px, 1.8vw, 25px)/1.4 'Amiri', serif;
}

.guestbook input, .guestbook textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--soft-linen);
  border-radius: 3px;
  background: rgba(248, 246, 241, .84);
  color: var(--charcoal-ink);
  direction: rtl;
  text-align: right;
  font: italic 400 clamp(21px, 1.6vw, 22px)/1.55 'Amiri', serif;
  box-shadow: inset 0 1px 3px rgba(40, 37, 33, .035);
  transition: border-color .2s, box-shadow .2s;
}

.guestbook input::placeholder, .guestbook textarea::placeholder {
  color: var(--muted-taupe);
  opacity: 1;
  font: inherit;
  font-size: clamp(19px, 1.45vw, 20px);
}

.guestbook input:focus, .guestbook textarea:focus {
  border-color: var(--champagne);
  outline: 2px solid var(--secondary-ink);
  outline-offset: 2px;
  box-shadow: none;
}

.guestbook textarea {
  min-height: 122px;
  resize: vertical;
}

.guestbook .submit {
  display: block;
  width: 100%;
  margin-top: 15px;
  padding: 10px 14px;
  border: 1px solid var(--champagne);
  border-radius: 3px;
  background: var(--champagne);
  color: var(--charcoal-ink);
  font: italic 400 clamp(25px, 1.9vw, 27px)/1.38 'Amiri', serif;
  box-shadow: 0 6px 18px rgba(40, 37, 33, .14);
  transition: background .2s, box-shadow .2s, transform .2s;
}

.guestbook .submit:hover {
  transform: translateY(-1px);
  background: var(--champagne-hover);
  box-shadow: 0 9px 24px rgba(40, 37, 33, .18);
}

.guestbook .submit:focus-visible {
  outline: 2px solid var(--secondary-ink);
  outline-offset: 3px;
}

.guestbook-note {
  min-height: 0;
  margin: 9px 0 0;
  color: var(--charcoal-ink);
  text-align: center;
  font: italic 400 clamp(19px, 1.5vw, 21px)/1.48 'Amiri', serif;
}

.footer {
  margin: 31px auto 24px;
  color: var(--pearl-ivory);
  direction: ltr;
  text-align: center;
  font: 500 clamp(14px, 4vw, 18px)/1.6 'Cormorant Garamond', serif;
  letter-spacing: .04em;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .72), 0 0 16px rgba(0, 0, 0, .4);
  white-space: nowrap;
}

.footer-heart {
  padding: 0 .08em;
  color: #f2d9b3;
}

.footer-names {
  letter-spacing: .06em;
}

.footer-ampersand {
  display: inline-block;
  width: .9em;
  height: auto;
  margin: 0 .06em;
  object-fit: contain;
  vertical-align: -.18em;
  filter: brightness(1.08) saturate(.72) drop-shadow(0 2px 8px rgba(203, 187, 163, .2));
}

/* Scroll reveals are enabled only after the envelope has opened. */
[data-scroll-reveal] { transition: opacity .72s ease, transform .72s cubic-bezier(.2, .7, .2, 1); }

[data-scroll-reveal].reveal-ready:not(.is-revealed) {
  opacity: 0;
  transform: translateY(18px);
}

/* Fixed media and replay controls */
.toolbar {
  position: fixed;
  z-index: 25;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  gap: 8px;
  direction: ltr;
  transition: opacity .16s ease, visibility .16s ease;
}

.round {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid var(--paper-edge);
  border-radius: 50%;
  background: rgba(31, 31, 29, .86);
  color: var(--pearl-ivory);
  font-size: 20px;
  backdrop-filter: blur(8px);
  touch-action: manipulation;
}

.round:before {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  content: "";
}

.music-status {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: max-content;
  max-width: min(220px, calc(100vw - 24px));
  padding: 4px 9px;
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  background: rgba(31, 31, 29, .92);
  color: var(--pearl-ivory);
  direction: rtl;
  font: 13px/1.5 'Amiri', serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

.music-status:empty { display: none; }

.scroll-down-indicator {
  position: absolute;
  top: 37.1%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: var(--secondary-ink);
  text-align: center;
  white-space: nowrap;
  font: 400 clamp(22px, 6vw, 27px)/.72 'Lateef', 'Amiri', serif;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, -50%, 0) translateY(3px);
  pointer-events: none;
  transition: opacity .55s ease, transform .55s ease, visibility 0s linear .55s;
}

.scroll-down-indicator.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, -50%, 0);
  transition: opacity .55s ease, transform .55s ease, visibility 0s;
}

.scroll-down-indicator.is-dismissed {
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, -50%, 0) translateY(-2px);
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}

.scroll-down-indicator__chevrons {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scroll-down-indicator__chevron {
  display: block;
  width: 5px;
  height: 5px;
  margin-top: -2px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: 0;
  transform: translateY(-2px) rotate(45deg);
}

.scroll-down-indicator.is-visible:not(.is-dismissed) .scroll-down-indicator__chevron {
  animation: scroll-down-chevron 1.7s ease-in-out infinite;
}

.scroll-down-indicator__chevron:first-child { margin-top: 0; }
.scroll-down-indicator__chevron:nth-child(2) { margin-top: -4px; animation-delay: .24s; }

@keyframes scroll-down-chevron {
  0%, 100% { opacity: 0; transform: translateY(-2px) rotate(45deg); }
  28% { opacity: .78; }
  66% { opacity: .28; transform: translateY(3px) rotate(45deg); }
}

body.form-focused .toolbar {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-down-indicator,
  .scroll-down-indicator.is-visible,
  .scroll-down-indicator.is-dismissed { transition: none; }

  .scroll-down-indicator.is-visible:not(.is-dismissed) .scroll-down-indicator__chevron {
    opacity: .62;
    transform: rotate(45deg);
    animation: none;
  }
}

@media (max-width: 640px) {
  .envelope-stack { width: min(94vw, 590px, max(240px, calc((100svh - 278px) * 1.43))); }
  .canvas-layer, .flap-pivot { width: 97.99%; }
  .invitation-mask { width: 97.99%; }
  .seal-wrap { width: clamp(50px, 13.8%, 77px); }
}

@media (max-width: 520px) {
  :root { --invitation-max: 100vw; }
  .stage { padding: 0 10px; }
  .stage.reading { padding: 18px 10px 0; }
  .below { width: calc(100% - 20px); }
  .editorial-panel { padding: 27px 19px 25px; }
  .guestbook { padding: 23px 22px 24px; }
  .section-ornament--left,
  .section-ornament--right { width: 19px; }
  .section-ornament--subtle { width: 26px; }
  .guestbook-intro { margin-bottom: 12px; }
  .guestbook-intro h2 { font-size: clamp(30px, 8vw, 34px); }
  .guestbook-intro p { font-size: clamp(17px, 4.4vw, 19px); }
  .guestbook label { margin: 10px 0 5px; font-size: clamp(19px, 4.7vw, 21px); }
  .guestbook input, .guestbook textarea { padding: 9px 12px; font-size: clamp(18px, 4.5vw, 19px); }
  .guestbook input::placeholder, .guestbook textarea::placeholder { font-size: clamp(17px, 4.1vw, 18px); }
  .guestbook textarea { min-height: 116px; }
  .guestbook .submit { margin-top: 13px; padding: 9px 12px; font-size: clamp(21px, 5.3vw, 23px); }
  .guestbook-note { font-size: clamp(17px, 4.1vw, 18px); }
  .timeline { max-width: 500px; margin-top: 17px; }
  .timeline-date { margin-bottom: 17px; }
  .timeline-item { min-height: 126px; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); }
  .timeline-icon { width: 96px; height: 92px; max-width: 100%; }
  .timeline-item:nth-child(4) { min-height: 144px; }
  .timeline-item:nth-child(4) .timeline-icon { width: min(120px, 100%); height: 120px; max-width: 100%; }
  .timeline-text h3 { font-size: clamp(20px, 5vw, 22px); line-height: 1.55; }
  .timeline-text time { font-size: 20px; line-height: 1.4; }
  .timeline-node { width: 12px; height: 12px; }
}

@media (max-width: 400px) {
  .count-item strong { font-size: clamp(26px, 8vw, 32px); }
  .count-item span { font-size: clamp(12px, 3.4vw, 13px); letter-spacing: .01em; }
  .count-separator { flex-basis: .2em; }
  .guestbook { padding: 21px 22px 22px; }
  .section-ornament--subtle { width: 22px; }
}

@supports (font-size: 1cqi) {
  .guestbook-intro h2 { font-size: clamp(30px, 7.5cqi, 42px); }
  .guestbook-intro p { font-size: clamp(18px, 4.1cqi, 23px); }
  .guestbook label { font-size: clamp(20px, 4.5cqi, 25px); }
  .guestbook input, .guestbook textarea { font-size: clamp(18px, 3.95cqi, 22px); }
  .guestbook input::placeholder, .guestbook textarea::placeholder { font-size: clamp(17px, 3.55cqi, 20px); }
  .guestbook .submit { font-size: clamp(21px, 4.8cqi, 27px); }
  .guestbook-note { font-size: clamp(17px, 3.7cqi, 21px); }
}

@media (max-height: 700px) {
  .landing {
    padding: max(6px, env(safe-area-inset-top)) 0 max(6px, env(safe-area-inset-bottom));
  }

  .cover-monogram-frame { height: clamp(84px, 14svh, 104px); }

  .cover-names {
    margin-top: 12px;
    font-size: clamp(22px, 5.8vw, 32px);
  }

  .cover-date { margin-top: 6px; font-size: 18.5px; }
  .envelope-stack {
    width: min(94vw, 580px, max(240px, calc((100svh - 290px) * 1.43)));
    margin-top: 16px;
  }
  .cover-ampersand { width: clamp(22px, 4.2vw, 29px); }
  .cover-separator { margin-bottom: 0px; }
  .save-the-date { margin-top: 3px; }
  .open-cue { font-size: 11px; }
}

@media (max-width: 520px) {
  .cover-names {
    gap: clamp(6px, 2.5vw, 11px);
    font-size: clamp(21px, 6.3vw, 30px);
    letter-spacing: .08em;
  }
}

@media (max-width: 360px) {
  .cover-names { gap: 6px; font-size: clamp(20px, 6.8vw, 22px); letter-spacing: .08em; }
  .cover-ampersand { width: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .open-cue-arrow { animation: none; }
  .seal-spin, .seal, .seal-wrap::before { animation: none !important; }
  .envelope-animation-stage, .envelope-button, .action, .guestbook .submit, [data-scroll-reveal], .toolbar { transition: none !important; }
  [data-scroll-reveal].reveal-ready:not(.is-revealed) { opacity: 1; transform: none; }
}
