:root {
    --bg: #f8f9fa;
    --sidebar-bg: #ffffff;
    --accent: #2980b9;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border: #edf2f7;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body {
    margin: 0; font-family: 'Inter', sans-serif;
    background: var(--bg); color: var(--text-dark); display: flex;
}

aside {
    width: 260px; height: 100vh; background: var(--sidebar-bg);
    position: fixed; border-right: 1px solid var(--border);
    padding: 30px 20px; display: flex; flex-direction: column; z-index: 100;
}

aside h1 { font-size: 1.8rem; color: var(--accent); font-weight: 700; margin-top: 10px; margin-bottom: 1px; }
aside p { font-size: 0.85rem; color: var(--text-light); margin-bottom: 30px; }

.sidebar-contact { display: flex; gap: 15px; margin-bottom: 35px; }
.sidebar-contact a { color: var(--text-dark); font-size: 1rem; text-decoration: none; transition: 0.2s; }
.sidebar-contact a:hover { color: var(--accent); transform: translateY(-2px); }
.sidebar-contact .cv-icon {
    font-size: 0.9rem; 
    margin-top: 2px; 
}

/* Style for the first letter */
.first-letter {
    color: var(--accent); /* Dark blue (from your root variables) */
    font-weight: 800;      /* Bold */
    margin-right: 0.8px;     /* Optional: adds a tiny bit of breathing room */
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
}

/* Ensure the hover/active states don't conflict */
nav button:hover .first-letter, 
nav button.active .first-letter {
    color: var(--accent); /* Keeps it consistent when selected */
}

nav button {
    display: block; width: 100%; text-align: left; background: none;
    border: none; padding: 12px 15px; cursor: pointer;
    font-size: 0.95rem; color: var(--text-dark); border-radius: 8px; margin-bottom: 5px;
}

/* Targets only the whoami button */
nav button[data-section="whoami"] {
    font-family: 'JetBrains Mono', monospace !important;
    /* font-weight: 700 !important;  */
    font-size: 1.1rem !important;
    text-transform: lowercase;
}

nav button:hover, nav button.active { background: rgba(41, 128, 185, 0.08); color: var(--accent); font-weight: 600; }

/* Sub-nav Logic */
/* .nav-group .sub-nav { max-height: 0; overflow: hidden; transition: 0.3s; padding-left: 10px; border-left: 1px solid var(--border); margin-left: 15px; }
.nav-group.expanded .sub-nav { max-height: 400px; margin-top: 5px; }
.nav-parent { display: flex; justify-content: space-between; align-items: center; } */
.nav-group .sub-nav {
    max-height: 0;
    overflow: hidden;
    /* Use a cubic-bezier for a "smart" feel: starts slow, accelerates, then eases out */
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 10px;
    border-left: 1px solid var(--border);
    margin-left: 15px;
    opacity: 0; /* Adding opacity makes the motion feel more fluid */
}

.nav-group.expanded .sub-nav {
    max-height: 400px;
    opacity: 1;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-in;
}

.nav-parent i {
    font-size: 0.75rem; 
    padding-top: 2px;
    margin-left: 8px;
    opacity: 0.7;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-group.expanded .nav-parent i { transform: rotate(180deg); }

main { margin-left: 260px; padding: 60px 80px; width: 100%; max-width: 1000px; }
/* .section { display: none; animation: fadeIn 0.4s ease; } */
.section {
    display: none;
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
} 
.section.active { display: block; }

/* --- Standardized Section Titles --- */
/* Merged and Optimized Header Styles */
main section h2, 
main section h3, 
.cv-block h2 {
    color: var(--accent);
    border-bottom: 2px solid var(--border);
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    
    /* Sticky Properties */
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
    
    /* Spacing */
    padding-top: 20px;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 30px;
}

.cv-block {
    padding-top: 20px; 
    margin-bottom: 20px; /* Reduced from 80px to 20px */
    scroll-margin-top: 40px; 
    border-radius: 12px;
    padding: 10px;
    transition: background-color 0.5s ease;
}

/* CV Item Accordion */
.cv-item { background: white; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.cv-item.static {
    cursor: default;
    background: #fff;
    border: 1px solid var(--border);
}

.cv-header { padding: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: #fff; }
.cv-header small { color: var(--text-light); font-size: 0.9rem; display: block; margin-top: 10px; }
.cv-header .icon { color: var(--accent); transition: 0.3s; }
.cv-item.active .icon { transform: rotate(180deg); }
.cv-focus-label {
    color: var(--accent); 
    font-weight: 700;     
}

.cv-body { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0, 1, 0, 1); padding: 0 20px; }
.cv-item.active .cv-body { max-height: 1500px; padding: 0 20px 20px 20px; }
.cv-item.static .cv-body {
    max-height: none !important; /* Always open */
    display: block !important;
    padding: 10px 20px 20px 20px;
    opacity: 1;
}
.cv-item.static .cv-header {
    cursor: default; /* No pointer finger */
    margin-bottom: 0 !important;
    padding-bottom: 1px !important;
}

/* Tech Stack - Star Separator config */
.small-sep {
    font-size: 0.8rem;    /* Makes the star smaller */
    padding: 0px 6px 5px 6px;       /* Adds space on both sides */
    vertical-align: middle;
    display: inline-block;
    color: var(--accent); /* Keeps the accent color consistent */
    text-shadow: 0px 0px 2px rgba(41, 127, 185, 0.307); /* Subtle glow effect */
}

/* Bullets */
.cv-details-list {
    margin-top: 5px; /* Reduced gap between subtitle and first bullet */
    padding: 0;
}

.cv-details-list li {
    display: flex;
    align-items: center; /* Aligns bullet icon with center of the text line */
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.cv-details-list li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
    line-height: 0; /* Ensures the bullet character itself doesn't add height */
    flex-shrink: 0;
    display: flex;
    align-items: center;

}/* --- Highlight Pulse Animation --- */
.region-highlight {
    animation: highlight-pulse 5s ease-out;
}

@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(41, 128, 185, 0.4);
        background-color: rgba(41, 128, 185, 0.05);
        border-color: var(--accent);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(41, 128, 185, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(41, 128, 185, 0);
        background-color: transparent;
    }
}

/* Project Dropdowns inside Experience */
.project-dropdown-list { margin-top: 20px; padding-left: 15px; border-left: 2px solid var(--border); }
.project-list-label { font-size: 0.75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.5px; }
.project-accordion { background: #f9f9f9; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.project-acc-header { padding: 10px 15px; display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.project-acc-body { max-height: 0; overflow: hidden; padding: 0 15px; transition: 0.3s ease; font-size: 0.85rem; color: var(--text-dark); }
.project-accordion.open .project-acc-body { max-height: 200px; padding: 0 15px 12px 15px; }

.project-acc-body p {
    margin-top: 4px !important;    /* Reduces space below the header */
    margin-bottom: 0 !important;   /* Removes space at the bottom */
}

/* --- Project Cards with Tags --- */
.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

#project-grid .card p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 0;
}

/* Research: Full width row style - Vertical Stack */
.research-row {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column; /* Stacks items vertically */
    gap: 12px;              /* Adds space between the stacked items */
}

.research-row h4 { margin: 0; color: var(--text-dark); font-size: 1.1rem; }
.research-row .subtitle { font-size: 0.9rem; color: var(--text-light); font-style: italic; }
.research-row .tags { display: flex; gap: 8px; flex-wrap: wrap; } /* Allows tags to wrap if many */
.research-row a { color: var(--accent); font-size: 0.9rem; font-weight: 600; text-decoration: none; align-self: flex-start; }

/* Whoami Snapshot Sections */
.snapshot-container { border-top: 1px solid var(--border); padding-top: 40px; }
.snapshot-group { margin-bottom: 40px; }
.snapshot-group h4 { color: var(--accent); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; margin-bottom: 15px; border-left: 3px solid var(--accent); padding-left: 12px; }

.tag { display: inline-block; padding: 4px 12px; border-radius: 20px; background: rgba(41, 128, 185, 0.1); color: var(--accent); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.tag.pink-tag { background: #fff0f5; color: #d11d5a; }
/* Grey-palette tech tags */
.tag-tech {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 6px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: #f1f3f5; /* Light grey background */
    color: #495057;      /* Dark grey text */
    font-size: 0.7rem;
    font-weight: 500;
}

/* Ensure the container looks good */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.intro-container { display: flex; gap: 40px; align-items: center; margin-bottom: 50px; }
.profile-pic { width: 250px; height: 250px; border-radius: 10px; object-fit: scale-down; border: 1px solid var(--border); box-shadow: var(--card-shadow); flex-shrink: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.card h4 {
    margin-bottom: 8px;
}

/* Project Card Footer */
/* Ensure footer links have space for icons */
.card-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 15px;
}

.card-footer a { 
    color: var(--accent); 
    font-weight: 600; 
    text-decoration: none; 
    font-size: 0.85rem; 
    display: flex; 
    align-items: center; 
    gap: 5px; /* space between icon and text */
}

.force-inactive {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: none !important;
    pointer-events: none; /* Prevents further interaction during scroll */
}

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--accent);
    border-radius: 50%; 
    color: var(--accent);
    
    /* REMOVE display: none; */
    display: flex; /* Always flex, controlled by opacity/visibility */
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* This is the class added by the scroll listener */
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:active:not(.flash-active) {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2002;
    background: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(10px);
    border: 0.1px solid var(--accent); 
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container for the icon */
.hamburger-box {
    width: 20px;
    height: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

/* Ensure the hamburger lines are visible and correctly spaced */
.hamburger-inner {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--accent);
    border-radius: 5px;
    position: relative; /* Needed to position the other two lines */
    top: 50%;         
    margin-top: -1.5px;
    transition: all 0.3s ease;
}

.hamburger-inner::before, 
.hamburger-inner::after {
    content: " "; /* CRITICAL: This makes the lines appear */
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--accent);
    border-radius: 5px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

/* Position them above and below the center line */
.hamburger-inner::before {
    top: -7px; 
}

.hamburger-inner::after {
    bottom: -7px;
}

.menu-toggle.active .hamburger-inner {
    background-color: transparent !important;
}
.menu-toggle.active .hamburger-inner::before {
    top: 0;
    transform: rotate(45deg);
}
.menu-toggle.active .hamburger-inner::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* Mobile Navigation Overlay */
/* --- Smarter Mobile Navigation Overlay --- */
.mobile-nav-overlay {
    display: flex;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    padding: 80px 20px;
    box-sizing: border-box;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-nav-overlay nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}
.close-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
}

.section {
    display: none;
    /* Apply the animation here with a gentle timing function */
    animation: fadeIn 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.section.active {
    display: block;
}

.mobile-nav-overlay {
    /* ... existing styles ... */
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* 2. Improve scroll behavior globally */
html {
    scroll-behavior: smooth;
}

.menu-toggle {
    display: none; 
}
/* --- Mobile Responsive Layout --- */
@media (max-width: 850px) {
    body {
        flex-direction: column;
        overflow-x: hidden;
    }

    /* Prevent body jitter during nav open */
    body.nav-open {
        overflow: hidden;
    }

    /* Make the mobile menu slide more fluidly */
    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    aside {
        width: 100%;
        height: auto;
        position: relative; /* Remove fixed positioning */
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 20px;
        box-sizing: border-box;
    }

    main {
        margin-left: 0;
        padding: 30px 20px;
        width: 100%;
        box-sizing: border-box; /* Ensures padding doesn't create overflow */
        overflow-x: visible;
    }

    .intro-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    
    /* Improve touch targets for nav buttons */
    nav button {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        padding: 12px 15px;
        cursor: pointer;
        font-size: 0.95rem;
        color: var(--text-dark);
        border-radius: 8px;
        margin-bottom: 5px;
        /* Smooth color and background transition */
        transition: background 0.25s ease, color 0.25s ease, transform 0.1s ease;
    }

    nav button:active {
        transform: scale(0.98); /* Subtle "click" feedback */
    }

    .grid, .intro-container, .cv-block {
        width: 100%;
        box-sizing: border-box;
    }

    .menu-toggle {
        display: flex;
        position: fixed;
        top: 20px;
        right: 20px; /* Moved to top-right */
        left: auto;  /* Remove left alignment */
        z-index: 1002;
    }

    /* Create a visible header background only when scrolling */
    .mobile-header {
        position: fixed;
        top: 0;
        width: 100%;
        height: 60px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
        display: none; /* Hidden by default */
        z-index: 1000;
        border-bottom: 1px solid var(--border);
    }

    /* Class added by JS to show the header when user scrolls */
    .mobile-header.show { display: block; }

    #back-to-top:active {
        transform: none !important;
        background: rgba(255, 255, 255, 0.9) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px); /* Slightly more distance for a smoother rise */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes temporary-flash {
    0% { background: var(--accent); color: white; }
    100% { background: rgba(255, 255, 255, 0.9); color: var(--accent); }
}

.flash-active {
    animation: temporary-flash 1s ease-out;
}