/* ============================================
   GLASSMORPHISM + SHADCN/UI DESIGN SYSTEM
   + ACCESSIBILITY & PERFORMANCE IMPROVEMENTS
   ============================================ */

:root {
    /* Light Mode Colors */
    --primary: #0f172a;
    --primary-foreground: #f8fafc;
    --secondary: #475569;
    --secondary-foreground: #f1f5f9;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.1);
    --background: #f8fafc;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-solid: #ffffff;
    --border: rgba(203, 213, 225, 0.6);
    --border-strong: rgba(203, 213, 225, 0.9);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #8b5cf6;
    
    /* Glassmorphism */
    --glass-blur: 12px;
    --glass-saturation: 180%;
    
    /* Typography */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Container */
    --container-max: 1280px;
    --container-padding: 24px;
}

/* Dark Mode – improved contrast */
[data-theme="dark"] {
    --primary: #f8fafc;
    --primary-foreground: #0f172a;
    --secondary: #cbd5e1;
    --secondary-foreground: #1e293b;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: rgba(96, 165, 250, 0.15);
    --background: #0f172a;
    --surface: rgba(30, 41, 59, 0.85);  /* less transparency for better contrast */
    --surface-solid: #1e293b;
    --border: rgba(51, 65, 85, 0.7);
    --border-strong: rgba(51, 65, 85, 0.9);
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #a78bfa;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    color: var(--primary);
    background: var(--background);
    line-height: 1.6;
    transition: background var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
    position: relative;
}

/* Background gradient for depth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
}

[data-theme="dark"] body::before {
    background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h1 { font-size: clamp(2.5rem, 5vw, 3.75rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(2rem, 4vw, 2.5rem); letter-spacing: -0.02em; }
h3 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
p { color: var(--secondary); margin-bottom: var(--space-md); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: all var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    padding: var(--space-4xl) 0;
}
.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}
.section-header p {
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.125rem;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-xl);
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ============================================
   GLASSMORPHISM COMPONENTS
   ============================================ */

.card,
.hero-gradient,
.slider-container,
.modal-content {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
}
.card {
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

/* Navbar (glass) */
.navbar {
    position: sticky;
    top: 0;
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) 0;
    z-index: 1000;
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}
.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.nav-profile-img {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--accent);
    transition: transform 0.2s;
}
.nav-links {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
}
.nav-links a {
    color: var(--secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    position: relative;
}
.nav-links a.active {
    color: var(--accent);
    font-weight: 600;
}
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: var(--radius-full);
}
.theme-toggle {
    background: rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.2s;
}
[data-theme="dark"] .theme-toggle {
    background: rgba(255,255,255,0.06);
}
.theme-toggle:hover {
    background: var(--accent-light);
    transform: scale(0.98);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}
.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
}
.btn-secondary:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}
.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}
/* Larger hero buttons on desktop */
@media (min-width: 768px) {
    .hero-buttons .btn {
        padding: 12px 28px;
        font-size: 1rem;
    }
}

/* Form validation styles */
input.error, textarea.error {
    border-color: var(--error) !important;
}
.error-message {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: var(--space-xs);
    display: none;
}
.error-message.show {
    display: block;
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-md);
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Slider dots */
.slider-dots {
    text-align: center;
    margin-top: var(--space-md);
}
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    margin: 0 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

/* Focus outlines for accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
button:focus-visible, a:focus-visible, .theme-toggle:focus-visible {
    outline-offset: 2px;
}
:focus:not(:focus-visible) {
    outline: none;
}

/* Profile image */
.profile-img {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-2xl);
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}
.profile-img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: var(--space-xl);
    margin-bottom: var(--space-xl);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 2px;
    height: calc(100% - 8px);
    background: linear-gradient(to bottom, var(--accent), var(--border));
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
}

/* Tags */
.tag {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

/* Filters */
.filter-btn {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border: 1px solid var(--border);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--secondary);
    font-weight: 500;
}
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}
label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--primary);
    font-size: 0.875rem;
}
input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--primary);
    transition: all var(--transition-fast);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border-radius: var(--radius-2xl);
    max-width: 500px;
    width: 90%;
    padding: var(--space-xl);
    animation: modalSlideIn 0.25s ease-out;
}
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 3000;
}
.toast {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-sm);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: slideIn 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.footer {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border-top: 1px solid var(--border);
    padding: var(--space-3xl) 0;
    margin-top: var(--space-4xl);
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
    animation: fadeUp var(--transition-base) forwards;
}

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        backdrop-filter: blur(var(--glass-blur));
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-lg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }
    .nav-links.active { display: flex; }
    .section { padding: var(--space-3xl) 0; }
    .profile-img { width: 120px; height: 120px; }
    .slide img { height: 250px; }
    .grid-2, .grid-3, .grid-4 { gap: var(--space-lg); }
    .hero-buttons .btn { padding: 8px 20px; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1536px) {
    :root { --container-max: 1440px; }
}

.global-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    backdrop-filter: blur(12px);
    border-radius: 50px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: slideUp 0.3s ease;
    border-left: 4px solid;
}
.global-toast.success { border-left-color: var(--success); }
.global-toast.error { border-left-color: var(--error); }
.global-toast.info { border-left-color: var(--info); }
@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}