/* Monochrome color palette */
:root {
    --background: #181818;
    --surface: #232323;
    --text: #f5f5f5;
    --text-light: #bdbdbd;
    --accent: #ededed;
    --accent-dark: #444;
    --border: #333;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: 'Space Grotesk', Arial, sans-serif;
    margin: 0;
    min-height: 10vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.main-header {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 2rem 0 1rem 0;
    text-align: center;
}

.profile-pic-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.2rem;
}

.profile-pic {
    /* INCREASED SIZE FOR DESKTOP */
    width: 160px;
    height: 160px;
    /* -------------------------- */
    object-fit: cover;
    border-radius: 24px;
    border: 2px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    background: var(--accent-dark);
    transition: transform 0.18s cubic-bezier(.4,2,.6,1), box-shadow 0.18s;
}
.profile-pic:hover {
    transform: scale(1.08) rotate(-2deg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.name {
    font-size: 2.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0 0 0.5rem 0;
    opacity: 1;
    transform: translateY(0);
    transition: none;
    animation: nameFadeIn 0.38s cubic-bezier(.4,2,.6,1);
}
.name.hide-anim {
    animation: nameFadeOut 0.32s cubic-bezier(.4,2,.6,1) forwards;
}

.social-links {
    margin: 0.7rem 0 1.2rem 0;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}
.social-links a img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1) drop-shadow(0 0 4px #fff8) grayscale(0.2);
    transition: filter 0.2s;
}
.social-links a:hover img {
    filter: brightness(1.2) invert(1) drop-shadow(0 0 8px #fff) grayscale(0);
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 2.2rem;
    margin-bottom: 0.5rem;
}
.main-nav a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.5rem; /* Standard padding */
    border-radius: 6px;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    
    /* Checkerboard style base */
    background: var(--accent-dark); /* Dark background */
    border: 2px solid white; /* Thin white border */
    box-shadow: none; /* No initial shadow */
}

/* New: Hover effect - keeps dark background, just adds a subtle white glow */
.main-nav a:hover {
    background: var(--accent-dark); /* Keep background dark */
    color: var(--text-light); /* Keep text color light */
    border-color: white; /* Keep border white */
    /* Add subtle hover glow */
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* New: Active/Current Page Button Style */
.main-nav a.active {
    background: var(--accent-dark); /* Keep background dark */
    color: white; /* Slightly brighter white for active text */
    border: 3px solid white; /* Thicker border for current page */
    /* Stronger white glow for the active page */
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.7);
}


section {
    margin-bottom: 2.5rem;
    background: var(--surface);
    border-radius: 10px;
    padding: 1.5rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

h2, h3 {
    color: #fff;
    text-align: center;
    text-shadow: 0 0 8px #fff, 0 0 16px #fff8;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
}

ul {
    padding-left: 1.2rem;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.languages {
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 1rem;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.2rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.skills-list li {
    background: var(--accent-dark);
    color: var(--accent);
    border-radius: 20px;
    padding: 0.4rem 1.1rem;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: transform 0.32s cubic-bezier(.4,2,.6,1);
}
.skills-list li:hover {
    transform: scale(1.04);
}

.footer {
    background: var(--surface);
    color: var(--text-light);
    text-align: center;
    padding: 1rem 0;
    font-size: 1rem;
    border-top: 1.5px solid var(--border);
}

.achievement-list, .project-list, .education-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2.5rem 0;
}

.achievement-item, .project-item, .education-item {
    background: var(--surface);
    border-radius: 10px;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.achievement-header, .project-header, .achievement-header, .education-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    font-weight: 600;
    color: var(--accent);
    transition: background 0.2s;
    justify-content: space-between;
    gap: 0.5rem;
}

.achievement-header:hover, .project-header:hover, .education-header:hover {
    background: var(--accent-dark);
}

.dropdown-icon {
    margin-left: 1rem;
    transition: transform 0.3s cubic-bezier(.4,2,.6,1);
    filter: brightness(2) drop-shadow(0 0 4px #fff8);
    order: 2;
}

.flair {
    order: 3;
    margin-left: 0;
    margin-right: 0;
    min-width: 90px;
    text-align: center;
    /* Responsive fix */
    white-space: nowrap;
    flex-shrink: 0;
}

.project-header > .dropdown-icon,
.project-header > .flair {
    margin-left: 0.7rem;
}

.achievement-item.open .dropdown-icon,
.project-item.open .dropdown-icon,
.education-item.open .dropdown-icon {
    transform: rotate(90deg);
}

.achievement-content, .project-content, .education-content {
    max-height: 0;
    overflow: hidden;
    background: #222;
    transition: max-height 0.5s cubic-bezier(.4,2,.6,1), padding 0.3s;
    padding: 0 1rem;
}

.project-item.open .project-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 1rem;
}

.achievement-item.open .achievement-content,
.project-item.open .achievement-content,
.education-item.open .education-content {
    max-height: 400px;
    padding: 1rem;
}

.achievement-content img, .project-content img {
    width: 100%;
    max-width: 600px;
    max-height: 300px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 0 12px #000a;
    background: #333;
    object-fit: contain;
}

.achievement-content .github-link, .project-content .github-link, .map-link {
    display: inline-block;
    margin-top: 1rem;
    color: #fff;
    background: #111;
    border-radius: 6px;
    padding: 0.3rem 1rem;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 0 8px #fff4;
    transition: background 0.2s, color 0.2s;
}
.achievement-content .github-link:hover, .project-content .github-link:hover, .map-link:hover {
    background: #fff;
    color: #111;
}

.flair {
    display: inline-block;
    margin-left: 1rem;
    padding: 0.18em 0.8em;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
    box-shadow: 0 0 6px #0002;
    white-space: nowrap;
}
.flair.completed {
    background: #2ecc40;
    color: #fff;
}
.flair.in-progress {
    background: #ffe066;
    color: #222;
}
.flair.flair-mono {
    background: #222;
    color: #ededed;
    border: 1px solid #444;
    box-shadow: none;
    margin-left: 1.2rem;
    margin-right: 0;
}

.img-expand-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.expandable-img {
    width: 320px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 0 12px #000a;
    background: #333;
    transition: width 0.3s, height 0.3s, object-fit 0.3s;
    cursor: pointer;
    max-width: 100%;
}
.expandable-img.expanded {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    z-index: 10;
}
.expand-btn {
    margin-top: 0.5rem;
    padding: 0.3rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: var(--accent-dark);
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 0 8px #0002;
}
.expand-btn:hover {
    background: var(--accent);
    color: var(--accent-dark);
}

/* Center headings on all pages */
section > h2, section > h3 {
    text-align: center;
}

/* Fade-in animation for main sections */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
section, .intro {
    animation: fadeInUp 0.8s cubic-bezier(.4,2,.6,1);
}

/* Name heading animations */
@keyframes nameFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes nameFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

/* Centered project title above image */
.project-title-centered {
    text-align: center;
    margin: 0 0 0.7rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.cv-nav-btn {
    display: inline-block;
    background: var(--accent-dark);
    color: var(--accent);
    border-radius: 6px;
    padding: 0.3rem 1.2rem;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    text-decoration: none;
    margin: 0.5rem 0;
    transition: background 0.2s, color 0.2s, transform 0.18s cubic-bezier(.4,2,.6,1);
}
.cv-nav-btn:hover {
    background: var(--accent-dark);
    color: var(--accent);
    transform: scale(1.08);
    box-shadow: 0 0 0 4px white, 0 0 12px 2px white;
    border: 2px solid white;
    transition: box-shadow 0.18s, border 0.18s, transform 0.18s cubic-bezier(.4,2,.6,1);
}
.cv-nav-btn:active {
    background: var(--accent-dark);
    color: var(--accent);
    transform: scale(0.96);
    box-shadow: 0 0 0 4px white, 0 0 12px 2px white;
    border: 2px solid white;
    transition: box-shadow 0.18s, border 0.18s, transform 0.18s cubic-bezier(.4,2,.6,1);
}

.github-link.cv-nav-btn:hover {
    background: var(--accent-dark);
    color: var(--accent);
    transform: scale(1.04);
    box-shadow: 0 0 0 4px white, 0 0 12px 2px white;
    border: 2px solid white;
    transition: box-shadow 0.18s, border 0.18s, transform 0.18s cubic-bezier(.4,2,.6,1);
}

/* Tablet/Small Desktop Styles */
@media (max-width: 900px) {
    .container {
        max-width: 100vw;
        padding: 1.2rem 0.5rem;
    }
    .main-header {
        padding: 1.2rem 0 0.7rem 0;
    }
    section {
        padding: 1rem 0.5rem;
    }
    .name {
        font-size: 1.5rem;
        word-break: break-word;
    }
    .profile-pic {
        /* INCREASED SIZE FOR TABLET */
        width: 100px;
        height: 100px;
        /* -------------------------- */
    }
    .main-nav {
        gap: 1rem;
        flex-wrap: wrap;
        font-size: 0.95rem;
    }
    .social-links {
        gap: 0.7rem;
    }
    .skills-list li {
        font-size: 0.95rem;
        padding: 0.3rem 0.7rem;
    }
    .achievement-content img, .project-content img {
        max-width: 100%;
        height: auto;
    }
}

/* Mobile Styles (The issue area) */
@media (max-width: 600px) {
    .container {
        padding: 0.7rem 0.1rem;
    }
    .main-header {
        padding: 0.7rem 0 0.5rem 0;
    }
    section {
        padding: 0.7rem 0.2rem;
    }
    .name {
        font-size: 1.1rem;
    }
    
    /* Force 2 buttons per row, perfectly centered */
    .main-nav {
        gap: 0.5rem 0.5rem; /* Set a small vertical and horizontal gap */
        padding: 0 5px; 
        /* Ensure flex items start from the center for the wrapping to look right */
        justify-content: center; 
    }
    .main-nav a {
        /* Calculate width to fit exactly two items per row, considering the gap */
        width: calc(50% - 0.25rem); /* 50% width minus half the horizontal gap (0.5rem / 2) */
        padding: 0.3rem 0.1rem; /* Adjust padding to be small for fit */
        text-align: center; /* Center the text inside the button */
        font-size: 0.9rem; /* Slightly smaller font to help fit */
        /* Flex properties to ensure wrapping and alignment */
        flex-grow: 1; /* Allow buttons to grow to fill available space */
        flex-shrink: 0; /* Prevent buttons from shrinking too much */
        flex-basis: calc(50% - 0.25rem); /* Minimum width for flex item */
    }
    /* Apply a clear to the element that should start the second row (the 3rd button) */
    .main-nav a:nth-child(3) {
        margin-left: auto; /* Align the third button to the left of its new row */
        margin-right: auto; /* Align the third button to the right of its new row */
        /* Use flex-basis to ensure it occupies the full width of its 'slot' for centering */
        flex-basis: calc(50% - 0.25rem); 
        width: calc(50% - 0.25rem);
    }
    .main-nav a:nth-child(4) {
        margin-left: auto; /* Align the fourth button to the left of its new row */
        margin-right: auto; /* Align the fourth button to the right of its new row */
        flex-basis: calc(50% - 0.25rem);
        width: calc(50% - 0.25rem);
    }
    
    .social-links {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .profile-pic {
        /* INCREASED SIZE FOR MOBILE */
        width: 80px;
        height: 80px;
        /* -------------------------- */
    }
    .skills-list {
        gap: 0.4rem 0.7rem;
    }
    .skills-list li {
        font-size: 0.85rem;
        padding: 0.2rem 0.5rem;
    }
    .achievement-content img, .project-content img {
        max-width: 100vw;
        height: auto;
    }
}

html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

body, html {
    width: 100vw;
    min-width: 0;
    overflow-x: hidden;
}

section, .main-header, .footer {
    word-break: break-word;
}

.achievement-content img, .project-content img {
    width: 100%;
    max-width: 600px;
    max-height: 300px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 0 12px #000a;
    background: #333;
}

.main-nav {
    flex-wrap: wrap;
}

/* Project Header Responsiveness Fix */
.project-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    font-weight: 600;
    color: var(--accent);
    transition: background 0.2s;
    justify-content: space-between;
    gap: 0.5rem;
}
.project-header > .flair {
    margin-left: 1.2rem;
    margin-right: 0;
    order: 2;
    flex-shrink: 0;
}
.project-header > .dropdown-icon {
    margin-left: auto;
    order: 3;
    flex-shrink: 0;
}
.project-header .project-title {
    flex-grow: 1;
    min-width: 0;
}

/* Projects Filtering Styles */
.project-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    padding: 0 10px;
    flex-wrap: wrap; 
}

.filter-btn {
    background: var(--accent-dark);
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    text-shadow: 0 0 4px #000;
    /* Reset default button style */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.filter-btn:hover {
    background: var(--accent);
    color: var(--background);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--background);
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--accent)55;
}

/* Ensure the project items have a block display for filtering and smooth spacing */
.project-list .project-item {
    transition: opacity 0.3s ease-in-out;
}