/* --- CSS Reset & Variables --- */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --primary-color: #268bd2;
    --text-color: #222222;
    --text-light: #555555;
    --bg-color: #ffffff;
    
    /* SIZING VARIABLES */
    --sidebar-width: 350px; 
    --gap: 5rem; 
    --border-color: #eeeeee;
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --content-padding: 3rem; 
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    font-size: 19px; /* Large font preserved */
}

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

/* --- Header --- */
.masthead {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-bottom: 3rem;
    width: 100%;
    position: sticky;        /* Makes it stick */
    top: 0;                  /* Sticks to the very top */
    background-color: #fff;  /* Prevents transparent overlap */
    z-index: 1000;
}

.masthead-inner {
    width: 100%;
    padding: 0 var(--content-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.nav-links { display: flex; gap: 2.5rem; font-size: 1.1rem; }
.nav-links a { font-weight: 600; color: var(--text-light); }
.nav-links a:hover { color: var(--primary-color); }

/* --- Layout Container --- */
.page-wrapper {
    width: 100%;
    padding: 0 var(--content-padding);
    display: flex;
    /* align-items: flex-start;  <-- REMOVED so sidebar stretches to full height */
    position: relative; /* Helps context */
}

/* --- Sidebar --- */
.sidebar {
    flex: 0 0 var(--sidebar-width);
    text-align: left;
    /* Sidebar now stretches height automatically due to flex default */
}

.profile-card {
    position: -webkit-sticky; /* Safari support */
    position: sticky;         /* Standard sticky positioning */
    top: 12rem;                /* Sticks 2rem from the top of the viewport */
    width: 100%;
    z-index: 10;
}

.avatar {
    width: 240px;
    height: 260px;
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    background-color: #f2f3f3;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    border: 1px solid #eee;
    overflow: hidden; /* CRITICAL */
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    transform: scale(1.5); 
}

.author-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    color: #111;
}

.author-bio {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.author-links { list-style: none; padding: 0; margin: 0; }
.author-links li { margin-bottom: 0.6rem; display: flex; }
.author-links a {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    min-width: 0;
    padding-top: 0.5rem;
    max-width: 1600px;
    padding-bottom: 4rem; /* Adds space at bottom for scrolling */
}

section {
    scroll-margin-top: 6.5rem;
    margin-bottom: 4rem;
}

h1 { 
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
    font-weight: 700;
    color: #222;
}
h2 { 
    font-size: 2rem; 
    margin-top: 4rem; 
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: #333;
}

p { margin-bottom: 1.5rem; text-align: left; font-size: 1.15rem; }

.content-list { 
    margin-bottom: 1.5rem; 
    padding-left: 1.2rem; 
    text-align: left;
    font-size: 1.15rem;
}
.content-list li { margin-bottom: 0.8rem; }

/* --- Flexbox Project Cards --- */
.flex-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: flex-start;
}

.project-card {
    /* Calculation for 3 columns:
        (100% width - (2 gaps * 2rem size)) / 3 items 
    */
    flex: 0 0 calc((100% - 4rem) / 3); 
    
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
}

/* --- Responsive Breakpoints --- */
/* Tablet: 2 Columns */
@media (max-width: 1200px) {
    .project-card {
        flex: 0 0 calc((100% - 2rem) / 2);
    }
}

/* Mobile: 1 Column */
@media (max-width: 768px) {
    .project-card { 
        flex: 0 0 100%; 
    }
    
    /* Mobile Layout Fixes */
    .page-wrapper { flex-direction: column; gap: 2rem; padding: 0 1.5rem; }
    .masthead-inner { padding: 0 1.5rem; }
    .sidebar { width: 100%; height: auto; padding-bottom: 2rem; border-bottom: 1px solid #eee; }
    .profile-card { position: static; text-align: center; }
    .avatar { margin: 0 auto 1.5rem; width: 180px; height: 180px; }
    .author-links { display: inline-block; text-align: left; }
    
    /* Modal Mobile */
    .close-btn { right: 1.5rem; top: 1.5rem; }
    .modal-content-wrapper { padding: 4rem 1.5rem; }
    .modal-title { font-size: 2rem; }
}

.card-media {
    height: 200px; /* Slightly shorter to fit 3 in a row better */
    background-color: #f7f7f7;
    display: flex;
    align-items: left;
    justify-content: center;
    border-bottom: 1px solid #eee;
    color: #999;
    font-size: 1.2rem;
    overflow: hidden;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* scales image to fill container without stretching */
    object-position: left center; /* focuses on left side */
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.8rem;
}
.card-title a { pointer-events: none; }

.card-badges {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.badge {
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: var(--text-light);
    background: #fff;
    font-weight: 600;
}

.card-excerpt {
    font-size: 0.93rem;
    color: #444;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.card-meta {
    font-size: 0.85rem;
    color: #888;
    margin-top: auto;
}


/* --- Footer --- */
.page-footer {
    margin-top: 6rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 1rem;
    color: #777;
}

/* --- Skills Section --- */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.skill-tag {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    color: #495057;
}
    /* --- MODAL (POPUP) STYLES --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; 
    z-index: 2000; /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(255,255,255, 1); /* Opaque white background */
}

.modal-content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
}

/* The Close Button */
.close-btn {
    position: fixed;
    top: 2rem;
    right: 3rem;
    color: #333;
    font-size: 3rem;
    font-weight: bold;
    border: 2px solid #333; /* Boxy border */
    padding: 4px 16px 4px 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 2001;
    background: #fff;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: #333;
    color: #fff;
}

/* Modal Internal Layout */
.modal-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.modal-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.modal-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    color: #666;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.modal-main-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    background-color: #f0f0f0;
    margin-bottom: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 1.5rem;
}

.modal-body-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 3rem;
}

.modal-skills-section {
    background-color: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
}

.modal-skills-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    color: #555;
}


/* --- Responsive Mobile --- */
    /* --- RESPONSIVE / MOBILE STYLES (UPDATED) --- */
@media (max-width: 900px) {
    /* 1. Header Fixes for Mobile */
    .masthead-inner { 
        flex-direction: column; /* Stack Name and Links vertically */
        padding: 0 1.5rem;
        gap: 1rem; /* Add spacing between them */
    }

    .nav-links {
        flex-wrap: wrap; /* Allow links to wrap to next line */
        justify-content: center; /* Center them */
        gap: 1rem; /* Reduce gap between links */
        font-size: 1rem; /* Slightly smaller text */
        text-align: center;
    }

    /* 2. Layout & Sidebar Fixes */
    .page-wrapper { flex-direction: column; gap: 2rem; padding: 0 1.5rem; }
    .sidebar { width: 100%; height: auto; padding-bottom: 2rem; border-bottom: 1px solid #eee; }
    .profile-card { position: static; text-align: center; }
    .avatar { margin: 0 auto 1.5rem; width: 180px; height: 180px; }
    .author-links { display: inline-block; text-align: left; }
    
    /* 3. Project Cards (1 per row) */
    .project-card { 
        flex: 0 0 100%; 
    }

    /* 4. Modal Fixes */
    .close-btn { right: 1.5rem; top: 1.5rem; }
    .modal-content-wrapper { padding: 4rem 1.5rem; }
    .modal-title { font-size: 2rem; }
}

@media (max-width: 1200px) and (min-width: 901px) {
    .project-card {
        flex: 0 0 calc((100% - 2rem) / 2);
    }
}

/* Replace the previous .github-modal-btn styles with this: */
.github-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #28434E; /* Use your primary blue color */
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.github-modal-btn:hover {
    color: #232A3D; /* Darker blue on hover */
    text-decoration: underline;
}

/* Mobile Adjustment */
@media (max-width: 900px) {
    .github-modal-btn { margin-left: 0; }
}

/* --- Performance Table Styles --- */
.table-wrapper {
    overflow-x: auto; /* Enables side scrolling on mobile */
    margin: 1.5rem 0;
    border: 1px solid #eeeeee;
    border-radius: 6px;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 600px; /* Prevents columns from squishing on small screens */
}

.performance-table th, 
.performance-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eeeeee;
    color: #333;
}

.performance-table th {
    background-color: #f8f9fa; /* Light grey header */
    color: #555;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.performance-table tr:last-child td {
    border-bottom: none; /* Remove bottom border from last row */
}

.performance-table tr:hover {
    background-color: #fcfcfc; /* Subtle hover effect */
}

/* --- Styled List for Modal/Content --- */
.styled-list {
    margin: 1rem 0 1.5rem 0;
    padding-left: 0; /* Remove default padding */
    list-style: none; /* Remove default bullets */
}

.styled-list li {
    position: relative;
    padding-left: 1.5rem; /* Space for the custom bullet */
    margin-bottom: 0.8rem; /* Space between items */
    color: #444;
    line-height: 1.6;
}

/* Create the Custom Bullet */
.styled-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px; /* Align with text */
    width: 6px;
    height: 6px;
    background-color: #268bd2; /* Your primary blue color */
    border-radius: 2px; /* Slight roundness (0 for perfect square) */
}