/* Custom Butterfly Cursor */
* {
    cursor: none !important;
}

/* Custom cursor container */
#custom-cursor {
    position: fixed;
    width: 36px;
    height: 36px;
    pointer-events: none;
    z-index: 10000;
    transform-origin: center center;
    transition: transform 0.15s ease;
}

/* Butterfly cursor structure */
.cursor-butterfly {
    position: absolute;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transform: rotate(-45deg);
    transition: filter 0.3s ease;
}

.cursor-butterfly-body {
    position: absolute;
    width: 3px;
    height: 21px;
    background: linear-gradient(to bottom, #e0e0e0, #ffffff);
    border-radius: 2px;
    z-index: 3;
    outline: 0.2px solid #000;
    outline-offset: 0.2px;
}

.cursor-butterfly-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    outline: 0.2px solid #000;
    outline-offset: 0.2px;
}

.cursor-butterfly-antenna {
    position: absolute;
    top: -4px;
    width: 1.5px;
    height: 7px;
    background: #ffffff;
    outline: 0.1px solid #000;
    outline-offset: 0.1px;
}

.cursor-butterfly-antenna::after {
    content: '';
    position: absolute;
    top: 0;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    outline: 0.1px solid #000;
    outline-offset: 0.1px;
}

.cursor-butterfly-antenna-left {
    left: -2px;
    transform: rotate(-25deg);
}

.cursor-butterfly-antenna-left::after {
    left: -0.5px;
}

.cursor-butterfly-antenna-right {
    right: -2px;
    transform: rotate(25deg);
}

.cursor-butterfly-antenna-right::after {
    right: -0.5px;
}

.cursor-butterfly-wings {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.cursor-butterfly-wing {
    width: 16px;
    height: 24px;
    background: #ffffff;
    position: relative;
    border-radius: 60% 40% 40% 60%;
    outline: 0.2px solid #000;
    outline-offset: 0.2px;
}

.cursor-butterfly-wing::before {
    content: '';
    position: absolute;
    bottom: -2px;
    width: 12px;
    height: 15px;
    background: #ffffff;
    border-radius: 50% 40% 60% 50%;
    outline: 0.2px solid #000;
    outline-offset: 0.2px;
}

.cursor-butterfly-wing-left {
    transform-origin: right center;
    animation: cursorFlapLeft 0.3s ease-in-out infinite;
}

.cursor-butterfly-wing-left::before {
    right: 0;
}

.cursor-butterfly-wing-right {
    transform-origin: left center;
    animation: cursorFlapRight 0.3s ease-in-out infinite;
}

.cursor-butterfly-wing-right::before {
    left: 0;
}

@keyframes cursorFlapLeft {
    0%, 100% {
        transform: rotateY(0deg) rotateZ(-3deg);
    }
    50% {
        transform: rotateY(-50deg) rotateZ(-6deg);
    }
}

@keyframes cursorFlapRight {
    0%, 100% {
        transform: rotateY(0deg) rotateZ(3deg);
    }
    50% {
        transform: rotateY(50deg) rotateZ(6deg);
    }
}

/* Cursor hover state */
#custom-cursor.hover {
    transform: scale(1.3);
}

#custom-cursor.hover .cursor-butterfly-wing-left {
    animation: cursorFlapLeftFast 0.15s ease-in-out infinite;
}

#custom-cursor.hover .cursor-butterfly-wing-right {
    animation: cursorFlapRightFast 0.15s ease-in-out infinite;
}

/* White glow on dark backgrounds */
#custom-cursor.dark-bg .cursor-butterfly {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.15));
}

@keyframes cursorFlapLeftFast {
    0%, 100% {
        transform: rotateY(0deg) rotateZ(-3deg);
    }
    50% {
        transform: rotateY(-70deg) rotateZ(-10deg);
    }
}

@keyframes cursorFlapRightFast {
    0%, 100% {
        transform: rotateY(0deg) rotateZ(3deg);
    }
    50% {
        transform: rotateY(70deg) rotateZ(10deg);
    }
}

/* Hide on touch devices */
@media (pointer: coarse) {
    #custom-cursor {
        display: none;
    }
    
    * {
        cursor: auto !important;
    }
}

/* Click Sprinkles */
.click-sprinkle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: sprinkleAnimation 0.8s ease-out forwards;
}

@keyframes sprinkleAnimation {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.click-sprinkle.star {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 7px solid var(--color);
    border-radius: 0;
}

.click-sprinkle.star::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 7px solid var(--color);
    top: 3px;
    left: -4px;
}

.click-sprinkle.circle {
    background: var(--color);
}

.click-sprinkle.square {
    border-radius: 2px;
    background: var(--color);
}

.click-sprinkle.heart {
    background: var(--color);
    transform: rotate(-45deg);
    border-radius: 50% 50% 0 0;
}

.click-sprinkle.heart::before,
.click-sprinkle.heart::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color);
    border-radius: 50%;
}

.click-sprinkle.heart::before {
    top: -4px;
    left: 0;
}

.click-sprinkle.heart::after {
    top: 0;
    left: 4px;
}

/* Pollen Trail Effect - Brutalist Style */
.pollen-grain {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    border-radius: 0; /* Sharp corners for brutalist look */
    animation: pollenFall 1.2s ease-out forwards;
    opacity: 0;
    outline: 0.5px solid rgba(0, 0, 0, 0.3);
}

@keyframes pollenFall {
    0% {
        opacity: 0.8;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    20% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.35;
        transform: translate(calc(var(--drift-x) * 0.5), calc(var(--drift-y) * 0.5)) scale(0.8) rotate(45deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--drift-x), var(--drift-y)) scale(0.2) rotate(90deg);
    }
}

/* Hide pollen on touch devices */
@media (pointer: coarse) {
    .pollen-grain {
        display: none;
    }
}
