/* Animated gradient background and lyric effects */

:root {
  --bg1: #0f1027;
  --bg2: #1b1c47;
  --bg3: #2a1b4a;
  --ac1: #ff7a18;
  --ac2: #af00ff;
  --ac3: #00d4ff;
  --text: #f5f7ff;
  --trip1: #ff0080;
  --trip2: #00ff80;
  --trip3: #8000ff;
  --trip4: #ff8000;
}

/* Optimized animated background - much better performance */
body {
  background: 
    linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 40%, var(--bg3) 100%),
    radial-gradient(circle at 25% 75%, var(--ac2) 0%, transparent 40%),
    radial-gradient(circle at 75% 25%, var(--ac3) 0%, transparent 40%);
  background-size: 200% 200%, 150% 150%, 150% 150%;
  animation: 
    smoothBackgroundShift 12s ease-in-out infinite,
    gentleColorCycle 20s linear infinite;
  color: var(--text);
  overflow-x: hidden;
}

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

@keyframes gentleColorCycle {
  0% { filter: hue-rotate(0deg) saturate(1) brightness(1); }
  50% { filter: hue-rotate(180deg) saturate(1.2) brightness(1.05); }
  100% { filter: hue-rotate(360deg) saturate(1) brightness(1); }
}

/* Optimized starfield overlay - much better performance */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.4), transparent),
    radial-gradient(2px 2px at 10% 80%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 70% 10%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,0.6), transparent);
  background-size: 200px 200px, 150px 150px, 100px 100px, 180px 180px, 120px 120px, 160px 160px;
  animation: gentleStarfield 25s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes gentleStarfield {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-200px); }
}

/* Remove the aurora overlay for better performance */
body::after {
  display: none;
}

/* Stage centers lyrics with plenty of air */
.lyrics-stage {
  position: relative;
  /* leave a bit more room for the fixed music player */
  min-height: calc(100svh - 7.5rem);
  display: grid;
  place-items: center;
  /* tightened padding so lyrics fit on one screen */
  padding: 3.25rem 0.75rem 5.5rem;
  z-index: 1;
}

.lyrics {
  max-width: 1200px;
  width: min(92vw, 1200px);
}

/* Each line animates in sequence */
.line {
  /* slightly smaller lines to help fit on smaller viewports */
  font-size: clamp(1.05rem, 1.7vw + 0.9rem, 2.4rem);
  line-height: 1.22;
  margin: 0.35em 0;
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  filter: blur(8px) brightness(0.3);
  will-change: transform, opacity, filter;
  letter-spacing: 0.02em;
  cursor: pointer; /* Make it clear text is interactive */
  transition: transform 0.3s ease;
}

/* Fun hover effects */
.line:hover {
  transform: translateY(-2px) scale(1.02);
}

body.malone-mode .line:hover {
  transform: translateY(-5px) scale(1.05);
}

/* Only animate when play class is active */
.lyrics.play .line {
  /* shorter, snappier reveal to match the song's vocal timing */
  animation: dramaticReveal 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Ensure lines stay hidden when not playing */
.lyrics:not(.play) .line {
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  filter: blur(8px) brightness(0.3);
}

/* Simple solid white text - no glow effects */
.line .ink {
  color: white;
  font-weight: 600;
  /* Remove all glow effects for performance */
}

/* Special effects for emphasized lines - just scaling */
.line.big .ink {
  color: white;
  font-weight: 600;
  animation: gentleScale 4s ease-in-out infinite;
}

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

/* Shimmer effect - solid white text, no glow */
.shimmer .ink {
  position: relative;
  color: white !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  animation: gentleScale 4s ease-in-out infinite;
}

/* Override for big lines */
.line.big.shimmer .ink {
  color: white !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  animation: gentleScale 4s ease-in-out infinite;
}

/* Remove the old shimmer overlay */
.shimmer .ink::after {
  display: none;
}



@keyframes dramaticReveal {
  0% { 
    opacity: 0; 
    transform: translateY(50px) scale(0.8); 
    filter: blur(12px) brightness(0.2);
  }
  20% {
    opacity: 0.3;
    transform: translateY(30px) scale(0.9);
    filter: blur(6px) brightness(0.6);
  }
  60% {
    opacity: 0.8;
    transform: translateY(8px) scale(0.98);
    filter: blur(2px) brightness(0.9);
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
    filter: blur(0) brightness(1);
  }
}

/* Subtle shimmer sweep on important lines */
.shimmer {
  position: relative;
}
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.15) 15%, transparent 30%);
  transform: translateX(-130%);
  animation: sweep 3.8s ease-in-out infinite 1s;
  pointer-events: none;
}
@keyframes sweep {
  0%, 45% { transform: translateX(-130%); }
  60% { transform: translateX(130%); }
  100% { transform: translateX(130%); }
}

/* Timed delays for each line - sequential with clear gaps */
.lyrics.play .line-1 { animation-delay: 0.4s; /* ~400ms */ }
.lyrics.play .line-2 { animation-delay: 1.6s; /* ~1600ms */ }
.lyrics.play .line-3 { animation-delay: 2.9s; /* ~2900ms */ }
.lyrics.play .line-4 { animation-delay: 4.3s; /* ~4300ms */ }
.lyrics.play .line-5 { animation-delay: 6.2s; /* anchor: "Congratulations" */ }
.lyrics.play .line-6 { animation-delay: 7.6s; /* follow-up */ }
.lyrics.play .line-7 { animation-delay: 9.0s; }
.lyrics.play .line-8 { animation-delay: 10.6s; }
.lyrics.play .line-9 { animation-delay: 12.5s; /* anchor: final "Yeah, we made it" */ }

/* Emphasis sizes */
.big { font-size: clamp(1.4rem, 2.6vw + 1rem, 3.2rem); }
.loud { font-weight: 800; letter-spacing: 0.015em; }

/* Footer nudge */
.hint {
  margin-top: 1.5rem;
  opacity: 0.8;
  font-size: 0.9rem;
}

/* Music embed fixed bottom-center */
.music-embed {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: env(safe-area-inset-bottom, 18px);
  z-index: 60;
  width: min(92vw, 660px);
  max-width: 660px;
  padding: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.1));
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
}

/* Make the iframe itself responsive and visually light */
.music-embed iframe {
  display: block;
  width: 100%;
  height: 100px; /* reduce default height to save vertical space */
  border-radius: 8px;
  border: none;
  overflow: hidden;
  background: transparent;
}

@media (max-width: 420px) {
  .music-embed iframe { height: 88px; }
  .lyrics-stage { padding-top: 2.5rem; padding-bottom: 6.25rem; }
}

/* Enhanced GitHub link */
.github-link {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10;
}

.github-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 30px;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  backdrop-filter: blur(10px);
  animation: githubPulse 3s ease-in-out infinite;
  white-space: nowrap;
}

.github-link .github-icon {
  font-size: 1.2rem;
}

.github-link .github-text {
  font-size: 0.85rem;
  letter-spacing: 0.025em;
}

.github-link a:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
  border-color: rgba(255,255,255,0.6);
  transform: scale(1.05) translateY(-2px);
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.6));
  animation-play-state: paused;
}

@keyframes githubPulse {
  0%, 100% { 
    transform: scale(1) translateY(0);
    box-shadow: 0 0 0 rgba(255,255,255,0.4);
  }
  50% { 
    transform: scale(1.02) translateY(-1px);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
  }
}



/* Sparkle canvas sits behind confetti but above vignette */
#sparkle-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  body { 
    animation: none; 
    background: linear-gradient(120deg, var(--bg1), var(--bg2) 40%, var(--bg3));
  }
  body::before, body::after { 
    animation: none; 
    opacity: 0.3;
  }
  .line { 
    animation: none !important; 
    opacity: 1; 
    transform: none; 
    filter: none; 
  }
  .line .ink { animation: none; }
  .shimmer::after { display: none; }
}



/* Mode Toggle */
.mode-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

.malone-toggle {
  padding: 0.5rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 2rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.malone-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.malone-toggle.active {
  background: linear-gradient(45deg, #ff0080, #8000ff);
  border-color: #ff0080;
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
}

/* Mobile responsiveness for toggle */
@media (max-width: 768px) {
  .mode-toggle {
    top: 0.75rem;
    right: 0.75rem;
  }
  
  .malone-toggle {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Low Effects Mode */
body.low-effects {
  background: 
    radial-gradient(ellipse at top, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  /* Remove complex animations for better performance */
  animation: none;
}

body.low-effects::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 10% 80%, white, transparent),
    radial-gradient(2px 2px at 70% 10%, rgba(255,255,255,0.7), transparent);
  background-size: 300px 300px, 250px 250px, 200px 200px, 280px 280px, 260px 260px;
  /* Reduce animation intensity for better performance */
  animation: gentleSparkle 30s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes gentleSparkle {
  0%, 100% { opacity: 0.6; transform: translateY(0px); }
  50% { opacity: 0.9; transform: translateY(-5px); }
}

/* Low effects overrides for existing animations */
body.low-effects .line {
  animation-duration: 1.5s !important;
}

/* Low effects mode - simple solid white text, no effects */
body.low-effects .line .ink {
  color: white !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  font-weight: 600 !important;
  /* No glow effects for performance */
}

body.low-effects .line.big .ink {
  color: white !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  font-weight: 600 !important;
  animation: gentleScale 4s ease-in-out infinite !important;
}

body.low-effects .shimmer::after {
  /* Disable shimmer effect in low effects mode for better performance */
  display: none !important;
}

/* Malone mode gets SUPER COLORFUL background effects */
body.malone-mode {
  background: 
    linear-gradient(135deg, #ff0080 0%, #8000ff 25%, #00ff80 50%, #ff8000 75%, #00ffff 100%),
    radial-gradient(circle at 25% 75%, #ff6b6b 0%, transparent 40%),
    radial-gradient(circle at 75% 25%, #4ecdc4 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, #ffeaa7 0%, transparent 60%),
    radial-gradient(circle at 20% 20%, #fd79a8 0%, transparent 30%),
    radial-gradient(circle at 80% 80%, #96ceb4 0%, transparent 35%);
  background-size: 400% 400%, 250% 250%, 250% 250%, 500% 500%, 200% 200%, 300% 300%;
  animation: 
    superColorfulShift 4s ease-in-out infinite,
    rainbowColorCycle 6s linear infinite,
    backgroundPulse 3s ease-in-out infinite;
}

body.malone-mode::before {
  animation-duration: 8s; /* Much faster starfield */
  opacity: 1.8;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,1), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,107,107,1), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(78,205,196,0.8), transparent),
    radial-gradient(2px 2px at 10% 80%, rgba(253,121,168,1), transparent),
    radial-gradient(1px 1px at 70% 10%, rgba(255,235,59,0.9), transparent),
    radial-gradient(1px 1px at 60% 90%, rgba(69,183,209,0.8), transparent),
    radial-gradient(1px 1px at 30% 50%, rgba(150,206,180,0.7), transparent);
  background-size: 120px 120px, 100px 100px, 70px 70px, 110px 110px, 80px 80px, 100px 100px, 90px 90px;
}

@keyframes superColorfulShift {
  0%, 100% { background-position: 0% 0%, 0% 100%, 100% 0%, 50% 50%, 25% 75%, 75% 25%; }
  25% { background-position: 50% 50%, 100% 0%, 0% 100%, 0% 0%, 75% 25%, 25% 75%; }
  50% { background-position: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 0%, 0% 100%; }
  75% { background-position: 50% 0%, 0% 50%, 50% 100%, 100% 50%, 0% 50%, 50% 0%; }
}

@keyframes rainbowColorCycle {
  0% { filter: hue-rotate(0deg) saturate(1.4) brightness(1.2); }
  20% { filter: hue-rotate(72deg) saturate(1.6) brightness(1.3); }
  40% { filter: hue-rotate(144deg) saturate(1.8) brightness(1.1); }
  60% { filter: hue-rotate(216deg) saturate(1.5) brightness(1.4); }
  80% { filter: hue-rotate(288deg) saturate(1.7) brightness(1.2); }
  100% { filter: hue-rotate(360deg) saturate(1.4) brightness(1.2); }
}

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

/* Simple gradient text for Malone mode - faster animations */
body.malone-mode .line .ink {
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #fd79a8) !important;
  background-size: 300% 300% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: 
    maloneGradientFlow 1.5s ease-in-out infinite,
    subtleBounce 3s ease-in-out infinite;
}

body.malone-mode .line.big .ink {
  background: linear-gradient(45deg, #ff0080, #00ff80, #8000ff, #ff8000, #00ffff, #ffff00) !important;
  background-size: 400% 400% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: 
    maloneGradientFlow 1s ease-in-out infinite,
    funkyBounce 2s ease-in-out infinite;
}

/* Simple gradient flow animation for Malone mode */
@keyframes maloneGradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Fun bounce effects */
@keyframes subtleBounce {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-2px) scale(1.01); }
}

@keyframes funkyBounce {
  0%, 100% { transform: translateY(0px) scale(1) rotate(0deg); }
  25% { transform: translateY(-3px) scale(1.02) rotate(0.5deg); }
  50% { transform: translateY(-5px) scale(1.03) rotate(0deg); }
  75% { transform: translateY(-3px) scale(1.02) rotate(-0.5deg); }
}

/* Shimmer for Malone mode - faster enhanced gradient */
body.malone-mode .shimmer .ink {
  background: linear-gradient(45deg, #ff0080, #00ff80, #8000ff, #ff8000, #ffff00, #ff0080) !important;
  background-size: 500% 500% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: 
    maloneShimmerFlow 1s linear infinite,
    funkyBounce 2s ease-in-out infinite !important;
}

/* Override for big shimmer lines in Malone mode */
body.malone-mode .line.big.shimmer .ink {
  background: linear-gradient(45deg, #ff0080, #00ff80, #8000ff, #ff8000, #ffff00, #00ffff, #ff0080) !important;
  background-size: 600% 600% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: 
    maloneShimmerFlow 0.8s linear infinite,
    funkyBounce 2s ease-in-out infinite !important;
}

@keyframes maloneShimmerFlow {
  0% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* Remove the old overlay shimmer for Malone mode */
body.malone-mode .shimmer .ink::after {
  display: none;
}
