/* --- SCROLLBAR --- */
/* Custom scrollbar removed to fix macOS 'gray bar' / double scrollbar visual issues */

/* --- VARIABLES --- */
:root {
    color-scheme: dark;
    --bg-main: #020202;
    --bg-card: #090909;
    --border-color: #1a1a1a;
    --border-hover: #333333;
    
    --text-primary: #f0f0f0;
    --text-secondary: #888888;
    --text-dim: #444444;
    
    /* Default Blue Theme */
    --accent: #3b82f6; 
    --accent-rgb: 59, 130, 246; /* RGB values for --accent */
    --accent-glow: rgba(59, 130, 246, 0.3);
    --success: #10b981;
    
    --font-display: 'Space Grotesk', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --gap: 24px;
}

/* --- THEMES --- */
body.theme-green {
    --accent: #00ff41;
    --accent-rgb: 0, 255, 65;
    --accent-glow: rgba(0, 255, 65, 0.3);
}

body.theme-red {
    --accent: #ff5f56;
    --accent-rgb: 255, 95, 86;
    --accent-glow: rgba(255, 95, 86, 0.3);
}

body.theme-purple {
    --accent: #d500f9;
    --accent-rgb: 213, 0, 249;
    --accent-glow: rgba(213, 0, 249, 0.3);
}

/* --- RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Fix anchor scrolling offset */
    width: 100%; /* Revert to 100% to avoid scrollbar overflow */
    max-width: 100%;
    background-color: var(--bg-main); /* Fix gray bar issue */
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-display);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll on body as well */
    -webkit-font-smoothing: antialiased;
    width: 100%; /* Revert to 100% */
    max-width: 100%;
    min-height: 100vh;
    /* will-change: scroll-position; REMOVED */
    margin: 0;
    padding: 0;
}

/* --- SITE WRAPPER --- */
.site-wrapper {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    max-width: 100%;
}

/* PERFORMANCE OPTIMIZATIONS ON SCROLL */
body.is-scrolling .mobile-bar,
body.is-scrolling .about-section,
body.is-scrolling .navbar {
    backdrop-filter: none !important; /* Heavy blur off */
    box-shadow: none !important; /* Shadows off */
}
body.is-scrolling .scanlines {
    display: none !important; /* Hide heavy animated overlay */
}
/* wireframe-box hiding REMOVED */

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
::selection { background: var(--accent); color: #fff; }

/* --- UTILITIES --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px; /* Increased padding from 24px to 40px for better spacing */
    position: relative;
    z-index: 2;
}

.mono { font-family: var(--font-code); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }

/* --- SCROLL PROGRESS --- */
.scroll-progress {
    position: fixed; top: 0; left: 0; height: 2px;
    background: var(--accent); width: 0%; z-index: 1000;
    box-shadow: 0 0 15px var(--accent); transition: width 0.1s;
}

/* --- IMMERSIVE BG REVEAL (Disabled) --- */
.project-bg-reveal {
    display: none; /* Disable the effect */
}

/* --- BACKGROUND & NOISE --- */
#bg-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; opacity: 0.3; pointer-events: none;
    animation: grid-breathe 10s ease-in-out infinite;
}
@keyframes grid-breathe {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.2; }
}

.noise-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1; opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.spotlight-overlay {
    /* display: none !important; REMOVED DEBUG */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1;
    
    /* Dot Matrix Background - More visible */
    background-image: radial-gradient(circle at center, rgba(var(--accent-rgb), 0.9) 2px, transparent 2px); /* Increased alpha and dot size */
    background-size: 15px 15px; /* Spacing between dots, increased for clarity */
    background-repeat: repeat;
    background-position: 0 0; /* Static grid to prevent jitter */
    
    /* Circular Mask to make the dot matrix glow */
    mask-image: radial-gradient(circle 80px at var(--mouse-x) var(--mouse-y), black 0%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle 80px at var(--mouse-x) var(--mouse-y), black 0%, transparent 100%);
    
    opacity: 0; /* Hidden initially, revealed by JS on first move */
    transition: opacity 0.3s;
    will-change: background-position, mask-image; /* Optimize performance */
}

/* --- SCANLINES --- */
.scanlines {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
    background-size: 100% 4px;
    animation: scanline-move 0.4s linear infinite;
    opacity: 0.03;
}
@keyframes scanline-move { 0% { transform: translateY(0); } 100% { transform: translateY(4px); } }

/* --- NAVBAR --- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    padding: 20px 40px; display: flex; justify-content: space-between; align-items: center;
    z-index: 100; background: rgba(2, 2, 2, 0.95); /* Removed backdrop-filter, increased opacity */
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transform: translateZ(0); backface-visibility: hidden; /* Chrome Optimization */
}
.nav-center {
    position: absolute; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 24px;
}

.nav-brand { font-weight: 700; font-size: 1rem; letter-spacing: -0.5px; }
.nav-time { font-family: var(--font-code); font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.nav-dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; animation: pulse 2s infinite; }

/* --- WORK STATUS --- */
.work-status {
    display: flex; align-items: center; gap: 8px; font-family: var(--font-code); font-size: 0.75rem; color: #fff;
    background: rgba(16, 185, 129, 0.1); padding: 4px 12px; border-radius: 20px; border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; box-shadow: 0 0 8px #10b981; animation: pulse 2s infinite; }

/* --- NORTHERN LIGHTS GLOW --- */
.hero-glow {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 600px; height: 600px;
    background: conic-gradient(from 90deg at 50% 50%, #000000 0%, #10b981 25%, #3b82f6 50%, #8b5cf6 75%, #000000 100%);
    filter: blur(100px); opacity: 0.15;
    border-radius: 50%; z-index: -1;
    animation: aurora-spin 10s ease-in-out infinite alternate; /* Faster & more organic */
}
@keyframes aurora-spin { 
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); } 
    100% { transform: translate(-50%, -50%) rotate(180deg) scale(1.2); } 
}

/* --- MAGNETIC BUTTON --- */
.magnetic-btn { transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); }

/* --- HERO --- */
.hero-section {
    min-height: 95vh; display: flex; flex-direction: column; justify-content: center; padding-top: 80px;
    position: relative; overflow: hidden; /* Contain 3D shards */
}

.hero-title {
    font-size: clamp(3.5rem, 9vw, 7rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em; margin-bottom: 2rem;
    background: linear-gradient(135deg, #fff 0%, #ccc 50%, #888 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.hero-desc {
    max-width: 600px; font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--text-secondary); margin-bottom: 2rem; font-weight: 300;
    border-left: 2px solid var(--border-color); padding-left: 24px;
}

.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 2rem; }
.skill-badge {
    font-family: var(--font-code); font-size: 0.8rem; color: var(--accent); border: 1px solid var(--accent);
    padding: 6px 12px; border-radius: 4px; background: rgba(59, 130, 246, 0.05);
}

.hero-socials { display: flex; gap: 16px; margin-bottom: 3rem; }
.hero-icon {
    color: var(--text-secondary); transition: 0.2s; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.hero-icon:hover { color: #fff; border-color: var(--accent); background: rgba(255,255,255,0.05); transform: translateY(-2px); }

.btn {
    padding: 14px 28px; background: var(--text-primary); color: var(--bg-main);
    font-family: var(--font-code); font-weight: 600; font-size: 0.9rem; border-radius: 4px;
    border: 1px solid var(--text-primary); display: inline-flex; align-items: center; gap: 10px;
    cursor: pointer; transition: 0.2s;
}
.btn:hover { background: transparent; color: var(--text-primary); transform: translateY(-2px); box-shadow: 0 10px 20px -10px rgba(255,255,255,0.2); }

/* --- INTERACTIVE TERMINAL --- */
.code-window {
    background: #050505; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden;
    font-family: var(--font-code); font-size: 0.9rem; margin-bottom: 12rem;
    box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8);
    transform: perspective(1000px) rotateX(0deg); transition: transform 0.1s;
    max-width: 1000px; margin-left: auto; margin-right: auto; /* Increased width constraint */
}

.window-bar {
    background: #111; padding: 12px 16px; display: flex; gap: 8px; border-bottom: 1px solid var(--border-color); align-items: center;
}
.win-dot { width: 10px; height: 10px; border-radius: 50%; }
.win-dot:nth-child(1) { background: #ff5f56; }
.win-dot:nth-child(2) { background: #ffbd2e; }
.win-dot:nth-child(3) { background: #27c93f; }
.win-title { margin-left: auto; color: #555; font-size: 0.75rem; }

.terminal-content { padding: 24px; color: #ccc; display: flex; flex-direction: column; min-height: auto; }
.term-line { margin-bottom: 6px; line-height: 1.5; word-break: break-all; }
.prompt { color: var(--accent); margin-right: 10px; white-space: nowrap; }

.cursor-blink {
    display: inline-block; width: 8px; height: 15px; background: var(--accent);
    animation: blink 1s infinite; vertical-align: middle;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.json-key { color: #e5c07b; }
.json-val { color: #98c379; }
.json-bracket { color: #d19a66; }

/* --- SERVICES SECTION --- */
.services-section { margin-bottom: 12rem; }
.services-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; /* Reverted to 3 columns */
}
.service-card {
    background: rgba(9, 9, 9, 0.6); backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: 12px; padding: 32px;
    display: flex; flex-direction: column; transition: transform 0.3s, border-color 0.3s;
    position: relative; overflow: hidden; /* Ensure overflow is hidden */
}
.service-card:hover { border-color: transparent; transform: translateY(-5px); }
.service-card:hover::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 200%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: skewX(-20deg); pointer-events: none; z-index: 10;
    animation: shine 0.75s;
}
.service-card.featured-service { border-color: var(--accent); background: rgba(59, 130, 246, 0.05); }

.service-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--accent); color: #fff; font-size: 0.6rem; font-weight: bold;
    padding: 4px 8px; border-radius: 4px; letter-spacing: 1px;
}

.service-icon { font-size: 2rem; margin-bottom: 16px; }
.service-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; color: #fff; }
.service-desc { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; flex-grow: 1; }

.service-features { list-style: none; padding: 0; margin-bottom: 24px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 16px; }
.service-features li { 
    color: #ccc; font-size: 0.85rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; 
}
.service-features li::before { content: "✓"; color: var(--success); font-weight: bold; }

.service-footer { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.service-price { font-family: var(--font-code); color: var(--accent); font-size: 1.1rem; font-weight: bold; }
.service-btn { justify-content: center; width: 100%; text-align: center; }

@media (max-width: 1024px) {
    .services-grid { grid-template-columns: 1fr; }
}

/* --- ABOUT SECTION --- */
.about-section {
    margin-bottom: 12rem; padding: 40px;
    background: rgba(5, 5, 5, 0.6); backdrop-filter: blur(10px);
    border: 1px solid var(--border-color); border-left: 4px solid var(--accent);
    border-radius: 8px; max-width: 800px; margin-left: auto; margin-right: auto;
}
.about-text { font-size: 1.1rem; color: #ccc; margin-bottom: 1.5rem; line-height: 1.8; }
.about-text strong { color: #fff; font-weight: 600; }

/* --- BENTO GRID & TILT CARDS --- */
.section-header { 
    margin-bottom: 50px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; 
    display: flex; align-items: baseline; justify-content: space-between;
    position: relative; z-index: 2; /* Ensure headers stay on top of parallax cards */
}

.section-title { font-size: 2.5rem; font-weight: 700; position: relative; color: #fff; }
/* Glitch animation removed */
.section-sub { font-family: var(--font-code); color: var(--accent); font-size: 0.9rem; letter-spacing: 1px; }

.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); margin-bottom: 12rem; }
.bento-grid .card:hover::before {
    /* Fix: Use static glow instead of moving shine for tech cards */
    display: block; animation: none;
    background: radial-gradient(circle at center, rgba(255,255,255,0.05) 0%, transparent 70%);
    left: 0; top: 0; width: 100%; height: 100%; opacity: 1;
}

.card {
    background: rgba(9, 9, 9, 0.6); backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: 8px; padding: 28px;
    display: flex; flex-direction: column; transition: transform 0.1s, border-color 0.3s;
    position: relative; overflow: hidden; /* Restored overflow hidden to prevent shine animation overflow */
}
.card:hover { border-color: transparent; }
.card:hover::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 200%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: skewX(-20deg); pointer-events: none; z-index: 10;
    animation: shine 0.75s;
}
@keyframes shine { 0% { left: -100%; } 100% { left: 100%; } }

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 12; }
.col-4 { grid-column: span 12; }
.col-3 { grid-column: span 6; }
@media (min-width: 768px) {
    .col-6 { grid-column: span 6; }
    .col-4 { grid-column: span 4; }
    .col-3 { grid-column: span 3; }
}

.card-icon { color: var(--accent); margin-bottom: 20px; }
.card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; }
.card p { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 24px; flex-grow: 1; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { 
    font-family: var(--font-code); font-size: 0.75rem; color: #bbb; background: rgba(255,255,255,0.03); 
    padding: 4px 10px; border: 1px solid var(--border-color); border-radius: 4px; 
    display: flex; align-items: center; gap: 6px;
}

/* --- TECH STACK COLORS (Tags & Bars) --- */
/* Flutter/Dart */
.t-flutter { color: #54C5F8; border-color: rgba(84, 197, 248, 0.3); background: rgba(84, 197, 248, 0.1); }
.bg-flutter { background: #54C5F8; }
.t-dart { color: #00B4AB; border-color: rgba(0, 180, 171, 0.3); background: rgba(0, 180, 171, 0.1); }
.bg-dart { background: #00B4AB; }

/* Android/Kotlin */
.t-kotlin { color: #7F52FF; border-color: rgba(127, 82, 255, 0.3); background: rgba(127, 82, 255, 0.1); }
.bg-kotlin { background: #7F52FF; }
.t-compose { color: #3DDC84; border-color: rgba(61, 220, 132, 0.3); background: rgba(61, 220, 132, 0.1); }

/* Web Core */
.t-js { color: #F7DF1E; border-color: rgba(247, 223, 30, 0.3); background: rgba(247, 223, 30, 0.1); }
.bg-js { background: #F7DF1E; }
.t-ts { color: #3178C6; border-color: rgba(49, 120, 198, 0.3); background: rgba(49, 120, 198, 0.1); }
.bg-ts { background: #3178C6; }
.t-html { color: #E34C26; border-color: rgba(227, 76, 38, 0.3); background: rgba(227, 76, 38, 0.1); }
.bg-html { background: #E34C26; }
.t-css { color: #563D7C; border-color: rgba(86, 61, 124, 0.3); background: rgba(86, 61, 124, 0.1); }
.bg-css { background: #563D7C; }

/* Frameworks & Tools */
.t-firebase { color: #FFCA28; border-color: rgba(255, 202, 40, 0.3); background: rgba(255, 202, 40, 0.1); }
.t-supabase { color: #3ECF8E; border-color: rgba(62, 207, 142, 0.3); background: rgba(62, 207, 142, 0.1); }
.t-next { color: #fff; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.1); }
.t-vite { color: #646CFF; border-color: rgba(100, 108, 255, 0.3); background: rgba(100, 108, 255, 0.1); }
.t-gemini { color: #8E24AA; border-color: rgba(142, 36, 170, 0.3); background: rgba(142, 36, 170, 0.1); }
.t-pwa { color: #5A0FC8; border-color: rgba(90, 15, 200, 0.3); background: rgba(90, 15, 200, 0.1); }
.t-db { color: #4DB6AC; border-color: rgba(77, 182, 172, 0.3); background: rgba(77, 182, 172, 0.1); } /* SQLite */
.t-arch { color: #90A4AE; border-color: rgba(144, 164, 174, 0.3); background: rgba(144, 164, 174, 0.1); } /* BLoC */

#ai-canvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.3s; pointer-events: none;
    /* mix-blend-mode: screen; REMOVED FOR CHROME PERFORMANCE */
}
.card:hover #ai-canvas { opacity: 0.4; }

/* --- STATUS BADGE --- */
.status-badge {
    font-size: 0.65rem; padding: 2px 8px; border-radius: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
    margin-left: auto;
}
.status-prod { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-beta { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.status-dev { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }

/* --- TOAST NOTIFICATION --- */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #111; border: 1px solid var(--accent); color: #fff;
    padding: 12px 24px; border-radius: 4px; font-family: var(--font-code); font-size: 0.85rem;
    opacity: 0; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); z-index: 2000;
    display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* --- METHODOLOGY --- */
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 12rem; }
@media (max-width: 768px) { .method-grid { grid-template-columns: 1fr; } }

.method-item { border-left: 2px solid var(--border-color); padding-left: 20px; transition: 0.3s; }
.method-item:hover { border-left-color: var(--accent); }
.method-title { font-family: var(--font-code); color: #fff; margin-bottom: 10px; font-weight: 600; display: block; }
.method-desc { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; }

/* --- PROJECTS FILTER --- */
.filter-container { display: flex; gap: 15px; margin-bottom: 50px; flex-wrap: wrap; }
.filter-btn {
    background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary);
    padding: 8px 16px; border-radius: 20px; cursor: pointer; font-family: var(--font-code); font-size: 0.85rem;
    transition: 0.2s;
}
.filter-btn:hover, .filter-btn.active { border-color: var(--accent); color: #fff; background: rgba(59, 130, 246, 0.1); }

/* --- SEARCH INPUT --- */
.search-wrapper { position: relative; display: inline-block; }
#project-search {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border-color); color: #fff;
    padding: 8px 36px 8px 16px; border-radius: 20px; font-family: var(--font-code); font-size: 0.85rem;
    outline: none; transition: 0.2s; width: 200px;
}
#project-search:focus { border-color: var(--accent); width: 240px; background: rgba(0,0,0,0.3); }
#project-search::placeholder { color: #555; }

/* --- PROJECTS --- */
.projects-grid { display: grid; grid-template-columns: 1fr; gap: 40px; margin-bottom: 12rem; align-items: start; }
@media (min-width: 1024px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }

.project-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column; transition: transform 0.3s, border-color 0.3s, opacity 0.3s; 
    min-height: auto; /* Reduced from 500px */
}
.project-card:hover { border-color: var(--accent); z-index: 5; }
.project-card.hidden { display: none; } /* Use CSS class for filtering logic */

/* --- GALLERY STYLES --- */
.project-gallery {
    height: 260px;
    background: #070707; border-bottom: 1px solid var(--border-color);
    position: relative; overflow-x: auto; overflow-y: hidden;
    white-space: nowrap; scroll-snap-type: x mandatory;
    display: flex; align-items: center; padding: 0 10px;
    scrollbar-width: thin; scrollbar-color: #333 #070707;
}
/* Remove brittle JS-based centering rule */

/* Safe Flexbox Centering using Auto Margins */
.project-gallery::after {
    content: '';
    flex: 0 0 auto;
    margin-right: auto; /* Pushes content to center from right */
}
/* We apply margin-left: auto to the first item via a specific selector if possible, or use a pseudo-element ::before */
.project-gallery::before {
    content: '';
    flex: 0 0 auto;
    margin-left: auto; /* Pushes content to center from left */
}

.project-gallery::-webkit-scrollbar { height: 6px; }
.project-gallery::-webkit-scrollbar-track { background: #070707; }
.project-gallery::-webkit-scrollbar-thumb { background-color: #333; border-radius: 3px; }

.gallery-item {
    height: 90%; flex: 0 0 auto;
    width: auto; /* Ensure width depends on aspect ratio */
    /* max-width constraint removed to allow overflow detection */
    object-fit: contain;
    scroll-snap-align: center;
    margin-right: 10px;
    border: 1px solid #222; border-radius: 4px; opacity: 0.6; transition: all 0.3s ease;
    cursor: zoom-in; background: #000;
}
.gallery-item:hover { opacity: 1; border-color: var(--accent); transform: scale(1.02); }

.gallery-count {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.7); color: #fff; font-family: var(--font-code);
    padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; z-index: 10;
    pointer-events: none;
}

.project-visual-abstract {
    height: 200px; background: #070707; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}

.wireframe-box {
    width: 140px; height: 190px; border: 2px solid #222; border-radius: 12px;
    background: #030303; position: relative; transform: rotate(-5deg) translateY(20px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6); transition: 0.4s;
    will-change: transform; /* Optimize for parallax */
}
.project-card:hover .wireframe-box { transform: rotate(0deg) translateY(10px) scale(1.05); border-color: #333; }

.project-content { padding: 32px; flex-grow: 1; display: flex; flex-direction: column; }
.project-meta { font-family: var(--font-code); font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.project-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; }
.project-desc { 
    color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 24px; line-height: 1.6;
    overflow-wrap: anywhere; word-break: break-word; /* Fix for long words */
}

.live-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

.tech-details {
    background: #111; padding: 15px; border-radius: 6px; border: 1px solid #222; margin-bottom: 20px; font-family: var(--font-code); font-size: 0.8rem; color: #ccc;
    overflow-wrap: anywhere; /* Fix for tech details */
}
.tech-row { display: flex; margin-bottom: 6px; }
.tech-key { color: var(--text-secondary); width: 100px; flex-shrink: 0; font-weight: 600; }
.tech-val { color: #ccc; }

.project-links { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: auto; display: flex; gap: 12px; }
.project-links:empty { display: none; padding: 0; border: 0; }
.btn-link { 
    font-family: var(--font-code); font-size: 0.8rem; padding: 8px 16px; 
    background: #111; border: 1px solid #333; color: #aaa; border-radius: 4px;
    display: flex; align-items: center; gap: 8px; font-weight: 500; transition: 0.2s; cursor: pointer;
}
.btn-link:hover { border-color: var(--accent); color: #fff; background: rgba(59, 130, 246, 0.1); }

/* --- TAG HOVER EFFECTS --- */
.tag { transition: all 0.3s ease; }
.tag-highlight {
    background: var(--accent) !important;
    color: #000 !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 15px var(--accent-glow);
    transform: scale(1.05);
    z-index: 10;
}
.tag-dim { opacity: 0.3; }
.card-dim { opacity: 0.3; filter: grayscale(1); transform: scale(0.98); }

/* --- GITHUB STATS --- */
.project-stats {
    display: flex; gap: 12px; margin-bottom: 8px; font-family: var(--font-code); font-size: 0.75rem; color: var(--text-secondary);
}
.stat-item { display: flex; align-items: center; gap: 4px; }
.stat-item svg { width: 14px; height: 14px; }

/* --- ECOSYSTEM HIGHLIGHT --- */
.project-card.highlight-eco {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.02);
    z-index: 10;
}
.project-card.dim-eco {
    opacity: 0.3;
    filter: grayscale(0.8);
}

/* --- LIGHTBOX --- */
.lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 2000;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(5px);
}
.lightbox.active { display: flex; opacity: 1; }

.lightbox-container { position: relative; max-width: 90%; max-height: 85%; display: flex; align-items: center; justify-content: center; }
.lightbox-img { max-width: 100%; max-height: 100%; box-shadow: 0 0 50px rgba(0,0,0,0.5); border: 1px solid #333; border-radius: 4px; }

.lightbox-close { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 2.5rem; cursor: pointer; z-index: 2001; transition: color 0.2s; }
.lightbox-close:hover { color: var(--accent); }

.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.5); color: #fff; width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.5rem; transition: all 0.2s; border: 1px solid rgba(255,255,255,0.1);
}
.lightbox-nav:hover { background: var(--accent); border-color: var(--accent); }
.lightbox-prev { left: -70px; }
.lightbox-next { right: -70px; }

.lightbox-caption {
    margin-top: 20px; color: #ccc; font-family: var(--font-code); font-size: 0.9rem;
    background: rgba(0,0,0,0.7); padding: 8px 16px; border-radius: 20px; border: 1px solid #333;
}

@media (max-width: 768px) {
    .container { padding: 0 24px; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .filter-container { gap: 10px; }
    #project-search { width: 100%; margin-left: 0 !important; margin-top: 10px; }
    .search-wrapper { width: 100%; margin-left: 0 !important; }
    #project-search:focus { width: 100%; }
}

/* --- CONTACT FORM --- */
.contact-section { margin-bottom: 8rem; }
.terminal-form {
    background: rgba(9, 9, 9, 0.6); backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: 8px; padding: 40px;
    max-width: 800px; margin: 0 auto;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.form-group label { color: var(--accent); font-size: 0.8rem; }
.term-input {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color);
    color: #fff; padding: 12px; border-radius: 4px; font-family: var(--font-code); font-size: 0.9rem;
    outline: none; transition: border-color 0.2s; width: 100%;
}
/* --- FILE UPLOAD CUSTOM --- */
.file-upload-wrapper {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    width: 100%;
}

.file-input-hidden {
    display: none;
}

.file-upload-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 16px;
    background: rgba(255,255,255,0.05); border: 1px dashed var(--border-color);
    color: #ccc; border-radius: 4px; cursor: pointer;
    font-family: var(--font-code); font-size: 0.9rem; transition: all 0.2s;
}
.file-upload-btn:hover {
    background: rgba(59, 130, 246, 0.1); border-color: var(--accent); color: #fff;
}

.file-name-display {
    font-size: 0.8rem; color: #666; text-align: center;
    word-break: break-all; min-height: 1.2em;
}

/* --- CUSTOM CHECKBOX (Safari Fix - Label Replacement Method) --- */
/* 1. Hide the actual input */
.custom-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* 2. Style the Label to make room for the custom box */
.custom-checkbox + label {
    position: relative;
    padding-left: 28px; /* Space for checkbox */
    cursor: pointer;
    user-select: none;
    display: inline-block;
    min-height: 20px; /* Ensure height matches box */
}

/* 3. Create the Box (Unchecked) */
.custom-checkbox + label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 18px;
    width: 18px;
    background-color: #000; /* Dark bg */
    border: 2px solid var(--accent); /* Visible Accent Border */
    border-radius: 4px;
    transition: all 0.2s;
    box-shadow: 0 0 5px rgba(0,0,0,0.5); /* Contrast shadow */
}

/* 4. Hover Effect */
.custom-checkbox:hover + label::before {
    background-color: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* 5. Checked State (Background) */
.custom-checkbox:checked + label::before {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* 6. Checkmark (Hidden by default, shown when checked) */
.custom-checkbox + label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.custom-checkbox:checked + label::after {
    transform: rotate(45deg) scale(1);
}

.submit-btn { width: 100%; justify-content: center; margin-top: 10px; }
.form-status { margin-top: 20px; text-align: center; font-size: 0.9rem; min-height: 24px; }
.form-status.success { color: var(--success); }
.form-status.error { color: #ff5f56; }

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
}

/* --- ARTICLES / BLOG --- */
.articles-grid { display: grid; grid-template-columns: 1fr; gap: 40px; margin-bottom: 12rem; }
@media (min-width: 768px) { .articles-grid { grid-template-columns: repeat(2, 1fr); } }

.article-card {
    padding: 32px; display: flex; flex-direction: column; align-items: flex-start;
    transition: transform 0.2s, border-color 0.2s;
}
.article-meta { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 12px; letter-spacing: 1px; }
.article-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 16px; line-height: 1.3; color: #fff; }
.article-excerpt { font-size: 0.95rem; color: #ccc; margin-bottom: 24px; line-height: 1.6; flex-grow: 1; }
.article-link { margin-top: auto; width: auto; }

/* --- ARTICLE LAYOUT & TOC --- */
.article-container {
    display: grid; grid-template-columns: 1fr 300px; gap: 60px;
    max-width: 1100px; margin: 0 auto; position: relative;
}
.article-content { max-width: 100%; font-size: 1.1rem; line-height: 1.8; color: #ddd; }

.toc-sidebar {
    position: sticky; top: 120px; height: fit-content;
    border-left: 1px solid var(--border-color); padding-left: 20px;
}
.toc-title { font-family: var(--font-code); font-size: 0.8rem; color: #666; margin-bottom: 16px; letter-spacing: 1px; }
.toc-list { list-style: none; padding: 0; }
.toc-list li { margin-bottom: 10px; }
.toc-link { 
    color: #888; font-size: 0.9rem; transition: color 0.2s; display: block; 
    text-decoration: none;
}
.toc-link:hover, .toc-link.active { color: var(--accent); transform: translateX(5px); }

.key-takeaways {
    background: rgba(59, 130, 246, 0.05); border: 1px solid var(--accent);
    border-radius: 8px; padding: 24px; margin-bottom: 40px;
}
.key-takeaways h3 { margin-top: 0; color: var(--accent); font-size: 1.2rem; }
.key-takeaways ul { margin: 0; padding-left: 20px; color: #ccc; }
.key-takeaways li { margin-bottom: 8px; }

/* Mobile Article Layout */
@media (max-width: 1024px) {
    .article-container { grid-template-columns: 1fr; }
    .toc-sidebar { display: none; } /* Hide TOC on mobile for simplicity, or move to top */
}

.article-content h2 { font-size: 1.8rem; margin-top: 3rem; margin-bottom: 1rem; color: #fff; scroll-margin-top: 100px; }
.article-content h3 { font-size: 1.4rem; margin-top: 2rem; margin-bottom: 0.8rem; color: #eee; }
.article-content p { margin-bottom: 1.5rem; }
.article-content code { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: var(--font-code); font-size: 0.9em; color: var(--accent); }
.article-content pre { background: #111; padding: 20px; border-radius: 8px; overflow-x: auto; border: 1px solid var(--border-color); margin-bottom: 2rem; }
.article-content pre code { background: none; padding: 0; color: #ccc; }

/* --- TESTIMONIALS --- */
.testimonials-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 8rem;
}
.testimonial-card {
    background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: 12px; padding: 32px;
    transition: transform 0.3s, border-color 0.3s;
    display: flex; flex-direction: column;
}
.testimonial-card:hover { border-color: var(--accent); transform: translateY(-5px); }

.testimonial-stars {
    color: var(--accent); letter-spacing: 4px; font-size: 1.2rem; margin-bottom: 16px;
}
.testimonial-quote {
    font-size: 1.1rem; line-height: 1.6; color: #eee; font-style: italic; margin-bottom: 24px;
    flex-grow: 1;
}
.testimonial-author { display: flex; flex-direction: column; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 16px; }
.author-name { font-weight: 700; color: #fff; font-size: 0.9rem; }
.author-role { font-size: 0.75rem; color: var(--text-secondary); font-family: var(--font-code); }

@media (max-width: 768px) {
    .testimonials-grid { grid-template-columns: 1fr; }
}

/* --- RESPONSIVE (MOBILE) FIXES --- */
@media (max-width: 768px) {
    /* Navbar: Clean up the top bar collision */
    .navbar { padding: 15px 20px; justify-content: space-between; }
    .nav-time, .nav-link { display: none !important; } /* Hide desktop links & time */
    .nav-left-group { gap: 0 !important; } /* Remove gap on mobile */
    .nav-center { position: static; transform: none; } /* Allow status to sit naturally */
    .nav-brand { font-size: 0.9rem; }
    .work-status { display: none !important; } /* Hide status on mobile */

    /* Hero: Fix orb overflow */
    .hero-section { overflow-x: hidden; padding-top: 60px; padding-left: 24px; padding-right: 24px; } /* Added horizontal padding */
    .hero-glow { width: 300px; height: 300px; filter: blur(80px); top: -50px; left: 50%; transform: translateX(-50%); max-width: 100vw; }
    .hero-title { font-size: 2.5rem; }

    /* Services: Stack them */
    .services-grid { grid-template-columns: 1fr !important; gap: 20px; }
    .service-card { padding: 24px; min-height: auto; }
    .services-section { padding-left: 24px; padding-right: 24px; } /* Added horizontal padding */

    /* Portfolio: Fix image sizing */
    .project-gallery { overflow-x: auto; scroll-snap-type: x mandatory; height: 350px; /* Increased height for vertical screenshots */ }
    .gallery-item { 
        max-width: 100%; height: 100%; /* Use full height */
        width: auto; /* Let width adjust */
        object-fit: contain; /* Show full image, don't crop */
        scroll-snap-align: center; 
        background: #000; /* Black background for letterboxing */
    }
    .bento-grid { grid-template-columns: 1fr; padding-left: 24px; padding-right: 24px; } /* Changed to single column grid */
    .card.col-4 { grid-column: span 1; }

    /* Articles: Fix spacing and layout */
    .articles-grid { grid-template-columns: 1fr; margin-bottom: 8rem; padding-left: 24px; padding-right: 24px; } /* Added horizontal padding */
    .container { padding: 0; } /* Removed container padding */
    
    /* General */
    body { overflow-x: hidden; }

    /* Fix Contact Form Overflow on Mobile */
    .terminal-form {
        padding: 20px; /* Reduced from 40px */
        width: 100%;
        box-sizing: border-box;
    }
    .contact-section { margin-bottom: 4rem; } /* Reduce bottom margin on mobile */

    /* Additional Mobile Specific Padding */
    .section-header { padding-left: 24px; padding-right: 24px; }
    .filter-container { padding-left: 24px; padding-right: 24px; }
    .projects-grid { padding-left: 24px; padding-right: 24px; }
    .method-grid { padding-left: 24px; padding-right: 24px; }
    .about-section { 
        margin-left: 24px; 
        margin-right: 24px; 
        padding: 32px 24px; 
        width: auto; /* Ensure it respects margins */
    }
    
    /* Hide Scrollbar on Mobile */
    ::-webkit-scrollbar { display: none; }
    
    /* Adjust Project Card Height on Mobile */
    .project-card { min-height: auto; }
}

/* FIX: Force background elements behind content */
#ai-canvas { z-index: -1 !important; }

/* --- FOOTER & SYS STATUS --- */
footer { padding: 80px 0 40px 0; border-top: 1px solid var(--border-color); text-align: center; position: relative; }
.footer-cta { margin-bottom: 40px; }
.footer-email { font-size: clamp(1.5rem, 5vw, 3rem); color: var(--text-secondary); cursor: pointer; transition: 0.3s; font-weight: 700; }
.footer-email:hover { color: #fff; text-shadow: 0 0 20px rgba(255,255,255,0.2); }

.socials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* --- BACK TO TOP --- */
.back-to-top {
    position: fixed; bottom: 90px; right: 30px; width: 40px; height: 40px;
    background: #111; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    opacity: 0; transition: 0.3s; z-index: 10000; /* Increased z-index */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.back-to-top.visible { opacity: 1; }
.back-to-top .arrow { font-size: 1.2rem; color: #fff; position: absolute; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring__circle {
    stroke-dasharray: 113; /* 2 * PI * r (18) */
    stroke-dashoffset: 113;
    transition: stroke-dashoffset 0.1s;
}

/* --- MOBILE BOTTOM BAR --- */
.mobile-bar {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(15, 15, 15, 0.9); backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
    display: none; padding: 10px 20px; gap: 20px; z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%; max-width: 300px; justify-content: space-around; /* Changed for 3 items */
}
.m-link {
    color: #888; display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: 0.2s; position: relative; text-decoration: none;
}
.m-link svg { width: 20px; height: 20px; }
.m-link span { font-size: 9px; font-family: var(--font-code); font-weight: 500; letter-spacing: 0.5px; }

.m-link.active { color: var(--accent); /* transform: translateY(-2px); */ }
.m-link.active svg { filter: drop-shadow(0 0 8px var(--accent)); }

@media (max-width: 768px) {
    .mobile-bar { display: flex; }
}

/* --- ANIMATIONS --- */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.btn, .service-btn {
    animation: pulse-glow 3s infinite;
}

/* Glitch keyframes removed */
.fade-up { opacity: 0; transform: translateY(30px); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); will-change: transform, opacity; }
.fade-up.visible { opacity: 1; transform: translateY(0); }
