/* ===========================================================================
    SECTION 1: CSS VARIABLES & RESET
    Description: Defines your theme colors and global resets.
    How to change: Update the hex codes here to change the site's primary palette.
    ===========================================================================
*/
:root {
    --bg-color: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #595959;
    --accent-color: #000000;
    
    --font-main: "Helvetica Neue", Arial, sans-serif;
    
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
}

/* --- 2. Global Resets --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.5s ease, color 0.5s ease;
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 3. Layout Classes --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-padding {
    padding: var(--space-xl) 0;
}

.section-title {
    font-size: 2rem;
    margin-bottom: var(--space-lg);
    letter-spacing: -0.5px;
    border-bottom: 2px solid var(--text-primary);
    display: inline-block;
    padding-bottom: 0.5rem;
}

/* ===========================================================================
    SECTION 2: HEADER & NAVIGATION
    Description: Styles the logo, menu, and theme toggles.
    How to change: Modify .nav-container for spacing or .theme-btn for button look.
    ===========================================================================
*/
.site-header {
    padding: var(--space-md) 0;
    border-bottom: 1px solid #eaeaea;
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    transition: padding 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
/* Lock the toggle container width to prevent layout shifting */
.theme-btn-wrapper {
    width: auto; /* REMOVED 85px. This lets the Flexbox 'gap' space it perfectly */
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-bottom-color: transparent;
}

.nav-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); 
    align-items: center;
    width: 100%;
    max-width: 1400px; /* INCREASED: This lets the links travel further into the gray area */
    margin: 0 auto;
    padding: 0 40px; /* Optional: adds a slightly wider buffer from the screen edge */
}

/* Ensure the logo sits in the middle column */
.brand-logo {
    grid-column: 2; /* Explicitly place in the center */
    justify-self: center; /* Center within the center column */
    margin: 0;
    font-size: 2.5rem; 
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1; 
    transition: transform 0.3s ease; 
    transform-origin: center top; 
}



/* Ensure the nav stays on the right */
.primary-nav {
    grid-column: 3; /* Explicitly place in the third column */
    justify-self: end;
}


.site-header.scrolled .brand-logo {
    transform: scale(0.7); 
}

/* Styles the navigation list, makes links sit side-by-side,
 and anchors the scroll-shrink animation to the right edge */

/* Let's slightly widen the exact, even gap between all links */
.primary-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2rem; /* INCREASED from var(--space-md) to space them out beautifully */
    transition: transform 0.3s ease; 
    transform-origin: right center; 
}
#theme-icon {
    font-size: 1.2rem; /* Shrinks the icon down to align beautifully with the text */
    line-height: 1;
    display: block; /* Prevents tiny vertical alignment glitches */
}

.site-header.scrolled .primary-nav ul {
    transform: scale(0.85); 
}

.primary-nav a, .theme-btn {
    text-decoration: none;
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.primary-nav a:hover, .theme-btn:hover {
    color: var(--accent-color);
}

/* --- 5. Hero Section --- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center; /* Change to 'flex-start' if you want it left-aligned! */
    
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem var(--space-lg) 2rem var(--space-lg);
    box-sizing: border-box;
}

.hero h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    font-weight: 400; /* The thinnest actual weight for this font */
    color: #666666;
    line-height: 1.25;
    margin: 0; /* Let the .hero padding handle the spacing instead */
}

/* ===========================================================================
    SECTION 6: FOOTER
    Description: Bottom site branding and social links.
    How to change: Adjust .footer-grid for column count.
    ===========================================================================
*/
.site-footer {
    padding: var(--space-lg) 0;
    margin-top: var(--space-xl);
    border-top: 1px solid #eaeaea;
    background-color: var(--bg-color);
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr; /* Gives the brand column more space */
    gap: var(--space-md);
}


.footer-tagline {
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: 1rem;
    font-weight: 500;
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-links h4 {
    color: var(--text-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1.2rem;
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

/* Social Link Alignment */
.social-item {
    display: flex;
    align-items: center;
    gap: 0.6rem; /* Creates perfect spacing between the icon and the text */
}

/* Icon Sizing and Theme Magic */
.social-item svg {
    width: 18px;
    height: 18px;
    fill: currentColor; /* MAGIC TRICK: This makes the SVG exactly match your text color (dark mode, light mode, or hover state!) */
    transition: transform 0.2s ease;
}

/* Optional: Slight bounce effect on hover */
.social-item:hover svg {
    transform: translateY(-2px);
}



/* ===========================================================================
    SECTION 4: PROJECT & ABOUT SECTIONS
    Description: Handles the grid layouts and fade-in animations.
    How to change: Change 'gap' in .project-grid or 'threshold' in JS to adjust timing.
    ===========================================================================
*/
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-md);
}

.project-card {
    padding: var(--space-md);
    border: 1px solid #eaeaea; 
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.project-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.project-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-link:hover {
    color: var(--text-secondary);
}

/* --- 8. About Section --- */
.about-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.about-bio {
    flex: 2;
}

.lead-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.4;
}

.about-bio p:not(.lead-text) {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.about-skills {
    flex: 1;
    border-top: 1px solid #eaeaea;
    padding-top: var(--space-md);
}

.about-skills h4 {
    font-size: 1.2rem;
    margin-bottom: var(--space-md);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.skill-list {
    list-style: none;
}

.skill-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eaeaea;
    color: var(--text-secondary);
    font-size: 0.95rem;
}


/* --- 10. Contact Form --- */
.contact-form {
    max-width: 600px; 
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

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

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group input, .form-group textarea {
    padding: 0.75rem;
    border: 1px solid #eaeaea; 
    background-color: transparent;
    color: var(--text-primary);
    font-family: var(--font-main); 
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--text-primary);
}

.submit-btn {
    padding: 1rem 2rem;
    background-color: var(--text-primary);
    color: var(--bg-color);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    align-self: flex-start; 
    transition: opacity 0.2s ease;
}

.submit-btn:hover {
    opacity: 0.8;
}

/* --- 11. Theme Integrations --- */


/* Dark Mode Variables & SVG Fix */
[data-theme="dark"] {
    --bg-color: #121212; 
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --accent-color: #ffffff;
}

[data-theme="dark"] .site-header, 
[data-theme="dark"] .site-footer, 
[data-theme="dark"] .about-skills, 
[data-theme="dark"] .skill-list li, 
[data-theme="dark"] .project-card, 
[data-theme="dark"] .form-group input, 
[data-theme="dark"] .form-group textarea {
    border-color: #333333;
}

[data-theme="dark"] .logo-bg {
    fill: #1a1a1a; 
}
[data-theme="dark"] .logo-text {
    fill: #ffffff; 
}


/*==============================================
       --- Mobile Responsive Fixes --- 
 ===============================================
 
 */

 /* --- 9. Media Queries --- for Minimum Display size*/
@media (min-width: 768px) {
    .about-layout {
        flex-direction: row;
    }
    
    .about-skills {
        border-top: none;
        border-left: 1px solid #eaeaea;
        padding-top: 0;
        padding-left: var(--space-lg);
    }
}

 /* ---  Media Queries --- for Maximum Display size*/

@media (max-width: 768px) {
    
/* Pushes the entire header down away from the mobile notch/status bar */
    .site-header {
        padding-top: 1.5rem; 
    }

    /* 1 & 3. Stack the header items and adjust the nav container */
    .nav-container {
        display: flex;
        flex-direction: column;
        align-items: center; 
        gap: 0.5rem; /* DECREASED: Pulls the links up closer to the logo */
    }

    .primary-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* 2. Slightly shrink the logo text so it fits on narrow screens */
    .brand-logo {
        font-size: 1.75rem;
    }

    /* 4. Adjust the hero text size for mobile readability */
    .hero {
        min-height: auto;
        padding: 2rem 1.5rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    /* 5. Fix the "Scrolled" state on mobile */
    .site-header.scrolled {
        padding-top: 1.5rem; /* Keeps the logo safe from the notch when scrolling */
        padding-bottom: 1rem;
    }

    /* Disable the desktop shrink animation on mobile to prevent huge gaps */
    .site-header.scrolled .brand-logo,
    .site-header.scrolled .primary-nav ul {
        transform: none; 
    }
}

/* =========================================
   EASTER EGG: TRANSPARENT TEARDOWN UI
========================================= */

#raw-source-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    font-size: 1.15rem;
    font-family: monospace;
    opacity: var(--code-opacity, 0); 
    filter: blur(4px);
    padding: 2rem;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    pointer-events: none;
    overflow: hidden;
    color: var(--code-base);
    transition: opacity 0.5s ease, color 0.5s ease;
}

/* Force main containers to go transparent so we see the code */

/* Black Transparent Mode Variables */
[data-theme="black-trans"] {
    
    --bg-color: #0a0a0a !important; /* Solid black base */
    --text-primary: #ffffff !important;
    --text-secondary: #a1a1aa !important;
    --accent-color: #ffffff !important;
    
    
    --code-opacity: 0.85;
    --code-base: #5c6370;
    --syn-comment: #5c6370;
    --syn-string: #98c379;
    --syn-tag: #61afef;
    --syn-keyword: #c678dd;
    --syn-function: #e5c07b;
    --syn-attr: #d19a66;

    /* Glassmorphism Variables */
    --glass-bg: rgba(10, 10, 10, 0.65); /* 65% black for floating panels */
    --glass-border: rgba(255, 255, 255, 0.08); /* Faint white frosted edge */
    --header-glass-bg: rgba(10, 10, 10, 0.95); /* 95% black for the heavy header */
}


/* Make the borders slightly frosty in Transparent Mode */
[data-theme="black-trans"] .site-header, 
[data-theme="black-trans"] .site-footer, 
[data-theme="black-trans"] .about-skills, 
[data-theme="black-trans"] .skill-list li, 
[data-theme="black-trans"] .project-card, 
[data-theme="black-trans"] .form-group input, 
[data-theme="black-trans"] .form-group textarea {
    border-color: rgba(255, 255, 255, 0.1);
}


/* Syntax Highlight Colors */
.syn-comment { color: var(--syn-comment); transition: color 0.5s ease; }
.syn-string { color: var(--syn-string); font-weight: bold; transition: color 0.5s ease; }
.syn-tag { color: var(--syn-tag); font-weight: bold; transition: color 0.5s ease; }
.syn-keyword { color: var(--syn-keyword); font-weight: bold; transition: color 0.5s ease; }
.syn-function { color: var(--syn-function); font-weight: bold; transition: color 0.5s ease; }
.syn-attr { color: var(--syn-attr); transition: color 0.5s ease; }


/* ===========================================================================
    SECTION 3: GLOBAL GLASS AUTOMATION (Teardown Mode)
    Description: Forces frosted glass on elements when [data-theme="black-trans"] is active.
    How to change: Add classes to the exclusions list to prevent specific elements from getting glass.
    ===========================================================================

/*
 1. The Heavy Master Header (Unaffected by automation) */
[data-theme$="-trans"] .site-header {
    background: var(--header-glass-bg) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border) !important;
}

/* 2. AUTO-GLASS CONTAINERS: Forms, Footer, Cards (Maintain Full Layout Width) */
[data-theme$="-trans"] form,
[data-theme$="-trans"] .project-card,
[data-theme$="-trans"] .site-footer,
[data-theme$="-trans"] .about-content {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    padding: 2.5rem !important;
    margin-bottom: 2rem;
    width: 100%; /* FIX: Forces it to stretch to your grid's boundaries */
    box-sizing: border-box;
}

/* 3. AUTO-GLASS TEXT: Standalone Headings & Paragraphs */
/* (Removed 'ul' from this list so it stops breaking your nav & footer grids) */
[data-theme="black-trans"] h1,
[data-theme="black-trans"] h2,
[data-theme="black-trans"] h3,
[data-theme="black-trans"] p {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px;
    padding: 1rem 1.5rem !important;
    margin-bottom: 1.5rem;
    width: fit-content;
    max-width: 100%;
}

/* 4. ANTI-INCEPTION: Prevent boxes inside boxes (NON-DESTRUCTIVE) */
[data-theme="black-trans"] .site-header h1,
[data-theme="black-trans"] .site-header h2,
[data-theme="black-trans"] .site-header h3,
[data-theme="black-trans"] .site-header p,
[data-theme="black-trans"] .project-card h1,
[data-theme="black-trans"] .project-card h2,
[data-theme="black-trans"] .project-card h3,
[data-theme="black-trans"] .project-card p,
[data-theme="black-trans"] .site-footer h1,
[data-theme="black-trans"] .site-footer h2,
[data-theme="black-trans"] .site-footer h3,
[data-theme="black-trans"] .site-footer p,
[data-theme="black-trans"] .about-content h1,
[data-theme="black-trans"] .about-content h2,
[data-theme="black-trans"] .about-content h3,
[data-theme="black-trans"] .about-content p,
[data-theme="black-trans"] form h1,
[data-theme="black-trans"] form h2,
[data-theme="black-trans"] form h3,
[data-theme="black-trans"] form p {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important; /* Added to strip away the bottom margin that was stretching the header */
}

/* 5. Fix Form Spacing (Since anti-inception stripped it) */
[data-theme="black-trans"] form label {
    display: block !important;
    margin-bottom: 0.5rem !important;
}

/* 6. Fix Form Inputs */
[data-theme="black-trans"] form input:not([type="submit"]),
[data-theme="black-trans"] form textarea {
    background: rgba(0, 0, 0, 0.2) !important; /* Slightly darker inner-box */
    border: 1px solid var(--glass-border) !important;
    padding: 1rem !important;
    width: 100% !important; /* Forces inputs to stretch across the form */
    box-sizing: border-box;
    margin-bottom: 1.5rem !important;
    color: var(--text-primary) !important;
}

/* 7. FIX: Rescue the "Send Message" Button */
[data-theme="black-trans"] form button,
[data-theme="black-trans"] form input[type="submit"] {
    background: var(--text-primary) !important; /* Solid color based on theme */
    color: var(--bg-color) !important; /* Inverted text color */
    padding: 1rem 2rem !important;
    font-weight: bold !important;
    border-radius: 4px !important;
    cursor: pointer;
    width: max-content !important; /* Prevents button from stretching across the screen */
    margin-top: 0.5rem !important;
}

/* --- 9. Media Queries --- */
@media (min-width: 768px) {
    .about-layout {
        flex-direction: row;
    }
    
    .about-skills {
        border-top: none;
        border-left: 1px solid #eaeaea;
        padding-top: 0;
        padding-left: var(--space-lg);
    }
}
/* --- Mobile Responsive Fixes --- */
@media (max-width: 768px) {
    /* 1. Stack the header items instead of forcing them on one line */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem; /* Adds breathing room between the logo and the links */
        padding: 1.5rem; 
    }

    /* 2. Slightly shrink the logo text so it fits on narrow screens */
    .logo, .logo h1, .logo span { 
        font-size: 1.75rem; 
    }

    /* 3. Align the navigation links neatly under the logo */
    .nav-container {
        display: flex;
        flex-wrap: wrap; /* Allows links to drop to a new line if needed */
        gap: 1rem;
        width: 100%;
    }

    /* 4. Adjust the hero text size for mobile readability */
    .hero {
        min-height: auto;
        padding: 2rem 1.5rem;
    }
    
    .hero h1 {
        font-size: 2.25rem; /* Scales down your fancy font for mobile */
        line-height: 1.3;
        text-align: center; /* ADDED: This forces the two lines to balance in the middle */
    }
    /* Footer Mobile Fix */
    .footer-grid {
        grid-template-columns: 1fr; /* Stacks everything into 1 column on mobile */
        gap: var(--space-lg);
    }
} 

/* ==========================
    --- Hide Scrollbar --- 
   ===========================  */
/* For Chrome, Safari, and newer Edge */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

/* For Firefox, IE, and older Edge */
html, body {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}

/* ==========================================================================
   1. LIGHT MODE
   Selection: Black Background, White Text
   ========================================================================== */
[data-theme="light"] ::selection {
    background-color: #000000 !important;
    color: #FFFFFF !important;
}
[data-theme="light"] ::-moz-selection {
    background-color: #000000 !important;
    color: #FFFFFF !important;
}

/* ==========================================================================
   2. DARK MODE & TEARDOWN MODE ('black-trans')
   Selection: White Background, Black Text
   ========================================================================== */
[data-theme="dark"] ::selection,
[data-theme="black-trans"] ::selection {
    background-color: #FFFFFF !important;
    color: #000000 !important;
}

[data-theme="dark"] ::-moz-selection,
[data-theme="black-trans"] ::-moz-selection {
    background-color: #FFFFFF !important;
    color: #000000 !important;
}