/* ============================================
   POLAROID GALLERY
   ============================================ */

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

:root {
  --bg: #fdf6f0;
  --frame: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --accent: #ff6b9d;
  --text: #4a3347;
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: 'Quicksand', sans-serif;
  background: var(--bg);
  overflow-x: hidden;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

/* ============================================
   CODE MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  background: var(--frame);
  padding: 3rem 2.5rem;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(255, 107, 157, 0.15);
  text-align: center;
  width: min(360px, 90vw);
}

.modal-card h2 {
  font-family: 'Pacifico', cursive;
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.modal-card input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid #eee;
  border-radius: 12px;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color 0.3s ease;
}

.modal-card input:focus {
  border-color: var(--accent);
}

.modal-card input::placeholder {
  color: #ccc;
}

.modal-card button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--frame);
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modal-card button:hover {
  transform: scale(1.03);
}

.modal-card button:active {
  transform: scale(0.97);
}

.modal-hint {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  min-height: 1.2em;
  transition: opacity 0.3s ease;
}

.modal-hint.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ============================================
   YOUTUBE AUDIO (hidden)
   ============================================ */

.yt-audio {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.yt-audio iframe {
  width: 1px;
  height: 1px;
  border: none;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.scroll-container {
  width: 100%;
}

.panel {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Intro */
.intro-panel {
  background: var(--bg);
  padding: 2rem;
}

.intro-text {
  text-align: center;
}

.intro-text h1 {
  font-family: 'Pacifico', cursive;
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  color: var(--accent);
  margin-bottom: 1rem;
  line-height: 1.25;
  animation: floatTitle 4s ease-in-out infinite;
}

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

.intro-text p {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: var(--text);
  font-weight: 500;
  opacity: 0.7;
  animation: fadePulse 3s ease-in-out infinite;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.4; }
}

.scroll-arrow {
  width: 18px;
  height: 18px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  margin: 2rem auto 0;
  animation: bounce 2s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes bounce {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(10px); }
}

/* Polaroid */
.polaroid-stage {
  background: var(--bg);
}

.polaroid {
  position: relative;
  width: min(480px, 85vw);
  transform: rotate(0deg);
  cursor: default;
  will-change: transform;
}

.polaroid-frame {
  background: var(--frame);
  padding: clamp(12px, 2.5vw, 22px) clamp(12px, 2.5vw, 22px) clamp(56px, 12vw, 88px) clamp(12px, 2.5vw, 22px);
  border-radius: 4px;
  box-shadow:
    0 4px 12px var(--shadow),
    0 20px 60px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 2;
}

.polaroid-frame img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  background: #f0e6df;
}

.polaroid-shadow {
  position: absolute;
  bottom: -10px;
  left: 10px;
  right: 10px;
  height: 40px;
  background: rgba(0, 0, 0, 0.07);
  filter: blur(16px);
  border-radius: 50%;
  z-index: 1;
}

/* Footer */
.footer-panel {
  background: var(--accent);
  min-height: 100vh;
}

.footer-content {
  text-align: center;
  padding: 2rem;
}

.footer-text {
  font-family: 'Pacifico', cursive;
  font-size: clamp(2.5rem, 10vw, 6rem);
  color: var(--frame);
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  line-height: 1.3;
}

.footer-text.visible {
  animation: floatFooter 3.5s ease-in-out infinite;
}

@keyframes floatFooter {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}

.footer-hearts {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.footer-hearts span {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--frame);
  opacity: 0;
  animation: heartPop 0.6s ease forwards;
}

.footer-hearts span:nth-child(1) { animation-delay: 0.4s; }
.footer-hearts span:nth-child(2) { animation-delay: 0.6s; }
.footer-hearts span:nth-child(3) { animation-delay: 0.8s; }

@keyframes heartPop {
  0% { opacity: 0; transform: scale(0) rotate(-15deg); }
  60% { transform: scale(1.3) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Audio toggle */
.audio-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--frame);
  box-shadow: 0 2px 10px var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--accent);
}

.audio-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.audio-toggle:active {
  transform: scale(0.95);
}

/* Progress dots */
.progress-dots {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  transition: all 0.3s ease;
}

.dot.active {
  opacity: 1;
  transform: scale(1.4);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .polaroid {
    width: min(400px, 90vw);
  }

  .polaroid-frame {
    padding: clamp(10px, 2vw, 16px) clamp(10px, 2vw, 16px) clamp(48px, 10vw, 68px) clamp(10px, 2vw, 16px);
  }

  .progress-dots {
    right: 12px;
    gap: 6px;
  }

  .dot {
    width: 6px;
    height: 6px;
  }

  .audio-toggle {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 480px) {
  .polaroid {
    width: min(320px, 92vw);
  }

  .polaroid-frame {
    padding: 8px 8px 48px 8px;
    border-radius: 3px;
  }

  .intro-text h1 {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  .footer-text {
    font-size: clamp(2rem, 12vw, 4rem);
  }

  .progress-dots {
    right: 8px;
    gap: 5px;
  }

  .dot {
    width: 5px;
    height: 5px;
  }

  .audio-toggle {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
  }

  .audio-toggle svg {
    width: 16px;
    height: 16px;
  }

  .modal-card {
    padding: 2rem 1.5rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .polaroid {
    width: min(320px, 55vh);
  }

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

@media (min-width: 1200px) {
  .polaroid {
    width: min(560px, 45vw);
  }

  .polaroid-frame {
    padding: 22px 22px 88px 22px;
  }

  .polaroid-shadow {
    height: 50px;
    bottom: -12px;
  }
}
