@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Quicksand:wght@400;500;600;700&display=swap');

:root {
  --color-cream: #fdfaff;
  --color-warm-pink: #b57edc;
  --color-soft-pink: #dcd0ff;
  --color-deep-rose: #463863;
  --color-gold: #f4d35e;
  --color-sky-blue: #c3b1e1;
  --color-leaf-green: #e6e6fa;
  
  --font-primary: 'Quicksand', sans-serif;
  --font-handwriting: 'Caveat', cursive;
  
  --transition-speed: 0.6s;
  --envelope-width: 320px;
  --envelope-height: 220px;
}

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

body {
  font-family: var(--font-primary);
  background-color: #f8f4ff;
  color: var(--color-deep-rose);
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

/* Background Canvas & Slideshow - FIXED in place */
#heart-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

.bg-slideshow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.72) 0%, rgba(240, 230, 250, 0.78) 55%, rgba(195, 177, 225, 0.55) 100%);
  z-index: 2;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.bg-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  filter: blur(8px) brightness(1.15) contrast(0.92);
  transform: scale(1.06);
  transition: opacity 2.5s ease-in-out, transform 20s linear;
  z-index: 1;
}

.bg-slide.active {
  opacity: 0.32; /* Mild and dreamy background representation */
  transform: scale(1.0);
}

/* Sun and Clouds - FIXED or slow floating */
.ghibli-sky-element {
  position: fixed;
  pointer-events: none;
  z-index: 2;
}

.ghibli-sun {
  top: 60px;
  right: 8%;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(244, 211, 94, 0.45) 0%, rgba(244, 211, 94, 0) 70%);
  border-radius: 50%;
  animation: sunGlow 8s infinite alternate ease-in-out;
}

.ghibli-cloud-1 {
  top: 10%;
  left: -200px;
  width: 250px;
  height: 70px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 50px;
  filter: blur(6px);
  animation: floatCloud 50s infinite linear;
}

.ghibli-cloud-2 {
  bottom: 20%;
  right: -250px;
  width: 300px;
  height: 90px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50px;
  filter: blur(9px);
  animation: floatCloudInverse 60s infinite linear;
}

/* Garlands / Hanging decorations (Ghibli playroom style) */
.garland {
  position: fixed;
  top: 0;
  width: 30px;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.garland-left {
  left: 20px;
}

.garland-right {
  right: 20px;
}

.garland-rope {
  width: 2px;
  height: 85%;
  background: rgba(92, 61, 70, 0.15);
  margin: 0 auto;
  position: relative;
  transform-origin: top;
  animation: swing 6s infinite ease-in-out;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 50px 0;
}

.garland-left .garland-rope {
  animation-delay: -1.5s;
}

.garland-item {
  font-size: 1.1rem;
  filter: drop-shadow(0 2px 4px rgba(181, 126, 220, 0.2));
  transform: rotate(15deg);
}

.garland-item:nth-child(even) {
  transform: rotate(-15deg);
}

/* Scrollable Layout Structure */
section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 80px 20px;
  width: 100%;
  z-index: 5;
}

/* General Layout Elements */
.container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

header {
  margin-bottom: 25px;
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeInDown 1s forwards ease-out 0.4s;
}

h1 {
  font-family: var(--font-handwriting);
  font-size: 3.2rem;
  color: var(--color-deep-rose);
  text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.9), 0 0 10px rgba(181, 126, 220, 0.25);
  margin-bottom: 5px;
}

h2 {
  font-family: var(--font-handwriting);
  font-size: 2.8rem;
  color: var(--color-deep-rose);
  margin-bottom: 15px;
  text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.8);
}

.section-subtitle {
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(92, 61, 70, 0.85);
  font-weight: 700;
  margin-bottom: 30px;
}

/* Section-Specific Subtitles */
#gallery .section-subtitle {
  color: var(--color-warm-pink);
}

#praises .section-subtitle {
  color: #7a66b8;
}

/* --- Section 1: Hero / Envelope Card --- */
.envelope-wrapper {
  position: relative;
  width: var(--envelope-width);
  height: var(--envelope-height);
  margin: 30px auto;
  cursor: pointer;
  perspective: 1000px;
  transition: transform 0.3s ease;
}

.envelope-wrapper:hover {
  transform: translateY(-5px);
}

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--color-soft-pink);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 15px 35px rgba(92, 61, 70, 0.15);
  transform-style: preserve-3d;
}

.envelope::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-width: 110px 160px 110px 0;
  border-style: solid;
  border-color: transparent var(--color-warm-pink) transparent transparent;
  border-radius: 0 0 12px 0;
  z-index: 3;
}

.envelope::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-width: 110px 0 110px 160px;
  border-style: solid;
  border-color: transparent transparent transparent var(--color-warm-pink);
  border-radius: 0 0 0 12px;
  z-index: 3;
}

.flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 120px solid var(--color-warm-pink);
  border-bottom: 0 solid transparent;
  transform-origin: top;
  z-index: 4;
  transition: transform 0.6s ease 0.6s, opacity 0.3s ease 0.6s, z-index 0s ease 0.9s;
  filter: drop-shadow(0 3px 3px rgba(92, 61, 70, 0.1));
  opacity: 1;
}

.pocket {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-bottom: 120px solid #e1d5ff;
  border-radius: 0 0 12px 12px;
  z-index: 3;
}

.letter {
  position: absolute;
  bottom: 5px;
  left: 15px;
  width: 290px;
  height: 190px;
  background-color: var(--color-cream);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 0 10px rgba(92, 61, 70, 0.05);
  z-index: 2;
  transition: transform 0.6s ease 0s, height 0.6s ease 0s, z-index 0s ease 0.6s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px dashed rgba(181, 126, 220, 0.3);
}

.letter-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: repeating-linear-gradient(45deg, var(--color-warm-pink), var(--color-warm-pink) 10px, var(--color-cream) 10px, var(--color-cream) 20px);
}

.envelope-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  background-color: #8a63c2;
  transform: translate(-50%, -20%) rotate(-45deg);
  z-index: 5;
  transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.envelope-heart:before,
.envelope-heart:after {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  background-color: #8a63c2;
  border-radius: 50%;
}

.envelope-heart:before {
  top: -16px;
  left: 0;
}

.envelope-heart:after {
  left: 16px;
  top: 0;
}

.sparkle-icon {
  position: absolute;
  pointer-events: none;
  font-size: 1.2rem;
  color: var(--color-gold);
  z-index: 10;
  animation: shine 1.8s infinite alternate;
}

/* Open Envelope States */
.envelope-wrapper.open .flap {
  transform: rotateX(180deg);
  z-index: 1;
  opacity: 0;
  transition: transform 0.6s ease 0s, opacity 0.3s ease 0.3s, z-index 0s ease 0.3s;
}

.envelope-wrapper.open .letter {
  transform: translateY(-130px) scale(1.06);
  height: 280px;
  z-index: 4;
  box-shadow: 0 15px 30px rgba(92, 61, 70, 0.18);
  overflow: visible;
  transition: transform 0.6s ease 0.3s, height 0.6s ease 0.3s, z-index 0s ease 0.3s;
}

.envelope-wrapper.open .envelope-heart {
  transform: translate(-50%, -150%) scale(0) rotate(-45deg);
  opacity: 0;
}

.letter-text {
  margin-top: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.letter-title {
  font-family: var(--font-handwriting);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-deep-rose);
  border-bottom: 1px solid rgba(92, 61, 70, 0.1);
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#letter-date {
  font-family: var(--font-primary);
  font-size: 0.72rem;
  background-color: var(--color-warm-pink);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 6px rgba(181, 126, 220, 0.2);
  letter-spacing: 0.2px;
  text-transform: none;
  opacity: 1;
}

.letter-content-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.letter-body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-deep-rose);
  text-align: center;
  font-weight: 500;
  width: 100%;
  animation: softFadeIn 0.5s ease-in-out;
}

.letter-footer {
  font-family: var(--font-handwriting);
  font-size: 1.5rem;
  text-align: right;
  margin-top: 8px;
  color: var(--color-warm-pink);
  font-weight: bold;
}

.controls {
  margin-top: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
  z-index: 6;
  transition: margin-top var(--transition-speed) ease;
}

.envelope-wrapper:not(.open) ~ .controls {
  margin-top: 20px;
}

.btn-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  background: white;
  border: 2px solid var(--color-soft-pink);
  color: var(--color-deep-rose);
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 25px;
  cursor: pointer;
  font-family: var(--font-primary);
  box-shadow: 0 4px 10px rgba(181, 126, 220, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  outline: none;
}

.btn:hover {
  background-color: var(--color-warm-pink);
  color: white;
  border-color: var(--color-warm-pink);
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 15px rgba(181, 126, 220, 0.25);
}

.btn-primary {
  background-color: var(--color-warm-pink);
  color: white;
  border-color: var(--color-warm-pink);
}

.btn-primary:hover {
  background-color: #8e4ec2;
  border-color: #8e4ec2;
}

.instruction-tip {
  font-size: 0.85rem;
  color: rgba(92, 61, 70, 0.65);
  display: flex;
  align-items: center;
  gap: 5px;
  animation: bounce 2s infinite ease-in-out;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-warm-pink);
  animation: bounce 2.5s infinite ease-in-out;
}

.scroll-indicator span {
  font-size: 1.2rem;
  margin-top: 2px;
}

/* --- Section 2: Polaroid Scrapbook --- */
.polaroids-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 35px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 20px;
}

.polaroid {
  background: white;
  padding: 15px 15px 35px 15px;
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(92, 61, 70, 0.12);
  border: 1px solid rgba(92, 61, 70, 0.05);
  max-width: 300px;
  width: 100%;
  transform: rotate(var(--rotation, 2deg)) scale(1);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2), box-shadow 0.4s ease;
  position: relative;
}

.polaroid:nth-child(even) {
  --rotation: -3deg;
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.05) translateY(-5px);
  box-shadow: 0 20px 45px rgba(181, 126, 220, 0.22);
  z-index: 10;
}

.polaroid-img-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.06);
}

.polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.polaroid:hover img {
  transform: scale(1.06);
}

.polaroid-caption {
  font-family: var(--font-handwriting);
  font-size: 1.6rem;
  margin-top: 15px;
  color: var(--color-deep-rose);
  text-align: center;
  font-weight: bold;
}

.polaroid-tape {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 110px;
  height: 28px;
  background-color: rgba(220, 208, 255, 0.5);
  backdrop-filter: blur(1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  z-index: 5;
}

/* --- Section 3: Compliments Carousel / Speech Bubbles --- */
.praises-timeline {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
  max-width: 550px;
  margin: 0 auto;
}

.praise-bubble {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px dashed rgba(181, 126, 220, 0.35);
  border-radius: 22px;
  padding: 22px 28px;
  box-shadow: 0 10px 25px rgba(181, 126, 220, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  text-align: left;
  line-height: 1.6;
  font-size: 1.1rem;
  color: var(--color-deep-rose);
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  position: relative;
}

.praise-bubble:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 15px 35px rgba(181, 126, 220, 0.15);
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--color-warm-pink);
}

.praise-badge {
  font-size: 1.6rem;
  line-height: 1;
}

.praise-text {
  flex-grow: 1;
}

.praise-sticker {
  position: absolute;
  bottom: -10px;
  right: 15px;
  font-size: 1.3rem;
  pointer-events: none;
  animation: bounce 2.2s infinite ease-in-out;
}

/* --- Section 4: Wishing Well --- */
.wishing-well-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 45px 30px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(92, 61, 70, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.wishing-well-icon {
  font-size: 4rem;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.25);
  animation: pulseRate 2.2s infinite;
}

.wishing-well-icon:hover {
  transform: scale(1.15) rotate(5deg);
}

.wishing-well-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--color-deep-rose);
  font-weight: 500;
  margin-bottom: 5px;
}

/* --- Scroll Reveal Framework --- */
.reveal {
  opacity: 0;
  transform: translateY(45px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Custom transitions for alternating list elements */
.reveal-left {
  opacity: 0;
  transform: translateX(-45px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(45px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Delay modifiers */
.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.45s; }

/* Widgets */
.widgets {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  gap: 10px;
}

.widget-btn {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(92, 61, 70, 0.08);
  font-size: 1.15rem;
  transition: all 0.3s ease;
  color: var(--color-deep-rose);
  outline: none;
}

.widget-btn:hover {
  transform: scale(1.1);
  background-color: var(--color-cream);
  color: var(--color-warm-pink);
}

.music-playing .music-icon {
  animation: rotateMusic 4s infinite linear;
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes sunGlow {
  0% {
    transform: scale(1);
    opacity: 0.35;
  }
  100% {
    transform: scale(1.15);
    opacity: 0.6;
  }
}

@keyframes floatCloud {
  0% {
    transform: translateX(-250px);
  }
  100% {
    transform: translateX(calc(100vw + 250px));
  }
}

@keyframes floatCloudInverse {
  0% {
    transform: translateX(250px);
  }
  100% {
    transform: translateX(calc(-100vw - 250px));
  }
}

@keyframes rotateMusic {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes pulseRate {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes swing {
  0%, 100% {
    transform: rotate(3deg);
  }
  50% {
    transform: rotate(-3deg);
  }
}

@keyframes shine {
  0% {
    opacity: 0.3;
    transform: scale(0.85) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1.12) rotate(12deg);
  }
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .garland {
    display: none; /* Hide garlands on tablets/phones to save horizontal viewport space */
  }
  
  .polaroids-container {
    gap: 25px;
  }
  
  h1 {
    font-size: 2.7rem;
  }
  
  h2 {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  :root {
    --envelope-width: 290px;
    --envelope-height: 200px;
  }
  
  .envelope::before, .envelope::after {
    border-width: 100px 145px 100px 0;
  }
  .envelope::after {
    border-width: 100px 0 100px 145px;
  }
  .flap {
    border-left-width: 145px;
    border-right-width: 145px;
    border-top-width: 110px;
  }
  .pocket {
    border-left-width: 145px;
    border-right-width: 145px;
    border-bottom-width: 110px;
  }
  .letter {
    width: 260px;
    height: 175px;
    left: 15px;
    padding: 15px;
  }
  
  .envelope-wrapper.open .letter {
    transform: translateY(-110px) scale(1.04);
    height: 250px;
  }
  
  .envelope-wrapper:not(.open) ~ .controls {
    margin-top: 15px;
  }
  
  .envelope-wrapper.open ~ .controls {
    margin-top: 130px;
  }
  
  h1 {
    font-size: 2.2rem;
  }
  
  h2 {
    font-size: 1.9rem;
  }
  
  .section-subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
  
  .polaroid {
    max-width: 250px;
    padding: 10px 10px 25px 10px;
  }
  
  .polaroid-caption {
    font-size: 1.3rem;
  }
  
  .praise-bubble {
    font-size: 0.98rem;
    padding: 16px 20px;
  }
}
