:root {
    /* Apple Dark Theme */
    --bg-color: #000000;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --glass-bg: rgba(28, 28, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(0, 0, 0, 0.05);
    --btn-primary-bg: #ffffff;
    --btn-primary-text: #000000;
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-text: #ffffff;
    
    /* Glows */
    --glow-1: rgba(0, 122, 255, 0.15); /* Blue */
    --glow-2: rgba(213, 63, 140, 0.15); /* Pink/Purple */
}

[data-theme="light"] {
    /* Apple Light Theme */
    --bg-color: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-border: rgba(0, 0, 0, 0.04);
    --nav-bg: rgba(255, 255, 255, 0.1);
    --btn-primary-bg: #000000;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: rgba(0, 0, 0, 0.08);
    --btn-secondary-text: #1d1d1f;
    
    /* Glows */
    --glow-1: rgba(0, 122, 255, 0.08);
    --glow-2: rgba(213, 63, 140, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    
    /* Prevent text selection and mobile tap highlights */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.4;
}

/* Subtle Ambient Glows - Hardware Accelerated for 120 FPS */
.ambient-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%; /* Fixed 100vw causing horizontal scroll on mobile */
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none; /* Prevents invisible layer from blocking clicks */
}

.glow {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    animation: drift 20s infinite alternate linear;
    will-change: transform;
    transform: translate3d(0, 0, 0); /* Force GPU acceleration */
}

.glow-1 {
    width: 60vw;
    height: 60vw;
    top: -20%;
    left: -10%;
    background: var(--glow-1);
}

.glow-2 {
    width: 50vw;
    height: 50vw;
    bottom: -10%;
    right: -10%;
    background: var(--glow-2);
    animation-direction: alternate-reverse;
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(5%, 10%, 0); }
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
}

/* Navigation - Liquid Glass Style */
.apple-nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate3d(-50%, 0, 0);
    width: 90%;
    max-width: 1000px;
    background: var(--nav-bg);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 0 10px rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    z-index: 1000;
}

.nav-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 32px;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .logo img {
    filter: invert(1) brightness(2);
}

.logo img:hover {
    transform: scale(1.05) translate3d(0, 0, 0);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
}

.nav-links a.active {
    font-weight: 600;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.icon-btn:hover {
    opacity: 1;
    transform: scale(1.1) translate3d(0, 0, 0);
}

.mobile-menu-btn {
    display: none;
}

/* Main Layout */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 120px 20px 60px;
}

.section-heading {
    text-align: center;
    margin-bottom: 3rem;
}

.section-heading h3 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.section-heading p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Hero Section */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-text {
    max-width: 800px;
}

.title {
    font-size: clamp(2.5rem, 10vw, 5.5rem); /* Fluid scaling prevents overflow on small screens */
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.btn:active {
    transform: scale(0.95) translate3d(0, 0, 0);
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.btn-secondary:hover {
    background: rgba(134, 134, 139, 0.2);
}

/* Bento Grid System */
.bento-section {
    padding: 6rem 0;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 250px;
    gap: 1.5rem;
}

.bento-item {
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}

.bento-item:hover {
    transform: translate3d(0, -5px, 0);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.item-icon {
    font-size: 2.2rem;
    color: var(--text-primary);
    opacity: 0.8;
    margin-bottom: auto;
}

.bento-item h4 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.bento-item p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.bento-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-item.wide {
    grid-column: span 3;
    grid-row: span 1;
}

/* Skills */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

.skill-pill {
    padding: 1rem 2rem;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-pill:hover {
    transform: scale(1.05) translate3d(0, 0, 0);
}

/* Contact / Social Bento */
.contact-section {
    padding: 6rem 0;
}

.social-bento {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.social-link {
    aspect-ratio: 1;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.4s ease;
}

.social-link:hover {
    transform: scale(1.1) translate3d(0, 0, 0);
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
}

/* God Level Smooth Load Animations */
.fade-in {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Safe Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero { animation-delay: 0.1s; }
#about { transition-delay: 0.2s; }
#skills { transition-delay: 0.3s; }
#contact { transition-delay: 0.4s; }

/* Custom Scrollbar for God-Level Polish */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile Responsiveness & 120fps fixes */
@media (max-width: 900px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bento-item.large {
        grid-column: span 2;
        grid-row: span 1;
    }
    .bento-item.wide {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    /* Extreme performance optimizations for mobile (Zero Lag) */
    :root {
        --nav-bg: rgba(0, 0, 0, 0.85);
        --glass-bg: rgba(28, 28, 30, 0.85);
    }
    [data-theme="light"] {
        --nav-bg: rgba(255, 255, 255, 0.9);
        --glass-bg: rgba(255, 255, 255, 0.85);
    }

    .glow {
        display: none; /* Completely remove background glows on mobile */
    }
    
    .glass {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .apple-nav {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .nav-links {
        position: absolute;
        top: 120%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: var(--nav-bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 1.5rem 0;
        border-radius: 24px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        opacity: 0;
        pointer-events: none;
        transform: translate3d(0, -10px, 0);
        transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        gap: 1.5rem;
        /* Removed will-change to fix iOS Safari flickering bug */
    }
    
    .nav-links.active {
        opacity: 1;
        pointer-events: all;
        transform: translate3d(0, 5px, 0);
    }
    
    .nav-links a {
        font-size: 1.1rem;
        text-align: center;
        display: block;
    }
    
    .mobile-menu-btn {
        display: flex;
        padding: 0.5rem; /* Increase tap target size for better accessibility */
    }
}

@media (max-width: 600px) {
    .subtitle { font-size: 1.2rem; }
    
    .nav-content {
        padding: 0.6rem 1rem;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(200px, auto);
        gap: 1rem; /* Reduce gap for tiny screens */
    }
    
    .bento-item {
        padding: 1.5rem;
    }
    
    .bento-item.large, .bento-item.wide {
        grid-column: span 1;
        grid-row: auto;
    }
    
    .social-bento {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem; /* Reduce gap for tiny screens */
    }
    
    .social-link {
        font-size: 1.8rem;
        border-radius: 16px;
    }
    
    main {
        padding: 100px 15px 40px; /* Reduce padding for small screens */
    }
}

/* Custom Cursor for PC */
@media (pointer: fine) {
    body, a, button, .icon-btn, .social-link {
        cursor: none !important;
    }
    
    .custom-cursor, .custom-cursor-follower {
        position: fixed;
        pointer-events: none;
        z-index: 9999;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: transform 0.1s ease;
        mix-blend-mode: difference;
    }
    
    .custom-cursor {
        width: 8px;
        height: 8px;
        background-color: #fff;
    }
    
    .custom-cursor-follower {
        width: 32px;
        height: 32px;
        border: 2px solid #fff;
        opacity: 0.5;
        transition: transform 0.15s ease-out, width 0.2s, height 0.2s, background-color 0.2s, opacity 0.2s;
    }
    
    .custom-cursor-follower.hover {
        width: 48px;
        height: 48px;
        background-color: #fff;
        border-color: transparent;
        opacity: 0.2;
    }
}
