:root {
    --bg-color: #f8f9fa;
    --sidebar-bg: #111315;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-light: #e5e7eb;
    --accent-color: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --border-color: #e2e8f0;
    --code-font: 'JetBrains Mono', 'Courier New', monospace;
    --body-font: 'Space Grotesk', sans-serif;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--body-font);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: 300px;
    /* Slightly wider for larger profile */
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    padding: 1.5rem 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    text-align: center;
    /* Centered content */
}

.profile-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

/* Centered items */

/* Larger Profile Image */
.avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

#profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.status-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background-color: #10b981;
    border: 3px solid var(--sidebar-bg);
    border-radius: 50%;
}

.info-block {
    margin-bottom: 1rem;
}

#name {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

#role {
    font-family: var(--code-font);
    font-size: 0.8rem;
    font-size: 0.75rem;
    color: var(--accent-color);
    margin-top: 0.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Reduced nav margin */
#section-nav {
    width: 100%;
    margin-top: 0px;
    margin-bottom: 0px;
}

#section-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    /* Tighter links */
    align-items: center;
}

#section-nav a {
    text-decoration: none;
    color: #9ca3af;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    padding: 0.3rem 0.8rem;
    /* Tighter padding */
    border-radius: 999px;
}

/* Center Align & Compact Summary */
#summary {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    text-align: center !important;
    padding: 0 0.5rem;
}

/* Bottom Block Compact */
.bottom-block {
    margin-top: auto;
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    font-size: 1.1rem;
}

.social-links a {
    color: #9ca3af;
    transition: color 0.2s;
}

.social-links a:hover {
    color: white;
    transform: translateY(-2px);
}

.email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--accent-color);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    width: 100%;
    max-width: 200px;
}

.email-btn:hover {
    background-color: #1d4ed8;
}

/* Main */
#main-content {
    flex-grow: 1;
    padding: 3rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    margin-bottom: 3.5rem;
    scroll-margin-top: 2rem;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--accent-color);
    font-size: 1rem;
}

/* Desktop Grid Row */
.desktop-grid-row {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media(min-width: 1024px) {
    .desktop-grid-row {
        display: grid;
        grid-template-columns: 2fr 1fr;
        /* 2/3 and 1/3 */
        gap: 2rem;
        align-items: start;
    }

    /* Ensure skills stack vertically in the narrow column */
    .desktop-grid-row #skills .cards-container {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.cards-container {
    display: grid;
    gap: 1rem;
}

.single-col {
    grid-template-columns: 1fr;
}

.grid-col {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

/* Projects Card Specifics */
.project-card {
    cursor: pointer;
}

.project-img-placeholder {
    width: 100%;
    height: 160px;
    background-color: #f3f4f6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s;
}

.project-card:hover .project-img-placeholder {
    transform: scale(1.02);
}

/* Experience */
.exp-card-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.company-logo {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
    padding: 2px;
    border: 1px solid #f3f4f6;
    transition: border-color 0.2s;
}

.exp-details {
    flex-grow: 1;
}

.role-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Education Links */
.role-title a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
}

.role-title a:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.company-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.date-row {
    font-family: var(--code-font);
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-badge {
    background: #f3f4f6;
    padding: 0px 6px;
    border-radius: 4px;
}

.duration-text {
    color: var(--accent-color);
    font-weight: 500;
}

.exp-body {
    margin-top: 0.25rem;
}

.keyword-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.exp-keyword {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Tech Chips */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.tech-chip {
    font-family: var(--code-font);
    font-size: 0.7rem;
    color: var(--accent-color);
    background: var(--accent-glow);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* Publication Links */
.pub-link-icon {
    font-size: 0.8em;
    margin-left: 0.5rem;
    color: var(--accent-color);
    text-decoration: none;
}

.pub-link-icon:hover {
    color: #1d4ed8;
}

/* Modal */
.modal {
    display: flex;
    /* Hidden by default via class */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal.hidden {
    display: none;
}

/* Maximized Modal */
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 12px;
    width: 85%;
    /* Reduced from 98% */
    height: 85vh;
    /* Reduced from 95vh */
    max-width: none;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.modal.visible .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 100;
    /* Ensure above everything */
    color: white;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-body {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
    gap: 0;
}

.modal-image-container {
    flex: 7;
    /* 70% Width */
    height: 100%;
    background: #050505;
    border-radius: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Enhanced Arrows */
.prev,
.next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: 50px;
    /* Larger click area */
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -25px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    /* Larger icon */
    transition: 0.3s ease;
    border-radius: 50%;
    /* Circular */
    user-select: none;
    background-color: rgba(0, 0, 0, 0.6);
    /* Darker, more visible */
    z-index: 10;
}

.next {
    right: 20px;
    /* Inset slightly */
}

.prev {
    left: 20px;
    /* Inset slightly */
}

.prev:hover,
.next:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-info {
    flex: 3;
    /* Takes 1/3rd width */
    padding: 2.5rem;
    overflow-y: auto;
    background: white;
    display: flex;
    flex-direction: column;
}

/* Adjust title in modal */
#modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    color: var(--text-primary);
}

#modal-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 1.5rem;
}

/* Responsive Modal (Stack on mobile) */
@media(max-width: 1024px) {
    .modal-content {
        width: 95%;
        height: 90vh;
        flex-direction: column;
    }

    .modal-image-container {
        flex: 1;
        /* Split evenly or let image take strictly needed height */
        height: 50%;
    }

    .modal-info {
        flex: 1;
        height: 50%;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 2rem 1rem;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    #section-nav {
        display: block;
        margin-top: 1.5rem;
    }

    #section-nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    #main-content {
        padding: 2rem 1.5rem;
    }
}