/* Additional Performance Optimizations */

/* Critical CSS - Above the fold styles */
.critical {
    font-display: swap;
}

/* Loading animations */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}

/* Advanced animations */
@keyframes morphing {
    0%, 100% {
        border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
    }
    25% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    75% {
        border-radius: 40% 60% 60% 40% / 30% 70% 40% 60%;
    }
}

.morphing-shape {
    animation: morphing 8s ease-in-out infinite;
}

/* Optimized hover effects */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #FFA500;
}

/* Text selection */
::selection {
    background: #FFD700;
    color: #1a1a1a;
}

::-moz-selection {
    background: #FFD700;
    color: #1a1a1a;
}

/* Focus states for accessibility */
.focus-ring:focus {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gradient-text {
        -webkit-text-fill-color: #FFD700;
        color: #FFD700;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if system preference) */
@media (prefers-color-scheme: light) {
    /* Optional light theme adjustments */
}

/* Container queries for advanced responsive design */
@container (min-width: 768px) {
    .container-responsive {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Advanced CSS Grid layouts */
.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    grid-auto-rows: masonry; /* Future CSS feature */
}

/* Performance optimized transforms */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Micro-interactions */
.micro-bounce {
    transition: transform 0.1s ease;
}

.micro-bounce:active {
    transform: scale(0.98);
}

/* Loading states */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Advanced typography */
.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* Fluid typography */
.fluid-text {
    font-size: clamp(1rem, 4vw, 2rem);
}

/* Container-based spacing */
.dynamic-spacing {
    padding: clamp(1rem, 5vw, 3rem);
}

/* Advanced clip-path animations */
.clip-path-animation {
    clip-path: polygon(0% 100%, 100% 100%, 100% 100%, 0% 100%);
    transition: clip-path 0.6s ease-in-out;
}

.clip-path-animation.visible {
    clip-path: polygon(0% 100%, 100% 100%, 100% 0%, 0% 0%);
}

/* CSS Houdini Paint Worklet fallbacks */
.paint-border {
    background: linear-gradient(45deg, #FFD700, transparent);
    padding: 2px;
}

.paint-border > * {
    background: #1a1a1a;
}

/* Advanced backdrop filters */
.advanced-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* CSS Grid subgrid support */
.subgrid-layout {
    display: grid;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;
}

/* Performance monitoring */
.perf-monitor {
    contain: layout style paint;
}

/* Advanced CSS custom properties */
:root {
    --scroll-percentage: 0;
    --mouse-x: 0px;
    --mouse-y: 0px;
}

/* Scroll-driven animations */
.scroll-reveal {
    transform: translateY(calc(var(--scroll-percentage) * -100px));
}

/* CSS Layers for better organization */
@layer base, components, utilities;

@layer base {
    html {
        scroll-behavior: smooth;
    }
}

@layer components {
    .btn-primary {
        background-color: #FFD700;
        color: #1a1a1a;
        padding: 0.75rem 1.5rem;
        border-radius: 9999px;
        font-weight: 700;
        transition: all 0.3s ease;
    }
    
    .btn-primary:hover {
        background-color: #FFA500;
        transform: translateY(-2px);
    }
}

@layer utilities {
    .text-shadow-xl {
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    }
}
