/* ========================================
   CSS Variables - Light Theme (Default)
   ======================================== */
:root {
    /* Colors - Trend 2026 */
    --bg: #fafaf9;
    --bg-primary: #fafaf9;
    --bg-secondary: #f5f5f4;
    --bg-tertiary: #e7e5e4;
    --surface: #f5f5f4;
    --text: #1c1917;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    --accent: #6366f1;
    --accent-primary: #6366f1;
    --accent-secondary: #4f46e5;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --border: #e7e5e4;
    --border-color: #e7e5e4;
    --code-bg: #f5f5f4;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
    
    /* Container */
    --container-padding: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
    --transition-base: 300ms ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* Font Sizes */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
}

/* ========================================
   CSS Variables - Dark Theme
   ======================================== */
[data-theme="dark"] {
    /* Colors - Trend 2026 */
    --bg: #0c0a09;
    --bg-primary: #0c0a09;
    --bg-secondary: #1c1917;
    --bg-tertiary: #292524;
    --surface: #1c1917;
    --text: #fafaf9;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #78716c;
    --accent: #818cf8;
    --accent-primary: #818cf8;
    --accent-secondary: #a5b4fc;
    --accent-hover: #a5b4fc;
    --accent-light: rgba(129, 140, 248, 0.08);
    --border: #292524;
    --border-color: #292524;
    --code-bg: #1c1917;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* ========================================
   CSS Reset
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    line-height: 1.6;
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg);
    overflow-x: hidden;
    width: 100%;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

/* ========================================
   Typography - Variable Fonts 2026
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300..700&display=swap');

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 400;
    font-variation-settings: 'wght' 400;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.6;
    letter-spacing: -0.01em;
}

.cursor-glow-surface {
    position: relative;
    isolation: isolate;
    --glow-x: 50%;
    --glow-y: 20%;
    --glow-opacity: 0;
}

.cursor-glow-surface::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(99, 102, 241, 0.12), transparent 11rem),
        radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(255, 255, 255, 0.12), transparent 5.5rem);
    opacity: var(--glow-opacity);
    transition:
        opacity 0.28s ease,
        background 0.12s linear;
}

[data-theme="dark"] .cursor-glow-surface::before {
    background:
        radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(129, 140, 248, 0.18), transparent 11rem),
        radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(255, 255, 255, 0.04), transparent 5.5rem);
}

.cursor-glow-surface > * {
    position: relative;
    z-index: 1;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    font-variation-settings: 'wght' 700;
    letter-spacing: -0.02em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* ========================================
   Buttons
   ======================================== */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

button:hover,
.btn:hover {
    background-color: var(--border);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

button:active,
.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

button:focus,
.btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    color: var(--accent);
    background-color: transparent;
    border-color: var(--accent);
}

.btn-secondary:hover {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-outline {
    border: 2px solid var(--accent);
    color: var(--accent);
    background-color: transparent;
}

.btn-outline:hover {
    background-color: var(--accent);
    color: #ffffff;
}

/* ========================================
   Container
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* ========================================
   Sections
   ======================================== */
section {
    padding: var(--spacing-2xl) 0;
}

.section-title {
    margin-bottom: var(--spacing-2xl);
    text-align: center;
}

/* ========================================
   Utilities
   ======================================== */
.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;
}

.highlight {
    color: var(--accent);
}

/* ========================================
   Selection
   ======================================== */
::selection {
    background-color: var(--accent);
    color: #ffffff;
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}

/* ========================================
   Scroll-Driven Animations 2026
   ======================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for cards */
.project-card.animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.project-card.animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.project-card.animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Enhanced focus states for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .cursor-glow-surface::before {
        display: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}
