/* =========================================== */
/* 01. GLOBAL RESET & VARIABLES (The Foundation) */
/* =========================================== */

/* Box Sizing Reset for consistent sizing across browsers */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS Custom Properties (Design Tokens) - Critical for modularity */
:root {
    --color-primary: #007bff; /* Primary Action Color */
    --color-secondary: #6c757d; /* Secondary/Text Color */
    --color-background: #f8f9fa; /* Light Background */
    --color-surface: #ffffff; /* Card/Surface Color */
    --color-text: #343a40; /* Main Text Color */
    --font-primary: 'Helvetica Neue', Arial, sans-serif;

    /* Spacing & Sizing Tokens */
    --spacing-unit: 1rem;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
    /* Smooth scrolling for single-page feel */
    scroll-behavior: smooth;
}

/* Global Container Setup - Limits width and centers content */
.container {
    width: 90%; /* Mobile safe margin */
    max-width: 1200px; /* Desktop maximum size */
    margin: 0 auto;
}

.section-padded {
    padding: calc(var(--spacing-unit) * 6) var(--spacing-unit);
}


/* =========================================== */
/* 02. BASE COMPONENTS (Typography & Buttons) */
/* =========================================== */

h1, h2, h3 {
    line-height: 1.2;
    margin-bottom: calc(var(--spacing-unit) * 0.5);
}

h1 { font-size: clamp(2rem, 6vw, 4rem); } /* Fluid typography using clamp() */
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-bottom: calc(var(--spacing-unit) * 2); }

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

/* Button Styles - Minimalist and high contrast */
.btn {
    display: inline-block;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: bold;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: 2px solid var(--color-primary);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-secondary);
}

/* =========================================== */
/* 03. HEADER & NAVIGATION (Mobile Default) */
/* =========================================== */

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    background-color: var(--color-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Mobile Nav List (Default stacking) */
.nav-list {
    display: none; /* Hidden by default on mobile */
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-surface);
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
}

/* Menu Toggle Button (Visible on mobile) */
.menu-toggle {
    display: block; /* Visible by default on mobile */
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

/* Nav Link Styling */
.nav-list li a {
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    display: block;
    border-bottom: 1px solid #eee;
}


/* =========================================== */
/* 04. SECTION STYLES (Mobile Default Flow) */
/* =========================================== */

#hero {
    text-align: center; /* Centered content on mobile */
    padding: calc(var(--spacing-unit) * 8) var(--spacing-unit);
}

.subheading {
    font-size: 1.2rem;
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--color-secondary);
}

.hero-actions .btn {
    margin: 0 5px; /* Small spacing between buttons on mobile */
}

/* About Section - Stacks vertically by default (Mobile First) */
.about-layout {
    display: flex;
    flex-direction: column; /* Stacked content for small screens */
    gap: calc(var(--spacing-unit) * 3);
    align-items: center;
}

.philosophy-image img {
    max-width: 100%; /* Ensure image scales down perfectly on mobile */
    height: auto;
    border-radius: 8px;
}


/* Skills Matrix - Stacks vertically by default (Mobile First) */
.skills-matrix {
    display: flex;
    flex-direction: column; /* Stacked categories for small screens */
    gap: calc(var(--spacing-unit) * 2);
}

.skill-category h3 {
    margin-bottom: var(--spacing-unit);
}

/* Skill Tags - Simple inline flow on mobile */
.skills-matrix .skill-tag {
    display: inline-block; /* Allows tags to wrap onto new lines if needed */
    background-color: #e9ecef;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem; /* Ensures tags wrap cleanly */
}

/* Project Grid - Single column stack by default (Mobile First) */
.project-grid {
    display: flex;
    flex-direction: column; /* Stacked cards on mobile */
    gap: calc(var(--spacing-unit) * 2);
}

.project-card {
    background-color: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: calc(var(--spacing-unit) * 2);
    text-align: center;
}

.project-card img {
    width: 100%; /* Full width on mobile */
    height: auto;
    border-radius: 4px;
    margin-bottom: var(--spacing-unit);
}


/* Contact Form - Simple vertical stacking (Mobile First) */
#contactForm {
    display: flex;
    flex-direction: column; /* Stacked fields on mobile */
    gap: calc(var(--spacing-unit) * 1.5);
    max-width: 600px; /* Constrain form width for readability */
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: bold;
}

.form-group input, .form-group textarea {
    width: 100%; /* Full width fields on mobile */
    padding: var(--spacing-unit);
    border: 1px solid #ccc;
    border-radius: 4px;
}


/* =========================================== */
/* 05. MEDIA QUERIES (Scaling Up - Tablet/Desktop) */
/* =========================================== */

/* --- TABLET & SMALL DESKTOP (min-width: 768px) --- */
@media screen and (min-width: 768px) {

    /* Navigation Behavior on larger screens */
    .menu-toggle { display: none; } /* Hide the hamburger icon */
    .nav-list {
        display: flex; /* Show nav list horizontally */
        flex-direction: row;
        position: static; /* Remove absolute positioning */
        box-shadow: none;
        width: auto;
    }
    .nav-list li a {
        border-bottom: none;
        padding: 0 calc(var(--spacing-unit) * 1.5);
    }

    /* About Section - Switches to two columns (Grid demonstration) */
    .about-layout {
        flex-direction: row; /* Side-by-side layout */
        align-items: center;
    }
    .philosophy-text, .philosophy-image {
        flex: 1; /* Equal distribution of space */
        padding: var(--spacing-unit);
    }

    /* Skills Matrix - Switches to two columns (Flex demonstration) */
    .skills-matrix {
        flex-direction: row;
        justify-content: space-around;
        text-align: center;
    }
    .skill-category {
        flex-basis: 45%; /* Gives categories roughly half the width */
    }

    /* Project Grid - Switches to a multi-column layout (Grid demonstration) */
    .project-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Fluid responsiveness */
        gap: calc(var(--spacing-unit) * 2);
    }

    /* Form adjustments for larger screens */
    .full-width {
        flex: 1; /* Allows the textarea to take up more space if needed */
    }
}

/* --- LARGE DESKTOP (min-width: 1024px) --- */
@media screen and (min-width: 1024px) {
    .container {
        max-width: 1300px; /* Slightly wider content area on large screens */
    }

    /* Hero actions spacing refinement for desktop */
    .hero-actions .btn {
        margin: 0 15px;
    }
}
