/* ==========================================================================
   MAGNETIC PHYSICS & MICRO-INTERACTIONS DESIGN SYSTEM
   Bespoke kinetic physics, cybernetic cursor, and 3D card tilt for
   Kartikay A Mathur - 3D Visual Artist & Creative Director Portfolio.
   Theme: Obsidian Void, Emerald (#11845c), Mint Glow (#e9fae6).
   ========================================================================== */

:root {
    --magnetic-mint: #e9fae6;
    --magnetic-emerald: #11845c;
    --magnetic-emerald-dark: #0a4f37;
    --magnetic-glow-mint: rgba(233, 250, 230, 0.35);
    --magnetic-glow-emerald: rgba(17, 132, 92, 0.45);
    --magnetic-ripple-bg: radial-gradient(circle, rgba(233, 250, 230, 0.38) 0%, rgba(17, 132, 92, 0.22) 55%, transparent 80%);
    --magnetic-spring-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   1. CYBERNETIC CURSOR DOT & IMPULSE RETICLE RING
   ========================================================================== */

.custom-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background: var(--magnetic-mint);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--magnetic-mint), 0 0 20px var(--magnetic-emerald);
    transition: opacity 200ms ease, transform 60ms linear, background-color 180ms ease, box-shadow 180ms ease;
    mix-blend-mode: difference;
    will-change: transform;
}

.custom-cursor-dot.cursor-hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
}

.custom-cursor-dot.cursor-hover {
    transform: translate(-50%, -50%) scale(1.5);
    background: #ffffff;
    box-shadow: 0 0 14px #ffffff, 0 0 28px var(--magnetic-mint);
}

.custom-cursor-dot.cursor-press {
    transform: translate(-50%, -50%) scale(0.7);
    background: var(--magnetic-emerald);
    box-shadow: 0 0 8px var(--magnetic-emerald);
}

/* Trailing Impulse Ring */
.custom-cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 42px;
    height: 42px;
    border: 1.5px solid rgba(233, 250, 230, 0.45);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 132, 92, 0.04);
    backdrop-filter: blur(0.5px);
    transition: width 240ms var(--magnetic-spring-curve),
                height 240ms var(--magnetic-spring-curve),
                border-color 200ms ease,
                background-color 200ms ease,
                border-radius 240ms var(--magnetic-spring-curve),
                box-shadow 240ms ease,
                opacity 200ms ease;
    will-change: transform, width, height, border-radius;
}

.custom-cursor-ring.cursor-hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

/* Interactive Hover State */
.custom-cursor-ring.active-hover {
    width: 68px;
    height: 68px;
    border-color: var(--magnetic-mint);
    background: rgba(233, 250, 230, 0.1);
    box-shadow: 0 0 24px rgba(17, 132, 92, 0.3), inset 0 0 12px rgba(233, 250, 230, 0.15);
}

/* Snapped Target Lock Reticle */
.custom-cursor-ring.active-magnetic {
    border-color: rgba(233, 250, 230, 0.85);
    box-shadow: 0 0 30px var(--magnetic-glow-emerald), inset 0 0 16px var(--magnetic-glow-mint);
    background: rgba(17, 132, 92, 0.12);
}

/* Press State */
.custom-cursor-ring.active-press {
    transform: translate(-50%, -50%) scale(0.85);
    border-color: var(--magnetic-mint);
    background: rgba(233, 250, 230, 0.22);
}

/* Contextual Ring Label (e.g. INSPECT, VIEW, DRAG) */
.cursor-ring-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--magnetic-mint);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 180ms ease, transform 180ms var(--magnetic-spring-curve);
    user-select: none;
    pointer-events: none;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.custom-cursor-ring.active-hover .cursor-ring-label,
.custom-cursor-ring.active-magnetic .cursor-ring-label {
    opacity: 1;
    transform: translateY(0);
}

/* Cursor Impulse Shockwave Effect on Click */
.cursor-impulse-shockwave {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--magnetic-mint);
    pointer-events: none;
    z-index: 99997;
    transform: translate(-50%, -50%) scale(1);
    animation: impulseShockwaveExpand 500ms var(--magnetic-spring-curve) forwards;
}

@keyframes impulseShockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.9;
        border-width: 2.5px;
    }
    50% {
        opacity: 0.5;
        border-color: var(--magnetic-emerald);
    }
    100% {
        transform: translate(-50%, -50%) scale(4.8);
        opacity: 0;
        border-width: 0.5px;
    }
}

/* ==========================================================================
   2. MAGNETIC TARGETS & DIFFERENTIAL PARALLAX LAYERS
   ========================================================================== */

.magnetic-target {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Smooth transition when releasing back from magnetic pull */
.magnetic-target.magnetic-releasing {
    transition: transform 550ms var(--magnetic-spring-curve);
}

/* Differential Parallax Layer for Inner Text / Icons */
.magnetic-inner,
.magnetic-text,
.magnetic-icon {
    display: inline-block;
    will-change: transform;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    pointer-events: none;
}

.magnetic-inner.magnetic-releasing,
.magnetic-text.magnetic-releasing,
.magnetic-icon.magnetic-releasing {
    transition: transform 550ms var(--magnetic-spring-curve);
}

/* ==========================================================================
   3. KINETIC 3D CARD TILT & SPECULAR FOIL DEPTH
   ========================================================================== */

.tilt-card-active,
.collectible-trading-card,
[data-tilt] {
    transform-style: preserve-3d;
    perspective: 1200px;
    will-change: transform;
    backface-visibility: hidden;
}

.tilt-card-active.tilt-releasing,
.collectible-trading-card.tilt-releasing {
    transition: transform 650ms var(--magnetic-spring-curve) !important;
}

/* 3D Elevated Elements within Cards */
.tilt-card-active .card-floating-badge,
.collectible-trading-card .card-floating-badge {
    transform: translateZ(28px);
    transform-style: preserve-3d;
    transition: transform 200ms ease;
}

.tilt-card-active .card-image-wrap,
.collectible-trading-card .card-image-wrap {
    transform: translateZ(12px);
    transform-style: preserve-3d;
}

/* High-Precision Specular Light Glare */
.magnetic-specular-glare {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: inherit;
    z-index: 5;
    opacity: 0;
    mix-blend-mode: screen;
    transition: opacity 300ms ease;
    will-change: opacity, background;
}

.tilt-card-active:hover .magnetic-specular-glare,
.collectible-trading-card:hover .magnetic-specular-glare {
    opacity: 1;
}

/* ==========================================================================
   4. TACTILE BUTTON RIPPLES & ZERO-LAYOUT-SHIFT MICRO-PRESS
   ========================================================================== */

/* Zero-layout-shift micro-press */
.magnetic-active-press {
    transform: scale(0.962) !important;
    transition: transform 120ms ease-out !important;
}

/* Click Ripple Container */
.magnetic-ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    z-index: 100;
}

/* Click Ripple Wave */
.magnetic-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    background: var(--magnetic-ripple-bg);
    animation: magneticRippleAnim 600ms var(--magnetic-spring-curve) forwards;
    will-change: transform, opacity;
}

@keyframes magneticRippleAnim {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.85;
    }
    40% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.8);
        opacity: 0;
    }
}

/* ==========================================================================
   5. ACCESSIBILITY & MOBILE RESPONSIVE GUARDS
   ========================================================================== */

/* Coarse Pointers & Touch Devices (Disable custom cursor and magnetic shifts) */
@media (pointer: coarse), (hover: none) {
    .custom-cursor-dot,
    .custom-cursor-ring,
    .cursor-impulse-shockwave {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .magnetic-target {
        transform: none !important;
        transition: none !important;
    }

    .tilt-card-active,
    .collectible-trading-card {
        transform: none !important;
    }
}

/* Reduced Motion Preference (Strict Respect for Vestibular Sensitivity) */
@media (prefers-reduced-motion: reduce) {
    .custom-cursor-ring {
        transition: none !important;
    }

    .custom-cursor-dot {
        transition: none !important;
    }

    .magnetic-target,
    .magnetic-inner,
    .magnetic-text,
    .magnetic-icon,
    .tilt-card-active,
    .collectible-trading-card {
        transform: none !important;
        transition: none !important;
    }

    .magnetic-ripple {
        animation: none !important;
        opacity: 0 !important;
    }

    .cursor-impulse-shockwave {
        animation: none !important;
        opacity: 0 !important;
    }
}
