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

/* CSS Variables for Light/Dark Theme */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6b6b6b;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --accent-color: #0066cc;
    --hover-bg: #f0f0f0;
    --link-color: #0066cc;
    --visited-color: #8b5cf6;
}

/* Dark theme via data-attribute (manual override) */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #121212;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #999;
    --text-muted: #999;
    --border-color: #333;
    --accent-color: #6db3ff;
    --hover-bg: #2a2a2a;
    --link-color: #6db3ff;
    --visited-color: #a78bfa;
}

/* Dark theme via system preference (when no manual override) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #121212;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-tertiary: #999;
        --text-muted: #999;
        --border-color: #333;
        --accent-color: #6db3ff;
        --hover-bg: #2a2a2a;
        --link-color: #6db3ff;
        --visited-color: #a78bfa;
    }
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    font-size: 16px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 200;
    font-size: 14px;
}

.skip-link:focus {
    top: 0;
}

a {
    color: var(--link-color);
}

a:visited:not(.nav-link):not(.social-link):not(.pub-link):not(.timeline-link) {
    color: var(--visited-color);
}

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

/* Ensure consistent font size across all pages */
.page-section {
    font-size: 16px;
}

.page-section p {
    font-size: 16px;
    line-height: 1.6;
}

/* Page Layout - Two Column Structure */
.page-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

/* Left Sidebar - Fixed */
.sidebar {
    position: sticky;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-content {
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.bio-image img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
}

.sidebar-name {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.sidebar-title {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-align: center;
}

.sidebar-affiliation {
    font-size: 0.9em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-align: center;
}

.sidebar-office {
    font-size: 0.82em;
    color: var(--text-tertiary);
    margin-bottom: 15px;
    text-align: center;
}

.sidebar-office a {
    color: var(--accent-color);
    text-decoration: none;
}

.sidebar-office a:hover {
    text-decoration: underline;
}

.bio-short {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-tertiary);
    margin-bottom: 15px;
    text-align: center;
    padding: 0 10px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0;
    background-color: var(--bg-primary);
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 56px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    z-index: 100;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

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

.nav-link.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    width: 70px;
    height: 36px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--accent-color);
}

.theme-toggle i {
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
}

.theme-toggle .fa-sun {
    color: #fbbf24;
}

.theme-toggle .fa-moon {
    color: #60a5fa;
}

/* Light theme - show moon on right, hide sun */
:root .theme-toggle .fa-sun {
    opacity: 0.3;
}

:root .theme-toggle .fa-moon {
    opacity: 1;
}

/* Dark theme - show sun on left, hide moon */
[data-theme="dark"] .theme-toggle .fa-sun {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .fa-moon {
    opacity: 0.3;
}

/* Page Sections */
.page-section {
    display: none;
    padding: 36px 56px;
}

.page-section.active {
    display: block;
}

.page-section:focus {
    outline: none;
}

.page-header {
    margin-bottom: 30px;
}

.main-name {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.main-title {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.main-affiliation {
    font-size: 1.1em;
    color: var(--text-tertiary);
    margin-bottom: 30px;
}

.bio-description {
    margin: 20px 0;
}

.bio-description p {
    color: var(--text-secondary);
    text-align: justify;
}

.links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Social link styling - icon + label */
.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    text-decoration: none;
    color: var(--text-tertiary);
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 12px;
}

.social-link i {
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.social-link .social-label {
    flex: 1;
}

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

/* Custom links (CV, Blog, etc.) */
.links a:not(.social-link) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    color: var(--link-color);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 500;
}

.links a:not(.social-link):hover {
    background-color: var(--hover-bg);
}

/* Sidebar link categories */
.links-category {
    width: 100%;
    margin-top: 4px;
}

.links-category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.links-category-toggle:hover {
    background-color: var(--hover-bg);
    color: var(--text-secondary);
}

.category-chevron {
    font-size: 9px;
    transition: transform 0.2s ease;
}

.links-category-toggle[aria-expanded="true"] .category-chevron {
    transform: rotate(180deg);
}

.links-category-items {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 4px;
}

.links-category-toggle[aria-expanded="true"] + .links-category-items {
    display: flex;
}

/* "See all" inline link */
.see-all-link {
    margin-top: 16px;
    text-align: right;
}

.nav-link-inline {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.nav-link-inline:hover {
    text-decoration: underline;
}

/* Content Sections */
.content-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.content-section:last-of-type {
    border-bottom: none;
}

.content-section h2 {
    font-size: 1.55em;
    color: var(--text-primary);
    margin-bottom: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Resume Section */
.resume-section {
    margin-bottom: 15px;
}

.resume-section h3 {
    font-size: 1.2em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.resume-item {
    margin-bottom: 12px;
    padding-left: 0;
    display: flex;
    gap: 10px;
}

.resume-logo {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resume-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.resume-details {
    flex: 1;
}

.resume-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.resume-header strong {
    font-size: 1em;
    color: var(--text-primary);
}

.date {
    color: var(--text-muted);
    font-size: 0.85em;
}

.resume-subheader {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2px;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.resume-advisor {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 2px;
}

.resume-thesis {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 2px;
}

.resume-thesis a {
    color: var(--accent-color);
    text-decoration: none;
}

.resume-thesis a:hover {
    text-decoration: underline;
}

.resume-commitment {
    color: var(--text-muted);
    font-size: 0.8em;
    font-style: italic;
    margin-left: 10px;
}

.resume-item p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.85em;
    line-height: 1.4;
}

.resume-bullets {
    margin: 4px 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.resume-bullets li {
    margin-bottom: 2px;
    font-size: 0.85em;
    line-height: 1.3;
}

/* News - simple one-liner per entry; whole row jumps to a Timeline anchor. */
.news-list {
    list-style: none;
}

.news-list li {
    margin-bottom: 8px;
    line-height: 1.55;
    font-size: 1em;
}

.news-row {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    align-items: baseline;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.news-row[data-href] {
    cursor: pointer;
}

.news-row[data-href]:hover,
.news-row[data-href]:focus-visible {
    background-color: var(--hover-bg);
    outline: none;
}

.news-date {
    font-weight: 700;
    color: var(--text-tertiary);
    font-size: 0.85em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.news-content {
    color: var(--text-secondary);
    min-width: 0;
}

.news-link {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    margin-left: 4px;
}

.news-link:hover {
    text-decoration: underline;
}

.news-tags {
    display: inline-flex;
    gap: 5px;
}

@media (max-width: 600px) {
    .news-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .news-tags {
        justify-self: start;
    }
}

.news-tag {
    display: inline-block;
    color: #fff;
    font-size: 0.68em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: lowercase;
    letter-spacing: 0.3px;
    opacity: 0.9;
}

/* Timeline - true cartesian: Y axis is time. Every card sits at an
   absolute top in px computed from its (month-fractional) end date;
   range cards (B.Sc., M.Sc., positions) get min-height equal to the
   year-span x _TIMELINE_YEAR_PX so they visibly cover their interval.
   Paper-side stays slim on the LEFT, institutional side gets extra
   width on the RIGHT. Container height is set inline by the builder. */
.timeline {
    position: relative;
    max-width: 1140px;
    margin: 8px auto 48px;
    --rail-gap: 36px;
    --lane-gap: 8px;
    /* --n-left, --n-right, --n-total, --total-recip are set inline by
       the build (from the greedy-lane assignment). All lanes - LEFT
       and RIGHT alike - share ONE uniform --lane-w, so an M.Sc. card
       on the right has the same width as an internship card on the
       left. The rail's x-coordinate is then derived from how many
       lanes sit to the left of it. Defaults below cover the no-data
       case (1 lane each side). */
    --n-left: 1;
    --n-right: 1;
    --n-total: 2;
    --total-recip: 0.5;
    --lane-w: calc(
        (100% - 2 * var(--rail-gap) - (var(--n-total) - 2) * var(--lane-gap))
        * var(--total-recip)
    );
    --left-side-w: calc(
        var(--n-left) * var(--lane-w) + (var(--n-left) - 1) * var(--lane-gap)
    );
    --right-side-w: calc(
        var(--n-right) * var(--lane-w) + (var(--n-right) - 1) * var(--lane-gap)
    );
    --rail-x: calc(var(--left-side-w) + var(--rail-gap));
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--rail-x);
    width: 2px;
    background: var(--border-color);
    transform: translateX(-1px);
    z-index: 0;
}

/* Month ticks on the rail - small dashes between year labels, like a
   ruler. Placement is per-band (variable year-band heights), computed
   in Python as fractions of each band's height. */
.timeline-month-tick {
    position: absolute;
    left: var(--rail-x);
    width: 8px;
    height: 1px;
    background: var(--border-color);
    transform: translateX(-50%);
    opacity: 0.6;
    z-index: 0;
}

.timeline-year-label {
    position: absolute;
    left: var(--rail-x);
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 2px 14px;
    font-size: 0.78em;
    font-weight: 700;
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    z-index: 3;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.timeline-item {
    position: absolute;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    z-index: 1;
}

.timeline-item:target,
.timeline-item:hover {
    z-index: 2;
}

.timeline-item:target {
    border-color: var(--dot-color, var(--accent-color));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot-color, var(--accent-color)) 25%, transparent);
}

/* Multi-lane positioning: each item exposes --lane (its index) and
   --lanes (the side's total lane count). Cards shrink to fit a lane's
   share of the side width, and shift away from the rail as lane grows. */
.timeline-item {
    --lane: 0;
    --lanes: 1;
}

/* card-w = (side-w - (lanes-1) * lane-gap) / lanes
   lane-offset = lane * (card-w + lane-gap)
   The CSS calc divisor must be a literal number, so we keep --lanes only
   as the denominator of --card-w (where it's a unitless divisor) and
   then build everything else as `lane * (card-w + lane-gap)`, a pure
   number * length. The dot+arm offsets are inlined into ::before /
   ::after directly so they don't depend on an extra --lane-offset
   indirection that pseudo-elements may resolve inconsistently. */
/* --lane-recip is set inline (1/lanes precomputed in Python) so we never
   use a var() as the calc divisor. Browsers (notably Firefox) silently
   discard `calc(... / var(...))` because the spec requires a literal
   number on the right of /. Multiplying by --lane-recip is spec-clean
   and works in every engine. */
.timeline-left {
    --card-w: calc((var(--left-side-w) - (var(--lanes) - 1) * var(--lane-gap)) * var(--lane-recip));
    width: var(--card-w);
    right: calc(100% - var(--rail-x) + var(--rail-gap) + var(--lane) * (var(--card-w) + var(--lane-gap)));
    left: auto;
}

.timeline-right {
    --card-w: calc((var(--right-side-w) - (var(--lanes) - 1) * var(--lane-gap)) * var(--lane-recip));
    width: var(--card-w);
    left: calc(var(--rail-x) + var(--rail-gap) + var(--lane) * (var(--card-w) + var(--lane-gap)));
    right: auto;
}

/* Rail marker = dot + arm, a sibling of the card under .timeline. The
   marker box must span the FULL timeline width (left:0; right:0) so
   that percentages inside the arm's `width:` calc resolve against the
   timeline, not against a narrow per-card box. The dot + arm are then
   positioned absolutely INSIDE the marker, each at its own offset from
   the rail.

   --lane-ratio (set inline as lane / lanes) drives the arm length:
       arm = (rail-gap - 7px) + ratio * (side-w + lane-gap)
   = 29px for lane 0 (arm just bridges card edge to dot), growing by
     one full sub-column's worth per additional lane index. */
.rail-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    pointer-events: none;
    /* Sit BELOW cards so the arm doesn't paint on top of any card it
       passes through on the way from the rail to a higher-lane box. */
    z-index: 0;
}
.rail-marker::after {
    /* The dot itself, sat on the rail. */
    content: "";
    position: absolute;
    top: 18px;
    left: var(--rail-x);
    margin-left: -7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--dot-color, var(--accent-color));
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}
.rail-marker::before {
    /* The horizontal arm. */
    content: "";
    position: absolute;
    top: 24px;
    height: 2px;
    background: var(--border-color);
}
.rail-marker-right::before {
    left: calc(var(--rail-x) + 7px);
    width: calc((var(--rail-gap) - 7px) + var(--lane-ratio) * (var(--right-side-w) + var(--lane-gap)));
}
.rail-marker-left::before {
    right: calc(100% - var(--rail-x) + 7px);
    width: calc((var(--rail-gap) - 7px) + var(--lane-ratio) * (var(--left-side-w) + var(--lane-gap)));
}
.timeline-item:hover + .rail-marker::after,
.timeline-item:target + .rail-marker::after {
    background: var(--dot-color, var(--accent-color));
}

/* Slim rows for the left side: compact padding, tighter typography so
   stacked point events (publications) don't dominate the rail. */
.timeline-slim {
    padding: 7px 12px;
}
.timeline-slim .timeline-date {
    font-size: 0.7em;
    margin-bottom: 1px;
}
.timeline-slim .timeline-title {
    font-size: 0.95em;
    margin: 1px 0;
    line-height: 1.3;
}
.timeline-slim .timeline-authors,
.timeline-slim .timeline-venue {
    font-size: 0.8em;
    line-height: 1.3;
}
.timeline-slim .timeline-venue {
    margin-top: 1px;
}
.timeline-slim .timeline-links {
    gap: 4px;
    margin-top: 5px;
}
.timeline-slim .timeline-link {
    font-size: 0.68em;
    padding: 1px 7px;
}
.timeline-slim::after { top: 14px; }
.timeline-slim::before { top: 20px; }

@media (max-width: 760px) {
    .timeline { --rail-x: 24px; }
    .timeline-year-label {
        transform: translate(-50%, -50%);
    }
    .timeline-left,
    .timeline-right {
        left: 50px;
        right: 0;
        width: auto;
    }
    /* On mobile everything stacks in one column, so the arm is always
       just a short hop from the rail to the card. */
    .rail-marker-left::before,
    .rail-marker-right::before {
        left: 14px;
        right: auto;
        width: 22px;
    }
}

.timeline-date {
    display: block;
    font-size: 0.74em;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 3px;
}

.timeline-dash {
    opacity: 0.55;
}

.timeline-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
    margin: 0 0 3px;
}

.timeline-logo {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    padding: 1px;
}

.timeline-org,
.timeline-authors {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.timeline-venue {
    font-size: 0.82em;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.timeline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.timeline-link {
    padding: 2px 9px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.72em;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.timeline-link:hover {
    border-color: var(--accent-color);
    color: #fff;
    background-color: var(--accent-color);
}

.paper-links {
    margin-top: 8px;
}

.paper-links a {
    display: inline-block;
    margin-right: 10px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
    padding: 4px 10px;
    border: 1px solid var(--accent-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.paper-links a:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Publications Grid (Berken Demirel Style) - For About page */
.publications-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Compact Publication Cards - For Resume page (APA reference style) */
.publication-item-compact {
    margin-bottom: 4px;
    padding-bottom: 0px;
    font-size: 0.85em;
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

/* Compact-body groups the citation line with its attached awards in a
   single flex item so they stack vertically inside the row, while the
   links pill row floats to the right. The award strip indents to the
   hanging-indent continuation, so it aligns with the second line of
   the reference rather than the first author. */
.pub-compact-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.pub-compact-reference {
    color: var(--text-secondary);
    text-align: justify;
    padding-left: 30px;
    text-indent: -30px;
}
.pub-compact-body > .entry-awards {
    padding-left: 30px;
    margin-top: 2px;
}

.pub-compact-reference strong {
    color: var(--text-primary);
    font-weight: 600;
}

.publication-item-compact .publication-links {
    margin: 0;
    padding: 0;
    gap: 6px;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.publication-item-compact .pub-link {
    padding: 3px 10px;
    font-size: 0.75em;
    margin: 0;
}

.publication-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.publication-left {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.publication-venue-tag {
    background-color: var(--accent-color);
    color: #fff;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 0.92em;
    font-weight: 700;
    text-align: center;
    width: 100%;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.publication-venue-tag a {
    color: inherit !important;
    text-decoration: none;
}

.publication-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.publication-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.publication-content {
    flex: 1;
}

.publication-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.publication-authors {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.publication-authors .author-me {
    font-weight: 600;
}

.publication-venue {
    font-size: 0.9em;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 12px;
}

.publication-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* Inline awards: attached to publications, education entries, and
   timeline cards. Renders as a subtle one-line-per-award strip with a
   small trophy glyph; the organization tail is dimmed. No background
   pill - we want this to feel like part of the entry, not a chip. */
.entry-awards {
    margin-top: 6px;
    margin-bottom: 2px;
}
.entry-award {
    font-size: 0.85em;
    color: var(--text-primary);
    line-height: 1.4;
}
.entry-award .fa-award {
    color: #b58900;
    margin-right: 4px;
    font-size: 0.95em;
}
.entry-award a {
    color: inherit;
    text-decoration: none;
}
.entry-award a:hover { color: var(--accent-color); }
.entry-award .award-name { font-weight: 600; }
.entry-award .award-org {
    color: var(--text-tertiary);
    font-weight: 400;
}
/* Slim timeline cards: match the card's reduced scale. */
.timeline-slim .entry-awards { margin-top: 4px; }
.timeline-slim .entry-award { font-size: 0.78em; }

/* Nested publication = 2-line chip inside a parent timeline card.
     line 1: [venue] title  ............................. (date)
     line 2: authors (single line, ellipsised)
   Each line stays on one row via white-space:nowrap + ellipsis, so the
   chip's footprint is predictable (~36-44px). Coloured left border
   picks up the parent's dot colour. */
.nested-pub {
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--dot-color, var(--accent-color));
    border-radius: 5px;
    line-height: 1.25;
    box-sizing: border-box;
}
.nested-pub-line-1 {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
}
.nested-pub-line-1 .nested-pub-title {
    font-size: 0.86em;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.nested-pub-venue-tag {
    flex: 0 0 auto;
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}
.nested-pub-line-1 .nested-pub-date {
    flex: 0 0 auto;
    font-size: 0.65em;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.nested-pub-line-2 {
    font-size: 0.72em;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nested-pub .timeline-links {
    margin-top: 4px;
    gap: 3px;
}
.nested-pub .timeline-link {
    font-size: 0.62em;
    padding: 0 5px;
}
.nested-pub .entry-awards { margin-top: 3px; }
.nested-pub .entry-award { font-size: 0.72em; }

.pub-link {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
    background-color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pub-link:hover {
    border-color: var(--accent-color);
    color: white;
    background-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* In-progress / under-review status badge on a publication */
.pub-status {
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: flex-start;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    color: #b45309;
    background-color: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.35);
}

/* Blog and Work Items */
.blog-list,
.repos-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.blog-item,
.work-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.blog-item:hover,
.work-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* The Open Source card is itself a navigation target (-> project page).
   The title inside is a separate link (-> GitHub). Cursor + focus ring
   make the click affordance obvious. */
.work-item[data-href] {
    cursor: pointer;
}
.work-item[data-href]:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.blog-link,
.work-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-item h3,
.work-item h3 {
    color: var(--text-primary);
    font-size: 1.2em;
    margin-bottom: 10px;
}

.blog-item p,
.work-item p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.blog-date {
    color: var(--text-muted);
    font-size: 0.9em;
    font-style: italic;
}

.work-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.work-tag {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid var(--border-color);
}

/* Blog search + tag filters */
.blog-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}

.blog-search {
    width: 100%;
    padding: 9px 14px;
    font-size: 0.95em;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.blog-search:focus {
    outline: none;
    border-color: var(--accent-color);
}

.blog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-filter {
    padding: 4px 12px;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blog-filter:hover {
    border-color: var(--accent-color);
}

.blog-filter.active {
    color: #fff;
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Tag chips on blog cards */
.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.blog-tag {
    padding: 3px 10px;
    font-size: 0.78em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blog-tag:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Lightbox overlay for zoomable publication images */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
    animation: lightbox-fade-in 0.2s ease;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: lightbox-zoom-in 0.25s ease;
}

@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes lightbox-zoom-in {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Footer */
footer {
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Layout */
    .page-layout {
        flex-direction: column;
    }

    /* Sidebar: compact layout */
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-content {
        padding: 20px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .bio-image img {
        width: 80px;
        height: 80px;
    }

    .sidebar-name {
        font-size: 1em;
        margin-bottom: 4px;
    }

    .sidebar-title {
        font-size: 0.85em;
        margin-bottom: 2px;
    }

    .sidebar-affiliation {
        font-size: 0.8em;
        margin-bottom: 5px;
    }

    .bio-short {
        font-size: 12px;
        margin-bottom: 5px;
        padding: 0;
    }

    .links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .social-link .social-label {
        display: none;
    }

    .social-link {
        padding: 6px;
    }

    .social-link i {
        font-size: 16px;
    }

    .links a:not(.social-link) {
        font-size: 11px;
    }

    .links-category-toggle {
        font-size: 10px;
        padding: 2px 4px;
    }

    .links-category-items {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding-left: 0;
    }

    /* Navigation */
    .main-nav {
        padding: 15px 16px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-link {
        font-size: 14px;
    }

    .theme-toggle {
        width: 56px;
        height: 30px;
    }

    .theme-toggle i {
        font-size: 12px;
    }

    /* Content */
    .main-content {
        padding: 0;
    }

    .page-section {
        padding: 20px 16px;
    }

    .main-name {
        font-size: 1.6em;
    }

    /* Publication cards: stack vertically */
    .publication-item {
        flex-direction: column;
    }

    .publication-left {
        width: 100%;
        flex-direction: row;
        gap: 12px;
        align-items: center;
    }

    .publication-venue-tag {
        width: auto;
    }

    .publication-image {
        max-width: 160px;
    }

    .pub-link {
        padding: 6px 12px;
        font-size: 0.75em;
    }

    /* Compact publications: stack */
    .publication-item-compact {
        flex-direction: column;
        gap: 8px;
    }

    .pub-compact-reference {
        padding-left: 0;
        text-indent: 0;
    }

    /* Resume */
    .resume-header {
        flex-direction: column;
    }

    .resume-subheader {
        flex-direction: column;
    }

    .resume-logo {
        width: 32px;
        height: 32px;
    }

    .timeline-container {
        grid-template-columns: 1fr;
    }

    /* Timeline */
    .timeline-item {
        padding-left: 24px;
        padding-bottom: 18px;
    }

    .timeline-title {
        font-size: 0.95em;
    }

    /* Blog/Work items */
    .blog-item,
    .work-item {
        padding: 14px;
    }

    .blog-item h3,
    .work-item h3 {
        font-size: 1.05em;
    }
}

/* Print Stylesheet
   Goals: (a) Ctrl+P on whichever section is visible prints only that
   section (no About+CV+Blogs+Timeline mash); (b) UI chrome (nav, theme
   toggle, search, filters, badges) is stripped; (c) buttons / pills /
   badges flatten to inline text so links look like links, not widgets. */
@media print {
    @page {
        margin: 1.4cm 1.6cm;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 10pt;
        line-height: 1.4;
    }

    /* Icon fonts (Font Awesome, academicons, devicons): force them to
       render with their declared colour. The print-color-adjust opt-in
       is scoped to icons only - applied globally it would also force
       page backgrounds and shaded blocks to print, which is what made
       the page look dark. */
    .fa, .fas, .far, .fal, .fab, .fa-solid, .fa-regular, .fa-brands,
    .ai, [class^="devicon-"], [class*=" devicon-"] {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color: #000 !important;
        display: inline-block !important;
        font-style: normal !important;
        font-weight: 900 !important;
        visibility: visible !important;
    }
    .fab, .fa-brands { font-weight: 400 !important; }
    /* The attached-award glyph keeps its gold tint - it's a meaningful
       semantic colour, not chrome. */
    .entry-award .fa-award { color: #8a5a00 !important; }

    /* One column. Sidebar becomes a compact header. The min-height:
       100vh from screen styles must be killed - in print, vh resolves
       to the page height, so leaving it on collapses the whole CV onto
       a single squashed page. */
    .page-layout {
        display: block;
        min-height: 0;
        height: auto;
    }
    html, body { height: auto; min-height: 0; }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        background: #fff;
        border: none;
        border-bottom: 1pt solid #000;
        margin-bottom: 12pt;
    }
    .sidebar-content {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 14pt;
        padding: 0 0 10pt;
    }
    .bio-image img { width: 70px; height: 70px; margin: 0; }
    .sidebar-name {
        font-size: 16pt;
        font-weight: 700;
        margin: 0;
        text-align: left;
        color: #000;
    }
    .sidebar-title,
    .sidebar-affiliation {
        font-size: 9.5pt;
        margin: 0;
        text-align: left;
        color: #333;
    }
    .bio-short { display: none; }
    .links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4pt 10pt;
        font-size: 8.5pt;
        margin-left: auto;
    }
    .links a,
    .social-link {
        color: #000 !important;
        padding: 0 !important;
        background: none !important;
        font-size: 8.5pt !important;
        font-weight: 400 !important;
    }
    .links-category-toggle { display: none; }
    .links-category-items { display: flex !important; flex-direction: row; gap: 4pt 10pt; }
    .social-link i { color: #000; }

    /* Hide on-screen chrome */
    .main-nav,
    .theme-toggle,
    .skip-link,
    footer,
    .blog-controls,
    .see-all-link,
    .blog-tags,
    .news-tags,
    .work-tags,
    .publication-image,
    .project-image,
    .timeline-logo {
        display: none !important;
    }
    /* Keep resume logos in print but shrink to a tight square so they
       sit next to the entry header without dominating it. */
    .resume-logo {
        display: block !important;
        flex: 0 0 auto;
    }
    .resume-logo img {
        width: 22pt !important;
        height: 22pt !important;
        object-fit: contain;
    }
    .resume-item {
        display: flex !important;
        gap: 6pt;
        align-items: flex-start;
    }
    .resume-details { flex: 1 1 auto; min-width: 0; }

    /* Only print the section the visitor is actually on. Note: no
       break-inside: avoid here - we WANT long sections (Publications,
       Experience) to break naturally across pages instead of being
       pushed entirely to the next page. */
    .page-section {
        display: none !important;
        padding: 0;
    }
    .page-section.active {
        display: block !important;
        padding: 0;
    }
    .main-content {
        max-width: 100%;
        padding: 0;
        background: #fff;
    }

    /* Section headings - let sections flow across pages so an h2 only
       starts a new page when content genuinely won't fit, not because
       break-inside: avoid was forcing the whole section forward. */
    .content-section {
        padding: 8pt 0;
        border-bottom: none;
    }
    .content-section h2 {
        font-size: 13pt;
        font-weight: 700;
        margin: 0 0 6pt;
        padding-bottom: 2pt;
        border-bottom: 0.75pt solid #000;
        letter-spacing: 0;
        color: #000;
        break-after: avoid;
    }

    /* Plain underlined text links instead of styled buttons */
    a {
        color: #000;
        text-decoration: underline;
    }

    .pub-link,
    .timeline-link {
        display: inline !important;
        border: none !important;
        background: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 4pt 0 0 !important;
        font-size: 9pt !important;
        font-weight: 400 !important;
        font-family: inherit !important;
        color: #000 !important;
        text-decoration: underline !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }
    .pub-link::before { content: "["; text-decoration: none; }
    .pub-link::after  { content: "]"; text-decoration: none; }

    .publication-links {
        display: inline !important;
        gap: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Strip pill / badge backgrounds */
    .news-date,
    .news-tag,
    .news-link,
    .blog-tag,
    .blog-filter,
    .blog-date,
    .tech-badge,
    .work-tag,
    .publication-venue-tag,
    .timeline-date {
        background: none !important;
        color: #000 !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        font-weight: 700 !important;
        font-size: inherit !important;
        opacity: 1 !important;
        box-shadow: none !important;
        letter-spacing: 0 !important;
    }
    .tech-badge i { display: none; }

    /* News: single inline run per entry, no grid (grid eats wrap space) */
    .news-list li {
        display: block;
        margin-bottom: 3pt;
        line-height: 1.35;
    }
    .news-row {
        display: block !important;
        padding: 0 !important;
        background: none !important;
        text-decoration: none;
        color: #000 !important;
    }
    .news-date {
        font-weight: 700;
        font-size: 9pt;
        color: #000;
        margin-right: 6pt;
    }
    .news-content { color: #000; font-size: 9.5pt; }
    .news-link { color: #000 !important; text-decoration: underline !important; }

    /* Resume items */
    .resume-item {
        display: block;
        margin-bottom: 6pt;
        break-inside: avoid;
    }
    .resume-details { flex: none; }
    .resume-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
    }
    .resume-header strong { font-size: 10.5pt; color: #000; }
    .date { color: #000; font-size: 9pt; }
    .resume-subheader,
    .resume-advisor { color: #222; font-size: 9.5pt; }
    .resume-bullets li { font-size: 9pt; line-height: 1.3; }

    /* Publication cards: collapse to citation row */
    .publication-item {
        display: block;
        padding: 4pt 0;
        border-bottom: 0.25pt solid #ccc;
        break-inside: avoid;
    }
    .publication-left {
        width: auto;
        display: inline;
        margin-right: 4pt;
    }
    .publication-venue-tag {
        display: inline;
        width: auto;
        margin: 0;
    }
    .publication-venue-tag::before { content: "["; }
    .publication-venue-tag::after  { content: "] "; }
    .publication-content { display: inline; }
    .publication-title,
    .publication-authors,
    .publication-venue {
        display: inline;
        font-size: 9.5pt;
    }
    .publication-title { font-weight: 700; }
    .publication-title::after  { content: ". "; }
    .publication-authors::after { content: ". "; }
    .publication-venue { font-style: italic; }
    .publication-venue::after { content: ". "; }

    /* Lists of publications: collapse flex/grid containers to plain
       block so the browser can break pages between items. Flex/grid
       containers in print often refuse to split, which is what makes
       the next section (e.g. Experience) start on a fresh page. */
    .publications-grid {
        display: block !important;
        gap: 0 !important;
    }

    /* Compact APA citations on CV (most common case for printed CV).
       Keep the flex row so the link pills / status badge stay on the
       right instead of dropping to a new line. */
    .publication-item-compact {
        display: flex;
        margin-bottom: 4pt;
        font-size: 9.5pt;
        break-inside: avoid;
    }
    .pub-compact-reference {
        padding-left: 18pt;
        text-indent: -18pt;
    }
    /* Attached awards: always render as a block on their own line,
       indented to align with the citation hang. The icon stays inline
       inside the line. */
    .entry-awards {
        display: block !important;
        margin: 2pt 0 0 18pt !important;
    }
    .entry-award {
        display: block !important;
        color: #000 !important;
        font-size: 9pt !important;
    }
    .entry-award .award-org { color: #333 !important; }

    /* Timeline: drop the rail and all box chrome. Cards are still
       absolute-positioned (their top: NNNpx is inline), but with no
       border, background, or rounded corners they read as flat text
       rows on the page. */
    .timeline-item {
        padding: 0 0 6pt 0;
        background: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .rail-marker,
    .timeline-month-tick { display: none !important; }
    .timeline::before { display: none !important; }
    .timeline-year-label {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        color: #000 !important;
    }
    .timeline-title { font-size: 10.5pt; }
    .timeline-org,
    .timeline-authors,
    .timeline-venue { font-size: 9.5pt; color: #222; }

    /* Blog list + Open Source cards: drop card chrome (borders, padding,
       backgrounds, shadows) so they print as flat text rows */
    .blog-item,
    .work-item {
        border: none !important;
        border-radius: 0 !important;
        padding: 4pt 0 !important;
        background: none !important;
        box-shadow: none !important;
        transform: none !important;
        break-inside: avoid;
    }
    .repos-list {
        display: block !important;
        grid-template-columns: none !important;
    }
    .work-head {
        gap: 6pt;
    }
    .work-icon,
    .work-ext { display: none !important; }
    .work-name { font-size: 10.5pt; font-weight: 700; color: #000; }
    .work-repo { color: #000; }
    .blog-item h3 { font-size: 10.5pt; }
}

/* ---- Blog pages (generated from org notes by builder.build_blogs) ---- */
.blog-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 20px;
    min-height: 100vh;
}

.blog-back {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9em;
}

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

.blog-page > h1 {
    font-size: 2em;
    line-height: 1.2;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.blog-meta {
    color: var(--text-muted);
    font-size: 0.92em;
    margin-bottom: 36px;
}

.blog-body {
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: 1.02em;
}

.blog-body h1,
.blog-body h2 {
    color: var(--text-primary);
    margin: 1.6em 0 0.5em;
    line-height: 1.3;
}

.blog-body h2 {
    font-size: 1.4em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.2em;
}

.blog-body h3 {
    color: var(--text-primary);
    margin: 1.3em 0 0.4em;
    font-size: 1.15em;
}

.blog-body p {
    margin: 0 0 1.1em;
}

.blog-body a {
    color: var(--link-color);
}

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

.blog-body strong {
    color: var(--text-primary);
}

.blog-body img,
.blog-body svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
}

.blog-body figcaption {
    font-size: 0.85em;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5em;
}

.blog-body math {
    font-size: 1.02em;
}

.blog-table {
    overflow-x: auto;
    margin: 1.5em 0;
}

.blog-body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8em;
}

.blog-body th,
.blog-body td {
    border: 1px solid var(--border-color);
    padding: 6px 9px;
    text-align: left;
    vertical-align: top;
}

.blog-body thead th {
    background: var(--bg-secondary);
}

.blog-body caption {
    caption-side: top;
    font-size: 0.85em;
    color: var(--text-muted);
    text-align: left;
    margin-bottom: 0.6em;
}

.blog-body .citation {
    white-space: nowrap;
}

.blog-refs-title {
    font-size: 1.4em;
    margin-top: 2em;
}

.blog-body .csl-bib-body {
    font-size: 0.9em;
}

.blog-body .csl-entry {
    margin-bottom: 0.6em;
    padding-left: 1.4em;
    text-indent: -1.4em;
}

.blog-body .footnotes {
    margin-top: 2.5em;
    padding-top: 1em;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-muted);
}

.blog-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ---- Open Source project cards ---- */
.repos-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.work-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    background: var(--bg-secondary);
}

.work-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.work-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.work-icon {
    font-size: 1.25em;
    color: var(--text-primary);
    flex-shrink: 0;
}

.work-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.work-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05em;
    line-height: 1.2;
}

.work-repo {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72em;
    color: var(--text-muted);
}

.work-ext {
    color: var(--text-muted);
    font-size: 0.8em;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.work-item:hover .work-ext {
    color: var(--accent-color);
}

.work-item p {
    margin: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.work-tag {
    display: inline-flex;
    align-items: center;
}

.lang-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
}

@media (max-width: 768px) {
    .repos-list {
        grid-template-columns: 1fr;
    }
}

/* ---- Clickable project titles + project pages ---- */
.project-link {
    color: var(--text-primary);
    text-decoration: none;
}

.work-name {
    text-decoration: none;
}

.project-link:hover,
.work-name:hover {
    color: var(--accent-color);
}

.project-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0 24px;
    display: block;
}

.project-page .publication-links {
    margin-top: 22px;
}

/* ---- Tech badges (Devicon / Font Awesome) ---- */
.tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 600;
    color: #fff;
}

.tech-badge i {
    font-size: 1.05em;
    line-height: 1;
}

/* constrain project page images (bound height; keep aspect ratio) */
.project-image {
    max-height: 360px;
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

/* project/blog summary lists */
.blog-body ul {
    margin: 0 0 1.1em;
    padding-left: 1.4em;
}

.blog-body li {
    margin-bottom: 0.4em;
}

/* dates: tabular figures for a clean, aligned look */
.date,
.timeline-date,
.blog-date,
.news-date,
.publication-venue {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* code blocks + inline code in project/blog bodies */
.blog-body pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 1.2em 0;
    font-size: 0.82em;
    line-height: 1.5;
}

.blog-body pre code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: none;
    padding: 0;
}

.blog-body :not(pre) > code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.88em;
}

/* highlight.js syntax tokens - theme-aware (follows data-theme toggle) */
.hljs { background: transparent; color: var(--text-primary); }
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag { color: #d73a49; }
.hljs-string, .hljs-meta .hljs-string { color: #032f62; }
.hljs-number, .hljs-symbol, .hljs-attr, .hljs-attribute, .hljs-bullet { color: #005cc5; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: #6f42c1; }
.hljs-built_in, .hljs-type { color: #e36209; }
.hljs-meta { color: #6a737d; }

[data-theme="dark"] .hljs-comment, [data-theme="dark"] .hljs-quote { color: #8b949e; }
[data-theme="dark"] .hljs-keyword, [data-theme="dark"] .hljs-selector-tag,
[data-theme="dark"] .hljs-literal, [data-theme="dark"] .hljs-doctag { color: #ff7b72; }
[data-theme="dark"] .hljs-string, [data-theme="dark"] .hljs-meta .hljs-string { color: #a5d6ff; }
[data-theme="dark"] .hljs-number, [data-theme="dark"] .hljs-symbol,
[data-theme="dark"] .hljs-attr, [data-theme="dark"] .hljs-attribute,
[data-theme="dark"] .hljs-bullet { color: #79c0ff; }
[data-theme="dark"] .hljs-title, [data-theme="dark"] .hljs-title.function_,
[data-theme="dark"] .hljs-section, [data-theme="dark"] .hljs-name { color: #d2a8ff; }
[data-theme="dark"] .hljs-built_in, [data-theme="dark"] .hljs-type { color: #ffa657; }
