/**
 * Christmas Lights Effect
 * Small, subtle Christmas lights that hang from the navigation bar
 * Cycles through different blinking modes like old-school Christmas lights
 */

/* Container positioned at the bottom of the navigation */
#site-navigation .christmas-lights-container {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    height: 25px;
    z-index: 1000;
    pointer-events: none;
    overflow: visible;
}

.christmas-lights-wire {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(30, 30, 30, 0.6) 5%,
        rgba(30, 30, 30, 0.6) 95%,
        transparent 100%
    );
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 30px;
}

.christmas-light {
    position: relative;
    width: 6px;
    height: 10px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    margin-top: 2px;
    transition: filter 0.3s ease, opacity 0.3s ease;
    will-change: filter, opacity; /* GPU optimization hint */
}

/* Light socket/cap */
.christmas-light::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px 2px 0 0;
}

/* Red lights */
.christmas-light.red {
    background: radial-gradient(ellipse at 30% 30%, #ff6b6b, #cc0000);
    box-shadow: 0 0 4px 1px rgba(255, 0, 0, 0.6), 0 0 8px 2px rgba(255, 0, 0, 0.3);
}

/* Green lights */
.christmas-light.green {
    background: radial-gradient(ellipse at 30% 30%, #69db7c, #008800);
    box-shadow: 0 0 4px 1px rgba(0, 255, 0, 0.5), 0 0 8px 2px rgba(0, 255, 0, 0.25);
}

/* Blue lights */
.christmas-light.blue {
    background: radial-gradient(ellipse at 30% 30%, #74c0fc, #0066cc);
    box-shadow: 0 0 4px 1px rgba(0, 100, 255, 0.5), 0 0 8px 2px rgba(0, 100, 255, 0.25);
}

/* Gold lights */
.christmas-light.gold {
    background: radial-gradient(ellipse at 30% 30%, #ffe066, #cc9900);
    box-shadow: 0 0 4px 1px rgba(255, 200, 0, 0.6), 0 0 8px 2px rgba(255, 200, 0, 0.3);
}

/* ===== MODE: Dimmed state ===== */
.christmas-light.dimmed {
    filter: brightness(0.3);
    opacity: 0.5;
}

/* ===== MODE 1: Steady Glow ===== */
.mode-steady .christmas-light {
    animation: none;
    filter: brightness(1.1);
}

/* ===== MODE 2: All Blink Together ===== */
.mode-blink .christmas-light {
    animation: blinkAll 1s ease-in-out infinite;
}

@keyframes blinkAll {
    0%, 100% { filter: brightness(1.2); opacity: 1; }
    50% { filter: brightness(0.4); opacity: 0.6; }
}

/* ===== MODE: Fast Strobe ===== */
.mode-strobe .christmas-light {
    animation: strobe 0.3s ease-in-out infinite;
}

@keyframes strobe {
    0%, 100% { filter: brightness(1.3); opacity: 1; }
    50% { filter: brightness(0.2); opacity: 0.4; }
}

/* ===== MODE 3: Alternating (odd/even) ===== */
.mode-alternate .christmas-light:nth-child(odd) {
    animation: altOdd 1s ease-in-out infinite;
}
.mode-alternate .christmas-light:nth-child(even) {
    animation: altEven 1s ease-in-out infinite;
}

@keyframes altOdd {
    0%, 100% { filter: brightness(1.2); opacity: 1; }
    50% { filter: brightness(0.3); opacity: 0.5; }
}
@keyframes altEven {
    0%, 100% { filter: brightness(0.3); opacity: 0.5; }
    50% { filter: brightness(1.2); opacity: 1; }
}

/* ===== MODE 4: Wave/Chase ===== */
.mode-wave .christmas-light {
    animation: wave 2s ease-in-out infinite;
}
.mode-wave .christmas-light:nth-child(1) { animation-delay: 0s; }
.mode-wave .christmas-light:nth-child(2) { animation-delay: 0.06s; }
.mode-wave .christmas-light:nth-child(3) { animation-delay: 0.12s; }
.mode-wave .christmas-light:nth-child(4) { animation-delay: 0.18s; }
.mode-wave .christmas-light:nth-child(5) { animation-delay: 0.24s; }
.mode-wave .christmas-light:nth-child(6) { animation-delay: 0.3s; }
.mode-wave .christmas-light:nth-child(7) { animation-delay: 0.36s; }
.mode-wave .christmas-light:nth-child(8) { animation-delay: 0.42s; }
.mode-wave .christmas-light:nth-child(9) { animation-delay: 0.48s; }
.mode-wave .christmas-light:nth-child(10) { animation-delay: 0.54s; }
.mode-wave .christmas-light:nth-child(11) { animation-delay: 0.6s; }
.mode-wave .christmas-light:nth-child(12) { animation-delay: 0.66s; }
.mode-wave .christmas-light:nth-child(13) { animation-delay: 0.72s; }
.mode-wave .christmas-light:nth-child(14) { animation-delay: 0.78s; }
.mode-wave .christmas-light:nth-child(15) { animation-delay: 0.84s; }
.mode-wave .christmas-light:nth-child(16) { animation-delay: 0.9s; }
.mode-wave .christmas-light:nth-child(17) { animation-delay: 0.96s; }
.mode-wave .christmas-light:nth-child(18) { animation-delay: 1.02s; }
.mode-wave .christmas-light:nth-child(19) { animation-delay: 1.08s; }
.mode-wave .christmas-light:nth-child(20) { animation-delay: 1.14s; }
.mode-wave .christmas-light:nth-child(21) { animation-delay: 1.2s; }
.mode-wave .christmas-light:nth-child(22) { animation-delay: 1.26s; }
.mode-wave .christmas-light:nth-child(23) { animation-delay: 1.32s; }
.mode-wave .christmas-light:nth-child(24) { animation-delay: 1.38s; }
.mode-wave .christmas-light:nth-child(25) { animation-delay: 1.44s; }
.mode-wave .christmas-light:nth-child(26) { animation-delay: 1.5s; }
.mode-wave .christmas-light:nth-child(27) { animation-delay: 1.56s; }
.mode-wave .christmas-light:nth-child(28) { animation-delay: 1.62s; }
.mode-wave .christmas-light:nth-child(29) { animation-delay: 1.68s; }
.mode-wave .christmas-light:nth-child(30) { animation-delay: 1.74s; }
.mode-wave .christmas-light:nth-child(31) { animation-delay: 1.8s; }
.mode-wave .christmas-light:nth-child(32) { animation-delay: 1.86s; }
.mode-wave .christmas-light:nth-child(33) { animation-delay: 1.92s; }
.mode-wave .christmas-light:nth-child(34) { animation-delay: 1.98s; }
.mode-wave .christmas-light:nth-child(35) { animation-delay: 2.04s; }

@keyframes wave {
    0%, 100% { filter: brightness(0.4); opacity: 0.6; }
    20%, 40% { filter: brightness(1.3); opacity: 1; }
}

/* ===== MODE 5: Slow Fade ===== */
.mode-fade .christmas-light {
    animation: slowFade 3s ease-in-out infinite;
}

@keyframes slowFade {
    0%, 100% { filter: brightness(0.5); opacity: 0.7; }
    50% { filter: brightness(1.2); opacity: 1; }
}

/* ===== MODE 6: Twinkle (random-feeling) ===== */
.mode-twinkle .christmas-light:nth-child(odd) {
    animation: twinkle1 2.5s ease-in-out infinite;
}
.mode-twinkle .christmas-light:nth-child(even) {
    animation: twinkle2 3s ease-in-out infinite;
}
.mode-twinkle .christmas-light:nth-child(3n) {
    animation: twinkle3 2.2s ease-in-out infinite;
}

@keyframes twinkle1 {
    0%, 100% { filter: brightness(1); opacity: 1; }
    25% { filter: brightness(1.3); opacity: 1; }
    50% { filter: brightness(0.6); opacity: 0.7; }
    75% { filter: brightness(1.1); opacity: 0.9; }
}
@keyframes twinkle2 {
    0%, 100% { filter: brightness(0.8); opacity: 0.9; }
    30% { filter: brightness(1.2); opacity: 1; }
    60% { filter: brightness(0.5); opacity: 0.6; }
}
@keyframes twinkle3 {
    0%, 100% { filter: brightness(1.1); opacity: 1; }
    40% { filter: brightness(0.4); opacity: 0.5; }
    70% { filter: brightness(1.3); opacity: 1; }
}

/* Hide on mobile */
@media (max-width: 768px) {
    #site-navigation .christmas-lights-container {
        display: none;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .christmas-light {
        animation: none !important;
        opacity: 1;
        filter: brightness(1.1);
    }
}
