:root {
  --maroon-deep: #3a0a13;
  --maroon-mid: #5c1220;
  --wine: #7e1b34;
  --gold: #c9a15a;
  --gold-soft: #e3c98a;
  --cream: #f4ead9;
  --blush: #e3b6ae;
  --ink: #2a0b10;
  --font-script: 'Pinyon Script', cursive;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--maroon-deep);
  color: var(--cream);
  font-family: 'EB Garamond', serif;
  overflow-x: hidden;
  overflow-y: hidden;
  height: 100vh;
}

body.opened {
  overflow-y: auto;
  height: auto;
}

h1,
h2,
h3,
.display {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.script {
  font-family: var(--font-script);
  font-weight: 400;
}

.eyebrow {
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--gold-soft);
}

a {
  color: inherit;
}

/* AMBIENT PETALS */
#petalLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -5%;
  font-size: 1.1rem;
  color: var(--blush);
  opacity: 0.75;
  animation: fall linear infinite;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.2));
}

@keyframes fall {
  0% {
    transform: translateY(-10vh) translateX(0) rotate(0deg);
  }

  100% {
    transform: translateY(110vh) translateX(var(--drift, 20px)) rotate(360deg);
  }
}

/* ENVELOPE SCREEN */
#envelopeScreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, var(--wine) 0%, var(--maroon-deep) 65%);
  transition: opacity 1s ease, transform 1s ease;
}

#envelopeScreen.hide {
  opacity: 0;
  transform: translateY(-40px);
  pointer-events: none;
}

.env-label {
  margin-top: 2.2rem;
  letter-spacing: 0.3em;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--gold-soft);
  opacity: 0.85;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

.envelope-wrap {
  perspective: 1400px;
  width: min(78vw, 340px);
}

.envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  cursor: pointer;
}

.env-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--maroon-mid), #4a0d18);
  border-radius: 4px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(201, 161, 90, 0.25);
}

.env-pocket-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  background: linear-gradient(135deg, var(--wine), var(--maroon-mid));
  z-index: 2;
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 50% 42%, 0 0);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 58%;
  background: linear-gradient(160deg, var(--wine), var(--maroon-mid));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(.6, .05, .2, 1);
  z-index: 4;
  box-shadow: inset 0 -1px 0 rgba(201, 161, 90, 0.2);
}

.envelope.opening .env-flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.seal {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a8843f, var(--gold) 55%, #8a6a2c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--maroon-deep);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.35);
  z-index: 5;
  transition: transform 0.35s ease, opacity 0.6s ease;
}

.envelope:hover .seal {
  transform: translate(-50%, -50%) scale(1.06);
}

.envelope.opening .seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
}

.letter-peek {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 8%;
  height: 0%;
  background: linear-gradient(180deg, var(--cream), #ece0cb);
  border-radius: 2px;
  z-index: 3;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: height 0.9s ease 0.5s, top 0.9s ease 0.5s;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.envelope.opening .letter-peek {
  height: 120%;
  top: -45%;
}

.letter-peek span {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  color: var(--maroon-mid);
  font-size: 1.15rem;
  opacity: 0;
  transition: opacity 0.6s ease 1.3s;
}

.envelope.opening .letter-peek span {
  opacity: 1;
}

/* MAIN CONTENT */
main {
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 1.4s ease 0.3s;
}

body.opened main {
  opacity: 1;
}

section {
  position: relative;
  padding: 6rem 1.5rem;
  max-width: 760px;
  margin: 0 auto;
}

/* --- hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 4rem;
}

.hero .to {
  font-size: 1.4rem;
  color: var(--gold-soft);
  margin-bottom: 0.6rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.2;
  margin-bottom: 1.2rem;
  text-align: center;
  width: 100%;
}

.title-line {
  display: block;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
}

.hero p {
  font-size: 1.15rem;
  max-width: 520px;
  line-height: 1.75;
  color: #e9d9c5;
}

.hero .divider {
  width: 56px;
  height: 1px;
  background: var(--gold);
  margin: 2rem auto;
  opacity: 0.7;
}

/* --- birthday cake --- */
.cake-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2.5rem auto 1rem;
  cursor: pointer;
  user-select: none;
}

.cake {
  position: relative;
  width: 150px;
  height: 100px;
  margin-top: 2rem;
}

.cake-layer {
  position: absolute;
  width: 100%;
  border-radius: 8px 8px 4px 4px;
}

.layer-bottom {
  bottom: 0;
  height: 50px;
  background: linear-gradient(to right, #5c1220, #7e1b34);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.layer-top {
  bottom: 44px;
  height: 38px;
  background: linear-gradient(to right, #7e1b34, #a32b47);
  width: 86%;
  left: 7%;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.3);
}

.frosting {
  position: absolute;
  bottom: 78px;
  left: 5%;
  width: 90%;
  height: 12px;
  background: var(--cream);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.frosting::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 10px;
  background: var(--cream);
  clip-path: polygon(0 0, 100% 0, 90% 100%, 80% 30%, 70% 100%, 60% 30%, 50% 100%, 40% 30%, 30% 100%, 20% 30%, 10% 100%);
}

.candle {
  position: absolute;
  width: 8px;
  height: 35px;
  background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 4px, var(--cream) 4px, var(--cream) 8px);
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
}

.flame {
  position: absolute;
  width: 14px;
  height: 24px;
  background: radial-gradient(circle at 50% 80%, #ffdf6d 20%, #ff8838 50%, #ff3b30 80%);
  border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  animation: flicker 0.15s ease-in-out infinite alternate;
  transform-origin: bottom center;
  filter: drop-shadow(0 0 8px rgba(255, 136, 56, 0.8));
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flame.extinguished {
  opacity: 0;
  transform: translateX(-50%) scale(0.1);
  pointer-events: none;
}

.cake-instruction {
  margin-top: 1.4rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  color: var(--gold-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: pulse 2s infinite;
}

@keyframes flicker {
  0% {
    transform: translateX(-50%) rotate(-2deg) scaleX(0.9);
  }

  100% {
    transform: translateX(-50%) rotate(2deg) scaleX(1.1);
  }
}

/* --- birthday counter --- */
.birthday-box {
  text-align: center;
  border: 1px solid rgba(201, 161, 90, 0.35);
  border-radius: 12px;
  padding: 3rem 2rem;
  background: linear-gradient(180deg, rgba(126, 27, 52, 0.25), transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.age-display {
  font-size: clamp(3rem, 12vw, 5.5rem);
  color: var(--gold-soft);
  font-family: 'Cormorant Garamond', serif;
  line-height: 1;
  font-weight: 600;
}

.age-sub {
  margin-top: 0.6rem;
  color: #e9d9c5;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
}

.birthday-cities {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 2rem;
  font-family: 'Jost', sans-serif;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  color: var(--gold-soft);
}

.birthday-cities .bullet {
  color: var(--blush);
}

/* --- reveal utility --- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

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

/* --- automatic carousel --- */
.carousel-section {
  padding: 5rem 1.5rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.timeline-head {
  text-align: center;
  margin-bottom: 3rem;
}

.timeline-head h2 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--gold-soft);
  margin-top: 0.5rem;
}

.carousel-container {
  position: relative;
  margin-top: 2.5rem;
  padding: 1rem 0;
  overflow: hidden;
}

.carousel-track-wrapper {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  width: 100%;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
}

.polaroid-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 3.5rem;
  align-items: center;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 4.5rem;
  box-sizing: border-box;
}

.carousel-slide .polaroid {
  background: var(--cream);
  padding: 0.8rem 0.8rem 2.5rem;
  border-radius: 2px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  transform: rotate(var(--tilt, -2deg));
  transition: transform 0.4s ease;
  max-width: 280px;
  width: 100%;
  margin: 0 auto;
}

.carousel-slide:hover .polaroid {
  transform: rotate(0deg) scale(1.03);
}

.carousel-slide .frame {
  aspect-ratio: 4/5;
  background: var(--maroon-deep);
  overflow: hidden;
  border-radius: 1px;
}

.carousel-slide .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.carousel-slide:hover .frame img {
  transform: scale(1.05);
}

.carousel-slide .cap {
  font-family: var(--font-script);
  color: var(--ink);
  text-align: center;
  margin-top: 0.6rem;
  font-size: 1.05rem;
}

.slide-caption h3 {
  font-size: 1.7rem;
  color: var(--gold-soft);
  margin-bottom: 0.8rem;
  font-family: 'Cormorant Garamond', serif;
}

.slide-caption p {
  line-height: 1.8;
  color: #e9d9c5;
  font-size: 1.05rem;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(58, 10, 19, 0.85);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-size: 2.2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
  user-select: none;
  line-height: 1;
}

.carousel-control:hover {
  background: var(--gold);
  color: var(--maroon-deep);
  border-color: var(--gold);
}

.carousel-control.prev {
  left: 0.5rem;
}

.carousel-control.next {
  right: 0.5rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 2rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244, 234, 217, 0.35);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  background: var(--gold-soft);
  transform: scale(1.3);
}

/* --- Polaroid Gallery Grid (Foto-Foto Kita) --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2.5rem;
  margin-top: 3rem;
  justify-content: center;
}

.polaroid-card {
  background: var(--cream);
  padding: 0.7rem 0.7rem 2.2rem;
  border-radius: 2px;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  max-width: 230px;
  width: 100%;
  margin: 0 auto;
}

.polaroid-card .frame {
  aspect-ratio: 1 / 1;
  background: var(--maroon-deep);
  overflow: hidden;
  position: relative;
  border-radius: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-card .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid-card .frame-placeholder {
  position: absolute;
  font-size: 2.5rem;
  color: rgba(227, 182, 174, 0.4);
  pointer-events: none;
  z-index: 1;
}

.polaroid-card .cap {
  font-family: var(--font-script);
  color: var(--ink);
  text-align: center;
  margin-top: 0.8rem;
  font-size: 0.95rem;
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.04) translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.tilt-left {
  transform: rotate(-3deg);
}

.tilt-right {
  transform: rotate(3deg);
}

.tilt-left-more {
  transform: rotate(-4.5deg);
}

/* --- Wishes Card Flip Grid (Kotak Harapan & Doa) --- */
.wishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.wish-card {
  height: 210px;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.wish-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 1px solid rgba(201, 161, 90, 0.3);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-front {
  background: linear-gradient(135deg, rgba(126, 27, 52, 0.3), rgba(58, 10, 19, 0.5));
  color: var(--cream);
}

.card-icon {
  font-size: 2.2rem;
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 0 5px rgba(201, 161, 90, 0.5));
}

.card-front h3 {
  font-size: 1.25rem;
  color: var(--gold-soft);
  letter-spacing: 0.05em;
}

.card-hint {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blush);
  opacity: 0.7;
}

.card-back {
  background: linear-gradient(135deg, var(--maroon-mid), var(--wine));
  color: var(--cream);
  transform: rotateY(180deg);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4);
}

.card-back h3 {
  font-size: 1.25rem;
  color: var(--gold-soft);
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(201, 161, 90, 0.2);
  padding-bottom: 0.4rem;
  width: 80%;
}

.card-back p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e9d9c5;
}

.wish-card:hover .card-inner {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

@media (max-width:860px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .wishes-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .polaroid-wrapper {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    text-align: center;
    padding: 0 1.5rem;
    max-width: 320px;
    margin: 0 auto;
  }

  .carousel-container {
    padding: 1rem 0;
  }

  .carousel-control {
    top: 30%;
    width: 38px;
    height: 38px;
    font-size: 1.8rem;
  }

  .carousel-control.prev {
    left: 0.3rem;
  }

  .carousel-control.next {
    right: 0.3rem;
  }

  .birthday-cities {
    font-size: 0.72rem;
    gap: 0.8rem;
    letter-spacing: 0.12em;
  }

  .letter-section {
    padding: 2.5rem 1.2rem;
  }
}

/* --- letter section --- */
.letter-section {
  background: linear-gradient(180deg, var(--cream), #ece0cb);
  color: var(--ink);
  border-radius: 8px;
  padding: 3.5rem 2.2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  position: relative;
}

.letter-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--maroon-mid) 1px, transparent 1px);
  background-size: 100% 2.1rem;
  opacity: 0.05;
  border-radius: 8px;
  pointer-events: none;
}

.letter-section .script {
  font-size: 1.6rem;
  color: var(--wine);
  display: block;
  margin-bottom: 1.5rem;
}

#typedLetter {
  font-size: 1.12rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

#typedLetter .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--wine);
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.letter-sign {
  margin-top: 2.5rem;
  text-align: right;
  color: var(--wine);
}

/* --- closing --- */
.closing {
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 1.5rem;
  box-sizing: border-box;
  position: relative;
}

.closing-content {
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.closing-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  perspective: 1000px;
}

.closing-image-container .polaroid {
  background: var(--cream);
  padding: 0.6rem 0.6rem 2rem;
  border-radius: 2px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  transform: rotate(-3deg);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  width: 170px;
  animation: gentleFloat 4.5s ease-in-out infinite alternate;
}

.closing-image-container .polaroid:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}

.closing-image-container .frame {
  aspect-ratio: 1/1;
  background: var(--maroon-deep);
  overflow: hidden;
}

.closing-image-container .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.closing-image-container .cap {
  font-family: var(--font-script);
  color: var(--ink);
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

@keyframes gentleFloat {
  0% {
    transform: translateY(0) rotate(-3deg);
  }

  100% {
    transform: translateY(-12px) rotate(-1deg);
  }
}

.closing h2 {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  color: var(--gold-soft);
  margin-bottom: 1rem;
}

.closing p {
  color: #e9d9c5;
  max-width: 460px;
  margin: 0 auto 2.4rem;
  line-height: 1.75;
}

.hug-btn {
  font-family: 'Jost', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  padding: 0.9rem 2.2rem;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.hug-btn:hover {
  background: var(--gold);
  color: var(--maroon-deep);
}

footer {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: rgba(244, 234, 217, 0.4);
  width: 100%;
}

/* music toggle */
#musicToggle {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 40;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(58, 10, 19, 0.75);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  backdrop-filter: blur(4px);
}

body.opened #musicToggle {
  opacity: 1;
  pointer-events: auto;
}

/* floating balloons burst */
.floating-balloon {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  width: 40px;
  height: 60px;
  animation: floatUp 6.5s linear forwards, sway var(--sway-speed, 3s) ease-in-out infinite alternate;
}

@keyframes floatUp {
  0% {
    bottom: -10%;
    transform: translateY(0);
  }

  100% {
    bottom: 110%;
    transform: translateY(0);
  }
}

@keyframes sway {
  0% {
    margin-left: calc(-1 * var(--sway-width, 30px));
  }

  100% {
    margin-left: var(--sway-width, 30px);
  }
}

/* REFACTORED UTILITIES */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

.envelope-eyebrow {
  margin-bottom: 0.8rem;
}

.peek-from {
  font-size: 0.85rem;
  font-family: var(--font-script);
  display: block;
  margin-top: 0.6rem;
  color: var(--wine);
  opacity: 0.85;
}

.timeline-head p {
  max-width: 500px;
  margin: 0.5rem auto 0;
  font-size: 1.05rem;
  color: #e9d9c5;
}

.filter-hue {
  filter: hue-rotate(40deg) saturate(1.1);
}

.filter-warm {
  filter: saturate(1.4) brightness(0.95);
}

.signature-name {
  font-size: 1.5rem;
  margin-top: 0.5rem;
  display: inline-block;
}

.music-svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.tap-hint {
  display: block;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--wine);
  opacity: 0.7;
  margin-top: 0.4rem;
}

/* STORY POPUP MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 11, 16, 0.85);
  /* Deep maroon transparency */
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(8px);
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--cream);
  color: var(--ink);
  border-radius: 12px;
  border: 1px solid var(--gold);
  max-width: 600px;
  width: 100%;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  font-size: 2.5rem;
  cursor: pointer;
  color: var(--wine);
  transition: color 0.3s ease, transform 0.3s ease;
  z-index: 10;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold);
  transform: rotate(90deg);
}

.modal-body {
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2.2rem;
  align-items: center;
}

.modal-image-wrapper {
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(201, 161, 90, 0.3);
}

.modal-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-text h3 {
  font-size: 1.8rem;
  color: var(--wine);
  margin-bottom: 1rem;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
}

.modal-text p {
  font-size: 1.02rem;
  line-height: 1.7;
  color: #4a3e3d;
  font-family: 'EB Garamond', serif;
}

@media (max-width: 600px) {
  .modal-body {
    grid-template-columns: 1fr;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    text-align: center;
  }

  .modal-image-wrapper {
    max-width: 200px;
    margin: 0 auto;
  }

  .modal-text h3 {
    font-size: 1.5rem;
  }
}