/**
 * Grok & Mon Visual Effects Styles
 * Smoke, color transitions, vinyl animation, trichome sparkles, CRT overlay
 */

/* ============================================
   SMOKE CANVAS
   ============================================ */
#smoke-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
    mix-blend-mode: screen;
}

/* ============================================
   CRT SCANLINE OVERLAY
   ============================================ */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    display: none;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.1),
            rgba(0, 0, 0, 0.1) 1px,
            transparent 1px,
            transparent 2px
        );
    animation: crt-flicker 0.1s infinite;
}

#crt-overlay.active {
    display: block;
}

#crt-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.2) 90%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
}

@keyframes crt-flicker {
    0% { opacity: 0.95; }
    50% { opacity: 1; }
    100% { opacity: 0.97; }
}

/* ============================================
   VINYL RECORD ANIMATION
   ============================================ */
#vinyl-record {
    position: fixed;
    bottom: 200px;
    right: 340px;
    width: 80px;
    height: 80px;
    z-index: 500;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#vinyl-record.playing {
    opacity: 1;
}

#vinyl-record .vinyl-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        #1a1a1a 0%,
        #0a0a0a 20%,
        #1a1a1a 40%,
        #0a0a0a 60%,
        #1a1a1a 80%,
        #0a0a0a 100%
    );
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.8);
    position: relative;
    transition: transform 0.1s linear;
}

#vinyl-record .vinyl-grooves {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        transparent 0px,
        transparent 2px,
        rgba(60, 60, 60, 0.3) 2px,
        rgba(60, 60, 60, 0.3) 3px
    );
}

#vinyl-record .vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        #C8102E 0%,
        #FFD700 50%,
        #009B3A 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 5px rgba(255, 215, 0, 0.5),
        inset 0 0 5px rgba(0, 0, 0, 0.3);
}

#vinyl-record .vinyl-label::after {
    content: '';
    position: absolute;
    width: 15%;
    height: 15%;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.8);
}

#vinyl-record .vinyl-label-text {
    font-family: 'Caprasimo', cursive;
    font-size: 8px;
    color: #000;
    opacity: 0.7;
    position: absolute;
    top: 25%;
    font-weight: bold;
}

#vinyl-record .vinyl-arm {
    position: absolute;
    top: 10px;
    right: -20px;
    width: 40px;
    height: 4px;
    background: linear-gradient(
        90deg,
        #666 0%,
        #888 50%,
        #666 100%
    );
    transform-origin: right center;
    transform: rotate(-25deg);
    transition: transform 0.5s ease;
    border-radius: 2px;
}

#vinyl-record.playing .vinyl-arm {
    transform: rotate(-15deg);
}

#vinyl-record .vinyl-arm::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -3px;
    width: 10px;
    height: 10px;
    background: #444;
    border-radius: 2px;
}

/* ============================================
   TRICHOME SPARKLE EFFECTS
   ============================================ */
#trichome-sparkles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}

.trichome-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(196, 181, 253, 0.6) 40%,
        transparent 70%
    );
    border-radius: 50%;
    animation: sparkle-twinkle 3s ease-in-out infinite;
    opacity: 0;
}

@keyframes sparkle-twinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Add some variation to sparkle colors */
.trichome-sparkle:nth-child(3n) {
    background: radial-gradient(
        circle,
        rgba(255, 215, 0, 0.9) 0%,
        rgba(255, 215, 0, 0.4) 40%,
        transparent 70%
    );
}

.trichome-sparkle:nth-child(5n) {
    background: radial-gradient(
        circle,
        rgba(74, 222, 128, 0.9) 0%,
        rgba(74, 222, 128, 0.4) 40%,
        transparent 70%
    );
}

.trichome-sparkle:nth-child(7n) {
    width: 6px;
    height: 6px;
}

/* ============================================
   EFFECTS SETTINGS PANEL
   ============================================ */
#effects-settings-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
}

.effects-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid var(--border);
    color: var(--rasta-gold);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.effects-toggle-btn:hover {
    border-color: var(--rasta-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: scale(1.1);
}

.effects-toggle-btn:focus {
    outline: 2px solid var(--rasta-gold);
    outline-offset: 2px;
}

.effects-icon {
    animation: sparkle-icon 2s ease-in-out infinite;
}

@keyframes sparkle-icon {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.effects-menu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 200px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.effects-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.effects-menu-header {
    background: linear-gradient(90deg, var(--rasta-red), var(--rasta-gold), var(--rasta-green));
    padding: 10px 15px;
    font-size: 12px;
    font-weight: bold;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.effect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.effect-option:last-child {
    border-bottom: none;
}

.effect-option:hover {
    background: rgba(255, 215, 0, 0.1);
}

.effect-option input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: #0a0a0a;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.effect-option input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--rasta-green), var(--rasta-gold));
    border-color: var(--rasta-green);
}

.effect-option input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 12px;
    font-weight: bold;
}

.effect-option input[type="checkbox"]:focus {
    outline: 2px solid var(--rasta-gold);
    outline-offset: 2px;
}

.effect-option span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    #smoke-canvas,
    #trichome-sparkles,
    #crt-overlay {
        display: none !important;
    }

    #vinyl-record .vinyl-disc {
        animation: none !important;
    }

    .trichome-sparkle {
        animation: none !important;
    }

    .effects-icon {
        animation: none !important;
    }

    #crt-overlay {
        animation: none !important;
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    #vinyl-record {
        display: none;
    }

    #effects-settings-panel {
        top: 10px;
        right: 10px;
    }

    .effects-toggle-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .effects-menu {
        width: 180px;
        right: -5px;
    }

    .effect-option {
        padding: 10px 12px;
    }

    /* Reduce particle density on mobile */
    #smoke-canvas {
        opacity: 0.25;
    }

    /* Reduce sparkles on mobile */
    .trichome-sparkle:nth-child(n+25) {
        display: none;
    }
}

/* ============================================
   ENHANCED PURPLE HAZE BLOBS (augment existing)
   ============================================ */
.haze-blob {
    transition: opacity 2s ease-in-out;
}

/* Add more dynamic movement */
.haze-blob:nth-child(1) {
    animation: haze-float 25s ease-in-out infinite, haze-pulse 8s ease-in-out infinite;
}

.haze-blob:nth-child(2) {
    animation: haze-float 30s ease-in-out infinite reverse, haze-pulse 10s ease-in-out infinite 2s;
}

.haze-blob:nth-child(3) {
    animation: haze-float 20s ease-in-out infinite, haze-pulse 6s ease-in-out infinite 4s;
}

@keyframes haze-pulse {
    0%, 100% {
        opacity: 0.12;
        filter: blur(100px);
    }
    50% {
        opacity: 0.18;
        filter: blur(120px);
    }
}
