:root {
  /* Matched exactly to the cream baked into the envelope.mp4 frames
     (sampled rgb 253,236,210). Keeps the video and page background
     seamless — no color seam where the video letterbox meets the page. */
  --cream: #fdecd2;
  --cream-soft: #fff4dd;
  --cream-deep: #ecd8ad;
  --sage: #b8b89e;
  --sage-deep: #636352;   /* deepened: 2.89 → 5.27:1 ✓ AA */
  --ink: #4a4636;
  --ink-soft: #6f6a58;
  --gold: #7a6438;        /* deepened: 2.53 → 4.88:1 ✓ AA */
  --wine: #7a2d3e;        /* split-complement accent — 7.97:1 ✓ AA */

  --font-script: "Great Vibes", "Apple Chancery", cursive;
  --font-display: "Italiana", "Cormorant Garamond", serif;
  --font-body: "Cormorant Garamond", "Times New Roman", serif;

  --shadow-soft: 0 30px 60px -30px rgba(74, 70, 54, 0.35);
  --shadow-letter: 0 40px 80px -20px rgba(74, 70, 54, 0.45);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Hide scrollbar track (the thin line on the right) */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / Edge legacy */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;                /* Chrome / Safari / mobile WebKit */
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(184, 184, 158, 0.16), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(184, 184, 158, 0.20), transparent 55%),
    var(--cream);
}

/* Lock page scroll while the stage is in front.
   `position: fixed` is the only reliable way on iOS Safari, since
   `overflow: hidden` alone still allows rubber-band scrolling. */
body.is-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

/* ============================================================
   STAGE — single seamless surface
   The <video> stays mounted from idle through ended; overlays sit
   on top of it. The same pixels persist across all states.
   ============================================================ */

.stage {
  position: fixed;
  inset: 0;
  /* Use the dynamic viewport on mobile so the URL bar doesn't clip us */
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  background: var(--cream);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: opacity 1s var(--ease), visibility 1s var(--ease);
}

.stage.is-idle {
  cursor: pointer;
}

.stage.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Persistent video — present in every state.
   `contain` keeps the envelope at its natural size relative to the
   composition. The video's cream letterbox matches the page bg, so
   the empty space looks like a continuous cream backdrop rather than
   black bars — no scaling needed on mobile. */
.stage__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--cream);
  pointer-events: none;
  /* Promote to its own GPU layer to isolate decode from the overlay paints */
  transform: translateZ(0);
  will-change: transform;
}

/* On portrait phones the source composition (envelope ~30% of a 16:9
   frame) shrinks into a small letterboxed strip. Scaling the video up
   restores the desktop proportions — the cream letterbox extends past
   the viewport but is clipped by the stage's overflow:hidden, and
   matches the page bg so no seam is visible. */
@media (max-width: 700px) and (orientation: portrait) {
  .stage__video {
    transform: translateZ(0) scale(1.8);
  }
}

@media (min-width: 701px) and (max-width: 1000px) and (orientation: portrait) {
  .stage__video {
    transform: translateZ(0) scale(1.35);
  }
}

/* Idle overlay: greeting at top, CTA just below envelope, envelope visible between */
.stage__idle {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  text-align: center;
  padding:
    calc(clamp(2.5rem, 7vh, 5rem) + env(safe-area-inset-top)) 1.5rem
    0;
  pointer-events: none;
  transition: opacity 0.7s var(--ease);
}

.stage.is-playing .stage__idle,
.stage.is-ended .stage__idle {
  opacity: 0;
  pointer-events: none;
}

.stage__heading {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

.stage__greeting {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ink);
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(253, 236, 210, 0.6);
}

.stage__invited {
  margin: 0;
  font-family: "Cinzel", serif;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--gold);
  text-indent: 0.35em; /* compensate trailing letter-spacing */
}

/* CTA sits in the 1fr middle zone, pinned just below the envelope */
.stage__cta {
  grid-row: 2;
  align-self: end;
  margin: 0 0 clamp(10%, 18vh, 24%);
  font-family: "Cinzel", serif;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--ink-soft);
  animation: ctaPulse 2.6s ease-in-out infinite;
}

@keyframes ctaPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Ended overlay: invitation card + scroll cue */
.stage__ended {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding:
    calc(clamp(2rem, 6vh, 4rem) + env(safe-area-inset-top)) 1.5rem
    calc(clamp(1.5rem, 4vh, 2.5rem) + env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.stage.is-ended .stage__ended {
  opacity: 1;
}

/* Double-happiness symbol inside the card, below the date */
.card__symbol {
  display: block;
  width: clamp(64px, 16vw, 96px);
  height: auto;
  margin: 1.25rem auto 0;
  border-radius: 4px;
}

/* Invitation card — sits over the open envelope */
.card {
  align-self: center;
  position: relative;
  width: min(360px, 78vw);
  padding: clamp(2rem, 4.5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  background: #fdf9ef;
  box-shadow:
    0 1px 0 rgba(168, 149, 104, 0.25) inset,
    0 30px 60px -25px rgba(74, 70, 54, 0.5),
    0 8px 18px -12px rgba(74, 70, 54, 0.35);
  text-align: center;
  color: var(--ink);

  transform: translateY(40px) scale(0.97);
  opacity: 0;
  transition:
    opacity 1.4s var(--ease) 0.2s,
    transform 1.4s var(--ease) 0.2s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(168, 149, 104, 0.45);
  pointer-events: none;
}

.stage.is-ended .card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card__inner {
  position: relative;
}

.card__eyebrow {
  font-family: var(--font-display);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.card__names {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
}

.card__name {
  font-size: clamp(2.4rem, 7vw, 3.8rem);
}

.card__amp {
  font-family: var(--font-script);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--gold);
  line-height: 1;
}

.card__ornament {
  color: var(--gold);
  margin: 1.25rem 0 1.5rem;
  display: flex;
  justify-content: center;
}

.card__line {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0.25rem 0;
  letter-spacing: 0.02em;
}

.card__date {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0;
  /* compensate for the trailing letter-spacing so the text stays optically centered */
  text-indent: 0.28em;
}

.stage__scroll {
  align-self: end;
  margin: 0;
  padding-bottom: clamp(1.5rem, 4vh, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.8s var(--ease) 1.4s;
}

.stage__scroll-label {
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-indent: 0.4em;
}

/* Mouse scroll icon */
.scroll-mouse {
  display: flex;
  justify-content: center;
  padding-top: 6px;
  width: 22px;
  height: 36px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 11px;
  box-sizing: border-box;
}

.scroll-mouse__wheel {
  width: 3px;
  height: 7px;
  background: var(--gold);
  border-radius: 2px;
  animation: scrollWheel 1.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes scrollWheel {
  0%   { transform: translateY(0);    opacity: 1; }
  60%  { transform: translateY(10px); opacity: 0; }
  61%  { transform: translateY(0);    opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

/* Tighten the card on phones so it sits inside the (now-scaled) envelope. */
@media (max-width: 700px) and (orientation: portrait) {
  .card__symbol {
    width: clamp(52px, 12vw, 72px);
    margin-top: 0.9rem;
  }
  .card {
    width: min(64vw, 260px);
    padding: 1.4rem 1.1rem;
  }
  .card::before {
    inset: 6px;
  }
  .card__eyebrow {
    font-size: 0.6rem;
    letter-spacing: 0.4em;
    margin: 0 0 0.85rem;
  }
  .card__name {
    font-size: clamp(1.7rem, 6.4vw, 2.2rem);
  }
  .card__amp {
    font-size: clamp(1.1rem, 3.6vw, 1.5rem);
  }
  .card__ornament {
    margin: 0.85rem 0 1rem;
  }
  .card__line {
    font-size: 0.78rem;
    margin: 0.15rem 0;
  }
  .card__date {
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
  }
}

.stage.is-ended .stage__scroll {
  opacity: 0.85;
}


/* ---------- Site ---------- */
.site {
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.site.is-revealed {
  opacity: 1;
}

.section {
  padding: clamp(4.5rem, 10vw, 8rem) 1.5rem;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.section + .section {
  border-top: 1px solid rgba(184, 184, 158, 0.4);
}

.section__eyebrow {
  font-family: var(--font-display);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--sage-deep);
  margin: 0 0 1.25rem;
}

/* Reveal-on-scroll */
.section,
.gallery__item {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.section.is-visible,
.gallery__item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Date */
.date__day {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  margin: 0 0 1.25rem;
  color: var(--ink);
  line-height: 1.05;
}

.date__time {
  font-family: var(--font-body);
  font-style: italic;
  margin: 0.25rem 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.date__time--soft {
  color: var(--sage-deep);
}

/* Countdown */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.75rem, 2vw, 1.75rem);
  max-width: 720px;
  margin: 0 auto;
}

.countdown__cell {
  background: var(--cream-soft);
  border: 1px solid rgba(168, 149, 104, 0.25);
  padding: clamp(1rem, 3vw, 2rem) 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-soft);
  position: relative;
}

.countdown__cell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(168, 149, 104, 0.15);
  pointer-events: none;
}

.countdown__num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.4rem);
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown__label {
  font-family: var(--font-display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--ink-soft);
}

/* Venue */
.venue__name {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin: 0 0 1rem;
  color: var(--ink);
  line-height: 1.1;
}

.venue__address {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  line-height: 1.7;
  letter-spacing: 0.05em;
}

/* RSVP */
.rsvp__title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(3rem, 8vw, 5rem);
  margin: 0 0 1.25rem;
  color: var(--ink);
  line-height: 1;
}

.rsvp__copy {
  max-width: 540px;
  margin: 0 auto 2.25rem;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 1rem 2.4rem;
  font-family: var(--font-display);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.78rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.4s var(--ease), color 0.4s var(--ease), transform 0.4s var(--ease);
  border: 1px solid currentColor;
}

.btn--solid {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.btn--solid:hover,
.btn--solid:focus-visible {
  background: var(--sage-deep);
  border-color: var(--sage-deep);
  transform: translateY(-1px);
  outline: none;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--sage-deep);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--sage-deep);
  color: var(--cream);
  outline: none;
}

/* Gallery */
.gallery__title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4rem);
  margin: 0 0 2.5rem;
  color: var(--ink);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 220px;
  gap: 1rem;
}

.gallery__item {
  margin: 0;
  overflow: hidden;
  background: var(--cream-deep);
  position: relative;
  box-shadow: var(--shadow-soft);
}

.gallery__item--tall {
  grid-row: span 2;
}

.gallery__item--wide {
  grid-column: span 2;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.4s var(--ease);
}

.gallery__item:hover img {
  transform: scale(1.05);
}

/* placeholder when image missing */
.gallery__item.is-empty img {
  display: none;
}

.gallery__item.is-empty {
  background:
    repeating-linear-gradient(
      45deg,
      var(--cream-soft) 0 12px,
      var(--cream-deep) 12px 24px
    );
}

.gallery__item.is-empty::after {
  content: "Photo";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline__title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0 0 3rem;
  color: var(--ink);
  line-height: 1.1;
}

.timeline {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Vertical spine */
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(168, 149, 104, 0.5) 8%,
    rgba(168, 149, 104, 0.5) 92%,
    transparent
  );
  transform: translateX(-50%);
}

.timeline__item {
  display: grid;
  grid-template-columns: 1fr 28px 1fr;
  align-items: center;
  gap: 0 1.25rem;
  padding: 1.4rem 0;
}

/* Time label — right-aligned on the left column */
.timeline__time {
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--wine);
  text-align: right;
  line-height: 1;
}

/* Wine dot on the spine */
.timeline__dot {
  width: 10px;
  height: 10px;
  background: var(--wine);
  border-radius: 50%;
  justify-self: center;
  box-shadow: 0 0 0 3px rgba(122, 45, 62, 0.15);
  flex-shrink: 0;
}

/* Event content — left-aligned on the right column */
.timeline__body {
  text-align: left;
}

.timeline__event {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin: 0 0 0.2rem;
  font-weight: 400;
}

.timeline__detail {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .timeline::before {
    left: 14px;
  }
  .timeline__item {
    grid-template-columns: 14px 1fr;
    grid-template-rows: auto auto;
    gap: 0 1rem;
    padding: 1.1rem 0;
  }
  .timeline__time {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
    margin-bottom: 0.15rem;
  }
  .timeline__dot {
    grid-column: 1;
    grid-row: 1 / 3;
    justify-self: center;
    align-self: start;
    margin-top: 0.15rem;
  }
  .timeline__body {
    grid-column: 2;
    grid-row: 2;
  }
}

/* ============================================================
   FAQ
   ============================================================ */
.faq__title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0 0 2.5rem;
  color: var(--ink);
  line-height: 1.1;
}

.faq__list {
  max-width: 680px;
  margin: 0 auto;
  text-align: left;
}

.faq__item {
  border-bottom: 1px solid rgba(184, 184, 158, 0.4);
}

.faq__item:first-child {
  border-top: 1px solid rgba(184, 184, 158, 0.4);
}

.faq__q {
  width: 100%;
  background: none;
  border: none;
  padding: 1.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: color 0.3s var(--ease);
}

.faq__q:hover {
  color: var(--gold);
}

/* +/– chevron */
.faq__q::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  flex-shrink: 0;
  transition: transform 0.35s var(--ease);
  line-height: 1;
}

.faq__q[aria-expanded="true"]::after {
  content: "–";
}

.faq__a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease);
}

.faq__a > p {
  overflow: hidden;
  margin: 0;
  padding-bottom: 0;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.7;
  transition: padding-bottom 0.4s var(--ease);
}

.faq__item.is-open .faq__a {
  grid-template-rows: 1fr;
}

.faq__item.is-open .faq__a > p {
  padding-bottom: 1.25rem;
}

/* Footer */
.footer {
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  border-top: 1px solid rgba(184, 184, 158, 0.4);
  background: var(--cream-soft);
}

.footer__monogram {
  font-family: var(--font-script);
  font-size: 3rem;
  color: var(--gold);
  margin: 0;
  line-height: 1;
}

.footer__line {
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 0.75rem 0 0;
}

/* Responsive */
@media (max-width: 700px) {
  .countdown {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 180px;
  }

  .gallery__item--wide {
    grid-column: span 2;
  }

  .gallery__item--tall {
    grid-row: span 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
