/* --- CSS Variables --- */
:root {
    --bg-color: #fafbf9;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --accent-color: #475569;
    --card-bg: #FFFFFF;
}

/* --- Basic Reset & Typography --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-top: 45px;
}

/* --- Layout Container --- */
.container {
    max-width: 1310px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.site-header { padding: 80px 0 60px; text-align: center; }
.site-header h1 { font-size: 2.5rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
.site-header .subtitle { font-size: 1.1rem; color: var(--text-muted); font-weight: 300; }

/* --- Navigation --- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: var(--bg-color);
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 14px 20px;
}
.site-nav a {
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.site-nav a:hover { color: var(--text-main); }

/* --- Portfolio Grid --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
    column-gap: 32px;
    row-gap: 40px;
    margin-bottom: 80px;
}

/* --- Project Cards --- */
.project-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #E5E7EB;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: relative;
}
.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.10);
}

.project-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background-color: #000000;
    display: block;
    border-bottom: 1px solid #f1f5f9;
    pointer-events: none;
    user-select: none;
}
.project-info { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.project-title-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.project-title { font-size: 1.25rem; font-weight: 600; }
.project-year { font-size: 0.85rem; color: var(--text-muted); }
.project-desc { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 16px; }

.watch-link {
    display: inline-block;
    text-decoration: none;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    margin-top: auto;
}
.watch-link:visited { color: var(--accent-color); }
.watch-link:hover { color: var(--text-main); }
.watch-link::after { content: ''; position: absolute; inset: 0; }

/* ========================================== */
/* --- Category Demarcations              --- */
/* ========================================== */
.category-header {
    grid-column: 1 / -1; /* CRITICAL: Forces the header to span across all grid columns */
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 30px; /* Gives extra breathing room above new sections */
    margin-bottom: -10px; /* Pulls the cards slightly closer to the header */
    scroll-margin-top: 60px;
}

/* Remove the top margin for the very first header so it stays flush with the top */
.portfolio-grid .category-header:first-child {
    margin-top: 0;
}

.category-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase; /* Makes it feel cinematic and formal */
    letter-spacing: 0.15em;
    color: var(--text-muted);
    white-space: nowrap; /* Prevents the text from stacking awkwardly on small phones */
}

.category-line {
    flex-grow: 1; /* Automatically stretches the line to fill all remaining empty space */
    height: 1px;
    background-color: #E5E7EB; /* A soft grey that perfectly matches your other borders */
}


/* ========================================== */
/* --- Modal Overlay & Content            --- */
/* ========================================== */
.modal-window {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(31, 41, 55, 0.9);
    z-index: 999; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-window.is-open { opacity: 1; pointer-events: auto; }

/* The invisible full-screen button that closes the modal */
.modal-overlay-close {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    cursor: default; z-index: 1;
}

.modal-content {
    background-color: var(--card-bg); width: 100%; max-width: 800px;
    max-height: 90vh; overflow-y: auto; padding: 40px; border-radius: 8px;
    position: relative; z-index: 2; /* Sits above the invisible close button */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px); transition: transform 0.3s ease;
}
.modal-window.is-open .modal-content { transform: translateY(0); }

.modal-close {
    position: absolute; top: -4px; right: 16px; font-size: 2.5rem;
    color: var(--text-muted); text-decoration: none; line-height: 1;
    transition: color 0.2s ease; z-index: 3;
}
.modal-close:hover { color: var(--text-main); }

/* --- Video Embed Container --- */
.video-wrapper {
    position: relative; width: 100%; aspect-ratio: 16 / 9;
    background: #000; margin-bottom: 24px; border-radius: 6px; overflow: hidden;
}
.video-wrapper iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}

/* --- Modal Typography Adjustments --- */
.modal-subtitle { font-size: 1rem; color: var(--text-muted); font-weight: 600; }
.modal-credits {
    background-color: var(--bg-color); padding: 24px; border-radius: 6px;
    margin-top: 24px; font-size: 0.9rem; color: var(--text-muted);
}
.modal-credits ul { margin-left: 20px; margin-top: 8px; }
.modal-credits strong { color: var(--text-main); }

.modal-hero-image {
    width: 100%;
    display: block;
    border-radius: 6px;
    margin-bottom: 24px;
    pointer-events: none;
    user-select: none;
 }
.modal-content .project-title { font-size: 2rem; }
.modal-content .project-title.modal-title-sm { font-size: 1.5rem; }
.modal-content .project-year { display: block; margin-bottom: 16px; }

/* ========================================== */
/* --- CSS-Only "Show More" Logic         --- */
/* ========================================== */

/* Hide the actual checkbox from view */
.load-more-checkbox {
    display: none;
}

/* Hide the extra projects by default */
.extra-projects {
    display: none;
}

/* THE MAGIC TRICK:
   When checkbox is checked, 'display: contents' makes the wrapper
   disappear, dropping the extra cards directly into the main grid layout. */
.load-more-checkbox:checked ~ .extra-projects {
    display: contents;
}

/* --- The Show More Button Styling --- */
.load-more-btn {
    grid-column: 1 / -1; /* Forces the button to span across the entire grid row */
    justify-self: center; /* Centers the button horizontally */

    display: inline-block;
    margin-top: 10px;
    padding: 14px 36px;
    background-color: var(--card-bg);
    color: var(--text-main);
    border: 1px solid #E5E7EB;
    border-radius: 30px; /* Gives it a sleek, pill-shaped look */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.load-more-btn:hover {
    background-color: var(--text-main);
    color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.05);
}

/* ========================================== */
/* --- Combined About & Footer Section    --- */
/* ========================================== */
.about-footer-section {
    background-color: var(--card-bg); /* Pure white background */
    padding: 100px 0;
    border-top: 1px solid #E5E7EB;
    scroll-margin-top: 60px;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Text left, Image right */
    gap: 80px;
    align-items: stretch; /* CRITICAL: Makes both columns exactly the same height */
}

/* --- Left Column: Content & Actions --- */
.about-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes text up and actions to the exact bottom */
}

.about-text p {
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-actions {
    margin-top: 40px; /* Ensures a gap even if text is very long */
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Keeps the email button and icons aligned to the left */
    gap: 24px; /* Space between email button and icons */
}

/* --- Right Column: Image --- */
.about-image-wrapper {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    height: 100%; /* Forces the wrapper to match the stretched grid height */
}

.about-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Zooms the image perfectly so it never warps or distorts */
    display: block;
    pointer-events: none;
    user-select: none;
}

/* --- Social Icons --- */
.social-links {
    display: flex;
    gap: 24px;
}

.social-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-icon:hover {
    color: var(--text-main);
    transform: translateY(-3px);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .site-nav {
        gap: 24px;
        padding: 12px 16px;
        justify-content: flex-start;
        overflow-x: auto;
    }
    .site-nav a {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .about-grid {
        grid-template-columns: 1fr; /* Stacks text and image vertically */
        gap: 40px;
    }

    .about-image-wrapper {
        order: -1; /* Moves the image ABOVE the text on phones */
        height: auto;
        aspect-ratio: 4 / 5; /* Gives the image a perfect portrait shape on mobile */
    }
}
