/* --- Global Styles & Variables --- */
:root {
    --primary-color: #005a9e; /* Professional blue from original index */
    --accent-hover: #00447a;
    --primary-bg: #ffffff;
    --secondary-bg: #f7f7f7;
    --border-color: #e0e0e0;
    --primary-text: #333333;
    --secondary-text: #666666;
    --timeline-bg: #1d2c41; /* Dark blue for the timeline */
    --timeline-text: #ffffff;
    --timeline-header: #a0c4e4; /* Lighter blue for era headers */
}

/* --- General Typography & Base Styles --- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: var(--secondary-bg);
    color: var(--primary-text);
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

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

ul {
    padding-left: 20px;
}

li {
    margin-bottom: 8px;
}

/* --- Unified Header --- */
header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #000;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

nav ul li a {
    font-weight: 600;
}

/* --- Page-Specific Layout Containers --- */
.main-container, .case-study-container, .projects-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 40px;
}

.main-container {
    display: flex;
    min-height: calc(100vh - 75px);
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 0; /* Override default padding for this specific container */
}

.case-study-container { padding: 0 2rem; }

/* --- Index Page: Timeline Sidebar --- */
.timeline { flex: 0 0 280px; background-color: var(--timeline-bg); color: var(--timeline-text); padding: 30px 20px; }
.timeline h2 { color: #fff; }
.timeline .era-header { color: var(--timeline-header); font-size: 0.9em; font-weight: bold; text-transform: uppercase; margin-top: 25px; margin-bottom: 10px; padding-left: 5px; }
.timeline ul { list-style: none; padding: 0; margin-top: 0; }
.timeline li { padding: 12px 15px; margin-bottom: 8px; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; border-left: 4px solid var(--primary-color); }
.timeline li:hover { background-color: rgba(255, 255, 255, 0.1); transform: translateX(5px); }

/* --- Index Page: Main Content --- */
.main-content { flex: 1; padding: 30px 40px; overflow-y: auto; }
.main-content h1 { border-bottom: 2px solid var(--secondary-bg); padding-bottom: 10px; }
.spotlight-card { background-color: #f9f9f9; border-left: 5px solid var(--primary-color); padding: 20px; margin-bottom: 30px; border-radius: 0 8px 8px 0; }

/* --- Cadenza Page: Content Sections --- */
.hero { text-align: center; padding: 4rem 1rem; border-bottom: 1px solid var(--border-color); margin-bottom: 3rem; }
.content-section h2 { border-left: 4px solid var(--primary-color); padding-left: 1rem; }
.screenshots-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 3rem 0; }
.tech-stack ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.tech-stack li { background-color: #e9ecef; padding: 0.5rem 1rem; border-radius: 5px; }

/* --- Projects Hub Page Styles --- */
.projects-header { text-align: center; border-bottom: 2px solid var(--border-color); padding-bottom: 20px; margin-bottom: 30px; }
.view-controls { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.view-controls button { background-color: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); padding: 8px 16px; margin-left: 10px; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; }
.view-controls button:hover, .view-controls button.active { background-color: var(--primary-color); color: #ffffff; }
.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
.card { background-color: #fff; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; box-shadow: 0 4px 8px rgba(0,0,0,0.05); transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.card-img { width: 100%; height: 200px; object-fit: cover; border-bottom: 1px solid var(--border-color); }
.card-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.card-content h3 { margin-top: 0; }
.card-content p { flex-grow: 1; }
.card-link { display: inline-block; background-color: var(--primary-color); color: #ffffff; text-decoration: none; padding: 10px 15px; border-radius: 5px; text-align: center; margin-top: 15px; align-self: flex-start; }
.list-view { display: flex; flex-direction: column; gap: 15px; }
.list-item { display: flex; align-items: center; background-color: #fff; padding: 15px 20px; border: 1px solid var(--border-color); border-radius: 8px; }
.list-icon { width: 40px; height: 40px; margin-right: 20px; }
.list-title { font-size: 1.2rem; font-weight: bold; }

/* --- Unified Footer --- */
footer { text-align: center; padding: 2rem; margin-top: 4rem; border-top: 1px solid var(--border-color); color: var(--secondary-text); background-color: #fff; }

/* --- Index Page: Modal / Popup Styles (REVISED FOR MOBILE) --- */

/* Default (Desktop) Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex; /* Becomes visible when active */
}

.modal {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    transform: translateY(-50px);
    transition: transform 0.3s ease-out;
    display: none; /* All modals hidden by default */
    margin-left: 140px; /* Offset from timeline sidebar */
}

.modal.active {
    display: block; /* The active modal becomes visible on desktop */
    transform: translateY(0);
}

.modal-title {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title h2 {
    margin: 0;
}

.modal-content {
    padding: 20px 30px;
}

.modal-footer {
    padding: 15px 30px;
    background-color: #f7f7f7;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.close-button-x {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2.5rem;
    font-weight: bold;
    border: none;
    background: none;
    cursor: pointer;
    color: #888;
}
.close-button-x:hover {
    color: #333;
}

.mobile-close-button {
    display: none; /* Hide the mobile button on desktop by default */
}

.mobile-timeline-link {
    display: none;
}


/* Mobile-Specific Styles */
@media (max-width: 800px) {
    .modal {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        margin-left: 0;
        transform: none;
        overflow: hidden;
        /* The JS will add the .active class */
        flex-direction: column;
    }
    
    .modal.active {
        display: flex; /* CRITICAL: Use flexbox for mobile layout */
        flex-direction: row;
    }

    .modal-title {
        flex-shrink: 0; /* Header does not shrink */
    }
    
    .modal-content {
        flex-grow: 1; /* Body grows to fill available space */
        overflow-y: auto; /* Makes the body scrollable if content overflows */
        padding: 20px;
    }
    
    .modal-footer {
        flex-shrink: 0; /* Footer does not shrink */
    }

    .close-button-x {
        display: none; /* Hide the 'X' button on mobile */
    }

    .mobile-close-button {
        display: block; /* Show the footer button on mobile */
        width: 100%;
        padding: 15px;
        border: none;
        border-radius: 8px;
        background-color: var(--primary-color);
        color: #ffffff;
        font-size: 1.1rem;
        font-weight: bold;
        cursor: pointer;
    }

    .mobile-timeline-link {
    display: block;
    background-color: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    padding: 12px;
    border-radius: 5px;
    text-align: center;
    margin: 25px 0;
}
}


/* --- Responsive Design --- */
@media (max-width: 800px) {
    .main-container { flex-direction: column; }
    .timeline { order: 2; }
    nav { flex-direction: column; gap: 1rem; }
    .screenshots-grid { grid-template-columns: 1fr; }
}
