/* ═══════════════════════════════════════════════════════════
   КАСТОМНЫЙ КУРСОР
   Magnetic cursor с multiple states
   ═══════════════════════════════════════════════════════════ */

.cursor,
.cursor * {
    pointer-events: none !important;
}

.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: var(--z-cursor);
    mix-blend-mode: normal;
    will-change: transform;
}

/* Скрываем на touch-устройствах */
@media (hover: none) or (pointer: coarse) {
    .cursor {
        display: none !important;
    }
}

/* ─────────────────────────────────────────────
   ЦЕНТРАЛЬНАЯ ТОЧКА (быстрая, следует за мышью)
   ───────────────────────────────────────────── */
.cursor__dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: 
        width 0.3s var(--ease-out),
        height 0.3s var(--ease-out),
        opacity 0.3s var(--ease-out),
        background 0.3s var(--ease-out);
    will-change: transform;
}

/* ─────────────────────────────────────────────
   ВНЕШНИЙ КРУГ (с задержкой, elastic)
   ───────────────────────────────────────────── */
.cursor__circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 36px;
    height: 36px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition:
        width 0.4s var(--ease-elastic),
        height 0.4s var(--ease-elastic),
        border-color 0.3s var(--ease-out),
        border-width 0.3s var(--ease-out),
        background 0.3s var(--ease-out),
        opacity 0.3s var(--ease-out);
    will-change: transform;
}

/* ─────────────────────────────────────────────
   ТЕКСТ ВНУТРИ КУРСОРА (для magnetic buttons)
   ───────────────────────────────────────────── */
.cursor__label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ffffff;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   СОСТОЯНИЯ КУРСОРА
   ═══════════════════════════════════════════════════════════ */

/* ─── HOVER на ссылках (расширение) ─────────── */
.cursor.is-link .cursor__dot {
    opacity: 1;
}

.cursor.is-link .cursor__circle {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-width: 1px;
}

/* ─── MAGNETIC (для CTA-кнопок) ─────────────── */
.cursor.is-magnetic .cursor__dot {
    opacity: 1;
}

.cursor.is-magnetic .cursor__circle {
    width: 90px;
    height: 90px;
    background: var(--accent);
    border-color: var(--accent);
    mix-blend-mode: normal;
}

.cursor.is-magnetic {
    mix-blend-mode: normal;
}

.cursor.is-magnetic .cursor__label {
    opacity: 1;
    color: var(--bg);
    font-weight: 600;
}

/* ─── TEXT (для input/textarea) ─────────────── */
.cursor.is-text .cursor__dot {
    opacity: 1;
}

.cursor.is-text .cursor__circle {
    width: 2px;
    height: 28px;
    border-radius: 1px;
    border-width: 0;
    background: #ffffff;
    animation: cursor-blink 1.2s ease-in-out infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── HIDDEN: только прозрачность, позицию держит JS ─── */
.cursor.is-hidden {
    opacity: 0;
}

.cursor.is-hidden .cursor__dot,
.cursor.is-hidden .cursor__circle,
.cursor.is-hidden .cursor__label {
    opacity: 0;
}

/* ─── DRAG (для перетаскивания) ────────────── */
.cursor.is-drag .cursor__dot {
    opacity: 1;
}

.cursor.is-drag .cursor__circle {
    width: 80px;
    height: 80px;
    background: rgba(198, 255, 0, 0.15);
    border: 1px dashed var(--accent);
    mix-blend-mode: normal;
}

.cursor.is-drag {
    mix-blend-mode: normal;
}

.cursor.is-drag .cursor__label {
    opacity: 1;
    color: var(--accent);
}

/* ─── VIEW (для медиа/картинок) ────────────── */
.cursor.is-view .cursor__dot {
    opacity: 1;
}

.cursor.is-view .cursor__circle {
    width: 100px;
    height: 100px;
    background: rgba(198, 255, 0, 0.9);
    border-color: var(--accent);
    mix-blend-mode: normal;
}

.cursor.is-view {
    mix-blend-mode: normal;
}

.cursor.is-view .cursor__label {
    opacity: 1;
    color: var(--bg);
    font-size: 11px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   MAGNETIC WRAPPER (для кнопок с magnetic-эффектом)
   ═══════════════════════════════════════════════════════════ */
.magnetic-area {
    position: relative;
    display: inline-block;
}

.magnetic-target {
    display: inline-block;
    will-change: transform;
    transition: transform 0.3s var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════
   HOVER-EFFECTS для интерактивных элементов
   Работают вместе с кастомным курсором
   ═══════════════════════════════════════════════════════════ */

/* Ссылки — тонкий underline animation */
[data-cursor="link"] {
    position: relative;
    transition: color 0.3s var(--ease-out);
}

/* Кнопки — subtle scale */
button[data-cursor="link"]:hover,
a[data-cursor="link"]:hover {
    transform: none; /* убираем чтобы не конфликтовало с курсором */
}

/* Инпуты — увеличенный focus */
[data-cursor="text"]:focus {
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════════
   CURSOR-TRAIL (опциональный след)
   Активируется через JS если нужен
   ═══════════════════════════════════════════════════════════ */
.cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: calc(var(--z-cursor) - 1);
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    animation: trail-fade 0.6s var(--ease-out) forwards;
}

@keyframes trail-fade {
    0% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

/* ═══════════════════════════════════════════════════════════
   HOVER-STATES для элементов с data-cursor
   ═══════════════════════════════════════════════════════════ */

/* Не показываем курсор поверх текста в определённых блоках */
[data-cursor="hidden"] {
    cursor: none !important;
}

/* ═══════════════════════════════════════════════════════════
   FALLBACK для устройств где курсор не работает
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .cursor {
        display: none !important;
    }
    
    body,
    body * {
        cursor: auto !important;
    }
}