/* Color Palette mapped for light & dark modes using CSS Variables */
:root {
    --color-primary: #0f172a;
    --color-secondary: #fdfdfd;
    --color-accent: #3b82f6;
    --color-card-bg: #ffffff;
    --color-card-border: #e2e8f0;
    --color-text-muted: #64748b;
}

html.dark {
    --color-primary: #f8fafc;
    --color-secondary: #0f172a;
    --color-accent: #60a5fa;
    --color-card-bg: #1e293b;
    --color-card-border: #334155;
    --color-text-muted: #94a3b8;
}

/* Helper Components */
.skill-badge-lg {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-card-border);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.skill-badge-lg:hover {
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

.skill-badge-sm {
    padding: 0.25rem 0.5rem;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

html.dark .skill-badge-sm {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Animated Gradient Hero Blob */
.hero-blob {
    position: absolute;
    top: 50%;
    left: 80%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0) 70%);
    border-radius: 50%;
    filter: blur(40px);
    z-index: -1;
    animation: blob-float 12s ease-in-out infinite alternate;
}

@keyframes blob-float {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-45%, -55%) scale(1.15);
    }
}

/* Base Project Card */
.project-card {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 0.75rem;
    transition: transform 0.36s cubic-bezier(.2, .9, .3, 1), box-shadow 0.36s, border-color 0.3s;
    transform-style: preserve-3d;
}

/* Fallback card hovering rules (non-JS tilt logic, handles mobile hover) */
html:not(.tilt-enabled) .project-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 18px 40px rgba(12, 20, 30, .08);
}

html.dark:not(.tilt-enabled) .project-card:hover {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

/* Card Visual Stack Overlays */
.project-card-image-wrap {
    overflow: hidden;
    position: relative;
}

.project-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(.2, .9, .3, 1);
}

.project-card:hover .project-card-image,
.project-card:focus-within .project-card-image {
    transform: scale(1.05);
    /* Slight zoom on hover/focus */
}

/* Dark Gradient Fade Overlay on Hover */
.project-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 80%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover .project-overlay,
.project-card:focus-within .project-overlay {
    opacity: 1;
}

/* CTA Overlay Wrapping */
.project-cta-wrap {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.4s cubic-bezier(.2, .9, .3, 1);
    display: flex;
    gap: 0.5rem;
}

.project-card:hover .project-cta-wrap,
.project-card:focus-within .project-cta-wrap {
    opacity: 1;
    transform: translateY(0);
}

/* Magnetic Custom Cursor */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), height 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
}

.custom-cursor.hovering {
    width: 45px;
    height: 45px;
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Scroll Revealing Keys */
[data-reveal] {
    opacity: 0;
}

.is-revealed {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fallbacks for Touch / Mobile Screens */
@media (hover: none) {
    .project-overlay {
        opacity: 0.8 !important;
    }

    .project-cta-wrap {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Reduced Motion Mode Fallback */
@media (prefers-reduced-motion: reduce) {

    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .project-card:hover {
        transform: none;
    }

    .project-card:hover .project-card-image {
        transform: none;
    }

    .is-revealed {
        animation: fadeIn 0.4s ease forwards !important;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}
