/* ============================================
   Holi T1: Couple Holi template
   Touch color splashes, polaroid cards, color my heart, hug & love floats
   ============================================ */

body {
  --holi-font: 'Quicksand', 'Nunito', sans-serif;
  --holi-display: 'Pacifico', cursive;
  --holi-dark: #1a0a12;
  --holi-mid: #2d1a28;
  --holi-pink: #e91e63;
  --holi-magenta: #c2185b;
  --holi-yellow: #ffeb3b;
  --holi-blue: #2196f3;
  --holi-green: #4caf50;
  --holi-orange: #ff5722;
  --holi-purple: #9c27b0;
  --holi-text: #fff;
  --holi-bg: #000000;
  --holi-overlay: rgba(0, 0, 0, 0.95);
  --holi-deco-opacity: 0.35;
  --holi-deco-dot-opacity: 0.25;
  --holi-color-dot-border: rgba(255, 255, 255, 0.3);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--holi-font);
  color: var(--holi-text);
  -webkit-tap-highlight-color: transparent;
  background: var(--holi-bg);
  transition: background 0.4s ease, color 0.4s ease;
}

body.holi-light-mode {
  --holi-text: #333;
  --holi-bg: #ffffff;
  --holi-overlay: rgba(255, 255, 255, 0.98);
  --holi-deco-opacity: 0.18;
  --holi-deco-dot-opacity: 0.18;
  --holi-color-dot-border: rgba(0, 0, 0, 0.15);
}

/* Theme toggle button */
.holi-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--holi-color-dot-border);
  background: var(--holi-bg);
  color: var(--holi-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.4s ease, border-color 0.4s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.holi-theme-toggle:hover {
  transform: scale(1.05);
}

.holi-theme-toggle .holi-theme-icon {
  position: absolute;
  font-size: 1.5rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.holi-theme-toggle .holi-theme-moon {
  opacity: 1;
}

.holi-theme-toggle .holi-theme-sun {
  opacity: 0;
}

body.holi-light-mode .holi-theme-toggle .holi-theme-moon {
  opacity: 0;
}

body.holi-light-mode .holi-theme-toggle .holi-theme-sun {
  opacity: 1;
}

/* ---- Floating decorations ---- */
.holi-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.holi-deco-dot {
  position: absolute;
  border-radius: 50%;
  opacity: var(--holi-deco-dot-opacity);
  animation: holiDecoFloat 15s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.holi-deco-1 { left: 8%; top: 12%; width: 20px; height: 20px; background: #e91e63; animation-delay: 0s; }
.holi-deco-2 { right: 15%; top: 18%; width: 28px; height: 28px; background: #9c27b0; animation-delay: -2s; }
.holi-deco-3 { left: 12%; bottom: 25%; width: 16px; height: 16px; background: #2196f3; animation-delay: -4s; }
.holi-deco-4 { right: 10%; bottom: 15%; width: 24px; height: 24px; background: #4caf50; animation-delay: -1s; }
.holi-deco-5 { left: 25%; top: 8%; width: 14px; height: 14px; background: #ffeb3b; animation-delay: -3s; }
.holi-deco-6 { right: 22%; top: 35%; width: 18px; height: 18px; background: #ff5722; animation-delay: -5s; }
.holi-deco-7 { left: 5%; top: 45%; width: 22px; height: 22px; background: #00bcd4; animation-delay: -6s; }
.holi-deco-8 { right: 8%; top: 60%; width: 12px; height: 12px; background: #f44336; animation-delay: -2.5s; }
.holi-deco-9 { left: 18%; bottom: 12%; width: 26px; height: 26px; background: #e91e63; animation-delay: -7s; }
.holi-deco-10 { right: 30%; bottom: 8%; width: 16px; height: 16px; background: #9c27b0; animation-delay: -1.5s; }

.holi-deco-emoji {
  position: absolute;
  font-size: 1.4rem;
  opacity: var(--holi-deco-dot-opacity);
  animation: holiDecoFloat 20s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.holi-deco-e1 { left: 6%; top: 30%; animation-delay: 0s; }
.holi-deco-e2 { right: 12%; top: 8%; animation-delay: -3s; }
.holi-deco-e3 { left: 20%; top: 70%; animation-delay: -6s; }
.holi-deco-e4 { right: 6%; top: 45%; animation-delay: -4s; }
.holi-deco-e5 { left: 35%; top: 15%; animation-delay: -2s; }
.holi-deco-e6 { right: 25%; bottom: 20%; animation-delay: -5s; }
.holi-deco-e7 { left: 8%; bottom: 40%; animation-delay: -8s; }
.holi-deco-e8 { right: 35%; top: 75%; animation-delay: -1s; }

@keyframes holiDecoFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(15px, -20px) scale(1.1); }
  50% { transform: translate(-10px, 15px) scale(0.95); }
  75% { transform: translate(-20px, -10px) scale(1.05); }
}

/* Soft gradient orbs in corners */
.holi-deco-orb {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(55px);
  opacity: var(--holi-deco-opacity);
  transition: opacity 0.4s ease;
  animation: holiDecoFloat 18s ease-in-out infinite;
  pointer-events: none;
}

.holi-deco-orb-tl {
  top: -40px;
  left: -40px;
  background: radial-gradient(circle, rgba(233,30,99,0.4), transparent 65%);
}

.holi-deco-orb-tr {
  top: -40px;
  right: -40px;
  background: radial-gradient(circle, rgba(156,39,176,0.35), transparent 65%);
  animation-delay: -4s;
}

.holi-deco-orb-bl {
  bottom: -40px;
  left: -40px;
  background: radial-gradient(circle, rgba(76,175,80,0.35), transparent 65%);
  animation-delay: -6s;
}

.holi-deco-orb-br {
  bottom: -40px;
  right: -40px;
  background: radial-gradient(circle, rgba(33,150,243,0.4), transparent 65%);
  animation-delay: -9s;
}

/* ---- Splash canvas (liquid gradient on hover / polaroid release) ---- */
.holi-splash-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.holi-splash-canvas.holi-canvas-on-top {
  z-index: 50;
}

.holi-splash-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* ---- Page container ---- */
.holi-pages {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.holi-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.4s ease;
}

.holi-page.holi-page-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Page 1: Make canvas interactive only on page 1 */
.holi-page-1 .holi-splash-canvas {
  pointer-events: auto;
}

.holi-page-1 .holi-splash-canvas canvas {
  pointer-events: auto;
}

/* ---- Buttons ---- */
.holi-btn {
  padding: 0.9rem 2.2rem;
  font-family: var(--holi-font);
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.holi-btn:hover {
  transform: scale(1.05);
}

.holi-btn:active {
  transform: scale(0.98);
}

.holi-btn-primary {
  background: linear-gradient(135deg, var(--holi-pink), var(--holi-purple));
  color: #fff;
  box-shadow: 0 4px 24px rgba(233, 30, 99, 0.45);
}

.holi-btn-primary:hover {
  box-shadow: 0 6px 32px rgba(233, 30, 99, 0.55);
}

.holi-btn-love {
  background: linear-gradient(135deg, #f44336, #e91e63);
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 24px rgba(244, 67, 54, 0.5);
}

/* ---- Page 1: Landing ---- */
.holi-p1-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 90vw;
}

.holi-p1-title {
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #e91e63 0%, #9c27b0 20%, #2196f3 40%, #4caf50 60%, #ffeb3b 80%, #ff5722 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holiTitleShimmer 4s ease-in-out infinite;
}

@keyframes holiTitleShimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.holi-p1-quote {
  font-family: 'Varela Round', 'Fredoka', sans-serif;
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  line-height: 1.6;
  color: var(--holi-text);
  margin-bottom: 2rem;
  font-weight: 700;
}

#holi-partner-name {
  color: var(--holi-pink);
  font-weight: 700;
}

/* ---- Page 2: Polaroid stack ---- */
.holi-page-2 {
  justify-content: center;
  overflow-y: auto;
  align-items: center;
}

.holi-p2-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.holi-p2-title {
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  color: var(--holi-text);
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 2;
}

.holi-p2-colorful {
  background: linear-gradient(90deg, #e91e63, #9c27b0, #2196f3, #4caf50, #ffeb3b, #ff5722);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holiColorfulGradient 4s ease-in-out infinite;
}

@keyframes holiColorfulGradient {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.holi-p2-polaroid-stack {
  position: relative;
  width: 360px;
  height: 440px;
  margin: 0 auto 2rem;
  touch-action: pan-y pinch-zoom;
  flex-shrink: 0;
}

.holi-polaroid {
  position: absolute;
  width: 300px;
  background: #fff;
  padding: 14px 14px 44px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: grab;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.6s ease-out;
  z-index: 1;
  left: 50%;
  top: 50%;
}

.holi-polaroid:active {
  cursor: grabbing;
}

.holi-polaroid-1 { transform: translate(-50%, -50%) rotate(-8deg); z-index: 4; }
.holi-polaroid-2 { transform: translate(-50%, -50%) rotate(-2deg) translateX(10px); z-index: 3; }
.holi-polaroid-3 { transform: translate(-50%, -50%) rotate(4deg) translateX(-8px); z-index: 2; }
.holi-polaroid-4 { transform: translate(-50%, -50%) rotate(8deg) translateX(12px); z-index: 1; }

.holi-polaroid.dragging {
  z-index: 10;
  transition: none;
}

.holi-polaroid-img {
  width: 100%;
  height: 270px;
  overflow: hidden;
  background: #f5f5f5;
}

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

.holi-polaroid-caption {
  font-family: var(--holi-display);
  font-size: 1.2rem;
  color: #333;
  text-align: center;
  margin-top: 14px;
}

/* Heart reveal after polaroids */
.holi-p2-heart-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  z-index: 5;
  background: var(--holi-overlay);
}

.holi-p2-heart-reveal.holi-visible {
  opacity: 1;
  visibility: visible;
}

.holi-p2-heart-outline {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(233, 30, 99, 0.4));
  animation: holiHeartPulse 1.5s ease-in-out infinite;
}

@keyframes holiHeartPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

.holi-p2-heart-hint {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--holi-text);
}

/* ---- Page 3: Color my heart ---- */
.holi-page-3 {
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

.holi-p3-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.holi-page-3 .holi-p3-title {
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  color: var(--holi-text);
  margin-bottom: 1.5rem;
  text-align: center;
}

.holi-p3-colorful {
  background: linear-gradient(90deg, #e91e63, #9c27b0, #2196f3, #4caf50, #ffeb3b, #ff5722);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holiColorfulGradient 4s ease-in-out infinite;
}

.holi-p3-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 580px;
}

@media (max-width: 580px) {
  .holi-page-3 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .holi-p3-content {
    width: 100%;
    max-width: 100%;
  }
  .holi-p3-game {
    width: 100%;
    max-width: 100%;
  }
  .holi-p3-heart-wrap {
    width: 100%;
  }
  .holi-p3-heart-flip {
    width: 100%;
    max-width: 100%;
    height: min(90vh, 420px);
  }
}

.holi-page-3.holi-p3-letter-visible .holi-p3-title {
  display: none;
}

.holi-p3-heart-wrap {
  perspective: 800px;
  color: #fff;
}

body.holi-light-mode .holi-p3-heart-wrap {
  color: #333;
}

.holi-p3-heart-flip {
  position: relative;
  width: 540px;
  height: 440px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.holi-p3-heart-flip.holi-flipped {
  transform: rotateY(180deg);
}

.holi-p3-heart-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.holi-p3-heart-front {
  background: transparent;
  justify-content: flex-start;
  padding-top: 0;
}

.holi-p3-front-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.holi-p3-heart-back {
  transform: rotateY(180deg);
  justify-content: stretch;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

.holi-heart-svg {
  width: 180px;
  height: 180px;
  overflow: visible;
  filter: drop-shadow(0 4px 20px rgba(233, 30, 99, 0.4));
}

.holi-heart-path {
  transition: fill 0.4s ease;
}

.holi-p3-tap-hint {
  font-size: 0.9rem;
  color: var(--holi-text);
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.holi-p3-heart-flip.holi-flipped .holi-p3-tap-hint {
  display: none;
}

/* Letter paper - looks like real letter */
.holi-letter-paper {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #fefdfa 0%, #faf6ef 35%, #f5ede3 70%, #f0e6da 100%);
  box-shadow: inset 0 0 0 1px rgba(139, 90, 43, 0.15),
              inset 3px 0 8px rgba(139, 90, 43, 0.08),
              0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem 2.5rem 1.75rem 2.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 2px;
}

.holi-letter-fold {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(180deg, rgba(139, 90, 43, 0.12) 0%, transparent 100%);
  pointer-events: none;
}

/* Bottom-right corner fold */
.holi-letter-paper::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #e0d4c0 0%, #d4c8b4 50%, #c9bca6 100%);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.holi-letter-content {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.18rem;
  line-height: 2;
  color: #2a1810;
  text-align: left;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  letter-spacing: 0.02em;
}

.holi-letter-content p {
  margin-bottom: 1rem;
}

.holi-letter-content p:first-child {
  margin-top: 0.25rem;
}

.holi-letter-greeting {
  font-weight: 600;
  color: #2a1810;
}

.holi-letter-signature {
  margin-top: 1.5rem;
  font-style: italic;
  color: #6b3410;
  font-weight: 600;
  font-size: 1.1rem;
}

.holi-letter-signature #holi-letter-sender {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-weight: 700;
}

/* Next button - outside letter, below flip card */
.holi-p3-next-wrap {
  display: none;
  margin-top: 1.5rem;
  text-align: center;
}

.holi-page-3.holi-p3-letter-visible .holi-p3-next-wrap {
  display: block;
}

/* Color dots - inside front face below heart */
.holi-p3-colors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 260px;
}

.holi-color-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--holi-color-dot-border);
  background: var(--holi-color);
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.holi-color-dot:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.holi-color-dot.holi-used {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* ---- Page 4: Loading & Hug ---- */
.holi-p4-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.holi-p4-loading.holi-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.holi-loading-dots {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}

.holi-loading-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--holi-pink), var(--holi-purple));
  animation: holiBounce 0.8s ease-in-out infinite;
}

.holi-loading-dots span:nth-child(1) { animation-delay: 0s; }
.holi-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.holi-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

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

.holi-loading-text {
  font-size: 1rem;
  color: var(--holi-text);
}

.holi-p4-hug {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease 0.2s, visibility 0.6s ease 0.2s;
}

.holi-p4-hug.holi-visible {
  opacity: 1;
  visibility: visible;
}

.holi-p4-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.holi-p4-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.holi-p4-success.holi-visible {
  display: flex;
}

.holi-p4-success .holi-btn-love {
  margin-top: 1.5rem;
}

.holi-hug-text {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--holi-text);
}

.holi-p4-typewriter-text {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--holi-text);
  min-height: 2.5rem;
}

.holi-p4-typewriter-text::after {
  content: '|';
  animation: holi-typewriter-blink 0.8s step-end infinite;
}

.holi-p4-typewriter-text.holi-done::after {
  display: none;
}

@keyframes holi-typewriter-blink {
  50% { opacity: 0; }
}

.holi-hug-gif-wrap {
  max-width: 300px;
  max-height: 320px;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease;
}

.holi-hug-gif-wrap.holi-hug-gif-hidden {
  max-height: 0;
  opacity: 0;
}

.holi-hug-gif {
  max-width: 300px;
  max-height: 300px;
  border-radius: 16px;
}

/* Love float container */
.holi-p4-float-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.holi-float-heart {
  position: absolute;
  font-size: 2rem;
  animation: holiFloatUp 4s ease-in forwards;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

@keyframes holiFloatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.8) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-150vh) scale(1.2) rotate(15deg);
  }
}
