/* Custom Styles augmenting Tailwind */

/* Global Resets & Base */
html {
    scroll-behavior: smooth;
}

body {
    background-color: #050505;
    background-image: 
        radial-gradient(circle at 50% 0%, #1a1a2e 0%, transparent 60%),
        radial-gradient(circle at 80% 50%, #0f172a 0%, transparent 50%);
    background-attachment: fixed;
}

/* Mobile Menu Styles */
#mobile-menu {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#mobile-menu.hidden {
    display: none;
}
#mobile-menu:not(.hidden) {
    display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

/* Typography Enhancements */
.font-heading {
    letter-spacing: 0.02em;
}

.text-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 50%, #3b82f6 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 5s ease infinite;
}

/* Animations */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    opacity: 0;
    animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes kenburns {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.animate-kenburns {
    animation: kenburns 20s ease-out infinite alternate;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 40px rgba(59, 130, 246, 0.5); }
}

/* Subtle Pulse Ring */
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.3); opacity: 0; }
}

.animate-pulse-ring {
    animation: pulse-ring 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Enhanced Glitch Effect - Subtle and Clean */
@keyframes glitch-anim {
    0%, 100% { 
        clip-path: inset(0 0 0 0);
        transform: translate(0);
        opacity: 0;
    }
    2% { 
        clip-path: inset(45% 0 30% 0);
        transform: translate(-1px, 0.5px);
        opacity: 0.4;
    }
    4% { 
        clip-path: inset(0 0 0 0);
        transform: translate(0);
        opacity: 0;
    }
    8% { 
        clip-path: inset(60% 0 15% 0);
        transform: translate(1px, -0.5px);
        opacity: 0.35;
    }
    12% { 
        clip-path: inset(0 0 0 0);
        transform: translate(0);
        opacity: 0;
    }
    50% { 
        clip-path: inset(30% 0 50% 0);
        transform: translate(-0.5px, 0.5px);
        opacity: 0.3;
    }
    52% { 
        clip-path: inset(0 0 0 0);
        transform: translate(0);
        opacity: 0;
    }
}

@keyframes glitch-skew {
    0%, 100% { transform: skew(0deg); }
    2% { transform: skew(-0.5deg); }
    4% { transform: skew(0deg); }
    8% { transform: skew(0.5deg); }
    12% { transform: skew(0deg); }
    50% { transform: skew(-0.3deg); }
    52% { transform: skew(0deg); }
}

.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 #ef4444;
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: 2px 0 #06b6d4;
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

.glitch-text:hover::before,
.glitch-text:hover::after {
    animation-duration: 0.3s;
}

.glitch-continuous {
    position: relative;
    display: inline-block;
    animation: glitch-skew 8s infinite ease-in-out;
}

.glitch-continuous::before,
.glitch-continuous::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

.glitch-continuous::before {
    left: 1px;
    color: rgba(239, 68, 68, 0.25);
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 6s infinite ease-in-out;
    z-index: -1;
    filter: blur(0.3px);
}

.glitch-continuous::after {
    left: -1px;
    color: rgba(6, 182, 212, 0.25);
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 5.5s infinite ease-in-out;
    z-index: -1;
    filter: blur(0.3px);
    animation-delay: 0.5s;
}

/* Glassmorphism & Panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    transition: 0.5s;
}

.glass-panel:hover::before {
    left: 100%;
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
}

/* Utility Classes */
.text-shadow-glow {
    text-shadow: 0 0 20px currentColor;
}

.border-gradient {
    position: relative;
    background: linear-gradient(#0a0a0a, #0a0a0a) padding-box,
                linear-gradient(135deg, #3b82f6, #06b6d4) border-box;
    border: 1px solid transparent;
    border-radius: 0.75rem;
}

/* Reveal on Scroll */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Rules Page Specifics */
.rule-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 1.5rem;
}

.rule-item:hover {
    transform: translateX(10px);
    border-left-color: #3b82f6;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), transparent);
}

/* Button Effects */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-primary:hover::after {
    left: 100%;
}

/* Grid Background Pattern */
.bg-grid-pattern {
    background-size: 40px 40px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
}

/* Neon Glow */
.neon-border {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3), inset 0 0 10px rgba(59, 130, 246, 0.1);
}

/* Gallery Expansion Logic */
.gallery-card {
    flex-grow: 1;
    filter: grayscale(100%) brightness(0.5);
    transition: flex 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease-in-out;
}

.gallery-card.active {
    flex-grow: 30; /* Much stronger growth factor */
    filter: grayscale(0%) brightness(1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Description Text Animation */
.gallery-card .gallery-desc {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(20px);
}

.gallery-card.active .gallery-desc {
    opacity: 1;
    max-height: 300px; /* Increased to accommodate longer text */
    transform: translateY(0);
    transition-delay: 0.3s; /* Increased delay slightly for smoother feel */
}

/* Ensure text is readable on all backgrounds */
.gallery-desc {
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@media (min-width: 768px) {
    .gallery-card.active {
        flex-grow: 10;
    }
}

/* Countdown Animations */
@keyframes countdown-fade-in {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes countdown-flip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    51% {
        transform: rotateX(-90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.countdown-item {
    opacity: 0;
    animation: countdown-fade-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.countdown-box {
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.countdown-box::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(6, 182, 212, 0.3));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(8px);
}

.countdown-box:hover::before {
    opacity: 1;
}

.countdown-number {
    display: inline-block;
    perspective: 200px;
    transform-style: preserve-3d;
    transition: opacity 0.2s ease;
    will-change: transform;
}

.countdown-flip {
    animation: countdown-flip 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown-number-wrapper {
    position: relative;
    overflow: hidden;
}

/* Shimmer effect on countdown boxes */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.countdown-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.countdown-box:hover::after {
    left: 100%;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .font-heading {
        word-break: break-word;
    }
    .glass-panel {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    
    /* Make gallery items vertical blocks on mobile */
    .gallery-card {
        flex-basis: 50px; /* Collapsed height on mobile */
        min-height: 50px;
    }
    
    .gallery-card.active {
        flex-basis: 350px;
        min-height: 350px;
        flex-grow: 100;
    }
}
