/**
 * HUNGAMA FESTIVAL - CINEMATIC ANIMATIONS & MOTION
 * 
 * Includes:
 * - Scroll-triggered fade-in animations
 * - Background parallax effects
 * - Hover motion states
 * - Mobile menu overlay styling
 * - Respects prefers-reduced-motion
 */

/* ============================================================
   1. SCROLL-TRIGGERED ANIMATIONS
   ============================================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sections marked with data-animate will fade in on scroll */
[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.32, 0, 0.67, 0), 
              transform 0.8s cubic-bezier(0.32, 0, 0.67, 0);
}

[data-animate].animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger effect for grids */
[data-animate] {
  --stagger-delay: 0ms;
  transition-delay: var(--stagger-delay);
}

[data-animate]:nth-child(2) { --stagger-delay: 100ms; }
[data-animate]:nth-child(3) { --stagger-delay: 200ms; }
[data-animate]:nth-child(4) { --stagger-delay: 300ms; }
[data-animate]:nth-child(n+5) { --stagger-delay: 400ms; }

/* ============================================================
   2. HERO PARALLAX EFFECT
   ============================================================ */

[data-parallax] {
  will-change: transform;
  backface-visibility: hidden;
}

/* ============================================================
   3. HOVER MOTION - CARDS & CTAs
   ============================================================ */

/* Nominee cards */
.nominee-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.nominee-card:hover,
.nominee-card.hover-lifted {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 60px rgba(225, 29, 46, 0.15),
    0 0 40px rgba(225, 29, 46, 0.1);
  border-color: rgba(225, 29, 46, 0.5);
}

/* Jury cards */
.jury-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.jury-card:hover,
.jury-card.hover-lifted {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 
    0 15px 40px rgba(225, 29, 46, 0.12),
    0 0 30px rgba(225, 29, 46, 0.08);
}

/* Partner/sponsor cards */
.partner-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: filter, transform;
}

.partner-card:hover,
.partner-card.hover-lifted {
  filter: brightness(1.2) drop-shadow(0 0 20px rgba(225, 29, 46, 0.3));
  transform: scale(1.05);
}

/* CTA Buttons */
button[data-hover-lift],
a.cta-button,
.cta-button {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

button[data-hover-lift]:hover,
a.cta-button:hover,
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(225, 29, 46, 0.25);
}

/* Gold accent glow on hover */
button[data-hover-lift]:hover::after,
.cta-button:hover::after {
  box-shadow: inset 0 0 20px rgba(225, 29, 46, 0.2);
}

/* Link hovers in navigation */
nav a {
  position: relative;
  transition: color 0.3s ease;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #dc2626, transparent);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

nav a:hover::after {
  width: 100%;
}

/* ============================================================
   4. MOBILE MENU OVERLAY
   ============================================================ */

/* Backdrop */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s ease;
}

.mobile-menu-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Menu overlay container */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, 
    rgba(10, 10, 10, 0.98) 0%,
    rgba(20, 20, 20, 0.95) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(225, 29, 46, 0.1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
  
  /* Transform animation */
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-overlay.active {
  transform: translateY(0);
}

/* Close button */
.mobile-menu-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 50;
  font-weight: bold;
}

.mobile-menu-close:hover {
  background: rgba(225, 29, 46, 0.2);
  border-color: rgba(225, 29, 46, 0.4);
  transform: rotate(90deg);
}

.mobile-menu-close:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* Menu items container */
.mobile-menu-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6rem 1.5rem 2rem;
  flex: 1;
}

.mobile-menu-items a {
  padding: 1rem 0;
  font-size: 1.125rem;
  text-decoration: none;
  color: #f0f0f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.mobile-menu-items a:hover {
  color: #dc2626;
  padding-left: 0.5rem;
}

.mobile-menu-items a:focus {
  outline: none;
  background: rgba(225, 29, 46, 0.1);
  color: #dc2626;
  padding-left: 0.5rem;
}

/* Active menu item highlight */
.mobile-menu-items a[aria-current="page"],
.mobile-menu-items a.active {
  color: #dc2626;
  padding-left: 0.5rem;
  border-left: 2px solid #dc2626;
  padding-left: calc(0.5rem - 2px);
}

/* CTA button in mobile menu */
.mobile-menu-cta {
  margin-top: 1rem;
  padding: 0.875rem 1rem !important;
  background: #dc2626;
  color: white !important;
  border: none !important;
  border-radius: 9999px;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.875rem;
  text-transform: uppercase;
}

.mobile-menu-cta:hover {
  background: #b91c1c;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(225, 29, 46, 0.3);
}

.mobile-menu-cta:focus {
  outline: 2px solid #fca5a5;
  outline-offset: 2px;
}

/* ============================================================
   5. ANCHOR OFFSET (For fixed navbar)
   ============================================================ */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* Match navbar height + small buffer */
}

/* ============================================================
   6. RESPECT PREFERS-REDUCED-MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-animate] {
    transition: none;
    opacity: 1;
    transform: none;
  }

  [data-parallax] {
    transform: none !important;
  }

  .nominee-card,
  .jury-card,
  .partner-card,
  button[data-hover-lift],
  a.cta-button,
  .cta-button {
    transition: none;
  }

  .mobile-menu-overlay {
    transform: none;
    transition: none;
  }

  .mobile-menu-backdrop {
    transition: none;
  }
}

/* ============================================================
   7. LOW-PERFORMANCE DEVICE DETECTION
   ============================================================ */

@media (max-width: 768px) {
  /* Disable parallax on mobile for performance */
  [data-parallax] {
    transform: none !important;
  }
}

/* Reduce animations on slower connections */
@media (prefers-reduced-data: reduce) {
  [data-animate] {
    transition-duration: 0.2s;
  }

  .nominee-card,
  .jury-card,
  .partner-card {
    transition-duration: 0.15s;
  }
}

/* ============================================================
   8. MOBILE MENU RESPONSIVE
   ============================================================ */

@media (min-width: 768px) {
  /* Hide mobile menu on desktop */
  .mobile-menu-overlay,
  .mobile-menu-backdrop {
    display: none !important;
  }
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
  .mobile-menu-overlay {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .mobile-menu-items {
    padding-top: max(6rem, calc(1.5rem + env(safe-area-inset-top)));
  }
}

/* ============================================================
   9. KEYBOARD & FOCUS MANAGEMENT
   ============================================================ */

:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* Enhance focus states */
button:focus-visible,
a:focus-visible {
  outline: 2px dashed #dc2626;
  outline-offset: 3px;
}

/* Hide focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   10. SMOOTH TRANSITIONS FOR SECTION BACKGROUNDS
   ============================================================ */

section {
  transition: background 0.6s ease;
}

/* ============================================================
   11. SMOOTH PAGE TRANSITIONS
   ============================================================ */

body {
  transition: opacity 0.3s ease-in-out;
}

/* Page unload animation (optional) */
body.fade-out {
  opacity: 0.7;
}
