/**
 * 3D Animated Background for Hero Clock
 * Time-based lighting with depth effects
 */

/* Hero section enhanced with 3D background */
.jbs-hero {
    position: relative;
    overflow: hidden;
}

/* Animated background layer */
.jbs-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(0, 0, 0, 0.02) 50%,
        transparent 100%
    );
    animation: rotate-gradient 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

/* Floating particles */
.jbs-hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(3px 3px at 20% 30%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(3px 3px at 60% 70%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(2px 2px at 50% 50%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(3px 3px at 90% 60%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 30% 80%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(4px 4px at 15% 50%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(2px 2px at 75% 40%, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 200%;
    animation: float-particles 30s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Darker particles for afternoon (better visibility) */
.jbs-hero[data-time-of-day="afternoon"]::after {
    background-image: 
        radial-gradient(3px 3px at 20% 30%, rgba(59, 130, 246, 0.4), transparent),
        radial-gradient(3px 3px at 60% 70%, rgba(37, 99, 235, 0.4), transparent),
        radial-gradient(2px 2px at 50% 50%, rgba(96, 165, 250, 0.3), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(59, 130, 246, 0.3), transparent),
        radial-gradient(3px 3px at 90% 60%, rgba(37, 99, 235, 0.4), transparent),
        radial-gradient(2px 2px at 30% 80%, rgba(96, 165, 250, 0.3), transparent),
        radial-gradient(4px 4px at 15% 50%, rgba(59, 130, 246, 0.4), transparent),
        radial-gradient(2px 2px at 75% 40%, rgba(37, 99, 235, 0.3), transparent);
}

/* Ensure content is above background */
.jbs-hero > * {
    position: relative;
    z-index: 1;
}

/* 3D Clock container with depth */
.jbs-clock {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.5s ease;
}

/* Enhanced 3D shadow based on time of day */
.jbs-clock::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-20px);
    width: 120%;
    height: 120%;
    border-radius: inherit;
    background: inherit;
    filter: blur(20px);
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

/* Time-based background classes */
.jbs-hero[data-time-of-day="morning"] {
    background: linear-gradient(135deg, #ff9a56 0%, #ffde59 100%);
    animation: pulse-warm 4s ease-in-out infinite;
}

.jbs-hero[data-time-of-day="afternoon"] {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 50%, #7dd3fc 100%);
    animation: pulse-bright 4s ease-in-out infinite;
}

.jbs-hero[data-time-of-day="evening"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    animation: pulse-sunset 4s ease-in-out infinite;
}

.jbs-hero[data-time-of-day="night"] {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    animation: pulse-night 4s ease-in-out infinite;
}

/* Enhanced clock shadows based on time */
.jbs-hero[data-time-of-day="morning"] .jbs-clock {
    box-shadow: 
        0 10px 40px rgba(255, 154, 86, 0.4),
        0 20px 80px rgba(255, 222, 89, 0.2),
        inset 0 -5px 20px rgba(255, 255, 255, 0.1);
}

.jbs-hero[data-time-of-day="afternoon"] .jbs-clock {
    box-shadow: 
        0 10px 40px rgba(47, 128, 237, 0.6),
        0 20px 80px rgba(86, 204, 242, 0.3),
        inset 0 -5px 20px rgba(255, 255, 255, 0.15);
}

.jbs-hero[data-time-of-day="evening"] .jbs-clock {
    box-shadow: 
        0 10px 40px rgba(250, 112, 154, 0.4),
        0 20px 80px rgba(254, 225, 64, 0.2),
        inset 0 -5px 20px rgba(255, 255, 255, 0.1);
}

.jbs-hero[data-time-of-day="night"] .jbs-clock {
    box-shadow: 
        0 10px 40px rgba(30, 60, 114, 0.3),
        0 20px 80px rgba(42, 82, 152, 0.2),
        inset 0 5px 20px rgba(255, 255, 255, 0.05);
}

/* Keyframe animations */
@keyframes rotate-gradient {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes float-particles {
    0%, 100% {
        background-position: 0% 0%, 100% 100%, 50% 50%, 80% 20%, 10% 90%, 30% 70%;
        opacity: 1;
    }
    25% {
        background-position: 10% 20%, 90% 80%, 60% 40%, 70% 30%, 20% 80%, 40% 60%;
        opacity: 0.8;
    }
    50% {
        background-position: 20% 40%, 80% 60%, 70% 30%, 60% 40%, 30% 70%, 50% 50%;
        opacity: 0.6;
    }
    75% {
        background-position: 10% 30%, 90% 70%, 55% 45%, 75% 25%, 15% 85%, 35% 65%;
        opacity: 0.8;
    }
}

/* Pulsing animations for different times of day */
@keyframes pulse-warm {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.05) saturate(1.1);
    }
}

@keyframes pulse-bright {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.1) saturate(1.15);
    }
}

@keyframes pulse-sunset {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.05) saturate(1.2);
    }
}

@keyframes pulse-night {
    0%, 100% {
        filter: brightness(0.9) saturate(0.8);
    }
    50% {
        filter: brightness(0.95) saturate(0.9);
    }
}

/* 3D depth for clock digits */
.jbs-time {
    text-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.4),
        0 2px 0 rgba(255, 255, 255, 0.3),
        0 3px 0 rgba(255, 255, 255, 0.2),
        0 4px 0 rgba(255, 255, 255, 0.1),
        0 5px 0 rgba(255, 255, 255, 0.05),
        0 10px 20px rgba(0, 0, 0, 0.2);
    transform: translateZ(10px);
}

/* Hover effect for 3D interaction */
.jbs-clock:hover {
    transform: translateY(-5px) scale(1.02);
}

/* Shimmer effect on clock */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.jbs-clock::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
    pointer-events: none;
    border-radius: inherit;
}

/* Dark mode adjustments */
[data-theme="dark"] .jbs-hero[data-time-of-day="morning"] {
    background: linear-gradient(135deg, #d17845 0%, #d9c248 100%);
}

[data-theme="dark"] .jbs-hero[data-time-of-day="afternoon"] {
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 50%, #38bdf8 100%);
}

[data-theme="dark"] .jbs-hero[data-time-of-day="evening"] {
    background: linear-gradient(135deg, #c85f7f 0%, #d9c238 100%);
}

[data-theme="dark"] .jbs-hero[data-time-of-day="night"] {
    background: linear-gradient(135deg, #172952 0%, #1f3a6e 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .jbs-hero::before {
        animation-duration: 30s;
    }
    
    .jbs-hero::after {
        animation-duration: 40s;
    }
    
    .jbs-clock::before {
        filter: blur(15px);
        opacity: 0.2;
    }
    
    .jbs-time {
        text-shadow: 
            0 1px 0 rgba(255, 255, 255, 0.3),
            0 2px 0 rgba(255, 255, 255, 0.2),
            0 3px 0 rgba(255, 255, 255, 0.1),
            0 5px 10px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 480px) {
    .jbs-hero::before {
        display: none; /* Disable heavy animation on very small screens */
    }
    
    .jbs-clock::before {
        filter: blur(10px);
        opacity: 0.15;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .jbs-hero::before,
    .jbs-hero::after,
    .jbs-clock,
    .jbs-clock::after {
        animation: none !important;
    }
    
    .jbs-clock:hover {
        transform: none;
    }
}

/* Performance optimization */
.jbs-hero,
.jbs-clock {
    will-change: transform, filter;
}

/* Ensure smooth rendering */
.jbs-hero::before,
.jbs-hero::after {
    transform: translateZ(0);
    backface-visibility: hidden;
}
