/* ============================================
   Tokens
   ============================================ */
:root {
  --bg: #1b0e14;
  --bg-panel: #26141c;
  --rose: #e8b4b8;
  --rose-soft: #f0cfd2;
  --rose-deep: #c97b86;
  --gold: #d8a657;
  --gold-soft: #e9c98a;
  --cream: #f7eae4;
  --berry: #7a2e44;

  --font-display: "Fraunces", serif;
  --font-body: "Manrope", sans-serif;

  --measure: 62ch;
}

/* ============================================
   Reset
   ============================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p { margin: 0; }

a { color: inherit; }

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

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
}

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

section {
  padding: 6.5rem 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  text-align: center;
  color: var(--rose-soft);
}

/* ============================================
   Ambient background embers
   ============================================ */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ember-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}

.aurora--one {
  width: 55vw;
  height: 55vw;
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, var(--berry), transparent 70%);
  animation: aurora-drift-a 34s ease-in-out infinite;
}

.aurora--two {
  width: 40vw;
  height: 40vw;
  bottom: -10%;
  right: -8%;
  background: radial-gradient(circle, rgba(216, 166, 87, 0.35), transparent 70%);
  animation: aurora-drift-b 40s ease-in-out infinite;
}

.aurora--three {
  width: 32vw;
  height: 32vw;
  top: 35%;
  left: 55%;
  background: radial-gradient(circle, rgba(232, 180, 184, 0.22), transparent 70%);
  animation: aurora-drift-c 46s ease-in-out infinite;
}

@keyframes aurora-drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, 8vh) scale(1.12); }
}
@keyframes aurora-drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, -6vh) scale(1.08); }
}
@keyframes aurora-drift-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-4vw, 5vh) rotate(8deg); }
}

.ember {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 6px 1px rgba(216, 166, 87, 0.8);
  opacity: 0;
  animation: ember-rise linear forwards;
}

@keyframes ember-rise {
  0% { opacity: 0; transform: translateY(0) translateX(0); }
  10% { opacity: 0.9; }
  90% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-100vh) translateX(var(--drift, 20px)); }
}

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.hero-flourish {
  position: absolute;
  z-index: 0;
  width: clamp(160px, 22vw, 280px);
  height: auto;
  right: clamp(0px, 6vw, 90px);
  bottom: 2%;
  opacity: 0.55;
  pointer-events: none;
}

.flourish-stem {
  fill: none;
  stroke: var(--rose-deep);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.flourish-leaf {
  fill: none;
  stroke: var(--rose-deep);
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: 0.8;
}

.flourish-bud {
  fill: var(--gold-soft);
  opacity: 0.9;
}

.reveal-item {
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s ease, transform 1s ease;
}

.hero.is-visible .reveal-item {
  opacity: 1;
  transform: translateY(0);
}

.hero.is-visible .hero-eyebrow { transition-delay: 0.1s; }
.hero.is-visible .hero-name { transition-delay: 0.28s; }
.hero.is-visible .hero-subtitle { transition-delay: 0.5s; }
.hero.is-visible .scroll-cue { transition-delay: 0.75s; }

.hero-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--rose);
  margin-bottom: 0.5rem;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(4.5rem, 15vw, 10rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow:
    0 0 30px rgba(232, 180, 184, 0.35),
    0 0 70px rgba(216, 166, 87, 0.18);
  animation: glow-flicker 6s ease-in-out infinite;
}

@keyframes glow-flicker {
  0%, 100% {
    text-shadow:
      0 0 30px rgba(232, 180, 184, 0.35),
      0 0 70px rgba(216, 166, 87, 0.18);
  }
  50% {
    text-shadow:
      0 0 40px rgba(232, 180, 184, 0.5),
      0 0 90px rgba(216, 166, 87, 0.28);
  }
}

.hero-subtitle {
  margin-top: 1.1rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.08em;
  color: var(--rose-deep);
}

.scroll-cue {
  margin-top: 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--rose);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.scroll-cue:hover { opacity: 1; }

.scroll-cue-line {
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, transparent, var(--rose-deep));
  animation: cue-pulse 2.2s ease-in-out infinite;
}

@keyframes cue-pulse {
  0%, 100% { transform: scaleY(1); opacity: 0.6; }
  50% { transform: scaleY(1.2); opacity: 1; }
}

/* ============================================
   Candles
   ============================================ */
.candles-section {
  text-align: center;
}

.section-hint {
  margin-top: 0.6rem;
  color: var(--rose-deep);
  font-size: 0.95rem;
}

.candles {
  margin: 3.5rem auto 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0.8rem, 3vw, 2rem);
}

.candle {
  position: relative;
  width: 26px;
  height: 130px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wax {
  position: absolute;
  bottom: 0;
  width: 20px;
  height: 78px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--rose-soft), var(--rose-deep));
  box-shadow: inset -3px 0 6px rgba(0, 0, 0, 0.25);
}

.wick {
  position: absolute;
  bottom: 78px;
  width: 2px;
  height: 12px;
  background: #3a2a2a;
  border-radius: 1px;
}

.flame {
  position: absolute;
  bottom: 88px;
  width: 16px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  background: radial-gradient(circle at 65% 65%, var(--gold-soft), var(--gold) 55%, var(--berry) 100%);
  box-shadow: 0 0 14px 3px rgba(216, 166, 87, 0.75);
  transform-origin: bottom center;
  animation: flicker 2.4s ease-in-out infinite;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.candle:nth-child(1) .flame { animation-duration: 2.1s; animation-delay: -0.3s; }
.candle:nth-child(2) .flame { animation-duration: 2.6s; animation-delay: -1.1s; }
.candle:nth-child(3) .flame { animation-duration: 2.3s; animation-delay: -0.6s; }
.candle:nth-child(4) .flame { animation-duration: 2.8s; animation-delay: -1.6s; }
.candle:nth-child(5) .flame { animation-duration: 2.2s; animation-delay: -0.9s; }

@keyframes flicker {
  0%, 100% { transform: rotate(45deg) scale(1); }
  25% { transform: rotate(40deg) scale(1.05); }
  50% { transform: rotate(48deg) scale(0.94); }
  75% { transform: rotate(43deg) scale(1.02); }
}

.candle.out .flame {
  opacity: 0;
  transform: rotate(45deg) scale(0.2) translateY(6px);
  animation: none;
}

.smoke {
  position: absolute;
  bottom: 100px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(230, 220, 220, 0.55);
  pointer-events: none;
  animation: smoke-rise 1.1s ease-out forwards;
}

@keyframes smoke-rise {
  0% { opacity: 0.6; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + 10px), -40px) scale(3); }
}

.wish-reveal {
  margin-top: 3rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  pointer-events: none;
}

.wish-reveal.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.wish-reveal p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  color: var(--gold-soft);
}

.wish-sign {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--rose-deep);
}

.relight-btn {
  margin-top: 1.8rem;
  background: transparent;
  border: 1px solid var(--rose-deep);
  color: var(--rose-soft);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.relight-btn:hover {
  background: rgba(232, 180, 184, 0.1);
  border-color: var(--rose-soft);
}

/* ============================================
   Letter
   ============================================ */
.letter-section {
  background: var(--bg-panel);
  max-width: none;
  border-radius: 0;
}

.letter {
  max-width: var(--measure);
  margin: 0 auto;
}

.letter p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.75;
  color: var(--cream);
  margin-bottom: 1.4rem;
}

.letter-open {
  font-style: italic;
  color: var(--rose-soft);
  margin-bottom: 0.6rem !important;
}

.letter-dropcap::first-letter {
  font-size: 3.4rem;
  font-weight: 600;
  line-height: 0.75;
  float: left;
  margin: 0.1rem 0.6rem 0 0;
  color: var(--gold-soft);
}

.signature-row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 2rem;
}

.seal {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 32% 28%, var(--gold-soft), var(--gold) 55%, var(--berry) 100%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  color: var(--cream);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.4rem;
  transform: rotate(-8deg);
}

.letter-sign {
  margin-top: 0 !important;
  font-style: italic;
  color: var(--rose-soft);
}

/* ============================================
   Gallery
   ============================================ */
.gallery {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 160px);
  gap: 1rem;
}

.gallery-item {
  margin: 0;
  grid-column: span 1;
  grid-row: span 1;
  position: relative;
}

.gallery-item--tall {
  grid-row: span 2;
}

.photo-card {
  width: 100%;
  height: 100%;
  background: var(--cream);
  padding: 8px 8px 8px;
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.photo-card:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.gallery-item:nth-child(1) .photo-card { --tilt: -2.5deg; }
.gallery-item:nth-child(2) .photo-card { --tilt: 1.5deg; }
.gallery-item:nth-child(3) .photo-card { --tilt: -1.5deg; }
.gallery-item:nth-child(4) .photo-card { --tilt: 2deg; }

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: linear-gradient(155deg, var(--berry), var(--bg-panel));
}

.gallery-item.is-empty .photo-card {
  background: var(--bg-panel);
  border: 1px dashed rgba(232, 180, 184, 0.3);
}

.gallery-item.is-empty::after {
  content: attr(data-label);
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: rgba(247, 234, 228, 0.45);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
  color: var(--rose-deep);
  font-size: 0.9rem;
}

/* ============================================
   Progress nav
   ============================================ */
.progress-nav {
  position: fixed;
  right: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--rose-deep);
  background: transparent;
  opacity: 0.55;
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: var(--gold-soft);
  border-color: var(--gold-soft);
  opacity: 1;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(216, 166, 87, 0.7);
}

@media (max-width: 640px) {
  .progress-nav { display: none; }
}

/* ============================================
   Confetti canvas
   ============================================ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  section { padding: 4.5rem 1.25rem; }
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 140px);
  }
  .gallery-item--tall { grid-row: span 2; }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-name { animation: none; }
  .scroll-cue-line { animation: none; }
  .flame { animation: none; }
  .ember { display: none; }
  .aurora { animation: none; }
  .wish-reveal { transition: opacity 0.4s ease; }
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .photo-card { transition: none; }
}
