/* Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark Theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0d0d0d;
    --bg-secondary: #141414;
    --bg-hover: #1a1a1a;
    --text-primary: #e5e5e5;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #f5f5dc;
    --accent-bright: #ffd700;
    --border: #222;
    --modal-bg: #1a1a1a;
    --toggle-bg: #333;
    --toggle-active: #f5f5dc;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-hover: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --accent: #2563eb;
    --accent-bright: #1d4ed8;
    --border: #e5e5e5;
    --modal-bg: #ffffff;
    --toggle-bg: #e5e5e5;
    --toggle-active: #2563eb;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* Layout: main always fills remaining width so no empty strip on the right */
.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Mobile top bar: menu + theme toggle, hidden on desktop */
.mobile-top-actions {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 202;
    flex-direction: column;
    gap: 0.5rem;
}
.mobile-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.mobile-menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.mobile-menu-icon {
    width: 24px;
    height: 24px;
}
.mobile-theme-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.mobile-theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.mobile-theme-toggle .sun-icon {
    display: none;
}
.mobile-theme-toggle .moon-icon {
    display: block;
}
[data-theme="light"] .mobile-theme-toggle .sun-icon {
    display: block;
}
[data-theme="light"] .mobile-theme-toggle .moon-icon {
    display: none;
}

/* Overlay behind sidebar on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.is-visible {
    opacity: 1;
}

/* Close button inside sidebar: hidden on desktop */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.sidebar-close:hover {
    background: var(--toggle-bg);
}

/* Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    transition: background 0.3s, border-color 0.3s;
}

.nav {
    padding: 2rem 1.5rem;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.nav-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

/* Theme Toggle - Prominent Icon Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--toggle-bg);
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

.nav-menu {
    list-style: none;
    margin-bottom: 1rem;
}

.nav-item {
    display: block;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active::before {
    content: '○';
    margin-right: 0.5rem;
    color: var(--accent);
}

.nav-below-separator {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.nav-external-links {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-external-link:hover {
    color: var(--accent);
}

.nav-external-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-section {
    margin-top: 1.5rem;
}

.nav-section-title {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 240px;
    padding: 3rem 4rem;
    width: 100%;
    min-width: 0; /* allow flex shrink so content never collapses */
    max-width: none; /* use full available width on laptop */
}

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

.subsection-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.subsection-title:first-of-type {
    margin-top: 0;
}

/* Tablet: use space well, avoid empty right side */
@media (max-width: 1024px) {
    .main {
        padding: 2.5rem 2.5rem;
    }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0;
    color: var(--text-primary);
    text-align: center;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 2.25rem;
    padding: 0 1rem;
    margin-bottom: 1rem;
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1;
    color: var(--bg-primary);
    background: var(--accent);
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.contact-btn:hover {
    background: var(--accent-bright);
    color: var(--bg-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.contact-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.contact-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.email-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    font-size: 0.875rem;
}

.email-toast.visible {
    display: flex;
}

.email-toast-copy {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.email-toast-copy:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.page-description {
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.7;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

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

.section-header-with-action .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.expand-collapse-all-btn {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.expand-collapse-all-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bg-primary);
}

/* Items Table */
.items-table {
    display: flex;
    flex-direction: column;
}

.item-row {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.item-row:hover {
    background: var(--bg-hover);
    margin: 0 -1rem;
    padding: 0.75rem 1rem;
}

.item-row:last-child {
    border-bottom: none;
}

.item-year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--text-muted);
    white-space: nowrap;
}

.item-content {
    min-width: 0;
}

.item-title {
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.item-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.item-row:hover .item-arrow {
    opacity: 1;
}

/* See more row (industry positions, two-column view) */
.see-more-row {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font: inherit;
    color: var(--text-secondary);
}
.see-more-row:hover {
    background: var(--bg-hover);
    margin: 0 -1rem;
    padding: 0.75rem 1rem;
    color: var(--accent);
}
.see-more-label { font-weight: 500; }
.see-more-arrow { opacity: 0.8; }

/* See more expandable content */
.list-more.list-more-hidden {
    display: none !important;
}

/* Grouped Labor (Accordion) */
.labor-subheading {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.labor-subheading:hover {
    background: var(--bg-hover);
    margin: 0 -1rem;
    padding: 0.75rem 1rem;
}

.labor-subheading .item-arrow {
    opacity: 1;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.group-title {
    font-weight: 500;
    color: var(--text-primary);
}

.group-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.group-items {
    display: none;
    padding: 0.15rem 0 0.35rem 0;
}

.group-items.open {
    display: block;
}

.labor-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.labor-row:hover {
    background: var(--bg-hover);
    margin: 0 -1rem;
    padding: 0.4rem 1rem;
}

.labor-row:last-child {
    border-bottom: none;
}

.labor-title {
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.labor-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.labor-location {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.labor-org {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.labor-location-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}

.labor-location-label {
    flex-shrink: 0;
}

.labor-location-value {
    text-align: right;
    color: var(--text-secondary);
}

/* Publication Items */
.pub-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.pub-row:last-child {
    border-bottom: none;
}

.pub-title {
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.pub-title a {
    color: var(--text-primary);
    text-decoration: none;
}

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

.pub-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.pub-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    transition: all 0.2s;
}

.pub-link:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* Section Subheadings */
.section-subtitle {
    margin: 1.5rem 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.skill-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-role {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.modal-org {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.modal-meta {
    margin-bottom: 1.5rem;
}

.modal-meta-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.modal-meta-label {
    color: var(--text-muted);
    min-width: 100px;
}

.modal-meta-value {
    color: var(--text-secondary);
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

.modal-description p {
    margin-bottom: 1rem;
}

.modal-tags {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Blog Page */
.blog-list {
    display: flex;
    flex-direction: column;
}

.blog-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.blog-item:last-child {
    border-bottom: none;
}

.blog-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.blog-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.blog-title a {
    color: var(--text-primary);
    text-decoration: none;
}

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

.blog-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive: hide sidebar, show only main content + hamburger; sidebar opens as overlay */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .mobile-top-actions {
        display: flex;
    }
    .mobile-theme-toggle {
        display: flex;
    }
    body.sidebar-open .mobile-menu-btn,
    body.sidebar-open .mobile-theme-toggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
        opacity: 0;
    }
    .sidebar-overlay.is-visible {
        pointer-events: auto;
        opacity: 1;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        max-width: 85vw;
        height: 100vh;
        bottom: auto;
        border-right: 1px solid var(--border);
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: flex;
        position: static;
    }

    .nav {
        padding: 2rem 1.5rem;
        padding-top: 1.5rem;
    }

    .nav-header {
        margin-bottom: 2rem;
        min-height: 44px;
        align-items: center;
    }

    .sidebar .theme-toggle {
        display: none !important;
    }

    .nav-below-separator {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .nav-external-links {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 0.5rem;
        gap: 0.75rem;
    }

    .nav-item.active::before {
        display: none;
    }

    .main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 2rem 1.5rem 2rem 3.5rem;
        box-sizing: border-box;
    }

    .item-row,
    .see-more-row,
    .labor-row,
    .pub-row {
        grid-template-columns: 110px 1fr;
    }

    .item-row .item-arrow,
    .see-more-row .item-arrow {
        display: none;
    }

    .page-description {
        max-width: 100%;
    }
}

/* Small mobile: tighter padding and readable tap targets */
@media (max-width: 480px) {
    .main {
        padding: 1.5rem 1rem;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .item-row,
    .see-more-row,
    .labor-row,
    .pub-row {
        grid-template-columns: 90px 1fr;
        gap: 1rem;
    }

    .section-title {
        font-size: 0.85rem;
    }
}

/* Empty State */
.empty-state {
    color: var(--text-muted);
    padding: 2rem 0;
    text-align: center;
    font-style: italic;
}

