:root {
  --cream: #f9f8f3;
  --pine: #2a3b32;
  --gold: #d4af37;
  --paper: #fffdf7;
  --shadow-soft: 0 14px 36px rgba(42, 59, 50, 0.14);
  --shadow-strong: 0 24px 60px rgba(42, 59, 50, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Work Sans", "Segoe UI", "Trebuchet MS", sans-serif;
  background-image:
    radial-gradient(circle at 12% 0%, rgba(212, 175, 55, 0.22), transparent 32%),
    radial-gradient(circle at 95% 12%, rgba(42, 59, 50, 0.1), transparent 28%),
    linear-gradient(180deg, #fffeff 0%, var(--cream) 55%, #f2f0e8 100%);
  color: var(--pine);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.invitation-shell {
  position: relative;
  z-index: 5;
}

.invitation-shell.is-ready {
  animation: invitationSoftReveal 0.7s ease-out both;
}

.brand-badge {
  position: fixed;
  right: 0.85rem;
  top: 0.85rem;
  z-index: 36;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.55rem;
  border: 1px solid rgba(42, 59, 50, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 20px rgba(42, 59, 50, 0.11);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  text-decoration: none;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
  opacity: 0.92;
}

.brand-badge:hover,
.brand-badge:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 26px rgba(42, 59, 50, 0.16);
}

.brand-badge:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.8);
  outline-offset: 2px;
}

.brand-badge-logo {
  width: 1.05rem;
  height: 1.05rem;
  object-fit: contain;
}

.brand-badge-text {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(42, 59, 50, 0.72);
  line-height: 1;
}

.ambient-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  width: clamp(180px, 32vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(4px);
  opacity: 0.4;
}

.orb-one {
  left: -12%;
  top: -8%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.48), rgba(212, 175, 55, 0.05));
  animation: driftSlow 16s ease-in-out infinite;
}

.orb-two {
  right: -9%;
  top: 18%;
  background: radial-gradient(circle, rgba(42, 59, 50, 0.26), rgba(42, 59, 50, 0.03));
  animation: driftSlow 18s ease-in-out infinite reverse;
}

.orb-three {
  left: 24%;
  bottom: -18%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.4), rgba(212, 175, 55, 0.02));
  animation: driftSlow 20s ease-in-out infinite;
}

.floating-hearts {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  bottom: -8vh;
  left: 0;
  width: var(--heart-size, 14px);
  height: var(--heart-size, 14px);
  transform: translateX(-50%) rotate(-45deg);
  border-radius: 20% 20% 0 0;
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.9), rgba(194, 83, 115, 0.72));
  opacity: 0;
  animation: floatHeart var(--heart-duration, 14s) linear infinite;
  animation-delay: var(--heart-delay, 0s);
}

.floating-heart::before,
.floating-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.floating-heart::before {
  left: 0;
  top: -50%;
}

.floating-heart::after {
  left: 50%;
  top: 0;
}

.celebration-burst {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
}

.burst-heart {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%) rotate(-45deg);
  background: linear-gradient(145deg, #f1ce62, #d45b7f);
  border-radius: 20% 20% 0 0;
  opacity: 0;
  animation: burstOut 1000ms cubic-bezier(0.18, 0.72, 0.22, 1) forwards;
  animation-delay: var(--burst-delay, 0ms);
}

.burst-heart::before,
.burst-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.burst-heart::before {
  left: 0;
  top: -50%;
}

.burst-heart::after {
  left: 50%;
  top: 0;
}

.congrats-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  z-index: 60;
  width: min(90%, 390px);
  transform: translateX(-50%) translateY(-130%);
  border-radius: 1rem;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 228, 0.95));
  box-shadow: var(--shadow-strong);
  padding: 0.85rem 1rem;
  text-align: center;
  opacity: 0;
  transition: transform 0.55s ease, opacity 0.55s ease;
  pointer-events: none;
}

.congrats-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.congrats-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(42, 59, 50, 0.65);
}

.congrats-main {
  margin-top: 0.2rem;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: clamp(1.6rem, 5vw, 2rem);
  line-height: 1;
  color: var(--pine);
}

.congrats-sub {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: rgba(42, 59, 50, 0.74);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 52;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.9), rgba(42, 59, 50, 0.9));
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}

.title-font {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  letter-spacing: 0.03em;
}

.sparkle-title {
  position: relative;
  display: inline-block;
  background: linear-gradient(115deg, #24362d 10%, #d1a731 50%, #2a3b32 85%);
  background-size: 220% 220%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: shimmerText 7s ease-in-out infinite;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(42, 59, 50, 0.72);
}

#cover {
  transition: opacity 0.65s ease, visibility 0.65s ease;
}

#cover.is-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-glow {
  background:
    radial-gradient(circle at 10% 10%, rgba(212, 175, 55, 0.24), transparent 33%),
    radial-gradient(circle at 85% 10%, rgba(42, 59, 50, 0.16), transparent 35%),
    linear-gradient(180deg, rgba(249, 248, 243, 0.78), rgba(249, 248, 243, 0.92));
}

.envelope-wrapper {
  perspective: 900px;
  box-shadow: var(--shadow-strong);
  animation: liftFloat 4.2s ease-in-out infinite;
  width: min(96vw, 540px);
  padding: clamp(1.4rem, 4.2vw, 2.5rem) clamp(1.2rem, 4vw, 2rem);
}

.envelope {
  position: relative;
  margin: 0 auto 1.4rem;
  width: clamp(235px, 72vw, 380px);
  aspect-ratio: 17 / 10.8;
  height: auto;
  border-radius: 0.2rem 0.2rem 0.7rem 0.7rem;
  border: 1px solid rgba(42, 59, 50, 0.22);
  background:
    linear-gradient(145deg, #f7e6b2 0%, #e3c978 45%, #d8b75e 100%);
  overflow: visible;
  transform-style: preserve-3d;
}

.envelope::before,
.envelope::after {
  content: "";
  position: absolute;
  inset: 0;
}

.envelope::before {
  background:
    linear-gradient(140deg, transparent 50%, rgba(255, 255, 255, 0.32) 50%),
    linear-gradient(220deg, transparent 50%, rgba(255, 255, 255, 0.28) 50%);
}

.envelope::after {
  top: auto;
  height: 50%;
  background: linear-gradient(180deg, transparent, rgba(42, 59, 50, 0.08));
}

.envelope-pocket {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 66%;
  z-index: 3;
  border-bottom-left-radius: 0.7rem;
  border-bottom-right-radius: 0.7rem;
  background:
    linear-gradient(180deg, #f2d58f 0%, #d9b25f 100%);
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-left: 1px solid rgba(42, 59, 50, 0.18);
  border-right: 1px solid rgba(42, 59, 50, 0.18);
  border-bottom: 1px solid rgba(42, 59, 50, 0.22);
}

.envelope-letter {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 76%;
  height: 78%;
  z-index: 2;
  transform: translateX(-50%) translateY(23%);
  transition: transform 0.85s cubic-bezier(0.2, 0.8, 0.22, 1);
}

.envelope-letter-inner {
  width: 100%;
  height: 100%;
  border-radius: 0.55rem;
  border: 1px solid rgba(42, 59, 50, 0.2);
  background:
    linear-gradient(180deg, #fffef9 0%, #f7f2e5 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-shadow:
    0 12px 20px rgba(42, 59, 50, 0.16),
    inset 0 -8px 12px rgba(212, 175, 55, 0.14);
  padding: 0.75rem;
}

.envelope-letter-title {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  color: rgba(42, 59, 50, 0.9);
  line-height: 1;
  letter-spacing: 0.03em;
  text-align: center;
}

.envelope-letter-date {
  font-size: clamp(0.48rem, 1.4vw, 0.62rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(42, 59, 50, 0.65);
}

.envelope-flap {
  position: absolute;
  left: -1px;
  right: -1px;
  top: -1px;
  height: 58%;
  z-index: 5;
  transform-origin: top;
  transform: rotateX(0deg);
  transition: transform 0.8s cubic-bezier(0.22, 0.67, 0.19, 1);
  background: linear-gradient(180deg, #f5e4af, #e8cb79);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  border-top: 1px solid rgba(42, 59, 50, 0.22);
}

.envelope-seal {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 6;
  display: inline-grid;
  place-items: center;
  width: clamp(60px, 17vw, 86px);
  height: clamp(60px, 17vw, 86px);
  transform: translateX(-50%);
  border-radius: 999px;
  overflow: hidden;
  transition: transform 0.6s ease, opacity 0.45s ease;
  border: 1px solid rgba(42, 59, 50, 0.38);
  background: #fff9e9;
  color: var(--pine);
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.envelope-seal-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 0.2rem;
  background: #fff9e9;
}

#tapToOpenCta {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.28);
}

#tapToOpenCta.is-ready,
#openInvitation.is-primed #tapToOpenCta {
  background: var(--pine);
  color: var(--paper);
  border-color: rgba(42, 59, 50, 0.9);
  box-shadow: 0 10px 18px rgba(42, 59, 50, 0.24);
}

#openInvitation.is-touch-opening #tapToOpenCta {
  animation: tapCtaPulse 1.4s ease-in-out infinite;
}

#cover.is-open #tapToOpenCta {
  animation: none;
}

#openInvitation:hover .envelope-flap,
#openInvitation:focus-visible .envelope-flap,
#openInvitation.is-touch-opening .envelope-flap,
#cover.is-open .envelope-flap {
  transform: rotateX(176deg);
}

#openInvitation:hover .envelope-letter,
#openInvitation:focus-visible .envelope-letter,
#openInvitation.is-touch-opening .envelope-letter,
#cover.is-open .envelope-letter {
  transform: translateX(-50%) translateY(-27%);
}

#openInvitation:hover .envelope-seal,
#openInvitation:focus-visible .envelope-seal,
#openInvitation.is-touch-opening .envelope-seal,
#cover.is-open .envelope-seal {
  transform: translateX(-50%) translateY(-52%) scale(0.84);
  opacity: 0;
}

#mainNav {
  box-shadow: var(--shadow-soft);
  z-index: 38;
}

.nav-link {
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: rgba(42, 59, 50, 0.8);
  transition: all 0.25s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(42, 59, 50, 0.11);
  color: var(--pine);
  outline: none;
}

.nav-link.is-active {
  background: var(--pine);
  color: var(--paper);
}

.count-card {
  box-shadow: var(--shadow-soft);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.count-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px rgba(42, 59, 50, 0.16);
}

.timeline {
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0.75rem;
  bottom: 0.75rem;
  left: 1rem;
  width: 2px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.7), rgba(42, 59, 50, 0.3));
}

.timeline-item {
  position: relative;
  padding-left: 2.3rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 1rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  border: 2px solid rgba(42, 59, 50, 0.9);
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.2);
}

#galleryTrack figure {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(360px, 82vw, 760px);
  padding: clamp(0.3rem, 1.2vw, 0.75rem);
  background:
    linear-gradient(145deg, rgba(255, 254, 249, 0.92), rgba(248, 242, 225, 0.86));
  transform: scale(0.986);
  opacity: 0.78;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

#galleryTrack {
  transition: transform 0.62s cubic-bezier(0.22, 0.84, 0.18, 1);
  will-change: transform;
}

#galleryTrack.is-dragging {
  transition: none !important;
}

#galleryTrack.is-dragging figure {
  transition: none;
}

#galleryTrack figure.is-active {
  transform: scale(1);
  opacity: 1;
}

#galleryPrev,
#galleryNext {
  transition: transform 0.18s ease, background-color 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
  touch-action: manipulation;
}

#galleryPrev.is-pressed,
#galleryNext.is-pressed {
  transform: translateY(-50%) scale(0.9);
}

.gallery-image {
  width: auto;
  max-width: 100%;
  height: min(74vh, 760px);
  object-fit: contain;
  object-position: center;
  border-radius: 1rem;
}

.gallery-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(42, 59, 50, 0.24);
  transition: all 0.25s ease;
}

.gallery-dot.is-active {
  width: 1.7rem;
  background: var(--gold);
}

.glow-button {
  position: relative;
  overflow: hidden;
}

.glow-button::after {
  content: "";
  position: absolute;
  inset: -120% auto auto -30%;
  width: 36%;
  height: 280%;
  transform: rotate(20deg);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: buttonSweep 3.8s ease-in-out infinite;
}

.faq-indicator {
  transition: transform 0.25s ease;
}

.faq-trigger[aria-expanded="true"] .faq-indicator {
  transform: rotate(45deg);
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item,
#events article,
#faq .rounded-2xl,
#gallery .rounded-3xl {
  transition: transform 0.36s ease, box-shadow 0.36s ease;
}

.timeline-item:hover,
#events article:hover,
#faq .rounded-2xl:hover,
#gallery .rounded-3xl:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(42, 59, 50, 0.14);
}

@keyframes liftFloat {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes shimmerText {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes driftSlow {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -18px, 0) scale(1.04);
  }
}

@keyframes floatHeart {
  0% {
    transform: translate3d(var(--heart-drift, 0px), 0, 0) rotate(-45deg) scale(0.8);
    opacity: 0;
  }
  12% {
    opacity: var(--heart-opacity, 0.55);
  }
  88% {
    opacity: var(--heart-opacity, 0.5);
  }
  100% {
    transform: translate3d(calc(var(--heart-drift, 0px) * 1.4), -112vh, 0) rotate(-45deg) scale(1.12);
    opacity: 0;
  }
}

@keyframes burstOut {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-45deg) scale(0.35);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--burst-x, 0px)), calc(-50% + var(--burst-y, 0px)))
      rotate(calc(-45deg + var(--burst-rot, 0deg)))
      scale(1.2);
  }
}

@keyframes buttonSweep {
  0% {
    left: -30%;
  }
  55%,
  100% {
    left: 128%;
  }
}

@keyframes tapCtaPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 18px rgba(42, 59, 50, 0.24);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 14px 22px rgba(42, 59, 50, 0.3);
  }
}

@keyframes invitationSoftReveal {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  #galleryTrack figure {
    min-height: clamp(360px, 96vw, 620px);
  }

  .gallery-image {
    height: min(70vh, 620px);
  }

  .brand-badge {
    right: 0.65rem;
    top: 0.7rem;
    padding: 0.34rem 0.48rem;
  }

  .brand-badge-text {
    font-size: 0.5rem;
  }
}

@media (min-width: 640px) {
  .nav-link {
    font-size: 0.78rem;
    padding: 0.5rem 0.95rem;
  }
}

@media (max-width: 640px) {
  #cover {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .envelope-wrapper {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .ambient-layer,
  .celebration-burst {
    display: none;
  }

  .floating-hearts {
    display: block;
  }

  .floating-heart {
    animation: floatHeart var(--heart-duration, 18s) linear infinite !important;
  }

  .timeline-item,
  #events article,
  #faq .rounded-2xl,
  #gallery .rounded-3xl,
  #galleryTrack figure {
    transform: none !important;
    box-shadow: none !important;
  }
}

#galleryTrack.force-animate {
  transition: transform 0.62s cubic-bezier(0.22, 0.84, 0.18, 1) !important;
}
