/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Critical rendering optimization */
* {
    box-sizing: border-box;
}

/* Hide Vue app until compiled */
[v-cloak] {
    display: none !important;
}

/* CSS Containment for isolated components */
#portfolio-card {
    contain: layout style;
}

.interactive-grid {
    contain: strict;
}

#benedict-canvas {
    contain: strict;
}

/* GPU acceleration - use sparingly, only for animated elements */
.cursor-dot {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Only hint GPU for elements that are actively animating */
.card-motion {
    transform: translateZ(0);
    backface-visibility: hidden;
}

nav ul::before {
    will-change: left, width;
    transform: translateZ(0);
}

/* Optimize backdrop-filter rendering */
@supports (backdrop-filter: blur(0px)) {
    .social-link {
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }
    
    .social-link:hover {
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

/* --- Custom Styles & Animations --- */
body {
    font-family: 'Space Mono', monospace;
    transition: background-color 0.3s ease, background-image 0.3s ease;
}

body.light-theme {
    background-color: #f8f9fa;
    background-image: radial-gradient(circle at top left, #ffffff, #f8f9fa);
}

body.dark-theme {
    background-color: #000000;
    background-image: none;
}

/* --- Desktop-Only Cursor Styles --- */
@media (hover: hover) and (pointer: fine) {
    * {
        cursor: none !important;
    }
}

/* Mobile: Use default cursors */
@media (hover: none) and (pointer: coarse) {
    * {
        cursor: auto !important;
    }
    
    .cursor-dot {
        display: none !important;
    }
}

/* Allow text selection */
p, h1, h2, h3, h4, h5, h6, span, li, div, input, textarea {
    user-select: text;
}

/* Custom Cursor */
.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 99999;
    --cursor-width: 10px;
    --cursor-height: 10px;
    width: var(--cursor-width);
    height: var(--cursor-height);
    border-radius: 50%;
    transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    mix-blend-mode: difference;
}

/* Light theme cursor colors */
.light-theme .cursor-dot {
    background-color: rgba(34, 211, 238, 0.6);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.5);
}
.light-theme .cursor-dot.link-hover {
    --cursor-width: 36px;
    --cursor-height: 36px;
    background-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.7);
}
.light-theme .cursor-dot.text-hover {
    --cursor-width: 3px;
    border-radius: 2px;
    background-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
}

/* Dark theme cursor colors */
.dark-theme .cursor-dot {
    background-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}
.dark-theme .cursor-dot.link-hover {
    --cursor-width: 36px;
    --cursor-height: 36px;
    background-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}
.dark-theme .cursor-dot.text-hover {
    --cursor-width: 3px;
    border-radius: 2px;
    background-color: rgba(244, 114, 182, 0.8);
    box-shadow: 0 0 10px rgba(244, 114, 182, 0.6);
}

/* Interactive Background Grid */
.interactive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    position: absolute;
    inset: 0;
}

.grid-cell {
    border-right: 1px solid rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    transition: background-color 0.4s ease;
}

.dark-theme .grid-cell {
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.grid-cell:hover {
    background-color: rgba(99, 102, 241, 0.04);
}

.dark-theme .grid-cell:hover {
    background-color: rgba(99, 102, 241, 0.08);
}

/* 3D Card Motion - DISABLED */
.card-motion {
    transition: transform 1.2s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 1.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    box-shadow: 0px 20px 50px -10px rgba(7, 35, 147, 0.1);
    will-change: auto;
}

/* Beautiful Blue Aesthetic Shadow on Hover - Gentle and refined */
/* COMMENTED OUT: 3D Card Motion Hover Effects */
/*
.card-motion:hover {
    will-change: transform, box-shadow;
    transform: translateY(-6px) scale(1.015);
    box-shadow: 
        0px 25px 70px -10px rgba(38, 93, 181, 0.4),
        0px 40px 100px -20px rgba(42, 45, 235, 0.3),
        0px 55px 130px -30px rgba(62, 11, 180, 0.25),
        0px 70px 160px -40px rgba(27, 7, 116, 0.2);
}
*/

/* JavaScript-enhanced 3D effects - Smooth and minimal */
/* COMMENTED OUT: JS Hover Effects */
/*
.card-motion.js-hover {
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 1.4s cubic-bezier(0.23, 1, 0.32, 1);
}
*/

/* Dark theme blue shadow - Subtle and elegant */
/* COMMENTED OUT: Dark Theme Card Motion Hover */
/*
.dark-theme .card-motion:hover {
    will-change: transform, box-shadow;
    transform: translateY(-6px) scale(1.015);
    box-shadow: 
        0px 25px 70px -10px rgba(59, 130, 246, 0.35),
        0px 40px 100px -20px rgba(99, 102, 241, 0.25),
        0px 55px 130px -30px rgba(139, 92, 246, 0.2),
        0px 70px 160px -40px rgba(59, 130, 246, 0.15);
}
*/

/* Animations & Transitions for Vue */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
    transform: translateY(10px);
}

/* Popup Animation */
.popup-enter-active {
    animation: popup-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.popup-leave-active {
    animation: popup-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse;
}
@keyframes popup-in {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes avatar-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(8deg); }
    50% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

@keyframes avatar-ring-glow {
    0% { 
        box-shadow: 
            0 0 0 0 rgba(99, 102, 241, 0.7),
            0 0 0 0 rgba(79, 70, 229, 0.5),
            0 0 0 0 rgba(139, 92, 246, 0.3);
    }
    25% {
        box-shadow: 
            0 0 0 8px rgba(99, 102, 241, 0.5),
            0 0 0 16px rgba(79, 70, 229, 0.3),
            0 0 0 24px rgba(139, 92, 246, 0.1);
    }
    50% {
        box-shadow: 
            0 0 0 12px rgba(99, 102, 241, 0.4),
            0 0 0 24px rgba(79, 70, 229, 0.2),
            0 0 0 36px rgba(139, 92, 246, 0.05);
    }
    75% {
        box-shadow: 
            0 0 0 8px rgba(99, 102, 241, 0.5),
            0 0 0 16px rgba(79, 70, 229, 0.3),
            0 0 0 24px rgba(139, 92, 246, 0.1);
    }
    100% { 
        box-shadow: 
            0 0 0 0 rgba(99, 102, 241, 0),
            0 0 0 0 rgba(79, 70, 229, 0),
            0 0 0 0 rgba(139, 92, 246, 0);
    }
}

@keyframes avatar-loading-ring {
    0% { 
        transform: rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: rotate(270deg);
        opacity: 1;
    }
    100% { 
        transform: rotate(360deg);
        opacity: 1;
    }
}

@keyframes avatar-gentle-scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes avatar-fade-reveal {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.avatar-wave {
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: visible;
    z-index: 1;
}

.avatar-wave.revealing {
    position: relative;
}

.avatar-wave.transformed {
    filter: brightness(1.05) contrast(1.05);
}

/* Cooldown state - clear visual feedback */
.avatar-wave.cooldown {
    opacity: 0.8;
    pointer-events: none;
}

.avatar-wave.cooldown::before {
    opacity: 0.3;
    border-color: rgba(99, 102, 241, 0.3) transparent transparent transparent;
}

/* Loading ring CSS container */
.avatar-wave::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border-radius: 50%;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    border: 3px solid transparent;
    border-top: 3px solid #6366f1;
    border-right: 3px solid #a855f7;
    border-bottom: 3px solid #4f46e5;
}

/* Light theme loading ring */
.light-theme .avatar-wave::before {
    border-top: 3px solid #6366f1;
    border-right: 3px solid #a855f7;
    border-bottom: 3px solid #4f46e5;
    border-left: 3px solid transparent;
}

/* Dark theme loading ring */
.dark-theme .avatar-wave::before {
    border-top: 3px solid #22d3ee;
    border-right: 3px solid #6366f1;
    border-bottom: 3px solid #a855f7;
    border-left: 3px solid transparent;
}

.avatar-wave.revealing::before {
    opacity: 1;
    animation: avatar-loading-ring 1.5s ease-in-out;
}

.avatar-wave::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, rgba(99, 102, 241, 0.1) 70%, transparent 80%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.avatar-wave.revealing::after {
    opacity: 1;
    animation: avatar-gentle-scale 1.5s ease-in-out;
}

/* Avatar image transition effects - SIMPLIFIED */
.avatar-container {
    position: relative;
}

.avatar-container .avatar-main {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.avatar-container .avatar-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

/* Transformed state - show hover image */
.avatar-container.transformed .avatar-main {
    opacity: 0;
}

.avatar-container.transformed .avatar-hover {
    opacity: 1;
}

/* Loading ring only when revealing */
.avatar-wave.revealing::before {
    opacity: 1;
    animation: avatar-loading-ring 0.8s ease-in-out;
}

@keyframes avatar-fade-out {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

@keyframes avatar-fade-in {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* Enhanced avatar visibility in light mode */
.light-theme .avatar-wave {
    filter: brightness(1.05) contrast(1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.light-theme .avatar-wave:hover {
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.25),
        0 0 0 3px rgba(79, 70, 229, 0.3),
        0 0 60px rgba(99, 102, 241, 0.4);
}

/* Dark mode avatar styles */
.dark-theme .avatar-wave {
    filter: brightness(1.05) contrast(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dark-theme .avatar-wave:hover {
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.5),
        0 0 0 3px rgba(99, 102, 241, 0.4),
        0 0 60px rgba(21, 23, 130, 0.6);
}

@keyframes emoji-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(14deg); }
    50% { transform: rotate(-8deg); }
    75% { transform: rotate(14deg); }
}
.emoji-wave:hover {
    animation: emoji-wave 0.6s ease-in-out;
}

@keyframes wavyAurora {
    from { transform: translate(-10px, -15px) rotate(-5deg); }
    to { transform: translate(10px, 15px) rotate(5deg); }
}
.aurora-bg {
    background-image: 
        radial-gradient(ellipse at 20% 25%, hsla(140, 70%, 80%, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse at 80% 30%, hsla(45, 80%, 85%, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse at 50% 80%, hsla(300, 80%, 85%, 0.3) 0%, transparent 70%);
    animation: wavyAurora 30s infinite alternate ease-in-out;
}

/* Minimalistic Custom Skill Badges */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
}

.skill-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.skill-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.skill-badge:hover::before {
    left: 100%;
}

.skill-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.skill-icon svg {
    width: 16px;
    height: 16px;
}

.skill-icon-text {
    font-size: 14px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.skill-name {
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.3px;
    font-size: 0.75rem;
}

/* Light Theme Skill Badges - More Subtle */
.light-theme .skill-badge {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(99, 102, 241, 0.15);
    color: #4b5563;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.light-theme .skill-badge:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(99, 102, 241, 0.3);
    color: #374151;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* Dark Theme Skill Badges - More Subtle */
.dark-theme .skill-badge {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(34, 211, 238, 0.15);
    color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-theme .skill-badge:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 211, 238, 0.3);
    color: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.2);
}

/* Simplified entrance animation */
.skill-badge {
    animation: skillBadgeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.skill-badge:nth-child(1) { animation-delay: 0.05s; }
.skill-badge:nth-child(2) { animation-delay: 0.1s; }
.skill-badge:nth-child(3) { animation-delay: 0.15s; }
.skill-badge:nth-child(4) { animation-delay: 0.2s; }
.skill-badge:nth-child(5) { animation-delay: 0.25s; }
.skill-badge:nth-child(6) { animation-delay: 0.3s; }
.skill-badge:nth-child(7) { animation-delay: 0.35s; }
.skill-badge:nth-child(8) { animation-delay: 0.4s; }
.skill-badge:nth-child(9) { animation-delay: 0.45s; }
.skill-badge:nth-child(10) { animation-delay: 0.5s; }
.skill-badge:nth-child(11) { animation-delay: 0.55s; }
.skill-badge:nth-child(12) { animation-delay: 0.6s; }
.skill-badge:nth-child(13) { animation-delay: 0.65s; }
.skill-badge:nth-child(14) { animation-delay: 0.7s; }

@keyframes skillBadgeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Canvas Title Animation Styles --- */
#benedict-canvas {
    display: block;
    image-rendering: crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: -moz-crisp-edges;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

#benedict-canvas:hover {
    opacity: 0.9;
}

/* Responsive canvas container */
@media (max-width: 768px) {
    .h-32, .sm\:h-40, .md\:h-48 {
        height: 5rem !important;
    }
    
    #benedict-canvas {
        height: 5rem !important;
    }
}

@media (max-width: 640px) {
    .h-32, .sm\:h-40, .md\:h-48 {
        height: 4rem !important;
    }
    
    #benedict-canvas {
        height: 4rem !important;
    }
}

/* Loading state for canvas */
.canvas-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.5;
}

.canvas-loading::after {
    content: "BENEDICT";
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    animation: pulseText 2s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ========================================
   LIQUID GLASS MORPHISM NAVIGATION
   ======================================== */

/* Navigation container */
nav ul,
.blogs-nav-container ul {
    position: relative;
    isolation: isolate;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dark-theme nav ul,
.dark-theme .blogs-nav-container ul {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Liquid glass sliding indicator */
nav ul::before,
.blogs-nav-container ul::before {
    content: '';
    position: absolute;
    top: 0.25rem;
    left: var(--glass-left, 0);
    width: var(--glass-width, 0);
    height: calc(100% - 0.5rem);
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 255, 255, 0.2) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 0;
    pointer-events: none;
}

.dark-theme nav ul::before,
.dark-theme .blogs-nav-container ul::before {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.3) 0%, 
        rgba(139, 92, 246, 0.2) 50%,
        rgba(59, 130, 246, 0.3) 100%
    );
    border: 1px solid rgba(167, 139, 250, 0.4);
    box-shadow: 
        0 8px 32px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 0 20px rgba(139, 92, 246, 0.2);
}

/* Navigation links */
.nav-link {
    position: relative;
    display: inline-block;
    padding: 0.5rem 1rem !important;
    border-radius: 10px;
    transition: all 0.3s ease;
    z-index: 1;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Mobile-specific nav link styling */
@media (max-width: 768px) {
    .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.6875rem !important;
    }
}

/* Remove old pseudo-element effects */
.nav-link::before,
.nav-link::after {
    display: none;
}

/* Hover state */
.nav-link:hover {
    transform: translateY(-1px);
    text-shadow: 0 0 12px currentColor;
}

/* Active state */
.nav-link.active {
    color: #fff !important;
}

.light-theme .nav-link {
    color: #64748b;
}

.light-theme .nav-link:hover {
    color: #3b82f6 !important;
}

.light-theme .nav-link.active {
    color: #1e40af !important;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.dark-theme .nav-link {
    color: #94a3b8;
}

.dark-theme .nav-link:hover {
    color: #a78bfa !important;
}

.dark-theme .nav-link.active {
    color: #fff !important;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.8);
}

/* Remove old animations */
@keyframes liquidRipple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Gooey effect filter for smooth liquid transitions */
@supports (filter: url('#goo')) {
    nav ul {
        filter: url('#goo');
    }
}

/* Remove conflicting styles */
.nav-link:active::before {
    animation: none;
}

.nav-link {
    transform-origin: center;
}

.nav-link:active {
    transform: translateY(0) scale(0.98);
}

/* ========================================
   BLOGS NAVIGATION (TOP-LEFT CORNER)
   ======================================== */

.blogs-nav-container {
    z-index: 21 !important;
}

/* Apply gooey effect to blogs nav container if supported */
@supports (filter: url('#goo')) {
    .blogs-nav-container ul {
        filter: url('#goo');
    }
}
