/* ================================================
   SHARED.CSS — Squidy Portfolio Global Effects
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

/* ─── Custom Cursor (desktop only) ───────────────── */
* {
    cursor: none !important;
}

/* Restore native cursor on touch/mobile */
@media (pointer: coarse) {
    * {
        cursor: auto !important;
    }

    #cursor-dot,
    #cursor-ring {
        display: none !important;
    }
}

#cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background: #a78bfa;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease;
    mix-blend-mode: difference;
}

#cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 1.5px solid rgba(167, 139, 250, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        border-color 0.3s ease,
        background 0.3s ease;
}

#cursor-ring.hovering {
    width: 64px;
    height: 64px;
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 1);
}

/* ─── Home Nav Button ─────────────────────────── */
#home-nav {
    position: fixed !important;
    top: 18px !important;
    left: 18px !important;
    z-index: 9000 !important;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 16, 60, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 14px;
    color: #c4b5fd;
    text-decoration: none;
    transition: background 0.25s ease, border-color 0.25s ease,
        box-shadow 0.25s ease, transform 0.2s ease;
    cursor: pointer !important;
}

#home-nav svg {
    width: 20px;
    height: 20px;
    stroke: #c4b5fd;
    transition: stroke 0.25s ease;
}

#home-nav:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

#home-nav:hover svg {
    stroke: #e0d7ff;
}

/* On mobile, make slightly larger for easy tapping */
@media (pointer: coarse) {
    #home-nav {
        width: 52px;
        height: 52px;
        top: 14px;
        left: 14px;
        border-radius: 16px;
        cursor: pointer !important;
    }

    #home-nav svg {
        width: 22px;
        height: 22px;
    }
}

/* ─── Particle Canvas ────────────────────────────── */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ─── Mesh Gradient Blobs ───────────────────────── */
.mesh-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
    animation: blobDrift 12s ease-in-out infinite alternate;
}

.mesh-blob:nth-child(1) {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6366f1, transparent 70%);
    top: -100px;
    left: -100px;
    animation-duration: 14s;
}

.mesh-blob:nth-child(2) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #a855f7, transparent 70%);
    bottom: -80px;
    right: -80px;
    animation-duration: 10s;
    animation-direction: alternate-reverse;
}

.mesh-blob:nth-child(3) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #ec4899, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 18s;
}

@keyframes blobDrift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(40px, -30px) scale(1.08);
    }

    66% {
        transform: translate(-20px, 50px) scale(0.95);
    }

    100% {
        transform: translate(30px, 20px) scale(1.05);
    }
}

/* ─── Content z-index wrapper ─────────────────────── */
body>*:not(#particle-canvas):not(.mesh-blob):not(#cursor-dot):not(#cursor-ring) {
    position: relative;
    z-index: 1;
    /* overflow stays default — each element manages its own */
}

/* ─── Avatar Pulsing Glow Rings ─────────────────── */
.avatar-ring {
    position: relative;
    display: inline-block;
    border-radius: 50%;
    cursor: none !important;
}

.avatar-ring img {
    display: block;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.7);
    box-shadow: 0 0 22px rgba(139, 92, 246, 0.35);
    position: relative;
    z-index: 1;
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
    animation: imgGlow 4s ease-in-out infinite alternate;
}

@keyframes imgGlow {
    0% {
        box-shadow: 0 0 22px rgba(139, 92, 246, 0.4);
        border-color: rgba(139, 92, 246, 0.7);
    }

    33% {
        box-shadow: 0 0 28px rgba(34, 211, 238, 0.4);
        border-color: rgba(34, 211, 238, 0.7);
    }

    66% {
        box-shadow: 0 0 28px rgba(236, 72, 153, 0.4);
        border-color: rgba(236, 72, 153, 0.7);
    }

    100% {
        box-shadow: 0 0 22px rgba(251, 191, 36, 0.4);
        border-color: rgba(251, 191, 36, 0.7);
    }
}

/* Two pulse rings, each with color-cycle */
.avatar-ring::before,
.avatar-ring::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.6);
    animation:
        sonarPulse 2.4s ease-out infinite,
        ringColor 8s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.avatar-ring::after {
    animation-delay: 1.2s, 2.7s;
}

@keyframes sonarPulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }

    70% {
        transform: scale(1.55);
        opacity: 0;
    }

    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

@keyframes ringColor {
    0% {
        border-color: rgba(139, 92, 246, 0.65);
    }

    25% {
        border-color: rgba(34, 211, 238, 0.65);
    }

    50% {
        border-color: rgba(236, 72, 153, 0.65);
    }

    75% {
        border-color: rgba(251, 191, 36, 0.65);
    }

    100% {
        border-color: rgba(139, 92, 246, 0.65);
    }
}

/* Hover — rings burst faster and glow cyan */
.avatar-ring:hover::before,
.avatar-ring:hover::after {
    animation:
        sonarPulsefast 0.85s ease-out infinite,
        ringColor 8s linear infinite;
    border-color: rgba(34, 211, 238, 0.8);
}

.avatar-ring:hover img {
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.55), 0 0 80px rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.9);
}

@keyframes sonarPulsefast {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* JS-proximity class — added when mouse is within 150px */
.avatar-ring.proximity-active::before,
.avatar-ring.proximity-active::after {
    animation:
        sonarPulse 1.2s ease-out infinite,
        ringColor 8s linear infinite;
    filter: brightness(1.5);
}

.avatar-ring.proximity-active img {
    box-shadow: 0 0 35px rgba(139, 92, 246, 0.6), 0 0 70px rgba(168, 85, 247, 0.2);
}

/* ─── Glassmorphism 2.0 ─────────────────────────── */
.stat-card,
.project {
    background: rgba(30, 27, 75, 0.65) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
    border: 1px solid rgba(139, 92, 246, 0.22) !important;
    position: relative;
    overflow: hidden !important;
    /* must stay hidden so shimmer ::after clips correctly */
}

/* Noise texture overlay */
.stat-card::before,
.project::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

/* ─── Shimmer Effect ────────────────────────────── */
.stat-card::after,
.project::after,
.shimmer-target::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -75%;
    width: 50%;
    height: 300%;
    background: linear-gradient(105deg,
            transparent 40%,
            rgba(255, 255, 255, 0.09) 50%,
            transparent 60%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 2;
    transition: none;
}

.stat-card.shimmer::after,
.project.shimmer::after,
.shimmer-target.shimmer::after,
.stat-card:hover::after,
.project:hover::after {
    animation: shimmerSlide 0.65s ease forwards;
}

@keyframes shimmerSlide {
    0% {
        left: -75%;
    }

    100% {
        left: 125%;
    }
}

/* ─── Text Split Character Animation ────────────── */
h1 .char {
    display: inline-block;
    opacity: 0;
    color: inherit;
    transform: translateY(40px);
    animation: charReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Reveal on Scroll ──────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ─── 3D Tilt Cards ─────────────────────────────── */
.stat-card,
.project {
    will-change: transform;
    transform-style: preserve-3d;
    transition: transform 0.08s ease, box-shadow 0.3s ease !important;
}

.stat-card:hover,
.project:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(99, 102, 241, 0.2) !important;
}

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(#6366f1, #a855f7);
    border-radius: 3px;
}

/* ─── Site Footer ───────────────────────────────── */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 3rem 1rem 1rem;
    margin-top: auto;
    font-size: 0.85rem;
    color: #94a3b8;
    z-index: 10;
}

.site-footer a {
    color: #c4b5fd;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #e0d7ff;
    text-decoration: underline;
}