/**
 * ExpoXR Grid System
 * Version: 1.3.0
 * Description: SVG-based styling for the ExpoXR grid patterns with multiple variants, themes, and sizes
 */

/* Grid Container */
.expo-grid-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* SVG Grid Base */
.expo-grid-container .expo-grid-svg {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
}

/* Grid Item Groups */
.expo-grid-container .grid-item {
    cursor: pointer;
    transition: all 0.8s ease;
}

/* Grid Item Shapes - Base styling for SVG elements */
.expo-grid-container .grid-item-shape {
    transition: fill 0.8s ease, stroke 0.8s ease, stroke-width 0.3s ease;
    vector-effect: non-scaling-stroke;
}

/* ==================== VARIANT 1: CLASSIC RECTANGLE ==================== */
.expo-grid-container.variant-classic .grid-item-shape {
    fill: transparent;
    stroke: rgba(228, 233, 236, 0.44);
    stroke-width: 1;
}

.expo-grid-container.variant-classic .grid-item:hover .grid-item-shape {
    fill: rgba(69, 85, 165, 0.15);
    stroke: rgba(42, 172, 226, 0.7);
    stroke-width: 1.5;
}

/* ==================== VARIANT 2: HEXAGON PATTERN ==================== */
.expo-grid-container.variant-hexagon .grid-item-shape {
    fill: transparent;
    stroke: rgba(228, 233, 236, 0.44);
    stroke-width: 2;
}

.expo-grid-container.variant-hexagon .grid-item:hover .grid-item-shape {
    fill: rgba(128, 98, 170, 0.12);
    stroke: rgba(128, 98, 170, 0.75);
    stroke-width: 2.2;
}

/* ==================== VARIANT 3: DIAMOND PATTERN ==================== */
.expo-grid-container.variant-diamond .grid-item-shape {
    fill: transparent;
    stroke: rgba(228, 233, 236, 0.44);
    stroke-width: 2;
}

.expo-grid-container.variant-diamond .grid-item:hover .grid-item-shape {
    fill: rgba(19, 188, 212, 0.1);
    stroke: rgba(19, 188, 212, 0.72);
    stroke-width: 2.3;
}

/* ==================== VARIANT 4: CIRCLE PATTERN ==================== */
.expo-grid-container.variant-circle .grid-item-shape {
    fill: transparent;
    stroke: rgba(228, 233, 236, 0.44);
    stroke-width: 3;
}

.expo-grid-container.variant-circle .grid-item:hover .grid-item-shape {
    fill: rgba(239, 70, 129, 0.08);
    stroke: rgba(239, 70, 129, 0.68);
    stroke-width: 3.2;
}

/* ==================== VARIANT 5: CURVED PATTERN (3D Slider Style) ==================== */
.expo-grid-container.variant-curved {
    perspective: 1000px;
    perspective-origin: 50% 50%;
    -webkit-perspective: 1000px;
    -webkit-perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    overflow: hidden; /* Hide parts that are far off like in index.html */
}

.expo-grid-container.variant-curved .expo-grid-svg {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.expo-grid-container.variant-curved .grid-item {
    position: relative; /* Allow for 3D positioning */
    transform-origin: center center;
    -webkit-transform-origin: center center;
    transition: none !important; /* No transitions for curved variant - no hover effects */
    /* transform and opacity will be set by JavaScript */
}

.expo-grid-container.variant-curved .grid-item-shape {
    transition: none !important; /* No shape transitions for curved variant */
    fill: transparent;
}

/* No hover effects for curved variant */
.expo-grid-container.variant-curved .grid-item:hover .grid-item-shape {
    /* Override any hover styles - no changes on hover */
    stroke: inherit; /* Keep original stroke */
    fill: inherit; /* Keep original fill */
}

/* ==================== SIZE VARIANTS ==================== */

/* Small Size - Smaller stroke widths */
.expo-grid-container.size-small .grid-item-shape {
    stroke-width: 1;
}

.expo-grid-container.size-small.variant-hexagon .grid-item-shape,
.expo-grid-container.size-small.variant-diamond .grid-item-shape {
    stroke-width: 1.5;
}

.expo-grid-container.size-small.variant-circle .grid-item-shape {
    stroke-width: 2;
}

/* Large Size - Thicker stroke widths */
.expo-grid-container.size-large .grid-item-shape {
    stroke-width: 2;
}

.expo-grid-container.size-large.variant-hexagon .grid-item-shape,
.expo-grid-container.size-large.variant-diamond .grid-item-shape {
    stroke-width: 3;
}

.expo-grid-container.size-large.variant-circle .grid-item-shape {
    stroke-width: 4;
}

/* ==================== THEME VARIANTS ==================== */

/* Light Theme (Default) */
.expo-grid-container.theme-light .grid-item-shape,
.expo-grid-container:not([class*="theme-"]) .grid-item-shape {
    stroke: rgba(228, 233, 236, 0.44);
}

.expo-grid-container.theme-light .grid-item:hover .grid-item-shape,
.expo-grid-container:not([class*="theme-"]) .grid-item:hover .grid-item-shape {
    fill: rgba(69, 85, 165, 0.15);
    stroke: rgba(42, 172, 226, 0.7);
}

/* Dark Theme */
.expo-grid-container.theme-dark {
    background: rgba(13, 21, 44, 0.1);
}

.expo-grid-container.theme-dark .grid-item-shape {
    stroke: rgba(69, 85, 165, 0.6);
    fill: rgba(13, 21, 44, 0.3);
}

.expo-grid-container.theme-dark .grid-item:hover .grid-item-shape {
    fill: rgba(42, 172, 226, 0.25);
    stroke: rgba(42, 172, 226, 0.8);
}

/* Dark theme rain and Christmas lights animations */
.expo-grid-container.theme-dark .grid-item.rain-animation .grid-item-shape {
    animation: rainEffectDark 2s ease-in-out forwards;
}

.expo-grid-container.theme-dark .grid-item.christmas-lights .grid-item-shape {
    animation: christmasLightsDark 3s ease-in-out infinite;
}

@keyframes rainEffectDark {
    0% {
        stroke: rgba(69, 85, 165, 0.6);
        stroke-width: 1;
        fill: rgba(13, 21, 44, 0.3);
        opacity: 1;
    }
    25% {
        stroke: rgba(42, 172, 226, 0.7);
        stroke-width: 1.5;
        fill: rgba(42, 172, 226, 0.2);
        opacity: 0.9;
    }
    50% {
        stroke: rgba(128, 98, 170, 0.75);
        stroke-width: 2;
        fill: rgba(128, 98, 170, 0.25);
        opacity: 0.85;
    }
    75% {
        stroke: rgba(239, 70, 129, 0.8);
        stroke-width: 1.8;
        fill: rgba(239, 70, 129, 0.3);
        opacity: 0.8;
    }
    100% {
        stroke: rgba(19, 188, 212, 0.75);
        stroke-width: 1.5;
        fill: rgba(19, 188, 212, 0.25);
        opacity: 0.9;
    }
}

@keyframes christmasLightsDark {
    0% {
        fill: rgba(42, 172, 226, 0.4);
        stroke: rgba(42, 172, 226, 0.8);
        stroke-width: 1.5;
        opacity: 0.9;
    }
    16.66% {
        fill: rgba(128, 98, 170, 0.35);
        stroke: rgba(128, 98, 170, 0.75);
        stroke-width: 1.8;
        opacity: 0.85;
    }
    33.33% {
        fill: rgba(239, 70, 129, 0.3);
        stroke: rgba(239, 70, 129, 0.7);
        stroke-width: 1.4;
        opacity: 0.9;
    }
    50% {
        fill: rgba(243, 110, 36, 0.45);
        stroke: rgba(243, 110, 36, 0.85);
        stroke-width: 2;
        opacity: 0.8;
    }
    66.66% {
        fill: rgba(19, 188, 212, 0.38);
        stroke: rgba(19, 188, 212, 0.78);
        stroke-width: 1.6;
        opacity: 0.88;
    }
    83.33% {
        fill: rgba(69, 85, 165, 0.32);
        stroke: rgba(69, 85, 165, 0.72);
        stroke-width: 1.3;
        opacity: 0.92;
    }
    100% {
        fill: rgba(42, 172, 226, 0.4);
        stroke: rgba(42, 172, 226, 0.8);
        stroke-width: 1.5;
        opacity: 0.9;
    }
}

.expo-grid-container.theme-dark.variant-hexagon .grid-item:hover .grid-item-shape {
    fill: #8062AA;
    stroke: #8062AA;
}

.expo-grid-container.theme-dark.variant-diamond .grid-item:hover .grid-item-shape {
    fill: #EF4681;
    stroke: #EF4681;
}

.expo-grid-container.theme-dark.variant-circle .grid-item:hover .grid-item-shape {
    fill: #F36E24;
    stroke: #F36E24;
}

/* Remove curved variant hover effects - no changes on hover */

/* ==================== AUTOMATIC ANIMATIONS ==================== */

/* Automatic color animation for SVG shapes with randomization */
.expo-grid-container .grid-item.auto-animate .grid-item-shape {
    animation: autoSVGColorPulse var(--random-duration, 4s) ease-in-out infinite;
    animation-delay: var(--random-delay, 0s);
    animation-direction: var(--random-direction, normal);
}

@keyframes autoSVGColorPulse {
    0%, 100% {
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
    }
    50% {
        fill: rgba(69, 85, 165, 0.08);
        stroke: rgba(69, 85, 165, 0.6);
        stroke-width: 1.3;
        opacity: 0.9;
    }
}

/* ==================== HOVER ANIMATIONS ==================== */

/* Disable all hover animations for curved variant */
.expo-grid-container.variant-curved .grid-item.rain-animation .grid-item-shape,
.expo-grid-container.variant-curved .grid-item.christmas-lights .grid-item-shape,
.expo-grid-container.variant-curved .grid-item.return-to-normal .grid-item-shape {
    animation: none !important;
}

/* Rain Animation */
.expo-grid-container .grid-item.rain-animation .grid-item-shape {
    animation: rainEffect 2s ease-in-out forwards;
}

@keyframes rainEffect {
    0% {
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        fill: transparent;
        opacity: 1;
    }
    25% {
        stroke: rgba(42, 172, 226, 0.6);
        stroke-width: 1.5;
        fill: rgba(42, 172, 226, 0.05);
        opacity: 0.9;
    }
    50% {
        stroke: rgba(19, 188, 212, 0.7);
        stroke-width: 2;
        fill: rgba(19, 188, 212, 0.08);
        opacity: 0.8;
    }
    75% {
        stroke: rgba(69, 85, 165, 0.8);
        stroke-width: 1.8;
        fill: rgba(69, 85, 165, 0.1);
        opacity: 0.85;
    }
    100% {
        stroke: rgba(128, 98, 170, 0.75);
        stroke-width: 1.5;
        fill: rgba(128, 98, 170, 0.08);
        opacity: 0.9;
    }
}

/* Christmas Lights Animation */
.expo-grid-container .grid-item.christmas-lights .grid-item-shape {
    animation: christmasLights 3s ease-in-out infinite;
}

@keyframes christmasLights {
    0% {
        fill: rgba(239, 70, 129, 0.15);
        stroke: rgba(239, 70, 129, 0.7);
        stroke-width: 1.5;
        opacity: 0.9;
    }
    16.66% {
        fill: rgba(243, 110, 36, 0.12);
        stroke: rgba(243, 110, 36, 0.65);
        stroke-width: 1.8;
        opacity: 0.85;
    }
    33.33% {
        fill: rgba(19, 188, 212, 0.1);
        stroke: rgba(19, 188, 212, 0.6);
        stroke-width: 1.2;
        opacity: 0.9;
    }
    50% {
        fill: rgba(69, 85, 165, 0.18);
        stroke: rgba(69, 85, 165, 0.75);
        stroke-width: 2;
        opacity: 0.8;
    }
    66.66% {
        fill: rgba(128, 98, 170, 0.14);
        stroke: rgba(128, 98, 170, 0.68);
        stroke-width: 1.6;
        opacity: 0.88;
    }
    83.33% {
        fill: rgba(42, 172, 226, 0.11);
        stroke: rgba(42, 172, 226, 0.63);
        stroke-width: 1.4;
        opacity: 0.92;
    }
    100% {
        fill: rgba(239, 70, 129, 0.15);
        stroke: rgba(239, 70, 129, 0.7);
        stroke-width: 1.5;
        opacity: 0.9;
    }
}

/* Different pulse colors for variants - more subtle */
.expo-grid-container.variant-hexagon .grid-item.auto-animate .grid-item-shape {
    animation: autoSVGColorPulseHexagon var(--random-duration, 4s) ease-in-out infinite;
    animation-delay: var(--random-delay, 0s);
    animation-direction: var(--random-direction, normal);
}

.expo-grid-container.variant-diamond .grid-item.auto-animate .grid-item-shape {
    animation: autoSVGColorPulseDiamond var(--random-duration, 4s) ease-in-out infinite;
    animation-delay: var(--random-delay, 0s);
    animation-direction: var(--random-direction, normal);
}

.expo-grid-container.variant-circle .grid-item.auto-animate .grid-item-shape {
    animation: autoSVGColorPulseCircle var(--random-duration, 4s) ease-in-out infinite;
    animation-delay: var(--random-delay, 0s);
    animation-direction: var(--random-direction, normal);
}

.expo-grid-container.variant-curved .grid-item.auto-animate .grid-item-shape {
    animation: autoSVGColorPulseCurved var(--random-duration, 4s) ease-in-out infinite;
    animation-delay: var(--random-delay, 0s);
    animation-direction: var(--random-direction, normal);
}

@keyframes autoSVGColorPulseHexagon {
    0%, 100% {
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
    }
    50% {
        fill: rgba(128, 98, 170, 0.06);
        stroke: rgba(128, 98, 170, 0.55);
        stroke-width: 1.4;
        opacity: 0.9;
    }
}

@keyframes autoSVGColorPulseDiamond {
    0%, 100% {
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
    }
    50% {
        fill: rgba(19, 188, 212, 0.07);
        stroke: rgba(19, 188, 212, 0.58);
        stroke-width: 1.3;
        opacity: 0.92;
    }
}

@keyframes autoSVGColorPulseCircle {
    0%, 100% {
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
    }
    50% {
        fill: rgba(239, 70, 129, 0.05);
        stroke: rgba(239, 70, 129, 0.52);
        stroke-width: 1.2;
        opacity: 0.94;
    }
}

@keyframes autoSVGColorPulseCurved {
    0%, 100% {
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
        filter: none;
    }
    50% {
        fill: rgba(42, 172, 226, 0.1);
        stroke: rgba(42, 172, 226, 0.7);
        stroke-width: 1.5;
        opacity: 0.9;
        filter: drop-shadow(0 0 6px rgba(42, 172, 226, 0.2));
    }
}

/* ==================== FADE EFFECTS ==================== */

/* Smooth transition back to normal state after hover */
.expo-grid-container .grid-item.return-to-normal .grid-item-shape {
    animation: returnToNormal 0.8s ease-out forwards;
}

@keyframes returnToNormal {
    0% {
        /* Current hover state */
        opacity: 1;
    }
    50% {
        /* Gentle fade */
        opacity: 0.5;
    }
    100% {
        /* Back to normal */
        fill: transparent;
        stroke: rgba(228, 233, 236, 0.44);
        stroke-width: 1;
        opacity: 1;
    }
}

/* Dark theme return to normal */
.expo-grid-container.theme-dark .grid-item.return-to-normal .grid-item-shape {
    animation: returnToNormalDark 0.8s ease-out forwards;
}

@keyframes returnToNormalDark {
    0% {
        /* Current hover state */
        opacity: 1;
    }
    50% {
        /* Gentle fade */
        opacity: 0.5;
    }
    100% {
        /* Back to dark theme normal */
        fill: rgba(13, 21, 44, 0.3);
        stroke: rgba(69, 85, 165, 0.6);
        stroke-width: 1;
        opacity: 1;
    }
}

/* Legacy fade out animation (now deprecated in favor of return-to-normal) */
.expo-grid-container .grid-item.fade-out .grid-item-shape {
    fill: transparent !important;
    stroke: rgba(228, 233, 236, 0.44) !important;
    stroke-width: 1 !important;
    transition: fill 1.2s ease-out, stroke 1.2s ease-out, stroke-width 0.8s ease-out;
    animation: none !important; /* Stop any running animations */
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

@media (max-width: 767px) {
    .expo-grid-container.theme-dark {
        padding: 15px;
        border-radius: 15px;
    }
    
    .expo-grid-container .grid-item-shape {
        stroke-width: 1;
    }
    
    .expo-grid-container.variant-hexagon .grid-item-shape,
    .expo-grid-container.variant-diamond .grid-item-shape {
        stroke-width: 1.5;
    }
    
    .expo-grid-container.variant-circle .grid-item-shape {
        stroke-width: 2;
    }
}

@media (max-width: 479px) {
    .expo-grid-container.theme-dark {
        padding: 10px;
        border-radius: 10px;
    }
    
    .expo-grid-container .grid-item-shape {
        stroke-width: 0.5;
    }
    
    .expo-grid-container.variant-hexagon .grid-item-shape,
    .expo-grid-container.variant-diamond .grid-item-shape,
    .expo-grid-container.variant-circle .grid-item-shape {
        stroke-width: 1;
    }
}

/* ==================== INTERACTION STATES ==================== */

/* Active/clicked state */
.expo-grid-container .grid-item.has-background .grid-item-shape {
    transition: fill 0.3s ease;
}

.expo-grid-container .grid-item.has-gradient .grid-item-shape {
    transition: fill 0.5s ease;
}

/* Focus state for accessibility */
.expo-grid-container .grid-item:focus {
    outline: 2px solid #2AACE2;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */

/* Optimize SVG rendering */
.expo-grid-container .expo-grid-svg {
    shape-rendering: geometricPrecision;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
}

/* GPU acceleration for animations */
.expo-grid-container .grid-item-shape {
    transform: translateZ(0);
    will-change: fill, stroke, stroke-width;
}