/* Custom Cursor Styles */

/* Hide default cursor when custom cursor is active */
.custom-cursor-active,
.custom-cursor-active * {
    cursor: none !important;
}

/* Main cursor dot */
.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    will-change: transform;
    backface-visibility: hidden;
}

/* Cursor outline ring */
.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    will-change: transform;
    backface-visibility: hidden;
    transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    opacity: 0.6;
}

/* Cursor trail particles */
.cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    margin-top: -2px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99997;
    opacity: 0.5;
    will-change: transform;
    backface-visibility: hidden;
}

/* Hover states */
.cursor-hover .cursor-ring {
    width: 60px;
    height: 60px;
    border-color: var(--accent-secondary);
    background-color: rgba(var(--accent-rgb), 0.1);
}

.cursor-hover .cursor-dot {
    transform: translate(-50%, -50%) scale(1.5);
}

/* Link hover */
.cursor-link .cursor-ring {
    width: 70px;
    height: 70px;
    border-width: 3px;
    border-color: var(--accent-color);
}

.cursor-link .cursor-dot {
    transform: translate(-50%, -50%) scale(0.5);
    background: var(--accent-secondary);
}

/* Button hover */
.cursor-button .cursor-ring {
    width: 80px;
    height: 80px;
    border-style: dashed;
    animation: cursor-rotate 2s linear infinite;
}

@keyframes cursor-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Text hover */
.cursor-text .cursor-ring {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    background: var(--accent-color);
    border: none;
}

.cursor-text .cursor-dot {
    opacity: 0;
}

/* Click animation */
.cursor-clicking .cursor-ring {
    transform: translate(-50%, -50%) scale(0.8);
}

.cursor-clicking .cursor-dot {
    transform: translate(-50%, -50%) scale(0.6);
}

/* Hidden state */
.cursor-hidden .cursor-dot,
.cursor-hidden .cursor-ring {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

/* ==================== */
/* DARK THEME CURSOR    */
/* ==================== */
.theme-dark .cursor-dot {
    background: rgba(0, 255, 255, 0.9);
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.8),
        0 0 20px rgba(0, 255, 255, 0.5),
        0 0 30px rgba(0, 255, 255, 0.3);
}

.theme-dark .cursor-ring {
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 
        0 0 5px rgba(0, 255, 255, 0.3),
        inset 0 0 5px rgba(0, 255, 255, 0.1);
}

.theme-dark .cursor-trail {
    background: rgba(0, 255, 255, 0.7);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* Dark mode: glitch effect on hover */
.theme-dark .cursor-hover .cursor-ring {
    animation: cursor-glitch 0.3s steps(2) infinite;
}

@keyframes cursor-glitch {
    0%, 100% { 
        transform: translate(-50%, -50%);
        border-color: #00ffff;
    }
    25% { 
        transform: translate(calc(-50% + 2px), calc(-50% - 2px));
        border-color: #ff00ff;
    }
    50% { 
        transform: translate(calc(-50% - 2px), calc(-50% + 2px));
        border-color: #00ffff;
    }
    75% { 
        transform: translate(calc(-50% + 1px), calc(-50% + 1px));
        border-color: #ff00ff;
    }
}

/* ==================== */
/* LIGHT THEME CURSOR   */
/* ==================== */
.theme-light .cursor-dot {
    background: #d2691e;
    box-shadow: 0 2px 8px rgba(210, 105, 30, 0.4);
}

.theme-light .cursor-ring {
    border-color: #d2691e;
    box-shadow: 0 2px 10px rgba(210, 105, 30, 0.2);
}

.theme-light .cursor-trail {
    background: #cd853f;
}

/* Light mode: ink ripple effect on hover */
.theme-light .cursor-hover .cursor-ring {
    animation: cursor-ink-ripple 0.6s ease-out;
}

@keyframes cursor-ink-ripple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
}

/* Magnetic cursor effect hint */
.cursor-magnetic {
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Disable custom cursor on touch devices and reduced motion */
@media (hover: none), (pointer: coarse) {
    .cursor-dot,
    .cursor-ring,
    .cursor-trail {
        display: none !important;
    }
    
    .custom-cursor-active,
    .custom-cursor-active * {
        cursor: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cursor-dot,
    .cursor-ring,
    .cursor-trail {
        display: none !important;
    }
    
    .custom-cursor-active,
    .custom-cursor-active * {
        cursor: auto !important;
    }
}
