/* ========================================
   Christmas Card 2025
   Elegant Holiday Design
   ======================================== */

:root {
  /* Color Palette */
  --burgundy: #6B1C23;
  --burgundy-light: #8B2232;
  --burgundy-dark: #4A1219;
  --forest: #1E3F2B;
  --forest-light: #2D5A3D;
  --gold: #C9A227;
  --gold-light: #E5C766;
  --cream: #FBF7F0;
  --cream-dark: #F0E8D9;
  --ivory: #FFFEF9;
  --charcoal: #1A1A1F;
  --charcoal-light: #2A2A30;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Allura', cursive;

  /* Spacing */
  --section-padding: clamp(3rem, 8vw, 6rem);

  /* Transitions */
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  scroll-behavior: smooth;
  /* Prevent overscroll showing white edges */
  background: var(--charcoal);
}

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--charcoal);
  background: var(--charcoal);
  min-height: 100vh;
  overflow-x: hidden;
  /* Prevent overscroll bounce on iOS */
  overscroll-behavior: none;
}

/* ========================================
   Snow Canvas
   ======================================== */

#snow-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}

/* ========================================
   Twinkling Lights
   ======================================== */

.lights-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Midground: above backgrounds, below UI elements (z-index 150) */
  z-index: 50;
  overflow: hidden;
}

/* Envelope lights - higher z-index for envelope screen */
.envelope-lights {
  z-index: 10;
}

.light {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.light--gold {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold), 0 0 20px var(--gold-light);
}

.light--white {
  background: white;
  box-shadow: 0 0 8px white, 0 0 15px rgba(255, 255, 255, 0.5);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ========================================
   Envelope Screen
   ======================================== */

.envelope-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  z-index: 100;
  background: radial-gradient(ellipse at 50% 30%, #2a2a35 0%, var(--charcoal) 60%, #0a0a0c 100%);
  transition: opacity 0.8s ease-out, visibility 0.8s;
}

.envelope-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ========================================
   Envelope - Realistic Closed Envelope Design

   Structure: Like a real envelope viewed from the front
   - Body: the main rectangular envelope front
   - Flap: folded DOWN over the body, triangular tip pointing down
   - Wax seal: at the flap tip, sealing it closed
   ======================================== */

/* Envelope Scene - Perspective Container */
.envelope-scene {
  perspective: 1500px;
  perspective-origin: center center;
  /* Push envelope down so its top is slightly below screen center */
  margin-top: 12vh;
}

/* Main Envelope Wrapper */
.envelope {
  --env-w: min(480px, 88vw);
  --env-h: calc(var(--env-w) * 0.48);
  --flap-h: calc(var(--env-h) * 0.45);

  /* Paper colors - rich cream stationery */
  --paper-front: #F5F0E6;
  --paper-front-light: #FAF7F0;
  --paper-flap: #EDE8DC;
  --paper-flap-dark: #E0D9CC;
  --paper-inner: #E8E0D0;
  --paper-shadow: #D4CBBA;

  /* Letter paper */
  --letter-paper: #F8F3E6;

  position: relative;
  width: var(--env-w);
  height: var(--env-h);
  cursor: pointer;
  transform-style: preserve-3d;
  transform: rotateX(5deg);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  isolation: isolate;
}

.envelope:hover {
  transform: translateY(-8px) rotateX(8deg) scale(1.02);
}

.envelope.opening {
  pointer-events: none;
  /* Fade out after letter slides up (1.4s delay + 4s animation = 5.4s) */
  animation: envelopeFadeOut 0.5s ease-out 5s forwards;
}

/* Envelope opening animations */
.envelope.opening .wax-seal {
  animation: sealBreak 0.4s ease-out forwards;
}

.envelope.opening .envelope-flap {
  animation: flapLift 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

.envelope.opening .envelope-letter {
  animation: letterEmerge 1.2s ease-out 0.8s forwards;
}

@keyframes sealBreak {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  40% { transform: translate(-50%, -50%) scale(1.2) rotate(-5deg); }
  100% { transform: translate(-50%, -50%) scale(0.8) rotate(10deg); opacity: 0; }
}

@keyframes flapLift {
  0% { transform: rotateX(0deg); }
  100% { transform: rotateX(160deg); }
}

@keyframes letterEmerge {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  /* Slide fully out of envelope (compensate for lower start) */
  25% {
    transform: translateY(-120%);
    opacity: 1;
  }
  /* Pause - hold position for ~1.5 seconds */
  62% {
    transform: translateY(-120%);
    opacity: 1;
  }
  /* Slide up and off screen */
  100% {
    transform: translateY(-300%);
    opacity: 1;
  }
}

@keyframes envelopeFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ----------------------------------------
   Envelope Body - The front face
   ---------------------------------------- */
.envelope-back-panel {
  position: absolute;
  inset: 0;
  background:
    /* Subtle paper grain */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--paper-front-light) 0%, var(--paper-front) 100%);
  border-radius: 4px;
  /* Body in front of letter and flap */
  z-index: 10;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 12px 24px -8px rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  /* Starts in lowered position */
  transform: translateY(calc(var(--env-h) * 0.35));
}

/* Decorative gold border frame */
.envelope-back-panel::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 2px;
  pointer-events: none;
  /* Inner double frame */
  box-shadow: inset 0 0 0 3px var(--paper-front), inset 0 0 0 4px rgba(201, 162, 39, 0.2);
}

/* Decorative border stripe at bottom */
.envelope-back-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg,
    var(--burgundy) 0%, var(--burgundy) 33%,
    var(--forest) 33%, var(--forest) 66%,
    var(--burgundy) 66%, var(--burgundy) 100%);
  border-radius: 0 0 4px 4px;
  opacity: 0.7;
}

/* Corner decorations for envelope */
.envelope-back-panel .corner-decor {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Decorative corner flourishes via additional pseudo element workaround */
.envelope::after {
  content: '✦';
  position: absolute;
  bottom: calc(var(--env-h) * 0.35 + 22px);
  right: 22px;
  font-size: 10px;
  color: var(--gold);
  opacity: 0.4;
  z-index: 11;
  pointer-events: none;
}

/* ----------------------------------------
   Letter Inside - Victorian Holiday Stationery Design
   ---------------------------------------- */
.envelope-letter {
  position: absolute;
  /* Start lower so letter is fully behind envelope body */
  top: calc(10% + var(--env-h) * 0.35);
  left: 5%;
  width: 90%;
  height: 82%;
  /* Layered paper effect - warm ivory with subtle cream undertones */
  background:
    /* Subtle linen texture overlay */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='linen'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23linen)' opacity='0.025'/%3E%3C/svg%3E"),
    /* Warm gradient - light from top */
    radial-gradient(ellipse at 50% 0%, #FFFDF8 0%, var(--letter-paper) 50%, #EBE3D3 100%);
  border-radius: 3px;
  transform-origin: center center;
  /* Multi-layered shadow for depth and realism */
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 8px 16px rgba(0, 0, 0, 0.12),
    0 16px 32px rgba(0, 0, 0, 0.08),
    /* Inner glow for paper thickness effect */
    inset 0 0 30px rgba(255, 253, 248, 0.4);
  /* Behind the body - inside the envelope */
  z-index: 1;
  opacity: 0;
  overflow: hidden;
}

/* Letter emerges after flap is done - slide out, pause ~1.5s, slide up */
.envelope.opening .envelope-letter {
  z-index: 7;
  animation: letterEmerge 4s ease-in-out 1.4s forwards;
}

/* Elegant triple-border frame */
.envelope-letter::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 2px;
  pointer-events: none;
}

.envelope-letter::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(201, 162, 39, 0.15);
  border-radius: 1px;
  pointer-events: none;
}

/* Paper texture for letter */
.letter-texture {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.letter-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1.25rem 1.25rem;
  text-align: center;
  gap: 0;
}

/* Corner flourishes - Victorian style */
.letter-inner::before,
.letter-inner::after {
  content: '❧';
  position: absolute;
  font-size: 0.9rem;
  color: var(--gold);
  opacity: 0.3;
}

.letter-inner::before {
  top: 0.4rem;
  left: 0.5rem;
  transform: rotate(-45deg);
}

.letter-inner::after {
  bottom: 0.4rem;
  right: 0.5rem;
  transform: rotate(135deg);
}

/* Main greeting - dramatic letterpress effect */
.letter-greeting {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.5vw, 2.2rem);
  font-weight: 600;
  color: var(--burgundy);
  line-height: 1.1;
  margin-bottom: 0.1rem;
  letter-spacing: 0.02em;
  /* Subtle embossed/letterpress effect */
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6),
    0 -1px 0 rgba(107, 28, 35, 0.1);
}

/* Script subgreeting with decorative swashes */
.letter-subgreeting {
  font-family: var(--font-script);
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  color: var(--forest);
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Ornate divider with diamond accent */
.letter-divider {
  position: relative;
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(201, 162, 39, 0.3) 20%,
    var(--gold) 50%,
    rgba(201, 162, 39, 0.3) 80%,
    transparent);
  margin-bottom: 0.3rem;
}

.letter-divider::before {
  content: '◆';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.45rem;
  color: var(--gold);
  background: var(--letter-paper);
  padding: 0 0.25rem;
}

/* Tagline - refined italic with better spacing */
.letter-tagline {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-style: italic;
  color: var(--charcoal);
  opacity: 0.65;
  margin-bottom: 0.2rem;
  letter-spacing: 0.04em;
}

/* Decorative snowflake ornament */
.letter-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.letter-ornament span {
  color: var(--gold);
  font-size: 0.6rem;
  opacity: 0.4;
}

/* Center snowflake - larger and more prominent */
.letter-ornament span:nth-child(2) {
  font-size: 1rem;
  opacity: 0.55;
  color: var(--burgundy);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* Family name - elegant small caps */
.letter-from {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  font-weight: 500;
  color: var(--burgundy);
  opacity: 0.6;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

/* ----------------------------------------
   Hide unused elements from old structure
   ---------------------------------------- */
.envelope-pocket,
.envelope-texture,
.envelope-fold,
.envelope-inner-shadow {
  display: none;
}

/* ----------------------------------------
   Flap - Folds DOWN over the envelope body
   Like a real closed envelope
   ---------------------------------------- */
.envelope-flap {
  position: absolute;
  /* Start in lowered position to match body */
  top: calc(var(--env-h) * 0.35);
  left: 0;
  width: 100%;
  height: var(--flap-h);
  /* The flap's OUTSIDE (what you see when closed) */
  background:
    linear-gradient(180deg,
      var(--paper-flap) 0%,
      var(--paper-flap-dark) 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  /* Flap on top when closed */
  z-index: 15;
  /* Shadow underneath the flap */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* When opening, flap rotates and drops z-index */
.envelope.opening .envelope-flap {
  animation:
    flapLift 1s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards,
    flapDropBehind 0.01s linear 1.3s forwards;
  will-change: transform;
}

@keyframes flapDropBehind {
  to { z-index: 5; }
}

/* Flap fold line - subtle crease where it bends */
.envelope-flap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 10%,
    rgba(0, 0, 0, 0.08) 30%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.08) 70%,
    transparent 90%);
}

/* Inner pattern - elegant envelope liner that extends down */
.flap-inner-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  /* Extend below the flap into the envelope */
  height: 160%;
  /* Shape: shallow triangle at top, then straight sides extending down */
  clip-path: polygon(0 0, 50% 12%, 100% 0, 100% 100%, 0 100%);
  /* Subtle burgundy with delicate gold accents */
  background:
    /* Delicate gold diamond lattice */
    repeating-linear-gradient(
      60deg,
      transparent 0px,
      transparent 22px,
      rgba(201, 162, 39, 0.15) 22px,
      rgba(201, 162, 39, 0.15) 23px
    ),
    repeating-linear-gradient(
      -60deg,
      transparent 0px,
      transparent 22px,
      rgba(201, 162, 39, 0.15) 22px,
      rgba(201, 162, 39, 0.15) 23px
    ),
    /* Soft highlight */
    radial-gradient(circle at 50% 20%, rgba(255,255,255,0.05) 0%, transparent 50%),
    /* Deep burgundy base */
    linear-gradient(180deg, var(--burgundy) 0%, var(--burgundy-dark) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

/* Show inner pattern instantly when flap reaches ~90 degrees (edge-on) */
.envelope.opening .flap-inner-pattern {
  animation: revealInner 0.01s steps(1) 0.64s forwards;
}

@keyframes revealInner {
  to { opacity: 1; }
}

/* ----------------------------------------
   Wax Seal - Center of flap tip
   ---------------------------------------- */
.wax-seal {
  position: absolute;
  /* Centered at flap tip (flap starts lowered) */
  top: calc(var(--flap-h) + var(--env-h) * 0.35);
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(50px, 14vw, 65px);
  height: clamp(50px, 14vw, 65px);
  border-radius: 50%;
  /* Realistic wax seal - light from upper left */
  background: radial-gradient(
    circle at 35% 35%,
    #B84050 0%,
    #9B2535 20%,
    var(--burgundy) 45%,
    #5A1520 80%,
    #3A0A10 100%
  );
  box-shadow:
    /* Outer shadow for depth */
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.3),
    /* Inner highlight from upper left */
    inset 2px 2px 6px rgba(255, 200, 200, 0.25),
    /* Inner shadow on lower right */
    inset -2px -2px 8px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* Higher than flap so seal sits on top */
  z-index: 20;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.envelope:hover .wax-seal {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow:
    0 8px 24px rgba(107, 28, 35, 0.6),
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 3px 6px rgba(255, 255, 255, 0.2),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4);
}

/* Seal shine/highlight */
.seal-shine {
  position: absolute;
  top: 12%;
  left: 15%;
  width: 35%;
  height: 30%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.3), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Monogram letter - embossed effect */
.seal-letter {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.15);
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.5),
    -1px -1px 1px rgba(255, 255, 255, 0.15),
    0 0 8px rgba(0, 0, 0, 0.3);
  user-select: none;
  position: relative;
  z-index: 1;
  letter-spacing: -0.05em;
}

.seal-letter small {
  font-size: 0.7em;
  vertical-align: middle;
  margin: 0 0.05em;
}

/* Decorative ring around seal */
.seal-ring {
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

/* Inner decorative ring */
.seal-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

/* ----------------------------------------
   CTA Text
   ---------------------------------------- */
.envelope-cta {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0;
  animation: ctaFadeIn 0.6s ease 0.8s forwards;
  transition: opacity 0.3s ease;
  /* Move down to match lowered envelope position */
  margin-top: calc(var(--env-h, 200px) * 0.35);
}

.envelope-cta.hidden {
  opacity: 0 !important;
  animation: none;
  pointer-events: none;
}

@keyframes ctaFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 0.5;
    transform: translateY(0);
  }
}

/* ========================================
   Scroll Hint
   ======================================== */

.scroll-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.scroll-hint.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-hint-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0.7;
}

.scroll-hint-arrow {
  width: 24px;
  height: 24px;
  color: var(--gold);
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-hint-arrow svg {
  width: 100%;
  height: 100%;
}

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

/* ========================================
   Main Card Content
   ======================================== */

.card-content {
  opacity: 0;
  visibility: hidden;
  position: relative;
  /* No z-index here - let child elements control their own stacking */
}

.card-content.visible {
  visibility: visible;
  animation: contentReveal 1.2s ease-out forwards;
}

@keyframes contentReveal {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Hero Section
   ======================================== */

.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--section-padding);
  padding-top: calc(var(--section-padding) + 2rem);
  background: linear-gradient(180deg, var(--charcoal) 0%, var(--charcoal-light) 100%);
  /* Extra top padding for overscroll */
  margin-top: -100px;
  padding-top: calc(var(--section-padding) + 100px + 2rem);
  position: relative;
}

.hero-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  z-index: 150;
}

.ornament-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
}

.ornament {
  color: var(--gold);
  font-size: 0.8rem;
}

.ornament-line .line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 400;
  color: var(--cream);
  letter-spacing: 0.05em;
  margin: 0.5rem 0;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-style: italic;
  color: var(--gold);
  margin-top: 0.5rem;
}


/* Hero Photos */
.hero-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 1100px;
  width: 100%;
  padding: 0 1rem;
}

@media (max-width: 900px) {
  .hero-photos {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
  }
}

@media (max-width: 480px) {
  .hero-photos {
    grid-template-columns: 1fr;
    max-width: 350px;
  }
}

.photo-frame {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
  z-index: 150;
}

.photo-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--gold);
  border-radius: 4px;
  opacity: 0.3;
  z-index: 2;
  pointer-events: none;
}

.photo-frame:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--charcoal-light) 0%, var(--charcoal) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  opacity: 0.5;
  font-family: var(--font-body);
}

.photo-placeholder span {
  font-size: 1.2rem;
}

.photo-placeholder small {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}


/* ========================================
   Letter Section
   ======================================== */

.letter-section {
  display: flex;
  justify-content: center;
  padding: var(--section-padding);
  background: linear-gradient(180deg, var(--charcoal-light) 0%, var(--forest-dark, #0D1F15) 100%);
  position: relative;
}

.letter {
  position: relative;
  max-width: 700px;
  width: 100%;
}

.letter-paper {
  background: var(--ivory);
  padding: clamp(2rem, 6vw, 4rem);
  border-radius: 2px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  z-index: 150;
}

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

.letter-header {
  text-align: right;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(107, 28, 35, 0.1);
}

.letter-date {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--burgundy);
  opacity: 0.7;
}

.letter-body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.9;
  color: var(--charcoal);
}

.letter-body p {
  margin-bottom: 1.5rem;
  text-indent: 2rem;
}

.letter-body p:first-of-type {
  text-indent: 0;
}

.salutation {
  font-family: var(--font-display);
  font-size: 1.3em;
  font-style: italic;
  margin-bottom: 1.5rem !important;
  text-indent: 0 !important;
}

.closing {
  text-indent: 0 !important;
  margin-top: 2rem !important;
  margin-bottom: 0.5rem !important;
}

.signatures {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-left: 2rem;
}

.signature {
  font-family: var(--font-script);
  font-size: 2.5rem;
  color: var(--burgundy);
}

.signature-and {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--charcoal);
  opacity: 0.6;
}

/* Scripture quote */
.scripture {
  margin-top: 2.5rem !important;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(107, 28, 35, 0.1);
  font-style: italic;
  text-align: center;
  text-indent: 0 !important;
  color: var(--forest);
  font-size: 0.95em;
  line-height: 1.7;
}

.scripture-ref {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.85em;
  color: var(--burgundy);
  opacity: 0.7;
  letter-spacing: 0.05em;
}

/* Letter Flourishes */
.letter-flourish {
  position: absolute;
  width: 40px;
  height: 40px;
  opacity: 0.15;
}

.letter-flourish::before,
.letter-flourish::after {
  content: '';
  position: absolute;
  background: var(--gold);
}

.letter-flourish.top-left {
  top: 1rem;
  left: 1rem;
}

.letter-flourish.top-left::before {
  width: 100%;
  height: 1px;
  top: 0;
  left: 0;
}

.letter-flourish.top-left::after {
  width: 1px;
  height: 100%;
  top: 0;
  left: 0;
}

.letter-flourish.top-right {
  top: 1rem;
  right: 1rem;
}

.letter-flourish.top-right::before {
  width: 100%;
  height: 1px;
  top: 0;
  right: 0;
}

.letter-flourish.top-right::after {
  width: 1px;
  height: 100%;
  top: 0;
  right: 0;
}

.letter-flourish.bottom-left {
  bottom: 1rem;
  left: 1rem;
}

.letter-flourish.bottom-left::before {
  width: 100%;
  height: 1px;
  bottom: 0;
  left: 0;
}

.letter-flourish.bottom-left::after {
  width: 1px;
  height: 100%;
  bottom: 0;
  left: 0;
}

.letter-flourish.bottom-right {
  bottom: 1rem;
  right: 1rem;
}

.letter-flourish.bottom-right::before {
  width: 100%;
  height: 1px;
  bottom: 0;
  right: 0;
}

.letter-flourish.bottom-right::after {
  width: 1px;
  height: 100%;
  bottom: 0;
  right: 0;
}

/* ========================================
   Gallery Section
   ======================================== */

.gallery-section {
  padding: var(--section-padding);
  background: linear-gradient(180deg, var(--forest-dark, #0D1F15) 0%, var(--charcoal) 100%);
  position: relative;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 400;
  color: var(--cream);
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  z-index: 150;
}

.gallery-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--gold);
  margin: 1rem auto 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
  z-index: 150;
}

.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--gold);
  border-radius: 4px;
  opacity: 0;
  z-index: 2;
  transition: opacity var(--transition-smooth);
  pointer-events: none;
}

.gallery-item:hover {
  transform: scale(1.03);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.gallery-item:hover::before {
  opacity: 0.5;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Gallery items - uniform squares */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   Closing Section
   ======================================== */

.closing-section {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--section-padding);
  /* Extra bottom padding for overscroll */
  padding-bottom: calc(var(--section-padding) + 100px);
  background: var(--charcoal);
  position: relative;
}

.closing-content {
  text-align: center;
  max-width: 600px;
  position: relative;
  z-index: 150;
}

.closing-ornament {
  margin-bottom: 2rem;
}

/* Door symbol - subtle pulse animation */
.door-symbol {
  width: 60px;
  height: 75px;
  animation: gentlePulse 4s ease-in-out infinite;
}

@keyframes gentlePulse {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.closing-message {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.closing-year {
  font-family: var(--font-script);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--gold);
  margin-bottom: 2rem;
}

.closing-names {
  margin-bottom: 2rem;
}

.closing-names span {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--cream);
  opacity: 0.7;
}

.closing-names .names {
  font-family: var(--font-script);
  font-size: 2.5rem;
  color: var(--gold);
  opacity: 1;
  margin-top: 0.5rem;
}

.closing-decoration {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.closing-decoration .star {
  color: var(--gold);
  font-size: 0.8rem;
  animation: twinkle 2s ease-in-out infinite;
}

.closing-decoration .star:nth-child(2) {
  animation-delay: 0.5s;
}

.closing-decoration .star:nth-child(3) {
  animation-delay: 1s;
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  transition-delay: var(--delay, 0s);
}

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

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .envelope-scene {
    /* Slightly less offset on mobile */
    margin-top: 8vh;
  }

  .envelope {
    width: 90vw;
  }

  .wax-seal {
    width: 50px;
    height: 50px;
  }

  /* Keep signatures on one line with "&" visible */
  .signatures {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Mobile text size improvements */
@media (max-width: 480px) {
  body {
    font-size: 18px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 10vw, 3rem);
  }

  .hero-subtitle {
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }

  .letter-body {
    font-size: clamp(1.05rem, 4vw, 1.2rem);
    line-height: 1.8;
  }

  .salutation {
    font-size: 1.4em;
  }

  .signature {
    font-size: 2.2rem;
  }

  .scripture {
    font-size: 1.05em;
  }

  .gallery-title {
    font-size: clamp(1.6rem, 7vw, 2rem);
  }

  .closing-message {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .closing-year {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .closing-names .names {
    font-size: clamp(1.5rem, 8vw, 2rem);
    word-break: keep-all;
    white-space: nowrap;
  }

  /* Envelope letter text - tighter spacing on mobile */
  .letter-greeting {
    font-size: clamp(1.6rem, 6vw, 2rem);
    margin-bottom: -0.2rem;
  }

  .letter-subgreeting {
    font-size: clamp(1.4rem, 5vw, 1.7rem);
    margin-bottom: -0.1rem;
  }

  .letter-divider {
    margin-top: -0.1rem;
    margin-bottom: 0;
  }

  .letter-tagline {
    font-size: clamp(1rem, 4vw, 1.2rem);
    margin-bottom: -0.1rem;
  }

  .letter-ornament {
    margin-bottom: -0.1rem;
    gap: 0.3rem;
  }

  .letter-from {
    font-size: clamp(0.85rem, 3vw, 1rem);
    margin-top: 0;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #snow-canvas {
    display: none;
  }
}
