:root {
  color-scheme: dark;
  --black: #060506;
  --black-soft: #100d0e;
  --cream: #f7efe2;
  --cream-muted: rgba(247, 239, 226, 0.72);
  --gold: #d6b36a;
  --gold-deep: #8f7238;
  --rose: #c98b8f;
  --rose-dim: rgba(201, 139, 143, 0.2);
  --glass: rgba(255, 247, 235, 0.075);
  --line: rgba(214, 179, 106, 0.24);
  --shadow: rgba(0, 0, 0, 0.42);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--black);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 10%, rgba(214, 179, 106, 0.13), transparent 32rem),
    radial-gradient(circle at 16% 48%, rgba(201, 139, 143, 0.13), transparent 22rem),
    linear-gradient(180deg, #070606 0%, #0f0b0c 38%, #060506 100%);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

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

.atmosphere {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  gap: 18px;
  align-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(214, 179, 106, 0.12), transparent 24rem),
    #050404;
  transition: opacity 900ms ease, visibility 900ms ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader__mark {
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid rgba(214, 179, 106, 0.28);
  border-top-color: var(--gold);
  border-radius: 999px;
  animation: spin 1200ms linear infinite;
}

.loader p,
.eyebrow,
.memory-card time,
.envelope__hint,
.sound-toggle {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loader p {
  margin: 0;
  color: var(--cream-muted);
  font-size: 0.72rem;
}

.section {
  position: relative;
  min-height: 100svh;
  padding: 92px 20px;
}

.hero {
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(rgba(6, 5, 6, 0.26), rgba(6, 5, 6, 0.78)),
    url("https://images.unsplash.com/photo-1518199266791-5375a83190b7?auto=format&fit=crop&w=1800&q=84") center / cover;
  filter: saturate(0.74) brightness(0.74);
  transform: translateY(calc(var(--scroll, 0) * 0.08px)) scale(1.06);
  will-change: transform;
}

.hero__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, transparent 0 16rem, rgba(6, 5, 6, 0.42) 34rem),
    linear-gradient(180deg, rgba(6, 5, 6, 0.12), #060506 96%);
}

.hero__content {
  position: relative;
  width: min(940px, 100%);
  padding: 0 4px;
  transform: translateY(calc(var(--scroll, 0) * -0.035px));
  will-change: transform;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.7rem, 15vw, 8.8rem);
  line-height: 0.86;
  text-wrap: balance;
}

.hero__subhead {
  width: min(620px, 100%);
  margin: 28px auto 0;
  color: var(--cream-muted);
  font-size: clamp(1rem, 4vw, 1.35rem);
  line-height: 1.6;
}

.enter-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin-top: 40px;
  padding: 0 26px;
  overflow: hidden;
  border: 1px solid rgba(214, 179, 106, 0.48);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(6, 5, 6, 0.44);
  cursor: pointer;
  box-shadow: 0 18px 70px rgba(214, 179, 106, 0.12);
  transition: border-color 220ms ease, transform 220ms ease, background 220ms ease;
}

.enter-button::before {
  content: "";
  position: absolute;
  inset: -80% -30%;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.22), transparent 64%);
  animation: shimmer 3800ms ease-in-out infinite;
}

.enter-button span,
.enter-button i {
  position: relative;
}

.enter-button i {
  width: 8px;
  height: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.enter-button:hover,
.enter-button:focus-visible {
  border-color: var(--gold);
  background: rgba(214, 179, 106, 0.11);
  transform: translateY(-2px);
  outline: none;
}

.scroll-cue {
  position: absolute;
  bottom: calc(22px + var(--safe-bottom));
  left: 50%;
  width: 1px;
  height: 54px;
  overflow: hidden;
  background: rgba(247, 239, 226, 0.18);
}

.scroll-cue span {
  display: block;
  width: 100%;
  height: 18px;
  background: var(--gold);
  animation: scrollCue 2200ms ease-in-out infinite;
}

.section__header {
  width: min(960px, 100%);
  margin: 0 auto 46px;
}

.section__header h2 {
  max-width: 760px;
  font-size: clamp(2.5rem, 11vw, 6rem);
  line-height: 0.92;
}

.timeline {
  min-height: auto;
  padding-top: 110px;
  background: linear-gradient(180deg, #060506 0%, #120e0f 52%, #080607 100%);
}

.timeline__rail {
  position: absolute;
  top: 340px;
  bottom: 80px;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(214, 179, 106, 0.5), transparent);
}

.memory-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  gap: clamp(18px, 5vw, 56px);
  align-items: center;
  width: min(1060px, 100%);
  margin: 0 auto 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 247, 235, 0.09), rgba(255, 247, 235, 0.035));
  box-shadow: 0 30px 90px var(--shadow);
  backdrop-filter: blur(20px);
}

.memory-card:nth-of-type(even) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
}

.memory-card:nth-of-type(even) figure {
  order: 2;
}

.memory-card figure {
  position: relative;
  min-height: 320px;
  margin: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #191314;
}

.memory-card img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  filter: saturate(0.78) contrast(0.96);
  transform: scale(1.02);
}

.memory-card figcaption {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(247, 239, 226, 0.16);
  border-radius: 999px;
  color: rgba(247, 239, 226, 0.82);
  background: rgba(6, 5, 6, 0.72);
  font-size: 0.68rem;
  line-height: 1.2;
}

.memory-card__copy {
  padding: clamp(20px, 4vw, 44px);
}

.memory-card time,
.milestone-dates {
  display: block;
  margin-bottom: 14px;
  color: var(--rose);
  font-size: 0.72rem;
  font-weight: 700;
}

.milestone-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.milestone-dates time {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(201, 139, 143, 0.28);
  border-radius: 999px;
  background: rgba(201, 139, 143, 0.08);
  color: rgba(247, 239, 226, 0.84);
  font-size: 0.64rem;
  line-height: 1;
  white-space: nowrap;
}

.memory-card h3 {
  margin-bottom: 16px;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 0.95;
}

.memory-card p {
  margin: 0;
  color: var(--cream-muted);
  font-size: clamp(0.98rem, 2vw, 1.1rem);
  line-height: 1.75;
}

.love-notes {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.love-note {
  position: absolute;
  max-width: min(270px, 72vw);
  padding: 12px 14px;
  border: 1px solid rgba(214, 179, 106, 0.2);
  border-radius: 8px;
  color: rgba(247, 239, 226, 0.9);
  background: rgba(6, 5, 6, 0.52);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  font-family: var(--serif);
  font-size: clamp(1rem, 4vw, 1.22rem);
  line-height: 1.25;
  animation: floatNote var(--duration, 12s) ease-in-out forwards;
}

.letter-section {
  display: grid;
  align-content: center;
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% 44%, rgba(201, 139, 143, 0.13), transparent 28rem),
    linear-gradient(180deg, #080607, #130f10 54%, #070607);
}

.envelope-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(920px, 100%);
  min-height: 540px;
  margin: 0 auto;
  perspective: 1400px;
}

.envelope {
  position: relative;
  width: min(430px, 88vw);
  aspect-ratio: 1.48;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: opacity 500ms ease, transform 900ms cubic-bezier(0.2, 0.9, 0.2, 1);
  z-index: 3;
}

.envelope__body,
.envelope__flap {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(214, 179, 106, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(247, 239, 226, 0.96), rgba(214, 179, 106, 0.72)),
    #e9d6ad;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.35);
}

.envelope__body::before,
.envelope__body::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(36deg, transparent 49.4%, rgba(143, 114, 56, 0.5) 50%, transparent 50.6%),
    linear-gradient(144deg, transparent 49.4%, rgba(143, 114, 56, 0.5) 50%, transparent 50.6%);
}

.envelope__flap {
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: top center;
  transition: transform 900ms cubic-bezier(0.18, 0.95, 0.18, 1);
  z-index: 2;
}

.envelope__seal {
  position: absolute;
  top: 49%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 247, 235, 0.54);
  border-radius: 999px;
  color: var(--cream);
  background: linear-gradient(135deg, #b1777c, #7a3439);
  box-shadow: 0 12px 30px rgba(122, 52, 57, 0.34);
  font-family: var(--serif);
  font-size: 2rem;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.envelope__hint {
  position: absolute;
  left: 50%;
  bottom: -44px;
  color: var(--gold);
  font-size: 0.7rem;
  transform: translateX(-50%);
  white-space: nowrap;
}

.envelope-stage.is-open .envelope {
  opacity: 0;
  pointer-events: none;
  transform: translateY(70px) rotateX(8deg) scale(0.9);
}

.envelope-stage.is-open .envelope__flap {
  transform: rotateX(172deg);
}

.letter-paper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 32px));
  max-height: min(78svh, 780px);
  margin: 0;
  overflow: auto;
  padding: clamp(28px, 6vw, 58px);
  border: 1px solid rgba(214, 179, 106, 0.34);
  border-radius: 8px;
  color: #211715;
  background:
    linear-gradient(rgba(255, 252, 245, 0.88), rgba(255, 252, 245, 0.88)),
    linear-gradient(135deg, #fbf3e4, #e7d1a8);
  box-shadow: 0 38px 110px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translate(-50%, -38%) rotateX(12deg) scale(0.82);
  transform-origin: center top;
  transition: opacity 720ms ease 260ms, transform 1000ms cubic-bezier(0.18, 0.95, 0.18, 1) 220ms;
  z-index: 2;
}

.envelope-stage.is-open .letter-paper {
  opacity: 1;
  transform: translate(-50%, -50%) rotateX(0deg) scale(1);
}

.letter-paper p {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4.6vw, 1.72rem);
  line-height: 1.42;
}

.letter-paper .signature {
  margin-top: 30px;
  color: #7a3439;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
}

.finale {
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 100svh;
  text-align: center;
  background:
    radial-gradient(circle at 50% 52%, rgba(214, 179, 106, 0.16), transparent 18rem),
    linear-gradient(180deg, #070607, #020202 62%, #000);
}

.finale__glow {
  position: absolute;
  width: min(620px, 86vw);
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(247, 239, 226, 0.18), rgba(214, 179, 106, 0.08) 36%, transparent 68%);
  filter: blur(4px);
  animation: breathe 6800ms ease-in-out infinite;
}

.finale__content {
  position: relative;
  width: min(900px, 100%);
}

.finale p {
  margin: 0 0 18px;
  color: var(--cream-muted);
  font-family: var(--serif);
  font-size: clamp(1.8rem, 8vw, 4.8rem);
  line-height: 0.98;
}

.finale h2 {
  font-size: clamp(2.4rem, 13vw, 7.5rem);
  line-height: 0.9;
  text-wrap: balance;
}

.sound-toggle {
  position: fixed;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(214, 179, 106, 0.34);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(6, 5, 6, 0.62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.sound-toggle__icon {
  width: 10px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 0 rgba(201, 139, 143, 0.46);
}

.sound-toggle[aria-pressed="true"] .sound-toggle__icon {
  background: var(--gold);
  animation: pulse 1900ms ease-out infinite;
}

.reveal,
.reveal-card {
  opacity: 0;
  transform: translateY(28px);
}

.is-loaded .reveal {
  animation: rise 1100ms cubic-bezier(0.2, 0.86, 0.22, 1) forwards;
}

.is-loaded .reveal:nth-child(2) {
  animation-delay: 160ms;
}

.is-loaded .reveal:nth-child(3) {
  animation-delay: 310ms;
}

.is-loaded .reveal:nth-child(4) {
  animation-delay: 460ms;
}

.reveal-card.is-visible {
  animation: rise 900ms cubic-bezier(0.2, 0.86, 0.22, 1) forwards;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

@keyframes shimmer {
  0%, 50% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

@keyframes scrollCue {
  0% { transform: translateY(-22px); opacity: 0; }
  30%, 70% { opacity: 1; }
  100% { transform: translateY(58px); opacity: 0; }
}

@keyframes floatNote {
  0% {
    opacity: 0;
    transform: translate3d(0, 24px, 0) scale(0.96);
  }
  14%, 76% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 22px), -84px, 0) scale(1.02);
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe {
  50% { transform: scale(1.08); opacity: 0.72; }
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(214, 179, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(214, 179, 106, 0); }
}

@media (max-width: 760px) {
  .section {
    padding: 78px 16px;
  }

  .hero {
    align-items: end;
    padding-bottom: 116px;
  }

  .hero__content {
    text-align: left;
  }

  .hero__subhead {
    margin-left: 0;
  }

  .timeline__rail {
    left: 18px;
    top: 300px;
  }

  .memory-card,
  .memory-card:nth-of-type(even) {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 34px;
  }

  .memory-card:nth-of-type(even) figure {
    order: 0;
  }

  .memory-card figure,
  .memory-card img {
    min-height: 248px;
  }

  .memory-card__copy {
    padding: 24px 10px 12px;
  }

  .envelope-stage {
    min-height: 620px;
  }

  .letter-paper {
    max-height: 82svh;
  }

  .sound-toggle {
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
  }
}

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

  .hero::before,
  .hero__content {
    transform: none;
  }
}
