/* ========================================
   CSS Custom Properties (Design Tokens)
   Modern light-dark() implementation
   ======================================== */

:root {
    color-scheme: light dark;

    /* ========================================
       Brand Colors
       ======================================== */
    --primary-color: #6c5ce7;
    --primary-dark: #5b4bc4;
    --primary-light: #a855f7;

    --secondary-color: #4ecdc4;
    --secondary-dark: #3db8b0;
    --secondary-light: #06b6d4;

    --accent-color: #ff6b9d;
    --accent-dark: #ec4899;
    --accent-light: #fbb6ce;

    /* Gradient-specific colors */
    --blue-navy: #0a1b76;

    /* ========================================
       Neutral Colors (Theme-Aware)
       ======================================== */
    --text-color: light-dark(#1f2937, #f9fafb);
    --text-secondary: light-dark(#6b7280, #d1d5db);
    --text-tertiary: light-dark(#9ca3af, #9ca3af);
    --text-inverse: light-dark(#ffffff, #000000);

    --bg-color: light-dark(#ffffff, #000000);
    --bg-secondary: light-dark(#f9fafb, #101012);
    --bg-tertiary: light-dark(#f3f4f6, #18181b);

    --border-color: light-dark(#e5e7eb, #52525b);
    --border-secondary: light-dark(#d1d5db, #71717a);

    /* ========================================
       Surface Colors (Cards, Modals, Elevated Elements)
       ======================================== */
    --surface-1: light-dark(#ffffff, #18181b);
    --surface-2: light-dark(#f9fafb, #27272a);
    --surface-3: light-dark(#f3f4f6, #3f3f46);

    /* ========================================
       Semantic Colors (States)
       ======================================== */
    --color-success: light-dark(#10b981, #34d399);
    --color-success-bg: light-dark(#d1fae5, rgba(52, 211, 153, 0.15));

    --color-error: light-dark(#ef4444, #f87171);
    --color-error-bg: light-dark(#fee2e2, rgba(248, 113, 113, 0.15));

    --color-warning: light-dark(#f59e0b, #fbbf24);
    --color-warning-bg: light-dark(#fef3c7, rgba(251, 191, 36, 0.15));

    --color-info: light-dark(#3b82f6, #60a5fa);
    --color-info-bg: light-dark(#dbeafe, rgba(96, 165, 250, 0.15));

    /* ========================================
       Interactive Colors
       ======================================== */
    --color-focus: light-dark(var(--primary-color), var(--secondary-color));
    --color-disabled: light-dark(#9ca3af, #6b7280);
    --color-disabled-bg: light-dark(#f3f4f6, #27272a);

    /* ========================================
       Component-Specific Colors
       ======================================== */
    /* Buttons */
    --btn-primary-text: light-dark(#1f2937, #ffffff);
    --btn-secondary-bg: light-dark(rgba(108, 92, 231, 0.1), rgba(192, 132, 252, 0.15));

    /* Tags/Badges */
    --tag-bg: light-dark(#f3e8ff, rgba(192, 132, 252, 0.25));
    --tag-border: light-dark(#e9d5ff, rgba(192, 132, 252, 0.4));
    --tag-text: var(--primary-color);

    /* Forms */
    --input-bg: light-dark(var(--bg-color), var(--bg-secondary));
    --input-border: var(--border-color);
    --input-focus-border: var(--color-focus);
    --input-placeholder: var(--text-tertiary);

    /* ========================================
       Section Backgrounds (Improved Contrast)
       ======================================== */
    --section-bg-odd: light-dark(rgba(249, 250, 251, 0.95), rgba(22, 22, 23, 0.95));
    --section-bg-even: light-dark(rgba(229, 231, 235, 0.95), rgba(34, 34, 38, 0.95));

    /* Card colors - Match section pattern */
    --card-bg-odd: var(--bg-color);
    --card-bg-even: var(--bg-color);

    /* Scoped section variables (inherited by children) */
    --section-bg: var(--section-bg-odd);
    --card-bg: var(--card-bg-odd);
    --card-shadow: var(--shadow-sm);

    /* ========================================
       Gradients
       ======================================== */
    --gradient-primary: linear-gradient(135deg,
        var(--primary-color) 0%,
        var(--accent-color) 50%,
        var(--secondary-color) 100%
    );

    --gradient-secondary: linear-gradient(135deg,
        var(--secondary-color) 0%,
        var(--primary-color) 50%,
        var(--blue-navy) 100%
    );

    --gradient-name: linear-gradient(90deg,
        var(--primary-color) 0%,
        var(--primary-light) 25%,
        var(--accent-dark) 50%,
        var(--secondary-light) 75%,
        var(--secondary-color) 100%
    );

    /* ========================================
       Opacity Scale
       ======================================== */
    --opacity-overlay: 0.95;
    --opacity-hover: 0.8;
    --opacity-disabled: 0.5;
    --opacity-subtle: 0.25;
    --opacity-ghost: 0.15;
    --opacity-barely: 0.05;

    /* ========================================
       Focus Ring (Accessibility)
       ======================================== */
    --focus-ring-color: var(--color-focus);
    --focus-ring-width: 2px;
    --focus-ring-offset: 3px;
    --focus-ring-style: solid;

    /* ========================================
       Effects - Using light-dark() for shadows
       ======================================== */
    --shadow-sm: light-dark(0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.5));
    --shadow-md: light-dark(0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 4px 8px -1px rgba(0, 0, 0, 0.6));
    --shadow-lg: light-dark(0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 10px 20px -3px rgba(0, 0, 0, 0.7));
    --shadow-xl: light-dark(0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 20px 30px -5px rgba(0, 0, 0, 0.8));

    /* ========================================
       Spacing
       ======================================== */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* ========================================
       Z-Index Scale
       ======================================== */
    --z-base: 1;
    --z-section-2: 2;
    --z-section-3: 3;
    --z-section-4: 4;
    --z-section-5: 5;
    --z-navbar: 1000;
    --z-modal: 2000;
    --z-tooltip: 3000;
    --z-skip-link: 10000;

    /* ========================================
       Layout
       ======================================== */
    --navbar-height: 70px;
    --container-max-width: 1200px;
    --section-padding-block: clamp(2rem, 5vw, 4rem);

    /* ========================================
       Typography
       ======================================== */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-display: 'Sen', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display-heavy: 'Techna Sans', 'Sen', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', 'Courier', monospace;
    --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: 2rem;
    --font-size-4xl: 2.5rem;
    --font-size-5xl: 3rem;

    /* ========================================
       Border & Transitions
       ======================================== */
    --border-radius: 0.5rem;
    --transition: all 0.3s ease;
}

/* ========================================
   CSS Cascade Layers
   Defines explicit order of precedence
   ======================================== */
@layer reset, base, layout, sections, components, utilities, animations;

/* ========================================
   CSS @property Declarations
   Enables smooth animation of custom properties
   ======================================== */
@property --shimmer-position {
    syntax: '<percentage>';
    initial-value: 200%;
    inherits: false;
}

@property --glow-intensity {
    syntax: '<number>';
    initial-value: 1;
    inherits: false;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
@layer reset {
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    /* Remove default focus for mouse users, keep for keyboard */
    *:focus:not(:focus-visible) {
        outline: none;
    }
}

@layer base {
    /* Smooth theme transitions - only active during theme change */
    html.theme-transitioning,
    html.theme-transitioning * {
        transition: background-color 0.8s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
    }

    html {
        scroll-behavior: smooth;
    }

    body {
        font-family: var(--font-primary);
        font-size: var(--font-size-base);
        line-height: 1.6;
        color: var(--text-color);
        background-color: var(--bg-color);
        transition: background-color 0.3s ease, color 0.3s ease;
        /* Background image is set dynamically via JavaScript */
        background-repeat: repeat;
        background-size: auto;
        background-attachment: scroll;
        overflow-x: hidden;
        font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    a {
        text-decoration: none;
        color: inherit;
        transition: var(--transition);
    }

    img {
        max-width: 100%;
        height: auto;
    }

    /* Accessibility - Focus Indicators */
    *:focus-visible {
        outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
        outline-offset: var(--focus-ring-offset);
        border-radius: 0.25rem;
    }
}

/* ========================================
   Layout & Utilities
   ======================================== */
@layer utilities {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 var(--spacing-md);
    }

    .gradient-text {
        background: var(--gradient-primary);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .section-title {
        font-family: var(--font-display-heavy);
        font-size: clamp(1.75rem, 5vw, 3rem);
        font-weight: 700;
        text-align: center;
        margin-bottom: var(--spacing-md);
        position: relative;
        font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1, "ss01" 1;

        &::after {
            content: '';
            display: block;
            width: 80px;
            height: 4px;
            background: var(--gradient-primary);
            margin: var(--spacing-sm) auto 0;
            border-radius: 2px;
        }
    }

    .middle-initial {
        font-family: var(--font-mono);
        font-weight: 500;
    }
}

/* ========================================
   Navigation
   ======================================== */
@layer layout {
    .navbar {
        position: fixed;
        top: 0;
        width: 100%;
        background-color: var(--bg-color);
        backdrop-filter: blur(10px);
        border-bottom: none;
        box-shadow: var(--shadow-sm);
        z-index: var(--z-navbar);
        transform: translateY(-100%);
        animation: navbarReveal linear both;
        animation-timeline: scroll();
        animation-range: 50vh 70vh;
        transition: transform 0.3s ease;

        &.hovered {
            animation: none !important;
            transform: translateY(0) !important;
        }
    }

    .nav-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: var(--spacing-sm) var(--spacing-md);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-logo {
        font-family: var(--font-display);
        font-size: var(--font-size-xl);
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        text-decoration: none;
        transition: transform 0.15s ease-out;
        border-radius: 0.375rem;
        padding: 0.25rem 0.5rem;
        margin: -0.25rem -0.5rem;
        position: relative;

        &:hover {
            transform: scale(1.02);

            .site-title {
                filter: brightness(1.1);
            }

            .logo-tooltip {
                opacity: 1;
                transform: translate(-50%, 0);
            }
        }

        &:focus-visible {
            outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
            outline-offset: 4px;
            border-radius: 0.375rem;
        }
    }

    .site-title {
        background: var(--gradient-name);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1;
        background-size: 100% 100%;
        transition: filter 0.15s ease-out;
    }

    /* Logo tooltip */
    .logo-tooltip {
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 50%;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 0.25rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        color: var(--text-tertiary);
        box-shadow: var(--shadow-sm);
        font-family: var(--font-primary);
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        transform: translate(-50%, -0.25rem);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .nav-menu {
        display: flex;
        list-style: none;
        gap: var(--spacing-md);
        border-radius: .3rem;
        flex: 1;
        justify-content: center;
    }

    .nav-link {
        color: var(--text-color);
        font-weight: 500;
        padding: var(--spacing-xs) var(--spacing-sm);
        border-radius: var(--border-radius);
        transition: var(--transition);

        &:hover {
            color: var(--primary-color);
            background-color: var(--bg-secondary);
        }
    }

    .nav-actions {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .hamburger {
        display: none;
        flex-direction: column;
        cursor: pointer;
        gap: 4px;
        background-color: var(--bg-color);
        border: none;

        .bar {
            width: 25px;
            height: 3px;
            background-color: var(--text-color);
            border-radius: 2px;
            transition: var(--transition);
        }
    }

    /* Parallax Background Layer */
    .parallax-background {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: var(--z-section-5);
        background-repeat: repeat;
        background-size: auto;
        background-attachment: scroll;
        pointer-events: none;
        mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 1) 100%);
        -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 20%, rgba(0, 0, 0, 1) 100%);
    }
}

/* ========================================
   Shared Section Properties
   ======================================== */
@layer sections {
    .hero,
    .about,
    .skills,
    .projects,
    .contact {
        min-height: 100vh;
        position: sticky;
        top: 0;
        contain: paint;
        background: var(--section-bg);
    }

    /* Section positioning with scoped variables */
    section[data-position="odd"] {
        --section-bg: var(--section-bg-odd);
        --card-bg: var(--card-bg-odd);
        --card-shadow: var(--shadow-sm);
    }

    section[data-position="even"] {
        --section-bg: var(--section-bg-even);
        --card-bg: var(--card-bg-even);
        --card-shadow: var(--shadow-md);
    }
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    overflow: hidden;
    anchor-name: --hero;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.4);
    width: 600px;
    height: 600px;
    background-image: url('/images/cif-mark.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    filter: drop-shadow(0 0 20px rgba(91, 75, 196, 0.2));
    z-index: 0;
}

@keyframes cifGlow {
    0%, 100% {
        filter: drop-shadow(0 0 30px rgba(108, 92, 231, 0.4)) drop-shadow(0 0 60px rgba(108, 92, 231, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(108, 92, 231, 0.5)) drop-shadow(0 0 80px rgba(108, 92, 231, 0.35));
    }
}


.hero-content {
    max-width: 900px;
    position: relative;
    z-index: var(--z-base);
    animation: heroParallax linear forwards;
    animation-timeline: scroll();
    animation-range: 0 100vh;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--gradient-secondary);
    color: white;
    border-radius: 2rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    animation: fadeInDown 0.8s ease-out;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 6.5rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.05;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1, "ss01" 1;
}

.hero-greeting {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 500;
    color: var(--text-secondary);
    animation: fadeInLeft 0.8s ease-out;
}

.hero-name {
    animation: fadeInRight 1s ease-out;
    letter-spacing: -0.02em;
    color: light-dark(var(--primary-dark), var(--primary-color));
    position: relative;
    word-wrap: break-word;
    hyphens: manual;
    font-family: var(--font-display-heavy);
    font-weight: 700;
}

.hero-name::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    background-position: var(--shimmer-position) center;
    opacity: var(--opacity-hover);
    animation: shimmerOnce 10s ease-in-out 2s 1 forwards;
}

.hero-tagline {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4.5vw, 2.75rem);
    font-weight: 700;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-color);
    font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1;
}

.rotating-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    filter: brightness(var(--glow-intensity));
    animation: textGlow 3s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: calc(var(--spacing-lg) * 1.5);
    line-height: 1.6;
    max-width: min(100%, 45ch);
    margin-left: auto;
    margin-right: auto;
    text-wrap: balance;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
    animation: fadeInUp 1.2s ease-out;
}

/* ========================================
   Buttons Component (with CSS Nesting)
   ======================================== */
@layer components {
    .btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 1rem 2rem;
        border-radius: 0.75rem;
        font-weight: 600;
        font-size: var(--font-size-base);
        transition: all 0.3s ease;
        cursor: pointer;
        border: 2px solid transparent;
        position: relative;
        overflow: hidden;
        letter-spacing: -0.01em;

        &::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        &:hover::before {
            width: 800px;
            height: 800px;
        }
    }

    .btn-primary {
        background: var(--gradient-primary);
        color: var(--btn-primary-text);
        box-shadow: 0 4px 15px rgba(192, 132, 252, 0.4);

        &:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(192, 132, 252, 0.5);

            svg {
                transform: translateX(5px);
            }
        }

        svg {
            transition: transform 0.3s ease;
        }
    }

    .btn-secondary {
        background: var(--btn-secondary-bg);
        color: var(--primary-color);
        border-color: var(--primary-color);
        backdrop-filter: blur(10px);

        &:hover {
            background: var(--primary-color);
            color: white;
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(192, 132, 252, 0.3);
        }
    }
}

.hero-stats {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
    animation: fadeInUp 1.4s ease-out;
}

.hero-stat {
    text-align: center;
    padding: var(--spacing-sm);
    min-width: 100px;
}

.stat-value {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.hero-scroll {
    position: absolute;
    bottom: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--primary-color);
    font-size: var(--font-size-sm);
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.hero-scroll:hover {
    color: var(--primary-dark);
    transform: translateY(-4px);
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-left: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(-45deg);
    border-radius: 2px;
}

/* ========================================
   Shared Card Properties
   ======================================== */
.about-card,
.skill-card,
.project-card,
.contact-form,
.contact-link {
    border-radius: var(--border-radius);
    border: 1px solid transparent;
}

/* Cards inherit background and shadow from section scope */
.about-card,
.skill-card,
.project-card,
.contact-form,
.contact-link {
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

/* Shared card heading styles */
.about-card h3,
.skill-card h3,
.project-content h3 {
    font-family: var(--font-display);
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Shared grid container styles */
.about-main,
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    container-type: inline-size;
}

/* Shared tag styles */
.tag,
.tech-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: 1px solid var(--tag-border);
    transition: var(--transition);
}

a.tag:hover,
a.tech-tag:hover {
    background: var(--gradient-primary);
    color: var(--btn-primary-text);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   About Section
   ======================================== */
.about {
    padding: var(--spacing-xl) 0;
}


.about-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.about-intro {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    margin-bottom: 0;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.about-intro {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.about-lead {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    line-height: 1.7;
    color: var(--text-color);
    font-weight: 500;
    text-wrap: balance;
}

.about-main {
    gap: var(--spacing-sm);
}

.about-card {
    padding: var(--spacing-sm) var(--spacing-md);
}


.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-list li {
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.about-list li:last-child {
    margin-bottom: 0;
}

.about-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* Container queries for about cards */
@container (max-width: 350px) {
    .about-card {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .about-card h3 {
        font-size: var(--font-size-lg);
    }
}

/* ========================================
   Skills Section
   ======================================== */
.skills {
    padding: var(--spacing-xl) 0;
}


.skills-grid {
    gap: var(--spacing-md);
}

.skill-card {
    padding: var(--spacing-md);
}


.skill-card p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

/* Container queries for skill cards */
@container (max-width: 350px) {
    .skill-card {
        padding: var(--spacing-sm);
    }

    .skill-card h3 {
        font-size: var(--font-size-lg);
    }
}

/* ========================================
   Projects Section
   ======================================== */
.projects {
    padding: var(--spacing-xl) 0;
}


.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-md);
    container-type: inline-size;
}

.project-image {
    width: 100%;
    height: 200px;
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.project-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: var(--transition);
}

/* RAG Backend architecture diagram (first card) */
.project-card:first-child .project-image img {
    object-fit: contain;
    background-color: var(--surface-1);
}


/* RAG Frontend screenshot (second card) */
.project-card:nth-child(2) .project-image img {
    object-fit: cover;
    object-position: bottom;
    background-color: var(--surface-1);
}


/* Faux Threads logo (third card) */
.project-card:nth-child(3) .project-image img {
    object-fit: contain;
    background-color: var(--bg-tertiary);
}

.project-image h3 {
    font-size: 1.5rem;
    padding: var(--spacing-md);
    text-align: center;
}

.project-content {
    padding: var(--spacing-md);
}

.project-content h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.project-content h3 a:hover {
    color: var(--primary-color);
}

.project-content p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

/* Container queries for project cards */
@container (max-width: 380px) {
    .project-card {
        min-width: 0;
    }

    .project-image {
        height: 160px;
    }

    .project-content {
        padding: var(--spacing-sm);
    }

    .project-content h3 {
        font-size: var(--font-size-lg);
    }
}

/* ========================================
   Contact Section
   ======================================== */
.contact {
    padding: var(--spacing-xl) 0;
}


.contact-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.contact-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin: var(--spacing-sm) auto 0;
    line-height: 1.6;
    text-wrap: balance;
}

.contact-wrapper {
    max-width: 800px;
    margin: 0 auto;
    container-type: inline-size;
}

.contact-form {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}


.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group textarea {
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    transition: var(--transition);
    color: var(--text-color);
    background-color: var(--bg-secondary);
}


.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 140px;
}

.form-status {
    margin-top: var(--spacing-sm);
    text-align: center;
    font-size: var(--font-size-sm);
}

.contact-form .btn {
    margin-top: var(--spacing-sm);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.contact-links {
    text-align: center;
}

.contact-links-label {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-sm);
}

.contact-options {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    font-weight: 500;
    transition: var(--transition);
}


.contact-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.contact-link svg {
    flex-shrink: 0;
}

/* Container queries for contact section */
@container (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .contact-options {
        flex-direction: column;
    }

    .contact-link {
        justify-content: center;
    }
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: var(--spacing-md) 0;
    border-top: none;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: var(--z-navbar);
}


.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
}

.social-links a {
    color: var(--text-color);
    opacity: var(--opacity-hover);
    transition: var(--transition);
}

.social-links a:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* ========================================
   Animations
   ======================================== */
@layer animations {
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes bounce {
        0%, 20%, 50%, 80%, 100% {
            transform: translateY(0);
        }
        40% {
            transform: translateY(-10px);
        }
        60% {
            transform: translateY(-5px);
        }
    }

    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(-30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeInLeft {
        from {
            opacity: 0;
            transform: translateX(-30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes fadeInRight {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    @keyframes textGlow {
        0%, 100% {
            --glow-intensity: 1;
        }
        50% {
            --glow-intensity: 1.2;
        }
    }

    @keyframes shimmerOnce {
        from {
            --shimmer-position: 200%;
        }
        to {
            --shimmer-position: -200%;
        }
    }

    /* Scroll-Driven Animations */
    @keyframes navbarReveal {
        from {
            transform: translateY(-100%);
        }
        to {
            transform: translateY(0);
        }
    }

    /* Card fade-in animations using CSS view() timeline */
    @keyframes cardFadeIn {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .skill-card,
    .project-card,
    .about-card,
    .stat-card {
        animation: cardFadeIn linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 25%;
    }
}

/* ========================================
   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;
    }

    /* Disable scroll-driven animations */
    .hero-content,
    .navbar,
    .skill-card,
    .project-card,
    .about-card,
    .stat-card {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }

    /* Keep navbar visible for reduced motion users */
    .navbar {
        transform: translateY(0) !important;
    }
}

/* ========================================
   Responsive Design
   Note: Typography uses different clamp() values at different breakpoints
   to achieve optimal scaling behavior across viewport sizes. This is intentional
   as viewport units scale differently at various widths.
   ======================================== */

/* Mobile and tablet */
@media (max-width: 768px) {
    .nav-container {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .nav-logo {
        font-size: var(--font-size-lg);
        padding: 0.2rem 0.4rem;
        margin: -0.2rem -0.4rem;
        flex-shrink: 1;
        min-width: 0;
    }

    .site-title {
        font-size: inherit;
        white-space: nowrap;
    }

    .nav-actions {
        flex-shrink: 0;
    }

    .nav-menu {
        display: flex;
        position: fixed;
        left: -100%;
        top: var(--navbar-height);
        flex-direction: column;
        background-color: var(--bg-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md);
        border-radius: .3rem;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active {
        background-color: var(--bg-color);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .hero-title {
        font-size: clamp(3.25rem, 13vw, 5.5rem);
        gap: 0.25rem;
        line-height: 1.05;
    }

    .hero-greeting {
        font-size: clamp(1rem, 3.5vw, 1.5rem);
        font-weight: 500;
    }

    .hero-tagline {
        font-size: clamp(1.5rem, 5.5vw, 2.25rem);
        font-weight: 700;
    }

    .hero-subtitle {
        font-size: clamp(0.95rem, 2.75vw, 1.15rem);
        opacity: 0.9;
    }

    .section-title {
        font-size: var(--font-size-3xl);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-stats {
        gap: var(--spacing-md);
    }

    .hero-stat {
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-lg: 3rem;
        --spacing-xl: 4rem;
    }

    .nav-logo {
        font-size: var(--font-size-base);
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-title {
        font-size: clamp(2.75rem, 14vw, 4rem);
        line-height: 1.05;
    }

    .hero-tagline {
        font-size: clamp(1.35rem, 6vw, 1.85rem);
    }

    .section-title {
        font-size: var(--font-size-2xl);
    }
}

/* ========================================
   Theme Toggle Button
   ======================================== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-md);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Theme icon content switches based on theme */
.theme-icon {
    font-style: normal;
    font-size: 2rem;
}

/* Theme toggle icon - default light mode */
.theme-icon::before {
    content: '◐'; /* Light mode icon */
}

/* Dark mode overrides - fallback for no JS */
@media (prefers-color-scheme: dark) {
    .theme-icon::before {
        content: '◑'; /* Dark mode icon */
    }

    .hero-background::before {
        opacity: 0.06;
        filter: invert(1) brightness(1.5) drop-shadow(0 0 30px rgba(108, 92, 231, 0.5)) drop-shadow(0 0 60px rgba(108, 92, 231, 0.4));
    }
}

/* JavaScript-controlled dark mode (overrides media query when toggled) */
.dark-mode .theme-icon::before {
    content: '◑'; /* Dark mode icon */
}

.dark-mode .hero-background::before {
    opacity: 0.06;
    filter: invert(1) brightness(1.5) drop-shadow(0 0 30px rgba(108, 92, 231, 0.5)) drop-shadow(0 0 60px rgba(108, 92, 231, 0.4));
}

/* ========================================
   Accessibility 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-width: 0;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 0;
    background: var(--bg-color);
    color: var(--text-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    text-decoration: none;
    z-index: var(--z-skip-link);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-sm);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: var(--spacing-xs);
}
