/* ============================================================
   MASTER STYLESHEET — Birthday Website for My Brother
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Lora:ital,wght@0,400;1,400&family=Dancing+Script:wght@600;700&family=Caveat:wght@500;600&display=swap');

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Lora', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ============================================================
   PAGE 1 — ENVELOPE (index.html)
   ============================================================ */

/* -- Stars background -- */
.page-envelope {
  min-height: 100vh;
  background: radial-gradient(ellipse at 60% 40%, #0d1b4b 0%, #050a18 70%, #000000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* Animated star layers */
.stars-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stars-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Floating particles */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.8), transparent);
  animation: floatParticle linear infinite;
  opacity: 0;
}

@keyframes floatParticle {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* -- Heading Text -- */
.envelope-hero-text {
  text-align: center;
  z-index: 10;
  margin-bottom: 3rem;
  pointer-events: none;
}

.hero-line-1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 4vw, 2.2rem);
  color: #f5e6b3;
  font-style: italic;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: gentleFadeUp 1.4s ease forwards 0.5s;
  text-shadow: 0 0 30px rgba(245,230,179,0.4);
}

.hero-line-2 {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: #d4af5a;
  margin-top: 0.6rem;
  opacity: 0;
  animation: gentleFadeUp 1.4s ease forwards 2.2s;
  text-shadow: 0 0 20px rgba(212,175,90,0.3);
}

@keyframes gentleFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- Envelope Container -- */
.envelope-wrapper {
  position: relative;
  z-index: 10;
  width: clamp(280px, 55vw, 500px);
  cursor: pointer;
  opacity: 0;
  animation: gentleFadeUp 1.2s ease forwards 1.2s;
}

.envelope-wrapper:hover .envelope-body {
  box-shadow:
    0 0 40px rgba(212,175,90,0.5),
    0 0 80px rgba(212,175,90,0.2),
    0 20px 60px rgba(0,0,0,0.6);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      0 0 40px rgba(212,175,90,0.5),
      0 0 80px rgba(212,175,90,0.2),
      0 20px 60px rgba(0,0,0,0.6);
  }
  50% {
    box-shadow:
      0 0 60px rgba(212,175,90,0.8),
      0 0 120px rgba(212,175,90,0.35),
      0 25px 70px rgba(0,0,0,0.7);
  }
}

/* Envelope SVG-style built in CSS */
.envelope-scene {
  position: relative;
  width: 100%;
  padding-top: 68%; /* 3:2 aspect ratio envelope shape */
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #f5e6c3 0%, #e8d49a 50%, #d4b870 100%);
  border-radius: 4px 4px 8px 8px;
  box-shadow:
    0 0 30px rgba(212,175,90,0.3),
    0 15px 50px rgba(0,0,0,0.5);
  overflow: hidden;
  transition: box-shadow 0.4s ease;
}

/* Bottom V-fold lines */
.envelope-body::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
  background:
    linear-gradient(135deg, transparent 49.5%, #c9a84c 49.5%, #c9a84c 50.5%, transparent 50.5%),
    linear-gradient(225deg, transparent 49.5%, #c9a84c 49.5%, #c9a84c 50.5%, transparent 50.5%);
  pointer-events: none;
  opacity: 0.5;
}

/* Side triangles */
.envelope-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom right, #dcc078 0%, transparent 50%),
    linear-gradient(to bottom left,  #dcc078 0%, transparent 50%);
  background-size: 50% 100%, 50% 100%;
  background-position: left, right;
  background-repeat: no-repeat;
  opacity: 0.4;
  pointer-events: none;
}

/* -- Envelope Flap -- */
.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}

.envelope-flap-face {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #f0d98a 0%, #d4b05a 60%, #c9a040 100%);
  clip-path: polygon(0 0, 100% 0, 50% 90%);
  border-bottom: 1px solid #b8903a;
  backface-visibility: hidden;
}

/* Wax seal */
.wax-seal {
  position: absolute;
  width: 54px;
  height: 54px;
  background: radial-gradient(circle at 35% 35%, #e63946, #9b1c24);
  border-radius: 50%;
  bottom: -27px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.3s ease, opacity 0.4s ease;
}

/* -- Letter inside envelope -- */
.letter-peek {
  position: absolute;
  bottom: 8%;
  left: 10%;
  right: 10%;
  height: 80%;
  background: linear-gradient(180deg, #fff9f0 0%, #fdf6e3 100%);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  transform: translateY(60%);
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 3;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 1rem;
  pointer-events: none;
}

.letter-peek::before {
  content: '🎂 Happy Birthday! 🎂';
  font-family: 'Playfair Display', serif;
  font-size: 0.75rem;
  color: #8B4513;
  opacity: 0.5;
  text-align: center;
  padding: 0 1rem;
}

/* Lines on the letter */
.letter-lines {
  width: 70%;
  margin-top: 0.6rem;
}

.letter-lines span {
  display: block;
  height: 1px;
  background: rgba(139, 69, 19, 0.15);
  margin: 0.5rem 0;
  border-radius: 2px;
}

/* -- Open state animations -- */
.envelope-wrapper.is-open .envelope-flap {
  transform: rotateX(180deg);
}

.envelope-wrapper.is-open .letter-peek {
  transform: translateY(-30%);
  transition-delay: 0.5s;
}

.envelope-wrapper.is-open .wax-seal {
  transform: translateX(-50%) scale(0);
  opacity: 0;
}

/* -- Screen fade-out -- */
.page-fade-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.8s ease;
}

.page-fade-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Tap hint */
.tap-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: rgba(212, 175, 90, 0.6);
  font-family: 'Dancing Script', cursive;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  animation: bounceFade 2s ease-in-out infinite 4s;
  opacity: 0;
}

@keyframes bounceFade {
  0%, 100% { opacity: 0; transform: translateX(-50%) translateY(0); }
  30%, 70% { opacity: 0.7; transform: translateX(-50%) translateY(-5px); }
}


/* ============================================================
   PAGE 2 — LETTER (message.html)
   ============================================================ */

.page-letter {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5ede0 0%, #ede0cd 40%, #f5ede0 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem 5rem;
  position: relative;
}

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

.letter-paper {
  position: relative;
  background: #fffdf7;
  max-width: 700px;
  width: 100%;
  border-radius: 3px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.05),
    0 8px 24px rgba(0,0,0,0.1),
    0 30px 60px rgba(0,0,0,0.12),
    inset 0 0 0 1px rgba(0,0,0,0.04);
  animation: paperAppear 0.9s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  overflow: hidden;
}

@keyframes paperAppear {
  from { opacity: 0; transform: translateY(30px) rotate(-0.5deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* Airmail striped border — top */
.airmail-border {
  height: 14px;
  background: repeating-linear-gradient(
    -45deg,
    #e63946 0px,
    #e63946 10px,
    #ffffff 10px,
    #ffffff 20px,
    #2563eb 20px,
    #2563eb 30px,
    #ffffff 30px,
    #ffffff 40px
  );
  flex-shrink: 0;
}

.letter-content {
  padding: 2.5rem 3rem 3rem;
}

/* Stamp */
.stamp-area {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.stamp {
  width: 70px;
  height: 85px;
  background: linear-gradient(135deg, #fef08a, #fde047);
  border: 3px solid #ca8a04;
  outline: 2px dashed #ca8a04;
  outline-offset: 3px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.15);
  transform: rotate(2deg);
  position: relative;
  overflow: hidden;
}

.stamp-text {
  font-size: 0.4rem;
  font-weight: bold;
  color: #92400e;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* Postmark */
.postmark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  width: 90px;
  height: 90px;
  border: 3px solid rgba(150, 100, 50, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.postmark::after {
  content: 'SEP 15 \'26';
  font-family: 'Caveat', cursive;
  font-size: 0.45rem;
  color: rgba(150,100,50,0.6);
  text-align: center;
}

/* Date line */
.letter-date {
  font-family: 'Dancing Script', cursive;
  font-size: 1rem;
  color: #9d6b34;
  margin-bottom: 1.5rem;
}

/* Salutation */
.letter-salutation {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: #2c1810;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.letter-salutation em {
  color: #c0392b;
  font-style: italic;
}

/* Body paragraphs */
.letter-body p {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.9;
  color: #3c2010;
  margin-bottom: 1.4rem;
  text-align: justify;
  hyphens: auto;
}

.letter-body p:first-child::first-letter {
  font-size: 3.5rem;
  font-family: 'Playfair Display', serif;
  float: left;
  line-height: 0.75;
  margin: 0.1rem 0.15rem 0 0;
  color: #c0392b;
  font-weight: 700;
}

.letter-body .highlight {
  background: linear-gradient(120deg, rgba(255,200,0,0.3) 0%, rgba(255,200,0,0.15) 100%);
  padding: 0 3px;
  border-radius: 2px;
}

.letter-body .memory-block {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid #d97706;
  padding: 1rem 1.2rem;
  border-radius: 0 6px 6px 0;
  margin: 1.5rem 0;
  font-style: italic;
  font-size: 0.95rem;
  color: #78350f;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.06);
}

.letter-body .memory-block::before {
  content: '💛 ';
}

/* Sign-off */
.letter-signoff {
  margin-top: 2rem;
}

.letter-signoff p {
  font-family: 'Lora', serif;
  color: #3c2010;
  margin-bottom: 0.3rem !important;
  text-align: left !important;
}

.letter-signature {
  font-family: 'Dancing Script', cursive;
  font-size: 2.2rem;
  color: #c0392b;
  margin-top: 0.8rem;
  display: block;
  line-height: 1;
}

/* Divider */
.letter-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(to right, transparent, #d4b870, transparent);
  margin: 2rem auto;
}

/* CTA Button */
.btn-memory-lane {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff;
  text-decoration: none;
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-style: italic;
  padding: 0.85rem 2rem;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(192,57,43,0.35), 0 2px 6px rgba(0,0,0,0.15);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
}

.btn-memory-lane::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-memory-lane:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 25px rgba(192,57,43,0.5), 0 4px 12px rgba(0,0,0,0.2);
}

.btn-memory-lane:hover::before {
  opacity: 1;
}

.btn-memory-lane:active {
  transform: translateY(-1px) scale(0.99);
}

.letter-cta {
  text-align: center;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Decorative rosette at top of letter */
.letter-rosette {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
  letter-spacing: 0.3em;
}


/* ============================================================
   PAGE 3 — GALLERY (gallery.html)
   ============================================================ */

.page-gallery {
  min-height: 100vh;
  background: linear-gradient(160deg, #1a2535 0%, #2c3e50 50%, #1e3040 100%);
  padding: 4rem 2rem 5rem;
  position: relative;
  overflow-x: hidden;
}

/* Subtle grid overlay */
.page-gallery::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Bokeh lights in background */
.bokeh-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bokeh {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.12;
  animation: bokehDrift ease-in-out infinite alternate;
}

.bokeh:nth-child(1) { width: 400px; height: 400px; background: #e63946; top: -100px; left: -100px; animation-duration: 8s; }
.bokeh:nth-child(2) { width: 300px; height: 300px; background: #d4af37; top: 30%; right: -80px; animation-duration: 10s; }
.bokeh:nth-child(3) { width: 350px; height: 350px; background: #2563eb; bottom: -80px; left: 30%; animation-duration: 12s; }

@keyframes bokehDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.1); }
}

/* Gallery Header */
.gallery-header {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-bottom: 3.5rem;
}

.gallery-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: #f5e6b3;
  text-shadow: 0 2px 20px rgba(245,230,179,0.3);
  letter-spacing: 0.02em;
  animation: gentleFadeUp 1s ease forwards;
}

.gallery-subtitle {
  font-family: 'Lora', serif;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: rgba(212,175,90,0.75);
  margin-top: 0.5rem;
  font-style: italic;
  animation: gentleFadeUp 1s ease forwards 0.3s;
  opacity: 0;
}

/* Decorative line */
.gallery-header-line {
  width: 80px;
  height: 2px;
  background: linear-gradient(to right, transparent, #d4af37, transparent);
  margin: 1.2rem auto 0;
  animation: expandLine 1s ease forwards 0.6s;
  transform: scaleX(0);
}

@keyframes expandLine {
  to { transform: scaleX(1); }
}

/* Photo Grid */
.photo-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Polaroid Card */
.polaroid {
  background: #ffffff;
  padding: 12px 12px 50px;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.3),
    0 12px 30px rgba(0,0,0,0.25);
  border-radius: 2px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  cursor: pointer;
  will-change: transform;
}

/* Alternating tilts */
.polaroid:nth-child(odd)  { transform: rotate(-2deg); }
.polaroid:nth-child(even) { transform: rotate(2.5deg); }
.polaroid:nth-child(3n)   { transform: rotate(-1deg); }
.polaroid:nth-child(4n)   { transform: rotate(3deg); }

.polaroid:hover {
  transform: rotate(0deg) scale(1.06) translateY(-8px) !important;
  box-shadow:
    0 12px 24px rgba(0,0,0,0.4),
    0 30px 60px rgba(0,0,0,0.35);
  z-index: 20;
}

/* Photo image area */
.polaroid-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e0e0e0;
}

.polaroid-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  filter: sepia(5%) saturate(90%);
}

.polaroid:hover .polaroid-img-wrap img {
  transform: scale(1.05);
  filter: sepia(0%) saturate(110%);
}

/* Caption */
.polaroid-caption {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  color: #2c2c2c;
  text-align: center;
  padding: 0 8px;
  letter-spacing: 0.01em;
}

/* Tape effect on some polaroids */
.polaroid::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 50px;
  height: 20px;
  background: rgba(255,240,150,0.6);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: none;
}

.polaroid:nth-child(3n+1)::before {
  display: block;
  transform: translateX(-50%) rotate(2deg);
}

.polaroid:nth-child(5n)::before {
  display: block;
  left: 30%;
  transform: translateX(-50%) rotate(-3deg);
}

/* Push pin */
.polaroid::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #e63946, #8b0000);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.3);
  z-index: 5;
  display: none;
}

.polaroid:nth-child(even)::after {
  display: block;
  background: radial-gradient(circle at 35% 35%, #2563eb, #1e3a8a);
  top: -10px;
}

/* Editorial scrapbook layout: let the shared photo lead the page. */
.page-gallery {
  background:
    radial-gradient(circle at 8% 12%, rgba(241, 126, 96, 0.24), transparent 24rem),
    radial-gradient(circle at 92% 34%, rgba(236, 190, 74, 0.2), transparent 22rem),
    linear-gradient(135deg, #163d42 0%, #245657 48%, #172f3b 100%);
}

.gallery-header {
  max-width: 760px;
  margin-bottom: 4rem;
}

.gallery-title {
  font-size: clamp(2.4rem, 6vw, 4.7rem);
  color: #fff4d6;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.gallery-subtitle {
  color: rgba(255, 235, 191, 0.84);
}

.photo-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.7rem 1.35rem;
  max-width: 1180px;
}

.polaroid {
  grid-column: span 4;
  padding: 10px 10px 48px;
  border-radius: 14px;
  background: #fffaf0;
  box-shadow:
    0 10px 20px rgba(4, 20, 25, 0.2),
    0 24px 48px rgba(4, 20, 25, 0.18);
  transform: rotate(-1deg);
}

.polaroid:nth-child(even) { transform: rotate(1.4deg); }
.polaroid:nth-child(3n) { transform: rotate(-0.6deg); }
.polaroid:nth-child(5n) { transform: rotate(2deg); }

.polaroid:nth-child(5),
.polaroid:nth-child(14),
.polaroid:nth-child(16) {
  grid-column: span 6;
}

.polaroid.featured-photo {
  grid-column: span 8;
  padding: 14px 14px 62px;
  transform: rotate(-1.2deg);
  background: #fffdf8;
  box-shadow:
    0 16px 30px rgba(4, 20, 25, 0.25),
    0 34px 70px rgba(4, 20, 25, 0.2);
}

.polaroid.featured-photo .polaroid-img-wrap {
  aspect-ratio: 4 / 3;
}

.polaroid.featured-photo .polaroid-caption {
  height: 62px;
  font-size: 1.35rem;
  color: #193d42;
}

.polaroid-img-wrap {
  border-radius: 9px;
  aspect-ratio: 4 / 5;
  background: #d8cbb8;
}

.polaroid-img-wrap img {
  filter: saturate(102%) contrast(101%);
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.035) translateY(-8px) !important;
}

.polaroid::before {
  display: block;
  background: rgba(255, 219, 128, 0.74);
}

.polaroid::after {
  display: block;
}

/* Gallery nav buttons */
.gallery-nav {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-top: 4rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.08);
  color: #f5e6b3;
  text-decoration: none;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-style: italic;
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  border: 1px solid rgba(245,230,179,0.25);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  letter-spacing: 0.03em;
}

.btn-back:hover {
  background: rgba(245,230,179,0.15);
  border-color: rgba(245,230,179,0.5);
  transform: translateX(-4px);
  color: #fff;
}

/* Photo placeholder gradient */
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #e8e0d0, #d4c8b0);
}


/* ============================================================
   SHARED UTILITIES
   ============================================================ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .letter-content {
    padding: 1.8rem 1.5rem 2rem;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 2rem 1.5rem;
  }

  .polaroid {
    padding: 8px 8px 40px;
  }

  .polaroid-caption {
    height: 40px;
    font-size: 0.9rem;
  }
}

@media (max-width: 400px) {
  .photo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 1rem;
  }
}


/* ============================================================
   WISHES MODAL POPUP v2 — PHOTO COLLAGE (TOP) + MESSAGES (BOTTOM)
   ============================================================ */

/* -- "One More Thing" trigger button -- */
.btn-wishes {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #d4af37, #f5e6b3);
  color: #2c1810;
  text-decoration: none;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 700;
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  border: 1px solid rgba(212,175,55,0.6);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  letter-spacing: 0.03em;
  box-shadow:
    0 4px 15px rgba(212,175,55,0.35),
    0 2px 6px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.4);
  margin-left: 1rem;
}

.btn-wishes:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 10px 25px rgba(212,175,55,0.55),
    0 4px 12px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

.btn-wishes:active { transform: translateY(-1px) scale(0.99); }

/* -- Overlay backdrop -- */
.wishes-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at 50% 30%, rgba(20,10,40,0.88), rgba(0,0,0,0.95));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
  overflow-y: auto;
}

.wishes-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0s linear 0s;
}

/* -- Modal card (scrollable inside overlay) -- */
.wishes-modal.collage-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: auto 0;
  background: linear-gradient(180deg, rgba(44,62,80,0.92) 0%, rgba(26,37,53,0.97) 100%);
  border: 1px solid rgba(245,230,179,0.22);
  border-radius: 20px;
  padding: 1.7rem 1.6rem 2rem;
  color: #f5e6b3;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.65),
    0 0 100px rgba(212,175,55,0.12),
    inset 0 1px 0 rgba(255,255,255,0.07);
  transform: scale(0.65) translateY(60px);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.45s ease;
}

.wishes-overlay.open .wishes-modal.collage-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* -- Ambient gold glow behind collage -- */
.collage-glow {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-width: 80vw;
  height: 320px;
  background: radial-gradient(ellipse at center, rgba(212,175,55,0.28), transparent 65%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
}

/* -- Close button -- */
.wishes-close {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: #f5e6b3;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.25s ease;
  border: 1px solid rgba(245,230,179,0.15);
  z-index: 20;
}

.wishes-close:hover {
  background: rgba(230,57,70,0.25);
  border-color: rgba(230,57,70,0.6);
  transform: rotate(90deg) scale(1.08);
}

/* ============================================================
   TOP SECTION — PHOTO COLLAGE
   ============================================================ */

.collage-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.6rem;
  margin-bottom: 0.2rem;
  z-index: 2;
  padding: 0.25rem;
}

/* 4 collage rows */
.collage-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: stretch;
  justify-content: center;
}
.collage-row.row-6 { margin-bottom: 0; }

/* piece box */
.collage-img {
  position: relative;
  flex: 1 1 0;
  overflow: hidden;
  border-radius: 6px;
  background: #1a2535;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  border: 2px solid #fffdf7;
  aspect-ratio: 1 / 1;

  /* Fly-in animation offsets – different angles per row class */
  opacity: 0;
  transform: translate3d(var(--tx, 0px), var(--ty, -180px), 0)
             rotateZ(var(--rot, -15deg))
             scale(0.6);
  transition:
    opacity 0.55s ease calc(var(--d, 0s) + 0.05s),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--d, 0s) + 0.05s),
    box-shadow 0.3s ease;
}

/* Assign per-row / per-piece fly-in angles for chaos */
.row-1 .collage-img.piece { --ty: -200px; --rot: -18deg; }
.row-1 .collage-img.c-2  { --tx: -30px; --rot: 14deg; }
.row-1 .collage-img.c-3  { --tx: 20px;  --rot: -10deg; }
.row-1 .collage-img.c-4  { --tx: 50px;  --rot: 20deg; }

.row-2 .collage-img.piece { --ty: 220px; --rot: 16deg; }
.row-2 .collage-img.c-5   { --tx: -60px; --rot: -14deg; }
.row-2 .collage-img.c-7   { --tx: 55px;  --rot: 12deg; }

.row-3 .collage-img.piece { --ty: -240px; --rot: -12deg; }
.row-3 .collage-img.c-8   { --tx: -40px; --rot: 18deg; }
.row-3 .collage-img.c-9   { --tx: 30px;  --rot: -8deg; }
.row-3 .collage-img.c-10  { --tx: 60px;  --rot: 16deg; }

.row-4 .collage-img.piece { --ty: 260px; --rot: 18deg; }
.row-4 .collage-img.c-11  { --tx: -70px; --rot: -16deg; }
.row-4 .collage-img.c-12  { --tx: 10px;  --rot: 10deg; }
.row-4 .collage-img.c-13  { --tx: 75px;  --rot: -18deg; }

/* Row 5 (NEW) – fly-in from the top again */
.row-5 .collage-img.piece { --ty: -280px; --rot: -18deg; }
.row-5 .collage-img.c-14  { --tx: -80px; --rot: 16deg; }
.row-5 .collage-img.c-15  { --tx: 0px;   --rot: -6deg; }
.row-5 .collage-img.c-16  { --tx: 85px;  --rot: 18deg; }

/* Row 6 (NEW) – fly-in from the bottom again */
.row-6 .collage-img.piece { --ty: 300px; --rot: 20deg; }
.row-6 .collage-img.c-17  { --tx: -90px; --rot: -18deg; }
.row-6 .collage-img.c-18  { --tx: -10px; --rot: 8deg; }
.row-6 .collage-img.c-19  { --tx: 95px;  --rot: -22deg; }

/* center "big" piece in row 2 */
.collage-img.piece.big {
  flex: 1.25 1 0;
  z-index: 2;
}

/* piece lands – snap into the merged collage */
.collage-img.piece.landed {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotateZ(var(--r-land, 0deg)) scale(1);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.35),
    0 8px 20px rgba(0,0,0,0.35);
}
/* small tilts once landed – makes it look like a real pinned collage */
.row-1 .c-1.landed { --r-land: -3deg; }
.row-1 .c-2.landed { --r-land:  2deg; }
.row-1 .c-3.landed { --r-land: -2deg; }
.row-1 .c-4.landed { --r-land:  3deg; }

.row-2 .c-5.landed { --r-land:  2.5deg; }
.row-2 .c-6.landed { --r-land: -1deg;  z-index: 3;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45), 0 14px 30px rgba(0,0,0,0.4);
}
.row-2 .c-7.landed { --r-land: -2deg; }

.row-3 .c-8.landed  { --r-land:  3deg; }
.row-3 .c-9.landed  { --r-land: -2.5deg; }
.row-3 .c-10.landed { --r-land:  1deg; }

.row-4 .c-11.landed { --r-land: -3deg; }
.row-4 .c-12.landed { --r-land:  2deg; }
.row-4 .c-13.landed { --r-land: -1deg; }

/* Row 5 (NEW) landing tilts – c-15 is the big hero piece */
.row-5 .c-14.landed { --r-land:  2.5deg; }
.row-5 .c-15.landed { --r-land: -1deg;  z-index: 3;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45), 0 14px 30px rgba(0,0,0,0.4);
}
.row-5 .c-16.landed { --r-land: -2.5deg; }

/* Row 6 (NEW) landing tilts */
.row-6 .c-17.landed { --r-land:  3deg; }
.row-6 .c-18.landed { --r-land: -2deg; }
.row-6 .c-19.landed { --r-land:  1.5deg; }

/* image inside piece */
.collage-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(95%) contrast(1.03);
}

.collage-img .collage-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: linear-gradient(135deg, #e8e0d0, #d4c8b0);
}

/* washi tape decoration on last row pieces */
.collage-img::after {
  content: '';
  position: absolute;
  width: 48px;
  height: 16px;
  background: rgba(255,238,150,0.7);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  z-index: 3;
  pointer-events: none;
  display: none;
}
.collage-img.tape-tl::after {
  display: block;
  top: -4px; left: 10%;
  transform: rotate(-22deg);
}
.collage-img.tape-tr::after {
  display: block;
  background: rgba(255,180,200,0.75);
  top: -4px; right: 10%;
  transform: rotate(20deg);
}
.collage-img.tape-bl::after {
  display: block;
  background: rgba(180,220,255,0.75);
  bottom: -4px; left: 15%;
  transform: rotate(14deg);
}
.collage-img.tape-br::after {
  display: block;
  background: rgba(200,255,210,0.78);
  bottom: -4px; right: 12%;
  transform: rotate(-16deg);
}

/* Heart badge - pops on top of collage center */
.collage-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0) rotate(-25deg);
  width: 62px;
  height: 62px;
  background: #fffdf7;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow:
    0 4px 14px rgba(0,0,0,0.45),
    0 0 0 3px rgba(230,57,70,0.15);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}
.collage-heart.revealed {
  animation: collageHeartPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes collageHeartPop {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0)   rotate(-25deg); }
  65%  { opacity: 1; transform: translate(-50%,-50%) scale(1.25) rotate(10deg); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1)    rotate(-6deg); }
}

/* Collage ribbon banner - sits at bottom of collage */
.collage-ribbon {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(20px) scale(0.8);
  padding: 6px 22px 6px 22px;
  background: linear-gradient(90deg, #e63946, #f4d03f, #e63946);
  background-size: 200% 100%;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  clip-path: polygon(0 0, 100% 0, 94% 100%, 6% 100%);
  min-width: 70%;
  text-align: center;
}
.collage-ribbon.revealed {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  transition:
    opacity 0.5s ease 0.1s,
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s;
  animation: ribbonShimmer 4s linear infinite 0.8s;
}
.collage-ribbon span {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.05rem;
  color: #2c1810;
  letter-spacing: 0.02em;
  display: inline-block;
}

@keyframes ribbonShimmer {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

/* ============================================================
   DIVIDER
   ============================================================ */
.collage-divider {
  margin: 1.2rem auto 0.5rem;
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.6), transparent);
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.collage-divider .divider-star {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #2c3e50;
  padding: 0 10px;
  color: #d4af37;
  font-size: 1rem;
}
.collage-divider.revealed {
  opacity: 1;
  transform: scaleX(1);
}

/* ============================================================
   BOTTOM SECTION — WISHES / QUOTES
   ============================================================ */

.wishes-section {
  position: relative;
  z-index: 2;
  padding-top: 0.4rem;
}

.wishes-header-mini {
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.wishes-header-mini.revealed {
  opacity: 1;
  transform: translateY(0);
}

.wishes-header-mini .wishes-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.25rem, 3.3vw, 1.6rem);
  color: #fff8dc;
  margin: 0 auto 0.3rem;
  text-align: center;
  letter-spacing: 0.01em;
}

.wishes-header-mini .wishes-subtitle {
  text-align: center;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(212,175,90,0.82);
  margin: 0;
}

/* Wishes list – one card per wish */
.wishes-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.wish-line {
  position: relative;
  background: linear-gradient(145deg, rgba(255,253,247,0.98), rgba(255,248,225,0.98));
  border-radius: 10px;
  padding: 0.75rem 1rem 0.75rem 3.2rem;
  color: #3c2010;
  box-shadow:
    0 4px 14px rgba(0,0,0,0.32),
    0 1px 3px rgba(0,0,0,0.2),
    inset 0 0 0 1px rgba(212,175,55,0.25);
  border-left: 3px solid #d4af37;

  /* initial state */
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition:
    opacity 0.55s ease var(--d, 0s),
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d, 0s),
    box-shadow 0.3s ease, border-color 0.3s ease;
}

.wish-line.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.wish-line:hover {
  box-shadow:
    0 6px 22px rgba(0,0,0,0.38),
    0 1px 3px rgba(0,0,0,0.2),
    inset 0 0 0 1px rgba(212,175,55,0.4);
  border-left-color: #e63946;
}

.wish-line.final-wish {
  border-left-color: #e63946;
  background: linear-gradient(145deg, #fff8dc, #fde9c3);
}
.wish-line.final-wish strong {
  color: #c0392b;
  font-weight: 700;
}

/* Emoji bullet – sits on the left */
.wish-bullet {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fdf3c2, #f4d03f);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.6);
  line-height: 1;
  flex-shrink: 0;
}

.wish-line p {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.96rem;
  line-height: 1.6;
  margin: 0;
  color: #3c2010;
}

/* Sign-off below wish list */
.wishes-card-signoff {
  text-align: center;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(245,230,179,0.22);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wishes-card-signoff.revealed {
  opacity: 1;
  transform: translateY(0);
}
.wishes-card-signoff p {
  font-family: 'Lora', serif;
  color: rgba(212,175,90,0.9);
  font-size: 0.9rem;
  font-style: italic;
  margin: 0 0 0.35rem;
}
.sign-name {
  font-family: 'Dancing Script', cursive;
  font-size: 1.9rem;
  color: #f5e6b3;
  line-height: 1;
  display: inline-block;
  text-shadow: 0 0 16px rgba(245,230,179,0.25);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .btn-wishes {
    margin-left: 0;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    padding: 0.7rem 1.4rem;
  }
  .gallery-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .wishes-overlay { padding: 1rem; }

  .wishes-modal.collage-modal {
    padding: 1.3rem 1rem 1.4rem;
    border-radius: 16px;
  }

  .collage-row { gap: 4px; margin-bottom: 4px; }

  .collage-img {
    border-width: 1.5px;
    border-radius: 5px;
  }
  .collage-img::after { width: 36px; height: 12px; }

  .collage-heart {
    width: 48px; height: 48px;
  }
  .collage-heart svg { width: 28px; height: 28px; }

  .collage-ribbon {
    padding: 4px 14px;
    min-width: 80%;
    bottom: 6px;
  }
  .collage-ribbon span { font-size: 0.92rem; }

  .wishes-header-mini .wishes-title { font-size: 1.2rem; }
  .wish-line { padding: 0.65rem 0.85rem 0.65rem 2.85rem; }
  .wish-line p { font-size: 0.9rem; line-height: 1.55; }
  .wish-bullet {
    left: 0.6rem;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
  .sign-name { font-size: 1.6rem; }
}

@media (max-width: 380px) {
  .collage-ribbon span { font-size: 0.85rem; }
  .wish-line p { font-size: 0.85rem; }
}
