/**
 * ═══════════════════════════════════════════════════════════════════════════
 * LUCA MANCO PORTFOLIO - MAIN STYLESHEET
 * ═══════════════════════════════════════════════════════════════════════════
 * 
 * TABLE OF CONTENTS
 * ─────────────────────────────────────────────────────────────────────────────
 * 1. FOUNDATION
 *    - CSS Custom Properties (Design Tokens)
 *    - Accessibility (Reduced Motion)
 *    - Base Styles & Resets
 * 
 * 2. CURSOR & EFFECTS
 *    - Custom Cursor
 *    - Ambient Glow
 *    - Skip Link
 * 
 * 3. LAYOUT
 *    - Container
 *    - Grid Background
 * 
 * 4. NAVIGATION
 *    - Glass Notch Header
 *    - Hamburger Menu
 *    - Mobile Menu Overlay
 * 
 * 5. COMPONENTS
 *    - Buttons
 *    - Form Elements
 *    - Cards (Bento, Log, Matrix)
 *    - Gallery & Lightbox
 * 
 * 6. SECTIONS
 *    - Hero
 *    - Projects
 *    - Experience (Philosophy Essay, Timeline, Capabilities)
 *    - Contact
 *    - Footer
 * 
 * 7. ANIMATIONS
 *    - Keyframes
 *    - Reveal Animations
 *    - Transitions
 * 
 * 8. RESPONSIVE
 *    - Mobile Improvements
 *    - Tablet Breakpoints
 *    - Accessibility Enhancements
 * 
 * 9. CROSS-BROWSER
 *    - Safari Fixes
 *    - Fallbacks
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. FOUNDATION - CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    /* Core Colors */
    --black: #000000;
    --surface: #0a0a0a;
    --surface-elevated: #111111;
    --border: #1a1a1a;
    --border-hover: #2a2a2a;
    
    /* Accent Colors */
    --blue: #0055FF;
    --blue-light: #3377ff;
    --blue-glow: rgba(0, 85, 255, 0.15);
    --green: #00D47E;
    --green-glow: rgba(0, 212, 126, 0.15);
    
    /* Error/Warning Colors */
    --error: #ff3b30;
    --error-glow: rgba(255, 59, 48, 0.15);
    --warning: #ff9500;
    
    /* Text Colors - WCAG AA Compliant */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0; /* Improved contrast */
    --text-tertiary: #888888;  /* Improved from #666 for better contrast */
    --text-muted: #777777;
    
    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing Scale (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;
    --space-11: 80px;
    --space-12: 100px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Focus Ring */
    --focus-ring: 0 0 0 3px rgba(0, 85, 255, 0.5);
}

/* ===========================================
   ACCESSIBILITY - REDUCED MOTION
   =========================================== */
@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;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ===========================================
   BASE STYLES
   =========================================== */

/* Universal box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: var(--blue);
    color: white;
}

/* ===========================================
   ANIMATED CUSTOM CURSOR
   =========================================== */
/* Hide default cursor only on devices that support hover (true desktops) */
@media (hover: hover) and (pointer: fine) {
    *, *::before, *::after {
        cursor: none !important;
    }
}

/* Custom cursor element */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: normal;
    transition: 
        width 0.2s ease,
        height 0.2s ease,
        background 0.2s ease,
        border-radius 0.2s ease,
        transform 0.08s ease-out;
}

/* Cursor ring (outer) */
.custom-cursor::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--blue);
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.2);
    transition: 
        width 0.25s ease,
        height 0.25s ease,
        border-radius 0.25s ease,
        border-width 0.25s ease,
        opacity 0.25s ease;
}

/* Cursor dot (inner) */
.custom-cursor::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: var(--blue);
    border-radius: 50%;
    transition: 
        width 0.25s ease,
        height 0.25s ease,
        border-radius 0.25s ease,
        background 0.25s ease;
}

/* Text cursor state - I-beam (smaller) */
.custom-cursor.cursor-text::before {
    width: 1.5px;
    height: 14px;
    border-radius: 1px;
    border-width: 0;
    background: var(--blue);
    opacity: 1;
}

.custom-cursor.cursor-text::after {
    width: 8px;
    height: 1.5px;
    border-radius: 1px;
    background: var(--blue);
}

/* Add top bar for I-beam */
.custom-cursor.cursor-text {
    height: 18px;
}

.custom-cursor.cursor-text::before {
    box-shadow: 
        -3px -6px 0 0 var(--blue),
        3px -6px 0 0 var(--blue),
        -3px 6px 0 0 var(--blue),
        3px 6px 0 0 var(--blue);
    width: 1.5px;
    height: 12px;
    background: var(--blue);
    border: none;
}

.custom-cursor.cursor-text::after {
    opacity: 0;
}

body {
    background-color: var(--black);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
}

/* ===========================================
   BACKGROUND DEPTH - Subtle Gradient Overlay
   =========================================== */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 85, 255, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 85, 255, 0.02) 0%, transparent 40%),
        radial-gradient(ellipse 50% 30% at 0% 80%, rgba(0, 85, 255, 0.02) 0%, transparent 35%);
    pointer-events: none;
    z-index: 0;
}

/* ===========================================
   AMBIENT CORNER GLOW - Adaptive Breathing Animation
   =========================================== */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    /* Default full opacity - will be dimmed by sections */
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Top-left corner glow - stronger */
.ambient-glow::before {
    content: "";
    position: absolute;
    top: -15%;
    left: -15%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(0, 85, 255, 0.25) 0%, rgba(0, 85, 255, 0.10) 40%, transparent 70%);
    animation: glowBreath1 8s ease-in-out infinite;
}

/* Bottom-right corner glow - stronger */
.ambient-glow::after {
    content: "";
    position: absolute;
    bottom: -15%;
    right: -15%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(0, 85, 255, 0.20) 0%, rgba(0, 85, 255, 0.08) 40%, transparent 70%);
    animation: glowBreath2 10s ease-in-out infinite;
}

@keyframes glowBreath1 {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes glowBreath2 {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===========================================
   IDLE ANIMATIONS - Ambient Life
   =========================================== */

/* Subtle breathing pulse for status indicator */
@keyframes breathe {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

/* Gentle float animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

/* Slow glow pulse */
@keyframes glowPulse {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(0, 85, 255, 0); 
    }
    50% { 
        box-shadow: 0 0 20px rgba(0, 85, 255, 0.15); 
    }
}

/* Text shimmer for accents */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Border travel animation */
@keyframes borderTravel {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--blue);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: 1000;
    font-size: 14px;
}

.skip-link:focus {
    top: var(--space-4);
}

/* Container utility */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-8);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-5);
    }
}

/* ===========================================
   MOUSE-REACTIVE GRID BACKGROUND
   =========================================== */

/* Base dot grid */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.grid-background canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Fallback static grid (shows before JS loads) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, #444444 1.5px, transparent 1.5px);
    background-size: 40px 40px;
    z-index: -1;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Hide static grid when canvas is active */
body.grid-active::before {
    opacity: 0;
}

/* ===========================================
   GLASS NOTCH HEADER
   =========================================== */

/* Safe area for smartphone notches (iPhone, Android) */
@supports (padding-top: env(safe-area-inset-top)) {
    .glass-notch {
        top: calc(var(--space-4) + env(safe-area-inset-top));
    }
}

.glass-notch {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    width: calc(100% - var(--space-8));
    max-width: 600px;
    
    /* Glassmorphism Effect */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 1px 2px rgba(255, 255, 255, 0.05) inset;
    
    font-family: var(--font-mono);
    z-index: 1000;
    
    animation: notchSlideIn 0.6s ease-out;
}

@keyframes notchSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Left section - Nav links on desktop, hamburger on mobile */
.notch-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Nav links - visible on desktop */
.notch-nav-links {
    display: flex;
    gap: var(--space-5);
}

.notch-nav-links a {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: color var(--transition-fast);
    position: relative;
}

/* Subtle underline animation on idle */
.notch-nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--blue);
    transition: all var(--transition-base);
    transform: translateX(-50%);
    opacity: 0.5;
}

.notch-nav-links a:hover {
    color: var(--text-primary);
}

.notch-nav-links a:hover::after {
    width: 100%;
    opacity: 1;
}

/* Hamburger - hidden on desktop, visible on mobile */
.glass-notch .hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.glass-notch .hamburger:hover {
    background: rgba(255, 255, 255, 0.05);
}

.glass-notch .hamburger:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.glass-notch .hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
    transform-origin: center;
}

.glass-notch .hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.glass-notch .hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.glass-notch .hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* Center - Logo always perfectly centered */
.notch-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.notch-logo .logo-img {
    height: 28px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3))
            drop-shadow(0 0 20px rgba(0, 85, 255, 0.4));
    transition: filter var(--transition-base);
    animation: logoBreath 4s ease-in-out infinite;
}

@keyframes logoBreath {
    0%, 100% { 
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3))
                drop-shadow(0 0 20px rgba(0, 85, 255, 0.4));
    }
    50% { 
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.4))
                drop-shadow(0 0 30px rgba(0, 85, 255, 0.55));
    }
}

.notch-logo:hover .logo-img {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.5))
            drop-shadow(0 0 30px rgba(0, 85, 255, 0.6));
}

/* Right - Status indicator */
.notch-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    font-size: 10px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.notch-status .status-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--green);
    animation: pulse-green 2s ease-in-out infinite;
}

.notch-status .status-text {
    display: inline;
}

/* Mobile breakpoint - swap nav links for hamburger */
@media (max-width: 600px) {
    .glass-notch {
        width: calc(100% - var(--space-6));
        max-width: none;
        padding: var(--space-3) var(--space-4);
    }
    
    .notch-nav-links {
        display: none;
    }
    
    .glass-notch .hamburger {
        display: flex;
    }
    
    .notch-status .status-text {
        display: none;
    }
    
    .notch-logo .logo-img {
        height: 24px;
    }
}

/* ===========================================
   MOBILE MENU OVERLAY
   =========================================== */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

/* Close button for mobile menu */
.mobile-menu-close {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    width: 48px;
    height: 48px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.mobile-menu-close:hover {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.mobile-menu-link {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
}

.mobile-menu-link:hover {
    color: var(--blue);
}

.mobile-menu-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    color: var(--blue);
}

.mobile-menu-social {
    display: flex;
    gap: var(--space-6);
    margin-top: var(--space-8);
}

.mobile-menu-social a {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===========================================
   ANIMATIONS & KEYFRAMES
   =========================================== */
@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--green);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 15px var(--green);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--blue);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 15px var(--blue);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Utility Classes */
.animate-fade-up {
    animation: fadeInUp 0.6s var(--transition-slow) forwards;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.5s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease forwards;
}

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

[class*="animate-"] {
    opacity: 0;
}

/* Scroll Reveal Classes */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ===========================================
   BENTO HERO GRID
   =========================================== */
.hero {
    min-height: 100vh;
    width: 100%;
    padding: calc(var(--space-12) + 60px) var(--space-8) var(--space-10);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-5);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    /* Perspective for 3D tilt effect */
    perspective: 1000px;
}

.bento-card {
    /* Solid background - blocks ambient glow */
    background: rgba(8, 8, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    
    /* 3D Transform Setup */
    transform-style: preserve-3d;
    transition: 
        transform 0.15s ease-out,
        border-color var(--transition-base),
        box-shadow var(--transition-base);
    will-change: transform;
    
    /* Subtle ambient animation */
    animation: cardAmbient 6s ease-in-out infinite;
}

.bento-card:hover {
    border-color: rgba(0, 85, 255, 0.3);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 85, 255, 0.15);
    animation: none; /* Pause ambient animation on hover */
}

/* Ambient card glow - subtle life */
@keyframes cardAmbient {
    0%, 100% { 
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 
            0 4px 24px rgba(0, 0, 0, 0.5),
            0 0 30px rgba(0, 85, 255, 0.03);
    }
}

/* Staggered animation delays for wave effect */
.bento-card:nth-child(1) { animation-delay: 0s; }
.bento-card:nth-child(2) { animation-delay: 1.5s; }
.bento-card:nth-child(3) { animation-delay: 3s; }
.bento-card:nth-child(4) { animation-delay: 4.5s; }

/* Card content layers for depth effect */
.bento-card > * {
    transform: translateZ(20px);
}

.bento-card .hero-title,
.bento-card .stat-number {
    transform: translateZ(40px);
}

/* Shine/glare effect overlay */
.bento-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
    z-index: 1;
}

.bento-card:hover::before {
    opacity: 1;
}

/* Ensure card content is above the shine */
.bento-card > * {
    position: relative;
    z-index: 2;
}

.bento-main {
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Availability Badge */
.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--green-glow);
    border: 1px solid rgba(0, 212, 126, 0.3);
    border-radius: 50px;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    margin-bottom: var(--space-7);
    width: fit-content;
}

.availability-badge .dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse-green 2s ease-in-out infinite;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--blue);
    letter-spacing: 1px;
    margin-bottom: var(--space-4);
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 var(--space-6) 0;
}

.hero-title span {
    color: var(--text-tertiary);
    background: linear-gradient(
        90deg, 
        var(--text-tertiary) 0%, 
        var(--text-tertiary) 40%,
        rgba(0, 85, 255, 0.7) 50%,
        var(--text-tertiary) 60%,
        var(--text-tertiary) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 8s ease-in-out infinite;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 480px;
    margin-bottom: var(--space-8);
}

/* CTA Buttons */
.cta-group {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: none;
    border: none;
    position: relative;
    overflow: hidden;
}

/* Primary Button - Hero CTA with special effects */
.btn-primary {
    background: var(--blue);
    color: white;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 85, 255, 0.3);
    isolation: isolate; /* Creates stacking context */
}

/* Ensure button text stays on top */
.btn-primary span,
.btn-primary {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Animated gradient background - behind text */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 25%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 100%
    );
    z-index: -1;
    transition: left 0.5s ease;
    pointer-events: none;
}

/* Glow ring effect */
.btn-primary::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--blue), #00d4ff, var(--blue), #00d4ff);
    background-size: 400% 400%;
    border-radius: calc(var(--radius-md) + 2px);
    z-index: -2;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-primary:hover {
    background: var(--blue-light);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(0, 85, 255, 0.4),
        0 0 40px rgba(0, 85, 255, 0.2);
    text-decoration: none;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover::after {
    opacity: 1;
}

/* Pulse animation on idle */
.btn-primary {
    animation: btnPulse 3s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(0, 85, 255, 0.3);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(0, 85, 255, 0.5);
    }
}

.btn-primary:hover {
    animation: none;
}

/* Focus states for buttons */
.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.5), 0 4px 15px rgba(0, 85, 255, 0.3);
}

.btn-secondary:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--focus-ring);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    animation: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    text-decoration: none;
    transform: translateY(-2px);
}

/* Photo Card */
.bento-photo {
    position: relative;
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px;
}

.photo-wrapper::before,
.photo-wrapper::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--blue);
    z-index: 2;
    transition: all var(--transition-base);
}

.photo-wrapper::before {
    top: -8px;
    left: -8px;
    border-right: none;
    border-bottom: none;
}

.photo-wrapper::after {
    bottom: -8px;
    right: -8px;
    border-left: none;
    border-top: none;
}

.photo-wrapper:hover::before,
.photo-wrapper:hover::after {
    width: 30px;
    height: 30px;
}

.profile-img {
    width: 100%;
    border-radius: var(--radius-sm);
    filter: grayscale(100%) contrast(110%);
    opacity: 0.85;
    transition: all var(--transition-base);
}

.photo-wrapper:hover .profile-img {
    filter: grayscale(0%);
    opacity: 1;
}

.photo-meta {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: rotate(90deg) translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Stats Card */
.bento-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    padding: var(--space-6);
}

.stat-item {
    text-align: center;
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.stat-number span {
    color: var(--blue);
    display: inline-block;
    animation: statPulse 3s ease-in-out infinite;
}

@keyframes statPulse {
    0%, 100% { 
        text-shadow: 0 0 0 rgba(0, 85, 255, 0);
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 15px rgba(0, 85, 255, 0.4);
        transform: scale(1.02);
    }
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Bento Grid Responsive */
@media (max-width: 900px) {
    .hero {
        min-height: 100vh;
        padding: calc(var(--space-11) + 60px) var(--space-5) var(--space-9);
        align-items: center;
        justify-content: center;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        max-width: 500px;
    }
    
    .bento-main {
        grid-row: auto;
        text-align: center;
    }
    
    .bento-main .availability-badge {
        margin-left: auto;
        margin-right: auto;
    }
    
    .bento-main .cta-group {
        justify-content: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .bento-photo {
        order: -1;
    }
    
    .photo-meta {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: calc(var(--space-10) + 60px) var(--space-4) var(--space-8);
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .bento-card {
        padding: var(--space-6);
    }
}

/* ===========================================
   LINK STYLES
   =========================================== */
a {
    color: var(--blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--blue-light);
}

a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* ===========================================
   PROJECTS SECTION
   =========================================== */
.projects-section {
    padding: var(--space-12) var(--space-8);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-4);
    margin-bottom: var(--space-10);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.section-number {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--blue);
    letter-spacing: 1px;
    animation: sectionNumPulse 4s ease-in-out infinite;
}

@keyframes sectionNumPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

/* Project Cards Grid */
.case-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: var(--space-5);
    align-items: stretch;
    max-width: 1200px;
    margin: 0 auto;
}

/* Modules - Glassmorphism Style */
.module {
    /* Solid background - blocks ambient glow */
    background: rgba(8, 8, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: var(--space-7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    
    /* 3D Transform Setup */
    transform-style: preserve-3d;
    transition: 
        transform 0.15s ease-out,
        border-color var(--transition-base),
        box-shadow var(--transition-base);
}

.module-grow {
    flex-grow: 1;
}

.module:hover {
    border-color: rgba(0, 120, 255, 0.25);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 120, 255, 0.1);
}

.module-header {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--blue);
    margin-bottom: var(--space-5);
    display: block;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-3);
}

.info-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    height: 100%;
}

.description-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 var(--space-5) 0;
}

/* Tech Grid */
.tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-7);
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spec-value {
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 500;
}

/* Metric Area */
.metric-box {
    border-top: 1px solid var(--border);
    padding-top: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.metric-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-detail {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--blue);
    max-width: 120px;
    line-height: 1.4;
}

.code-link {
    font-family: var(--font-mono);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    position: relative;
    color: var(--blue);
    transition: color var(--transition-fast);
}

.code-link:hover {
    color: var(--blue-light);
}

.code-link::after {
    content: '→';
    transition: transform var(--transition-fast);
}

.code-link:hover::after {
    transform: translateX(4px);
}

/* Gallery Grid - FIXED FOR BETTER IMAGE DISPLAY */
.gallery-module {
    padding: var(--space-3);
    background: var(--black);
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: var(--space-3);
    height: 100%;
    min-height: 400px;
}

.img-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-base);
}

.img-box:hover {
    border-color: var(--border-hover);
}

.img-box.main {
    grid-column: 1 / -1;
    min-height: 280px;
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
    transition: transform var(--transition-base);
}

.img-box:hover img {
    transform: scale(1.02);
}

.img-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    letter-spacing: 1px;
}

@media (max-width: 900px) {
    .case-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        min-height: 300px;
        grid-template-rows: 200px auto;
    }
    
    .section-header {
        flex-direction: column;
        gap: var(--space-2);
    }
}

/* ===========================================
   EXPERIENCE SECTION
   =========================================== */
.experience-section {
    padding: var(--space-12) var(--space-8);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

/* Philosophy Essay - Personal Intro */
.philosophy-essay {
    max-width: 900px;
    margin: 0 auto var(--space-12) auto;
    padding: var(--space-8) var(--space-10);
    position: relative;
    background: linear-gradient(135deg, 
        rgba(0, 85, 255, 0.04) 0%, 
        rgba(15, 15, 20, 0.8) 40%,
        rgba(15, 15, 20, 0.8) 60%,
        rgba(0, 85, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Decorative accent line on left */
.philosophy-essay::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        var(--blue) 30%, 
        var(--blue) 70%, 
        transparent 100%);
    border-radius: 2px;
}

/* Subtle glow effect */
.philosophy-essay::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, 
        rgba(0, 85, 255, 0.15) 0%, 
        transparent 30%,
        transparent 70%,
        rgba(0, 85, 255, 0.1) 100%);
    z-index: -1;
    opacity: 0.5;
}

.essay-header {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--blue);
    margin-bottom: var(--space-5);
    font-family: var(--font-mono);
}

.essay-text {
    font-size: 1.1rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: var(--space-5);
    text-align: left;
    letter-spacing: 0.01em;
    font-weight: 400;
}

.essay-text:first-of-type {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 450;
}

.essay-text:last-child {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
}

@media (max-width: 768px) {
    .philosophy-essay {
        padding: var(--space-6) var(--space-5);
        padding-left: var(--space-7);
        margin-bottom: var(--space-8);
    }
    
    .philosophy-essay::before {
        top: 10%;
        bottom: 10%;
    }
    
    .essay-text {
        font-size: 1rem;
        line-height: 1.75;
    }
    
    .essay-text:first-child {
        font-size: 1.05rem;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: var(--space-10);
    max-width: 1200px;
    margin: 0 auto;
}

/* Timeline Log Cards */
.timeline-log {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.log-card {
    padding: var(--space-7);
    /* Solid background - blocks ambient glow */
    background: rgba(8, 8, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    
    /* 3D Transform Setup */
    transform-style: preserve-3d;
    transition: 
        transform 0.15s ease-out,
        border-color var(--transition-base),
        box-shadow var(--transition-base);
}

.log-card:hover {
    border-color: rgba(0, 120, 255, 0.25);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 120, 255, 0.1);
}

.log-card.active {
    border-left: 3px solid var(--blue);
}

.log-card .status-indicator {
    position: absolute;
    top: var(--space-7);
    right: var(--space-7);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--green);
}

.log-card .status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse-green 2s ease-in-out infinite;
}

.log-header {
    margin-bottom: var(--space-3);
}

.log-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--blue);
    letter-spacing: 0.5px;
}

.log-role {
    font-size: 1.5rem;
    font-weight: 600;
    margin: var(--space-2) 0;
    letter-spacing: -0.02em;
}

.log-location {
    font-size: 13px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    margin-bottom: var(--space-4);
}

.log-detail {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 600px;
}

.log-detail strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Capabilities Matrix (Skills Sidebar) */
.capabilities-matrix {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.matrix-block {
    /* Solid background - blocks ambient glow */
    background: rgba(8, 8, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    
    /* 3D Transform Setup */
    transform-style: preserve-3d;
    transition: 
        transform 0.15s ease-out,
        border-color var(--transition-base),
        box-shadow var(--transition-base);
}

.matrix-block:hover {
    border-color: rgba(51, 119, 255, 0.25);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(51, 119, 255, 0.1);
}

.matrix-block:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--focus-ring);
}

.matrix-block.highlight {
    border-left: 3px solid var(--blue);
}

.matrix-label {
    font-family: var(--font-mono);
    color: var(--blue);
    font-size: 11px;
    margin-bottom: var(--space-5);
    letter-spacing: 1px;
}

.tech-row {
    font-size: 14px;
    margin-bottom: var(--space-3);
    line-height: 1.5;
    color: var(--text-primary);
}

.tech-row span {
    color: var(--text-tertiary);
    display: block;
    font-size: 10px;
    margin-bottom: var(--space-1);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.capability-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.capability-list li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    line-height: 1.6;
    padding-left: var(--space-4);
    border-left: 1px solid var(--border);
}

.capability-list li strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-1);
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: var(--space-9);
    }
    
    .log-role {
        font-size: 1.3rem;
    }
}

/* ===========================================
   CONTACT SECTION
   =========================================== */
.contact-section {
    padding: var(--space-12) var(--space-8);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.contact-content {
    max-width: 650px;
    margin: 0 auto;
    text-align: center;
}

.contact-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    margin-bottom: var(--space-5);
    letter-spacing: -0.02em;
}

.contact-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    line-height: 1.7;
}

/* Contact Form Styles */
.contact-form {
    text-align: left;
    margin-bottom: var(--space-8);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-2);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

/* Form Validation States */
.form-group input:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

.form-group input:invalid:not(:placeholder-shown):focus,
.form-group textarea:invalid:not(:placeholder-shown):focus {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-glow);
}

.form-group.error input,
.form-group.error textarea {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-glow);
}

.form-group .error-message {
    display: none;
    color: var(--error);
    font-size: 12px;
    font-family: var(--font-mono);
    margin-top: var(--space-2);
}

.form-group.error .error-message {
    display: block;
}

/* Required field indicator */
.form-group label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-submit {
    width: 100%;
    justify-content: center;
    padding: var(--space-4) var(--space-6);
}

/* Form Message */
.form-message {
    display: none;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-size: 14px;
    text-align: center;
}

.form-message.success {
    background: var(--green-glow);
    border: 1px solid rgba(0, 212, 126, 0.3);
    color: var(--green);
}

.form-message.error {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

/* Social Icons */
.social-links {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-6);
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    animation: socialBreath 4s ease-in-out infinite;
}

@keyframes socialBreath {
    0%, 100% { 
        border-color: var(--border);
        transform: translateY(0);
    }
    50% { 
        border-color: rgba(0, 85, 255, 0.15);
        transform: translateY(-2px);
    }
}

/* Staggered delays for social icons */
.social-icon:nth-child(1) { animation-delay: 0s; }
.social-icon:nth-child(2) { animation-delay: 0.5s; }
.social-icon:nth-child(3) { animation-delay: 1s; }
.social-icon:nth-child(4) { animation-delay: 1.5s; }

.social-icon:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-glow);
    animation: none; /* Stop breathing on hover */
}

.social-icon:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--focus-ring);
    animation: none;
}

.social-icon svg {
    width: 20px;
    height: 20px;
}

/* ===========================================
   FOOTER
   =========================================== */
footer {
    padding: var(--space-8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
    background: #000000;
    position: relative;
    z-index: 100;
}

footer .footer-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

footer .footer-legal a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-base);
}

footer .footer-legal a:hover {
    color: var(--text-primary);
}

footer .footer-legal a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

footer .made-with {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

/* ===========================================
   ACCESSIBILITY ENHANCEMENTS
   =========================================== */

/* Skip Link (visible on focus) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--blue);
    color: white;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    z-index: 1000;
    font-family: var(--font-mono);
    font-size: 14px;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: var(--space-4);
}

/* Ensure all focusable elements have visible focus */
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================
   MOBILE-SPECIFIC IMPROVEMENTS
   =========================================== */

/* Touch-friendly tap targets (minimum 44x44px) */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: var(--space-3) var(--space-5);
    }
    
    .social-icon {
        width: 48px;
        height: 48px;
    }
    
    .notch-nav-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* COMPLETELY disable custom cursor on mobile/touch */
    .custom-cursor,
    .cursor,
    .cursor-ring {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    html, body, * {
        cursor: auto !important;
    }
    
    /* Smaller profile photo on mobile */
    .bento-photo {
        padding: var(--space-3);
    }
    
    .photo-wrapper {
        max-width: 180px;
    }
    
    .photo-wrapper::before,
    .photo-wrapper::after {
        width: 15px;
        height: 15px;
    }
    
    .photo-wrapper::before {
        top: -6px;
        left: -6px;
    }
    
    .photo-wrapper::after {
        bottom: -6px;
        right: -6px;
    }
    
    /* Better gallery on mobile */
    .gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: var(--space-2);
        min-height: 0;
    }
    
    .img-box.main {
        min-height: 200px;
    }
    
    .img-box {
        min-height: 120px;
    }
    
    /* Improve form inputs for mobile */
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Stack footer links on mobile */
    footer .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Mobile-specific animations */
    .bento-card {
        animation: mobileSlideUp 0.6s ease-out forwards;
        opacity: 0;
    }
    
    .bento-card:nth-child(1) { animation-delay: 0.1s; }
    .bento-card:nth-child(2) { animation-delay: 0.2s; }
    .bento-card:nth-child(3) { animation-delay: 0.3s; }
    
    .log-card {
        animation: mobileSlideUp 0.5s ease-out forwards;
        opacity: 0;
    }
    
    .log-card:nth-child(1) { animation-delay: 0.1s; }
    .log-card:nth-child(2) { animation-delay: 0.2s; }
    .log-card:nth-child(3) { animation-delay: 0.3s; }
    .log-card:nth-child(4) { animation-delay: 0.4s; }
    
    /* Subtle touch feedback */
    .btn:active,
    .social-icon:active,
    .log-card:active,
    .bento-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

@keyframes mobileSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .photo-wrapper {
        max-width: 150px;
    }
    
    .gallery-module {
        padding: var(--space-2);
    }
    
    .img-box.main {
        min-height: 180px;
    }
    
    .img-box {
        min-height: 100px;
    }
}

/* ===========================================
   IMAGE LIGHTBOX / FULLSCREEN VIEWER
   =========================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: var(--space-6);
    right: var(--space-6);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.lightbox-caption {
    text-align: center;
    margin-top: var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* Make gallery images clickable */
.img-box {
    cursor: pointer;
}

.img-box:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ===========================================
   KEYBOARD NAVIGATION IMPROVEMENTS
   =========================================== */

/* Section focus for keyboard navigation */
section:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 4px;
}

/* Log cards should be keyboard navigable */
.log-card:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--focus-ring);
}

/* Module cards keyboard focus */
.module:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: var(--focus-ring);
}

/* ===========================================
   CROSS-BROWSER COMPATIBILITY
   =========================================== */

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    .glass-notch,
    .bento-card,
    .log-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(20px)) {
    .glass-notch {
        background: rgba(20, 20, 20, 0.95);
    }
    
    .mobile-menu {
        background: rgba(0, 0, 0, 0.98);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COOKIE CONSENT BANNER
   ═══════════════════════════════════════════════════════════════════════════ */
.cookie-banner {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    z-index: 10001;
    width: calc(100% - var(--space-8));
    max-width: 480px;
    background: rgba(15, 15, 20, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.3s ease,
                visibility 0.3s ease;
}

.cookie-banner.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.cookie-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.cookie-content a {
    color: var(--blue);
    text-decoration: none;
}

.cookie-content a:hover {
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

.cookie-btn {
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.cookie-btn-secondary {
    background: transparent;
    color: var(--text-tertiary);
    border: 1px solid var(--border);
}

.cookie-btn-secondary:hover {
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.cookie-btn-primary {
    background: var(--blue);
    color: white;
}

.cookie-btn-primary:hover {
    background: var(--blue-light);
    transform: translateY(-1px);
}

.cookie-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .cookie-banner {
        bottom: var(--space-4);
        width: calc(100% - var(--space-6));
        padding: var(--space-4) var(--space-5);
    }
    
    .cookie-content p {
        font-size: 0.85rem;
    }
    
    .cookie-actions {
        flex-direction: column;
    }
    
    .cookie-btn {
        width: 100%;
        padding: var(--space-3) var(--space-5);
    }
}
