/* Save the Date – minimalist, coastal, monochromatic */

:root {
  --bone: #FAF9F6;
  --paper: #F5F5F0;
  --taupe: #8B857E;
  --taupe-light: #A39B92;
  --taupe-soft: #B8B0A6;
  --ink: #6B6560;
  --white: #fff;
  --font-body: "cormorant-garamond", "Cormorant Garamond", Georgia, serif;
  --font-display: "sloopscriptpro-medium", "SloopScriptPro", "Sloop Script Pro", cursive;
  --font-serif: var(--font-display);
  --font-script: var(--font-display);
  --font-hero-date: var(--font-display);
  --font-sans: var(--font-body);
  --font-story-body: var(--font-body);
  --section-copy-size: clamp(1.22rem, 1.05rem + 0.42vw, 1.38rem);
  /* Matches “We’re getting married!” — shared by hero date + section H2s */
  --font-display-heading-size: clamp(2.05rem, 5.5vw + 1.35rem, 4.75rem);
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --radius: 4px;
  --shadow: 0 2px 16px rgba(107, 101, 96, 0.06);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--taupe);
  background: var(--bone);
}

body.is-site-gated {
  overflow: hidden;
}

html.site-access-granted body.is-site-gated {
  overflow: visible;
}

.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;
}

/* Full-page password gate (see script.js — change SITE_ACCESS_PASSWORD) */
.site-gate {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: var(--paper);
}

html.site-access-granted .site-gate,
.site-gate.site-gate--dismissed {
  display: none;
}

.site-gate-inner {
  width: 100%;
  max-width: min(34rem, calc(100vw - 2rem));
  text-align: center;
}

/* Gate logo — same asset as nav / hero, sized for the dialog */
.site-gate-logo {
  display: block;
  width: min(300px, 78vw);
  height: clamp(48px, 20vw, 104px);
  margin: 0 auto var(--space-md);
  background-color: var(--taupe);
  mask-image: url("assets/erin-joey-logo.png");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("assets/erin-joey-logo.png");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.site-gate-title {
  font-family: var(--font-body);
  font-size: clamp(0.82rem, 1.1vw + 0.32rem, 1.05rem);
  font-weight: 400;
  letter-spacing: normal;
  color: var(--taupe);
  line-height: 1.45;
  margin: 0 0 var(--space-lg);
}

.site-gate-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.site-gate-date {
  width: 100%;
}

.site-gate-date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.28rem 0.2rem;
}

.site-gate-digit {
  box-sizing: border-box;
  width: 2.15rem;
  height: 2.55rem;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 400;
  text-align: center;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(139, 133, 126, 0.35);
  border-radius: var(--radius);
}

.site-gate-digit:focus {
  outline: none;
  border-color: var(--taupe);
}

.site-gate-slash {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--taupe-light);
  line-height: 2.55rem;
  user-select: none;
  padding: 0 0.06rem;
}

@media (min-width: 400px) {
  .site-gate-digit {
    width: 2.35rem;
    height: 2.65rem;
  }

  .site-gate-slash {
    line-height: 2.65rem;
  }
}

.site-gate-submit {
  padding: 0.85rem var(--space-lg);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--bone);
  background: var(--taupe);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.site-gate-submit:hover {
  background: var(--ink);
}

.site-gate-error {
  margin: var(--space-sm) 0 0;
  font-size: 0.88rem;
  color: #8b5a4a;
}

.site-gate-error:not([hidden]) {
  display: block;
}


/* Subtle paper texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Navigation — fades in with hero once background video is ready */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(139, 133, 126, 0.12);
  opacity: 0;
  transition:
    background 0.2s,
    opacity 1.75s ease 0.18s;
}

body:has(.hero.hero--media-ready) .nav {
  opacity: 1;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  max-width: min(20rem, 55vw);
  text-decoration: none;
  color: var(--taupe);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-logo:hover {
  color: var(--ink);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-lg);
}

.nav-links a {
  color: var(--taupe);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: normal;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--taupe);
}

@media (max-width: 700px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-md);
    background: var(--bone);
    border-bottom: 1px solid rgba(139, 133, 126, 0.1);
    display: none;
    gap: 0;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links li {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(139, 133, 126, 0.08);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }
}

/* Hero */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.hero {
  position: relative;
  /* One full viewport on load; dvh accounts for mobile browser chrome */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  padding-top: 80px;
  padding-bottom: var(--space-2xl);
  overflow: hidden;
  /* Shared width so the date lines up with the logo’s left/right edges */
  --hero-logo-width: min(840px, 96vw);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--bone);
  z-index: 0;
}

.hero-bg-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 1.85s ease 0.12s;
}

.hero.hero--media-ready .hero-bg-media {
  opacity: 1;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(var(--hero-logo-width), 100%);
  max-width: none;
}

/* Keep hero text invisible until video has a frame (see initHeroAwaitVideo in script.js) */
.hero:not(.hero--media-ready) .hero-names,
.hero:not(.hero--media-ready) .hero-date,
.hero:not(.hero--media-ready) .hero-countdown,
.hero:not(.hero--media-ready) .hero-scroll {
  animation: none !important;
  opacity: 0;
}

.hero-names {
  margin: 0 0 var(--space-sm);
  line-height: 1.2;
}

.hero.hero--media-ready .hero-names {
  opacity: 0;
  animation: heroFadeUp 2.45s cubic-bezier(0.33, 0.86, 0.32, 1) 0.2s forwards;
}

/* Logo — filled with taupe (matches .hero-date tone) */
.hero-logo {
  display: block;
  width: var(--hero-logo-width);
  height: clamp(118px, 28vw, 220px);
  margin: 0 auto;
  background-color: var(--taupe);
  mask-image: url("assets/erin-joey-logo.png");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("assets/erin-joey-logo.png");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.hero-date {
  font-family: var(--font-hero-date);
  font-size: var(--font-display-heading-size);
  font-weight: 400;
  letter-spacing: -0.035em;
  color: var(--taupe);
  margin: 0 auto;
  line-height: 1.3;
  width: var(--hero-logo-width);
  max-width: 100%;
  box-sizing: border-box;
  /* Slight left shift without fighting the fade animation’s transform */
  padding-right: 0.85rem;
  padding-bottom: var(--space-xl);
}

.hero.hero--media-ready .hero-date {
  opacity: 0;
  animation: heroFadeUp 2.2s cubic-bezier(0.33, 0.86, 0.32, 1) 0.65s forwards;
}

.hero-countdown {
  width: min(100%, 34rem);
  margin: var(--space-xl) auto 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero-countdown .countdown-values span,
.hero-countdown .countdown-values strong {
  color: var(--taupe);
}

.hero-countdown .countdown-values strong {
  font-size: clamp(1.75rem, 5vw, 3rem);
  letter-spacing: -0.09em;
}

.countdown-values {
  margin: 0;
  display: grid;
}

/* Hero countdown: compact columns, readable spacing */
.hero-countdown .countdown-values {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  grid-template-columns: repeat(4, max-content);
  justify-content: center;
  column-gap: 2rem;
  row-gap: var(--space-xs);
}

.hero.hero--media-ready .hero-countdown {
  opacity: 0;
  animation: heroFadeUp 2s cubic-bezier(0.33, 0.86, 0.32, 1) 0.82s forwards;
}

.hero-scroll {
  position: relative;
  z-index: 1;
  margin-top: var(--space-2xl);
  color: var(--taupe-soft);
  text-decoration: none;
  font-size: 1.25rem;
}

.hero.hero--media-ready .hero-scroll {
  opacity: 0;
  animation:
    heroFadeIn 1.5s ease 1.35s forwards,
    bounce 2.2s ease-in-out 3s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .nav {
    opacity: 1 !important;
    transition: background 0.2s !important;
  }

  .hero-bg-media {
    opacity: 1 !important;
    transition: none !important;
  }

  .footer-bg-media {
    opacity: 1 !important;
  }

  .hero-names,
  .hero-date,
  .hero-countdown,
  .hero-scroll {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .section-welcome .intro-heading,
  .section-welcome .intro-body,
  .section-welcome .intro-signoff,
  .section-story .story-section-title,
  .section-story .story-body p,
  .section-travel .travel-reveal,
  .section-dress .dress-reveal,
  .section-faq .faq-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* Sections */
.section {
  padding: var(--space-2xl) var(--space-md);
}

.container {
  max-width: 640px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--font-display-heading-size);
  font-weight: 400;
  text-align: center;
  letter-spacing: normal;
  text-transform: none;
  color: var(--taupe);
  margin: 0 0 var(--space-xl);
}

/* Welcome — matches Our Story when coastal stage uses same texture */
.section-welcome {
  background: transparent;
}

.section-welcome.intro-countdown-stage {
  background-color: transparent;
}

.section-welcome .container {
  max-width: 42rem;
}

.intro-countdown-stage {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)),
    url("assets/our-story-bg-texture.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.intro-countdown-stage.section-welcome.section {
  padding: 0;
  background-color: transparent;
}

.intro-countdown-stage .welcome-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 100svh;
  padding: max(env(safe-area-inset-top), calc(56px + var(--space-md)))
    var(--space-md)
    max(env(safe-area-inset-bottom), var(--space-xl));
  background: transparent;
  isolation: isolate;
}

.intro-countdown-stage .welcome-inner::before {
  content: none;
}

.intro-countdown-stage .welcome-inner .container {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Same type pairing as Our Story: Cinzel for heading, story body stack for copy */
.intro-heading {
  font-family: var(--font-display);
  font-size: var(--font-display-heading-size);
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
  color: var(--taupe);
  text-align: center;
  margin: 0 0 var(--space-md);
  line-height: 1.25;
}

.intro-body {
  font-family: var(--font-story-body);
  font-size: var(--section-copy-size);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--taupe-light);
  text-align: center;
  line-height: 1.8;
  margin: 0 0 var(--space-sm);
}

.intro-signoff {
  font-family: var(--font-story-body);
  font-size: var(--section-copy-size);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--taupe-light);
  text-align: center;
  line-height: 1.8;
  margin: 0;
}

/* Same colors as Our Story (.story-body p / .section-title) — default .intro-* rules apply */
/* Countdown panel */
.countdown-panel {
  width: 100%;
  max-width: min(36rem, 100%);
  margin: 0 auto;
  padding: var(--space-md) var(--space-md);
  text-align: center;
  background: var(--paper);
  border: 1px solid rgba(139, 133, 126, 0.28);
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(107, 101, 96, 0.06);
}

.hero-countdown.countdown-panel {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.countdown-values span {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--taupe-light);
}

.countdown-values strong {
  font-family: "Cinzel", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.35rem, 6vw, 4.1rem);
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1.08;
  color: var(--taupe);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 35rem) {
  .hero-countdown .countdown-values {
    grid-template-columns: repeat(2, max-content);
    column-gap: 2rem;
    row-gap: 0.35rem;
  }
}

/* Our Story — full viewport split: photo (left) + scrollable text (right) */
.section-story {
  --story-gutter: clamp(1rem, 3vw, 2.25rem);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  height: 100svh;
  padding: 0;
  background-color: #14161a;
  background-image:
    linear-gradient(rgba(20, 22, 26, 0.82), rgba(20, 22, 26, 0.82)),
    url("assets/our-story-bg-slate.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.section-story .story-section-title.section-title,
.section-story .story-section-title {
  position: absolute;
  top: clamp(0.75rem, 2.2vh, 1.35rem);
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  pointer-events: none;
  color: var(--white);
}

.section-story .story-split {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: min(90rem, 100%);
  margin-inline: auto;
  display: grid;
  /* Equal-width columns so photo and text sides match */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: var(--story-gutter);
  padding-inline: var(--story-gutter);
  padding-top: calc(clamp(4.25rem, 11vh, 6.5rem) + var(--space-sm));
  padding-bottom: var(--story-gutter);
  box-sizing: border-box;
}

.section-story .story-photo-panel {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--story-gutter) 0 var(--story-gutter) var(--story-gutter);
  box-sizing: border-box;
}

/* Bounds the frame; slides are absolutely stacked so intrinsic image sizes
   cannot blow up the row (fixes bottom clipping / photos sitting too low). */
.section-story .story-slideshow {
  position: relative;
  width: min(100%, 34rem);
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  margin-inline: auto;
  overflow: hidden;
}

.section-story .story-slideshow .story-photo {
  display: block;
  filter: grayscale(100%);
}

.section-story .story-photo-slide {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  /* Fill frame; crop tall/wide images instead of shrinking layout */
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.9s ease-in-out;
}

.section-story .story-photo-slide.is-active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

.section-story .story-photo-slide:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 4px;
}

.section-story .story-text-panel {
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--story-gutter) var(--story-gutter) var(--story-gutter) 0;
  box-sizing: border-box;
  background: transparent;
}

/* Wraps scroll + bottom fade so the fade matches text width (incl. scrollbar gutter) */
.section-story .story-text-column {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 34rem);
  max-width: 100%;
}

.section-story .story-text-scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  text-align: left;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
  padding-bottom: clamp(1.75rem, 4vh, 3rem);
  transition: box-shadow 0.25s ease;
  background: transparent;
}

.section-story .story-text-scroll.story-text-scroll--at-end {
  box-shadow: none;
}

.section-story .story-text-scroll::-webkit-scrollbar {
  width: 10px;
}

.section-story .story-text-scroll::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 5px;
}

.section-story .story-text-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 5px;
}

.section-story .story-text-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.48);
}

.story-scroll-affordance {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: clamp(4.25rem, 15vh, 7rem);
  padding-bottom: 0.35rem;
  box-sizing: border-box;
  /* Same width as .story-text-scroll — positioned inside .story-text-column */
  background: linear-gradient(
    to top,
    rgba(18, 20, 24, 0.9) 0%,
    rgba(18, 20, 24, 0.5) 48%,
    rgba(18, 20, 24, 0) 100%
  );
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.story-scroll-affordance-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255, 255, 255, 0.9);
  text-shadow:
    0 1px 8px rgba(0, 0, 0, 0.55),
    0 0 2px rgba(0, 0, 0, 0.45);
}

.story-scroll-affordance-cue::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid rgba(255, 255, 255, 0.55);
  border-bottom: 2px solid rgba(255, 255, 255, 0.55);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
  transform: translateY(0) rotate(45deg);
  animation: storyScrollCueNudge 1.35s ease-in-out infinite;
}

.story-scroll-affordance.story-scroll-affordance--no-overflow,
.story-scroll-affordance.story-scroll-affordance--at-end {
  opacity: 0;
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .story-scroll-affordance-cue::after {
    animation: none;
  }
}

@keyframes storyScrollCueNudge {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }
  50% {
    transform: translateY(7px) rotate(45deg);
  }
}

.section-story .story-body p {
  font-family: var(--font-story-body);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: normal;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.8;
  margin: 0 0 var(--space-md);
}

.section-story .story-body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 52rem) {
  .section-story {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  .section-story .story-split {
    grid-template-columns: 1fr;
    /* Taller photo strip on phones so cover crops less of faces; text fills remaining space */
    grid-template-rows: clamp(22rem, 58svh, 40rem) minmax(14rem, 1fr);
    height: auto;
    min-height: calc(100svh - var(--story-gutter));
  }

  .section-story .story-photo-panel {
    max-height: none;
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }

  .section-story .story-slideshow {
    width: 100%;
    height: 100%;
    max-height: 100%;
  }

  .section-story .story-photo-slide {
    object-position: center top;
  }

  .section-story .story-text-panel {
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }

  .section-story .story-text-column {
    width: 100%;
    max-width: none;
  }

  .section-story .story-text-scroll {
    max-width: none;
    max-height: 100%;
  }
}

/* Scroll-in per block: left → right (.story-anim-ready / .story-in-view on each element) */
.section-welcome .intro-heading.story-anim-ready:not(.story-in-view),
.section-welcome .intro-body.story-anim-ready:not(.story-in-view),
.section-welcome .intro-signoff.story-anim-ready:not(.story-in-view),
.section-story .story-section-title.story-anim-ready:not(.story-in-view),
.section-story .story-body p.story-anim-ready:not(.story-in-view),
.section-travel .travel-reveal.story-anim-ready:not(.story-in-view),
.section-dress .dress-reveal.story-anim-ready:not(.story-in-view),
.section-faq .faq-reveal.story-anim-ready:not(.story-in-view) {
  opacity: 0;
  transform: translateX(calc(-1 * clamp(4.5rem, 28vw, 14rem)));
}

.section-welcome .intro-heading.story-anim-ready,
.section-welcome .intro-body.story-anim-ready,
.section-welcome .intro-signoff.story-anim-ready,
.section-story .story-section-title.story-anim-ready,
.section-story .story-body p.story-anim-ready,
.section-travel .travel-reveal.story-anim-ready,
.section-dress .dress-reveal.story-anim-ready,
.section-faq .faq-reveal.story-anim-ready {
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-welcome .intro-heading.story-in-view,
.section-welcome .intro-body.story-in-view,
.section-welcome .intro-signoff.story-in-view,
.section-story .story-section-title.story-in-view,
.section-story .story-body p.story-in-view,
.section-travel .travel-reveal.story-in-view,
.section-dress .dress-reveal.story-in-view,
.section-faq .faq-reveal.story-in-view {
  opacity: 1;
  transform: translateX(0);
}

/* Travel & Accommodations — same texture + light scrim as welcome ("We're getting married") */
.section-travel {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)),
    url("assets/travel-bg-texture.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.section-travel .container {
  max-width: 42rem;
  text-align: left;
  position: relative;
  z-index: 1;
}

.travel-main-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: var(--font-display-heading-size);
  letter-spacing: normal;
  color: var(--taupe);
  line-height: 1.25;
  margin: 0 0 var(--space-xl);
}

.travel-group {
  margin-bottom: var(--space-xl);
}

.travel-group:last-child {
  margin-bottom: 0;
}

.travel-subheading {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--taupe);
  margin: 0 0 var(--space-md);
}

.travel-prose p {
  font-family: var(--font-story-body);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--taupe-light);
  line-height: 1.8;
  margin: 0 0 var(--space-md);
}

.travel-prose p:last-child {
  margin-bottom: 0;
}

.travel-prose a {
  color: var(--taupe);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.travel-prose a:hover {
  color: var(--ink);
}

.travel-callout {
  font-family: var(--font-sans);
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--taupe-light);
}

.travel-cta-line {
  margin: var(--space-md) 0 var(--space-lg);
}

.travel-policies-intro {
  margin-bottom: var(--space-sm);
}

.travel-list {
  font-family: var(--font-story-body);
  font-size: 18px;
  color: var(--taupe-light);
  line-height: 1.75;
  margin: 0 0 var(--space-md);
  padding-left: 1.35rem;
}

.travel-list li {
  margin-bottom: var(--space-xs);
}

.travel-list li:last-child {
  margin-bottom: 0;
}

/* Dress Code — photo + dark scrim (same treatment as legacy coastal welcome) */
.section-dress {
  background-color: #121110;
  background-image:
    linear-gradient(rgba(18, 16, 15, 0.82), rgba(18, 16, 15, 0.82)),
    url("assets/dress-code-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.section-dress .container {
  max-width: 42rem;
  text-align: left;
  position: relative;
  z-index: 1;
}

.dress-prose p {
  font-family: var(--font-story-body);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--taupe-light);
  line-height: 1.8;
  margin: 0 0 var(--space-md);
}

.dress-prose p:last-of-type {
  margin-bottom: 0;
}

.dress-prose strong {
  font-weight: 600;
  color: var(--taupe);
}

.dress-temps-label {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.dress-list {
  font-family: var(--font-story-body);
  font-size: 18px;
  color: var(--taupe-light);
  line-height: 1.75;
  margin: 0 0 var(--space-md);
  padding-left: 1.35rem;
}

.dress-list li {
  margin-bottom: var(--space-xs);
}

/* Built-in grid (no image) so the palette sits on the section background — truly transparent */
.dress-palette-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-lg) var(--space-md);
  margin-top: var(--space-lg);
  margin-left: auto;
  margin-right: auto;
  max-width: 36rem;
  width: 100%;
}

.dress-palette-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
}

.dress-swatch {
  width: clamp(4.25rem, 11vw, 5.5rem);
  height: clamp(4.25rem, 11vw, 5.5rem);
  border-radius: 50%;
  border: 1px solid rgba(139, 133, 126, 0.22);
  flex-shrink: 0;
}

.dress-swatch--champagne {
  background: #f7efe4;
}

.dress-swatch--blush {
  /* Soft blush — muted lavender-rose */
  background: #d9d2d9;
}

.dress-swatch--taupe {
  background: #b9aba1;
}

.dress-swatch--sand {
  background: #efe8e1;
}

.dress-swatch--sage {
  background: #bcc8bc;
}

.dress-swatch--warm-gray {
  background: #ccc9c4;
}

.dress-swatch--olive {
  background: #c2c6a3;
}

.dress-swatch--slate {
  background: #8c9eb0;
}

.section-dress .dress-swatch-label {
  font-family: var(--font-story-body);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.section-dress .section-title {
  color: var(--white);
  text-shadow:
    0 1px 22px rgba(0, 0, 0, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.45);
}

.section-dress .dress-prose p {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.section-dress .dress-prose strong {
  color: var(--white);
}

.section-dress .dress-temps-label {
  color: rgba(255, 255, 255, 0.92);
}

.section-dress .dress-list {
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 640px) {
  .dress-palette-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* FAQ */
.section-faq {
  background: var(--paper);
}

.section-faq .container {
  max-width: 42rem;
  text-align: left;
}

.faq-list {
  margin: 0;
  padding: 0;
}

.faq-item {
  margin: 0;
}

.faq-item + .faq-item {
  margin-top: var(--space-lg);
}

.faq-question {
  font-family: var(--font-story-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--taupe);
  line-height: 1.45;
  margin: 0 0 var(--space-sm);
}

.faq-answer p {
  font-family: var(--font-story-body);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--taupe-light);
  line-height: 1.8;
  margin: 0 0 var(--space-sm);
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer a {
  color: var(--taupe);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-answer a:hover {
  color: var(--ink);
}

/* Details */
.section-details {
  background: var(--bone);
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  max-width: 560px;
  margin: 0 auto;
}

.detail-card {
  background: var(--white);
  padding: var(--space-lg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(139, 133, 126, 0.1);
}

.detail-card h3 {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: uppercase;
  margin: 0 0 var(--space-sm);
  color: var(--taupe);
}

.detail-time {
  font-family: var(--font-script);
  font-size: 1.5rem;
  letter-spacing: normal;
  color: var(--taupe);
  margin: 0 0 var(--space-xs);
}

.detail-place {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  letter-spacing: normal;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--taupe);
  margin: 0 0 var(--space-xs);
}

.detail-address {
  font-size: 0.85rem;
  color: var(--taupe-light);
  margin: 0;
  line-height: 1.6;
  font-weight: 300;
}

@media (max-width: 560px) {
  .details-grid {
    grid-template-columns: 1fr;
  }
}

/* RSVP */
.section-rsvp {
  background: var(--paper);
}

.rsvp-by {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: normal;
  color: var(--taupe-light);
  margin: -var(--space-md) 0 var(--space-lg);
}

/* RSVP envelope (updated component) */
.section-rsvp .rsvp-envelope-wrapper {
  --rsvp-paper-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 80px 20px 40px;
  margin: 0 auto var(--space-lg);
  max-width: 100%;
  perspective: 1000px;
  background: #f6f3ef;
  border-radius: 4px;
}

.section-rsvp .rsvp-envelope-wrapper:has(.envelope.open) {
  padding-bottom: min(340px, 48vh);
}

.section-rsvp .envelope {
  width: min(360px, 94vw);
  height: 240px;
  position: relative;
  background: #efeae5;
  border-radius: 6px;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
  overflow: hidden;
  transform-style: preserve-3d;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.section-rsvp .envelope:hover:not(.open) {
  transform: translateY(-8px);
}

.section-rsvp .envelope.open {
  overflow: visible;
  /* 2D paint order uses z-index; avoids flap/card fighting in 3D depth during rotateX */
  transform-style: flat;
}

.section-rsvp .envelope:focus {
  outline: 2px solid var(--taupe);
  outline-offset: 4px;
}

.section-rsvp .envelope:focus:not(:focus-visible) {
  outline: none;
}

.section-rsvp .envelope::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--rsvp-paper-grain);
  opacity: 0.12;
  pointer-events: none;
  border-radius: 6px;
}

/* Body first in DOM, flap last — flap sits on top when closed via z-index */
.section-rsvp .envelope-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 2;
  isolation: isolate;
}

.section-rsvp .envelope.open .envelope-body {
  overflow: visible;
  z-index: 10;
}

.section-rsvp .envelope-flap {
  position: absolute;
  width: 100%;
  height: 52%;
  top: 0;
  background: #e7e1db;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s ease, box-shadow 0.4s ease;
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.05);
  z-index: 4;
  /* default visible so the flipped “back” of the flap still paints */
  backface-visibility: visible;
}

/* Open: flap folded back, visible behind card; above grain (::after z-index 0), below body (10) */
.section-rsvp .envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 3;
  background: linear-gradient(185deg, #d8d2cc 0%, #c9c3bc 45%, #bab4ad 100%);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.35),
    inset 0 -3px 10px rgba(0, 0, 0, 0.08);
}

.section-rsvp .rsvp-card {
  position: absolute;
  width: 88%;
  left: 6%;
  height: 420px;
  /* Fully below envelope (H=240, card=420 → need bottom ≤ -(420−240) = -180; extra margin hides peek) */
  bottom: -440px;
  z-index: 1;
  background: #fdfbf8;
  border-radius: 3px;
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 1.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-rsvp .rsvp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--rsvp-paper-grain);
  opacity: 0.08;
  pointer-events: none;
}

.section-rsvp .envelope.open .rsvp-card {
  transform: translateY(-300px) translateZ(0);
  z-index: 2;
}

.section-rsvp .rsvp-inner {
  position: relative;
  z-index: 2;
  padding: 40px 28px;
  text-align: center;
}

.section-rsvp .rsvp-title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 4.5vw, 28px);
  letter-spacing: normal;
}

.section-rsvp .rsvp-date {
  font-family: var(--font-body);
  font-size: 16px;
  margin-top: 10px;
  color: #8c8178;
}

.section-rsvp .rsvp-divider {
  width: 40px;
  height: 1px;
  background: #d8d2cc;
  margin: 20px auto;
}

/* Readable embossed title on cream (original #F6F3EF was invisible on card) */
.section-rsvp .rsvp-title.emboss {
  color: #b0a59c;
  text-shadow:
    1px 1px 0 rgba(255, 255, 255, 0.85),
    -1px -1px 0 rgba(0, 0, 0, 0.12);
}

.section-rsvp #rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-rsvp #rsvp-form input,
.section-rsvp #rsvp-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #e5ded8;
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: normal;
  color: var(--taupe);
}

.section-rsvp #rsvp-form input:focus,
.section-rsvp #rsvp-form select:focus {
  outline: none;
  border-color: var(--taupe);
}

.section-rsvp #rsvp-form button {
  margin-top: 10px;
  padding: 14px;
  background: #8c8178;
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: normal;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.section-rsvp #rsvp-form button:hover {
  background: #6f665e;
}

.section-rsvp .rsvp-envelope-hint {
  font-size: 0.78rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--taupe-light);
  margin: var(--space-md) 0 0;
  text-align: center;
}

@media (max-width: 600px) {
  .section-rsvp .rsvp-envelope-wrapper {
    padding: 60px 16px 32px;
  }

  .section-rsvp .envelope {
    width: min(360px, 90vw);
    height: 200px;
  }

  .section-rsvp .rsvp-card {
    width: 94%;
    left: 3%;
    bottom: -440px;
  }

  .section-rsvp .envelope.open .rsvp-card {
    transform: translateY(-320px) translateZ(0) scale(1.05);
  }

  .section-rsvp .rsvp-inner {
    padding: 32px 20px;
  }
}

.form-row {
  margin-bottom: var(--space-md);
}

.form-row label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: var(--space-xs);
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  border: 1px solid rgba(139, 133, 126, 0.25);
  border-radius: var(--radius);
  background: var(--bone);
  color: var(--taupe);
  transition: border-color 0.2s;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
  color: var(--taupe-soft);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--taupe);
}

.form-row textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--bone);
  background: var(--taupe);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--ink);
}

.rsvp-note {
  font-size: 0.8rem;
  color: var(--taupe-light);
  text-align: center;
  margin: 0;
}

/* Registry */
.section-registry {
  background: var(--bone);
}

.registry-intro {
  text-align: center;
  color: var(--taupe);
  font-weight: 300;
  margin: 0 0 var(--space-lg);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.registry-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

.registry-link,
.travel-cta-link {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--taupe);
  background: var(--white);
  border: 1px solid rgba(139, 133, 126, 0.2);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.registry-link:hover,
.travel-cta-link:hover {
  border-color: var(--taupe);
  color: var(--ink);
}

/* Footer — full-bleed looping video + scrim + closing copy */
.footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  margin: 0;
  min-height: clamp(12.8rem, 25.6vw, 20.8rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--space-xl) * 0.8) var(--space-md);
  text-align: center;
  color: var(--bone);
}

.footer-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #121110;
}

.footer-bg-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.footer-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    rgba(12, 11, 10, 0.52),
    rgba(10, 9, 8, 0.68)
  );
}

.footer-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  max-width: 100%;
}

.footer-text {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.8vw + 0.35rem, 2.85rem);
  font-weight: 400;
  letter-spacing: normal;
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.65),
    0 2px 24px rgba(0, 0, 0, 0.5);
}

.footer-monogram {
  display: block;
  width: min(11rem, 52vw);
  height: clamp(2rem, 6vw, 2.75rem);
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.97);
  mask-image: url("assets/erin-joey-logo.png");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("assets/erin-joey-logo.png");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  opacity: 0.98;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}
