/* ============================================
   VALENTINE'S DAY WEBSITE FOR MARGO
   Color Palette: Pinks, Reds, Cream, White
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --pink-primary: #FF69B4;
  --pink-light: #FFB6C1;
  --pink-soft: #FFF0F5;
  --pink-blush: #FFE4F0;
  --red-heart: #FF1744;
  --red-dark: #D50000;
  --white: #FFFFFF;
  --cream: #FFF8F0;
  --text-dark: #4A2040;
  --text-medium: #7A4068;
  --text-light: #A06080;
  --shadow-pink: rgba(255, 105, 180, 0.3);
  --shadow-soft: rgba(0, 0, 0, 0.08);

  --font-display: 'Great Vibes', cursive;
  --font-handwriting: 'Caveat', cursive;
  --font-body: 'Quicksand', sans-serif;
  --font-title: 'Dancing Script', cursive;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--pink-soft);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* --- Particles Canvas --- */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* --- Music Button --- */
.music-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  background: var(--white);
  border: 2px solid var(--pink-primary);
  border-radius: 50px;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--pink-primary);
  box-shadow: 0 4px 15px var(--shadow-pink);
  transition: all 0.3s ease;
}

.music-btn:hover {
  background: var(--pink-primary);
  color: var(--white);
  transform: scale(1.05);
}

.music-btn.muted {
  opacity: 0.6;
}

.music-btn.muted .music-icon {
  text-decoration: line-through;
}

.music-icon {
  font-size: 18px;
}

/* ============================================
   SECTION 1: ENVELOPE LANDING
   ============================================ */
.envelope-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pink-soft) 0%, var(--pink-blush) 50%, var(--pink-light) 100%);
  z-index: 1000;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.envelope-section.opened {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.envelope-container {
  text-align: center;
}

.envelope-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--text-dark);
  margin-bottom: 40px;
  animation: pulse-soft 2s ease-in-out infinite;
}

.envelope-hint {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-light);
  margin-top: 24px;
  animation: bounce-gentle 1.5s ease-in-out infinite;
}

/* Envelope */
.envelope {
  width: clamp(220px, 50vw, 320px);
  height: clamp(160px, 35vw, 220px);
  position: relative;
  cursor: pointer;
  margin: 0 auto;
  transition: transform 0.3s ease;
}

.envelope:hover {
  transform: scale(1.05);
}

.envelope:focus {
  outline: 3px solid var(--pink-primary);
  outline-offset: 8px;
  border-radius: 4px;
}

.envelope-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #FF85C0 0%, var(--pink-primary) 100%);
  border-radius: 0 0 12px 12px;
  position: relative;
  box-shadow: 0 8px 30px var(--shadow-pink), 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.envelope-body::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 49.5%, #E0558A 49.5%, #E0558A 50.5%, transparent 50.5%),
              linear-gradient(-135deg, transparent 49.5%, #E0558A 49.5%, #E0558A 50.5%, transparent 50.5%);
  opacity: 0.3;
}

.envelope-flap {
  width: 100%;
  height: 60%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  transform-origin: top center;
  transition: transform 0.6s ease;
  background: var(--pink-primary);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: brightness(1.1);
}

.envelope.opening .envelope-flap {
  transform: rotateX(180deg);
}

.envelope-letter {
  position: absolute;
  width: 70%;
  height: 60%;
  background: var(--white);
  left: 15%;
  top: 20%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.6s ease 0.3s;
  z-index: 1;
}

.envelope.opening .envelope-letter {
  transform: translateY(-80px);
}

.letter-heart {
  font-size: 2rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  position: relative;
  z-index: 1;
}

.section {
  padding: 100px 20px;
  position: relative;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--red-heart);
  text-align: center;
  margin-bottom: 8px;
}

.section-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-light);
  text-align: center;
  margin-bottom: 60px;
  font-weight: 500;
}

/* --- Scroll Animations --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.slide-left {
  transform: translateX(-60px);
}

.animate-on-scroll.slide-left.visible {
  transform: translateX(0);
}

.animate-on-scroll.slide-right {
  transform: translateX(60px);
}

.animate-on-scroll.slide-right.visible {
  transform: translateX(0);
}

.animate-on-scroll.scale-in {
  transform: scale(0.8);
}

.animate-on-scroll.scale-in.visible {
  transform: scale(1);
}

/* ============================================
   SECTION 2: LOVE LETTER
   ============================================ */
.love-letter-section {
  background: linear-gradient(180deg, var(--pink-soft) 0%, var(--cream) 50%, var(--pink-soft) 100%);
  padding-top: 120px;
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  color: var(--red-heart);
  text-align: center;
  margin-bottom: 50px;
  line-height: 1.2;
  text-shadow: 2px 2px 4px rgba(255, 23, 68, 0.15);
}

.letter-paper {
  max-width: 700px;
  margin: 0 auto;
  background: var(--cream);
  padding: clamp(30px, 5vw, 60px);
  border-radius: 8px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.05),
    0 8px 30px rgba(0,0,0,0.08),
    inset 0 0 60px rgba(255, 240, 245, 0.5);
  position: relative;
  border: 1px solid rgba(255, 182, 193, 0.3);
}

.letter-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 40px;
  right: 40px;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    transparent,
    transparent 10px,
    var(--pink-light) 10px,
    var(--pink-light) 11px
  );
}

.letter-content p {
  font-family: var(--font-handwriting);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  line-height: 1.8;
  color: var(--text-dark);
  margin-bottom: 20px;
  min-height: 1.8em;
}

.letter-content .signature {
  font-family: var(--font-title);
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  color: var(--red-heart);
  margin-top: 30px;
  text-align: right;
}

/* Typing cursor */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--red-heart);
  margin-left: 2px;
  animation: blink-cursor 0.8s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ============================================
   SECTION 3: PHOTO GALLERY
   ============================================ */
.gallery-section {
  background: var(--white);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-soft);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
  background: var(--white);
}

.gallery-item:hover {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: 0 12px 40px var(--shadow-pink);
}

.gallery-item:nth-child(even):hover {
  transform: translateY(-8px) rotate(1deg);
}

.gallery-img-wrapper {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.gallery-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

.gallery-caption {
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-medium);
  text-align: center;
  font-weight: 500;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(74, 32, 64, 0.92);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.lightbox.active {
  opacity: 1;
}

.lightbox.hidden {
  display: none !important;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--white);
  font-size: 3rem;
  cursor: pointer;
  transition: transform 0.3s ease;
  line-height: 1;
}

.lightbox-close:hover {
  transform: rotate(90deg) scale(1.1);
}

.lightbox-img {
  max-width: 85%;
  max-height: 75vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  object-fit: contain;
}

.lightbox-caption {
  color: var(--white);
  font-size: 1.1rem;
  font-family: var(--font-handwriting);
  font-weight: 600;
}

/* SECTION 4: TIMELINE — removed */

/* ============================================
   SECTION 5: REASONS I LOVE YOU
   ============================================ */
.reasons-section {
  background: var(--white);
}

.reasons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.reason-card {
  perspective: 1000px;
  min-height: 180px;
}

.reason-front {
  background: linear-gradient(135deg, var(--white) 0%, var(--pink-soft) 100%);
  border: 2px solid var(--pink-light);
  border-radius: 20px;
  padding: 28px 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
  box-shadow: 0 4px 15px var(--shadow-soft);
}

.reason-card:hover .reason-front {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 35px var(--shadow-pink);
  border-color: var(--pink-primary);
}

.reason-number {
  font-family: var(--font-title);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--red-heart);
  line-height: 1;
}

.reason-heart {
  color: var(--pink-primary);
  font-size: 1.2rem;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.reason-front p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-medium);
  font-weight: 500;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.2); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

/* ============================================
   SECTION 6: MEME ZONE
   ============================================ */
.memes-section {
  background: linear-gradient(180deg, var(--pink-soft) 0%, var(--cream) 100%);
}

.memes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
}

.meme-card {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 25px var(--shadow-soft);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  transform: rotate(var(--rotation, 0deg));
}

.meme-card:nth-child(1) { --rotation: -2deg; }
.meme-card:nth-child(2) { --rotation: 1.5deg; }
.meme-card:nth-child(3) { --rotation: -1deg; }
.meme-card:nth-child(4) { --rotation: 2deg; }
.meme-card:nth-child(5) { --rotation: -1.5deg; }
.meme-card:nth-child(6) { --rotation: 1deg; }

.meme-card:hover {
  transform: rotate(0deg) scale(1.05) translateY(-8px);
  box-shadow: 0 16px 45px var(--shadow-pink);
}

.meme-img-wrapper {
  overflow: hidden;
  aspect-ratio: 1;
}

.meme-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.meme-card:hover .meme-img-wrapper img {
  transform: scale(1.05);
}

.meme-caption {
  padding: 16px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--white);
}

/* ============================================
   SECTION 7: FOOTER
   ============================================ */
.footer-section {
  background: linear-gradient(135deg, var(--pink-primary) 0%, var(--red-heart) 100%);
  padding: 80px 20px;
  text-align: center;
  color: var(--white);
}

.footer-hearts {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.footer-hearts span {
  font-size: 1.6rem;
  animation: float-heart 3s ease-in-out infinite;
  display: inline-block;
}

.footer-hearts span:nth-child(1) { animation-delay: 0s; }
.footer-hearts span:nth-child(2) { animation-delay: 0.3s; }
.footer-hearts span:nth-child(3) { animation-delay: 0.6s; }
.footer-hearts span:nth-child(4) { animation-delay: 0.9s; }
.footer-hearts span:nth-child(5) { animation-delay: 1.2s; }

@keyframes float-heart {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.footer-main {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 8px;
}

.footer-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 500;
  margin-bottom: 16px;
}

.footer-tiny {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

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

  .memes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .section {
    padding: 70px 16px;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 400px;
    margin: 0 auto;
  }

  /* Reasons */
  .reasons-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .reason-card {
    min-height: auto;
  }

  /* Memes */
  .memes-grid {
    grid-template-columns: 1fr;
    max-width: 350px;
    margin: 0 auto;
  }

  .meme-card {
    transform: rotate(0deg) !important;
  }

  /* Music button */
  .music-btn {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* Small mobile */
@media (max-width: 375px) {
  .main-title {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .letter-paper {
    padding: 20px;
  }

  .letter-content p {
    font-size: 1.1rem;
  }
}
