/* Self-hosted fonts (../fonts relative to this stylesheet at /assets/css/) */
@font-face { font-family:'InterLocal'; font-weight:400; font-display:swap; src:url('../fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family:'InterLocal'; font-weight:500; font-display:swap; src:url('../fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family:'InterLocal'; font-weight:600; font-display:swap; src:url('../fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family:'InterLocal'; font-weight:700; font-display:swap; src:url('../fonts/inter-700.woff2') format('woff2'); }

/* Portfolio CSS: one typeface (Inter) on a fixed scale; the green accent marks
   links, the selected state and the hero cursor. */

:root {
    /* Colors - Light Mode */
    --color-bg: #fafafa;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f4f4f5;
    --color-bg-hover: #e4e4e7;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-hover: rgba(0, 0, 0, 0.16);
    --color-text: #18181b;
    --color-text-secondary: #52525b;
    --color-text-tertiary: #71717a;      /* 4.6:1 on the page background (AA) */
    --color-accent: #0a7d57;             /* link/accent text, 5.1:1 on white */
    --color-accent-hover: #075f42;
    --color-accent-bright: #0e9f6e;      /* non-text accents: cursor, focus ring */
    --color-accent-strong: #075f42;      /* text on the soft accent fill */
    --color-accent-soft: rgba(14, 159, 110, 0.12); /* selected nav item, filter, language */
    --color-accent-fill: #7aff9e;        /* marker under the current role */
    --color-on-accent: #ffffff;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.82);
    --backdrop-blur: blur(12px);

    /* Typography: one family, one scale */
    --font-sans: 'InterLocal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace; /* code only */

    --fs-label: 0.8125rem;   /* 13px  section labels, chips, tags, small dates */
    --fs-small: 0.875rem;    /* 14px  meta lines, nav, buttons, footer */
    --fs-base: 1rem;         /* 16px  body text, list and card titles */
    --fs-lead: 1.125rem;     /* 18px  hero tagline, featured titles */
    --fs-h2: 1.25rem;        /* 20px  group headings (years, categories) */
    --fs-h1: clamp(1.875rem, 1.45rem + 1.8vw, 2.5rem);    /* page titles */
    --fs-display: clamp(2.5rem, 1.7rem + 3.4vw, 3.5rem);  /* hero name only */

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Radius: small chips, cards/menus, pills */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-accent: #7aff9e;
    --color-accent-hover: #9bffb6;
    --color-accent-bright: #7aff9e;
    --color-accent-strong: #7aff9e;
    --color-accent-soft: rgba(122, 255, 158, 0.12);
    --color-accent-fill: #7aff9e;
    --color-on-accent: #0d0d11;
    --color-bg: #0d0d11;
    --color-bg-secondary: #14141a;
    --color-bg-tertiary: #1c1c24;
    --color-bg-hover: #26262f;
    --color-border: rgba(255,255,255,0.08);
    --color-border-hover: rgba(255,255,255,0.18);
    --color-text: #f3f3f7;
    --color-text-secondary: #a3a3b8;
    --color-text-tertiary: #8a8aa3;      /* 5.5:1 on cards (AA) */
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(20, 20, 26, 0.88);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* One keyboard focus ring for every interactive element */
:where(a, button, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--color-accent-bright);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* Top fade: the page dissolves into the background behind the floating nav, so
   text and images scrolling up do not show through around the pill. Purely visual:
   it never takes clicks. */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 116px;
    z-index: 90;
    pointer-events: none;
    background: linear-gradient(to bottom,
        var(--color-bg) 0,
        var(--color-bg) 62px,
        color-mix(in srgb, var(--color-bg) 75%, transparent) 84px,
        color-mix(in srgb, var(--color-bg) 30%, transparent) 102px,
        transparent 100%);
}

/* Navigation */
.nav {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: calc(100% - var(--space-8));
    /* the pill lines up with the 952px content column (avatar on the text edge) */
    max-width: calc(1000px - 2 * var(--space-6) + 16px);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: 6px 8px 6px 6px;
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
}

.nav-logo {
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.25;
    letter-spacing: -0.011em;
    color: var(--color-text);
}

.nav-cursor {
    /* the blinking cursor lives in the hero only */
    display: none;
}

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

/* Brand block: name + current role with the employer's mark */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}

.nav-avatar-link {
    flex: none;
    display: block;
    line-height: 0;
}

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--color-border);
}

.nav-brand .nav-name {
    white-space: nowrap;
}

.nav-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--color-text-secondary);
    white-space: nowrap;
    min-width: 0;
}

.nav-role-mark {
    display: block;
    flex: none;
    height: 10px;
    width: auto;
    opacity: 0.7;
}

[data-theme="dark"] .nav-role-mark {
    filter: invert(1);
    opacity: 0.85;
}

.nav-role-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-role:hover {
    color: var(--color-text);
}

.nav-role:hover .nav-role-mark {
    opacity: 1;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    font-size: 0.9375rem; /* 15px: the main navigation reads at full ink */
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.006em;
    color: var(--color-text);
    border-radius: var(--radius-full);
    white-space: nowrap;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
}

.nav-link.active {
    /* "you are here": a soft accent fill plus weight, not colour alone */
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    font-weight: 600;
}

/* Contact: the one outlined pill in the header (same pill shape as nav items) */
.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    margin-left: var(--space-2);
    padding: 0 14px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.006em;
    white-space: nowrap;
    color: var(--color-text);
    border: 1px solid var(--color-border-hover);
    border-radius: var(--radius-full);
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.nav-cta:hover {
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    border-color: transparent;
}

.nav-cta svg {
    flex: none;
    color: var(--color-text-tertiary);
}

.nav-cta:hover svg {
    color: inherit;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    margin-left: var(--space-1);
    padding-left: var(--space-2);
    border-left: 1px solid var(--color-border);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    flex: none;
    background: none;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-toggle:hover {
    background: var(--color-bg-hover);
}

.lang-dropdown {
    position: relative;
}

.lang-current {
    list-style: none;
    cursor: pointer;
    height: 36px;
    padding: 0 10px 0 12px;
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-text-secondary);
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.lang-current:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
}

.lang-current::-webkit-details-marker { display: none; }
.lang-current::after {
    content: "";
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    opacity: 0.7;
}

.lang-dropdown[open] .lang-current {
    color: var(--color-text);
    background: var(--color-bg-hover);
}

.lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    min-width: 168px;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    font-size: var(--fs-small);
    padding: 0 10px;
    border-radius: 8px;
    color: var(--color-text);
}

.lang-option:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

.lang-option.active {
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    font-weight: 600;
}

.lang-code {
    color: var(--color-text-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.4rem;
}

.lang-option.active .lang-code { color: inherit; }

.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.theme-toggle:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* Main */
.main {
    flex: 1;
    padding-top: 88px;
}

/* Every page starts its title at the same height */
.cv-page,
.publications-page,
.presentations-page,
.microblog-page,
.microblog-item-page,
.privacy-page {
    padding-top: var(--space-12);
}

/* Sections */
.section {
    padding: var(--space-16) 0;
}

.section-title {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-6);
}

/* Hero */
.hero {
    min-height: auto;
    display: flex;
    align-items: center;
    padding: var(--space-12) 0 0;
}

.hero-row { display:flex; gap:2rem; align-items:stretch; }
.hero-row:has(.hero-photo) { flex-direction:row-reverse; align-items:center; justify-content:space-between; }
.hero-photo {
    flex:none; width:176px; height:176px; border-radius:50%; object-fit:cover;
    box-shadow:0 0 0 6px var(--color-bg), 0 0 0 7px var(--color-border), var(--shadow-md);
}
@media (max-width: 640px) {
    .hero-row:has(.hero-photo) { flex-direction:column; align-items:flex-start; gap:1.25rem; }
    .hero-photo { width:112px; height:112px; }
}
.hero-text { flex:1 1 auto; min-width:0; }
.hero-name { font-weight:700; font-size:var(--fs-display); letter-spacing:-0.032em; line-height:1.05; }
.hero-cursor { color:var(--color-accent-bright); font-weight:500; margin-left:0.03em; animation: hero-blink 1.1s steps(1) infinite; }
@keyframes hero-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero-cursor { animation: none; } }
.hero-tagline { font-size:var(--fs-lead); color:var(--color-text-secondary); max-width:36rem; margin-top:var(--space-5); line-height:1.6; text-wrap:pretty; }
.hero-tagline strong {
    font-weight:600; letter-spacing:-0.01em; color:var(--color-text);
    /* marker-style accent under the current role */
    background-image:linear-gradient(color-mix(in srgb, var(--color-accent-fill) 55%, transparent), color-mix(in srgb, var(--color-accent-fill) 55%, transparent));
    background-repeat:no-repeat; background-size:100% 0.34em; background-position:0 92%;
    -webkit-box-decoration-break:clone; box-decoration-break:clone;
}

.hero-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 18px;
    font-size: var(--fs-small);
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
    cursor: pointer;
}
.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-hover);
}
.btn-secondary:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}

/* Accent button: solid green on light; on dark a soft green fill with a green
   outline, so the bright accent does not glare */
.btn-accent {
    background: var(--color-accent);
    color: var(--color-on-accent);
    border-color: var(--color-accent);
}

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

[data-theme="dark"] .btn-accent {
    background: var(--color-accent-soft);
    border-color: rgba(122, 255, 158, 0.45);
    color: var(--color-accent);
}

[data-theme="dark"] .btn-accent:hover {
    background: rgba(122, 255, 158, 0.2);
    border-color: var(--color-accent);
    color: var(--color-accent-hover);
}

/* Quiet secondary button: neutral, pairs with the accent button */
.btn-quiet {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-hover);
}

.btn-quiet:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}

/* Currently / affiliations strip (home) */
.now-section {
    padding-top: var(--space-10);
    padding-bottom: 0;
}

.now-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6) var(--space-10);
}

.now-actions {
    margin-top: var(--space-8);
}

/* Borderless: affiliations read as a light row, not boxed cards */
.now-badge {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.now-org {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-text-secondary);
    transition: color var(--transition-base);
}

/* Typographic wordmark (crisp, theme-aware recreation of a text logo) */
.now-wordmark {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--color-text-secondary);
    opacity: 0.8;
    transition: color var(--transition-base), opacity var(--transition-base);
}

.now-wordmark .wm-lead { font-weight: 700; }
.now-wordmark .wm-tail { font-weight: 500; }

a.now-badge:hover .now-wordmark {
    opacity: 1;
}

/* Full name shown under a logo/wordmark */
.now-name {
    font-size: var(--fs-label);
    color: var(--color-text-tertiary);
}

/* Real logos, desaturated to greyscale so detailed emblems keep their detail
   (on dark the tones are inverted so the marks read light on the dark surface) */
.now-logo {
    display: block;
    align-self: flex-start;
    height: 28px;
    width: auto;
    max-width: 160px;
    opacity: 0.75;
    filter: grayscale(1);
    transition: opacity var(--transition-base);
}

[data-theme="dark"] .now-logo,
[data-theme="dark"] .cv-logo,
[data-theme="dark"] .cv-teach-logo img {
    /* dark marks turned light: inverted greyscale at full strength, not faded */
    filter: grayscale(1) invert(1) brightness(1.15);
    opacity: 0.92;
}

[data-theme="dark"] a.now-badge:hover .now-logo,
[data-theme="dark"] .cv-item:hover .cv-logo {
    opacity: 1;
}

a.now-badge:hover .now-org {
    color: var(--color-accent);
}

a.now-badge:hover .now-logo {
    opacity: 1;
}

.now-role {
    font-size: var(--fs-label);
    color: var(--color-text-tertiary);
}

@media (max-width: 640px) {
    .now-badge {
        flex-basis: 100%;
    }
}

/* Home "work" block: two rich cards (publications + presentations) */
.work-section {
    padding-top: var(--space-16);
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

.work-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    text-decoration: none;
    transition: border-color var(--transition-base);
}

.work-card:hover {
    border-color: var(--color-border-hover);
}

.work-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.work-card-icon {
    display: inline-flex;
    color: var(--color-text-tertiary);
    transition: color var(--transition-base);
}

.work-card:hover .work-card-icon {
    color: var(--color-accent);
}

.work-card-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-text);
}

/* Push the count badge to the far end of the header row */
.work-card-head .quick-link-count {
    margin-left: auto;
}

.work-card-feature {
    display: grid;
    gap: var(--space-1);
    flex: 1 1 auto;
}

.work-feature-meta {
    font-size: var(--fs-label);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.work-feature-title {
    font-size: var(--fs-lead);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--color-text);
    text-wrap: balance;
}

.work-feature-sub {
    font-size: var(--fs-small);
    color: var(--color-text-secondary);
}

.work-card-cta {
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--color-accent);
    margin-top: auto;
}

.work-card:hover .work-card-cta {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Count badge pill (reused on the home work cards) */
.quick-link-count {
    display: inline-block;
    min-width: 1.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
}

/* Whole publication box clickable on the publications page */
.publication-card .publication-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

@media (max-width: 640px) {
    .work-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    .work-card {
        padding: var(--space-5);
    }
}

/* Titles in lists and cards: no orphans, balanced headings */
.cv-title,
.cv-item-title,
.category-title,
.year-heading,
.mb-related-list a,
.mb-pager-title,
.work-feature-title {
    text-wrap: balance;
}

.cv-item-subtitle,
.presentation-event,
.publication-details,
.publication-authors,
.contact-intro {
    text-wrap: pretty;
}

/* Page Header */
.page-header {
    text-align: left;
    margin-bottom: var(--space-10);
}

.page-title {
    font-size: var(--fs-h1);
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.15;
    color: var(--color-text);
    margin-bottom: var(--space-2);
    text-wrap: balance;
}

.page-subtitle {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
    max-width: 40rem;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    justify-content: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-10);
    flex-wrap: wrap;
}

.filter-tab {
    font-family: inherit;
    font-size: var(--fs-label);
    font-weight: 500;
    line-height: 1;
    height: 32px;
    padding: 0 14px;
    background: transparent;
    border: 1px solid var(--color-border-hover);
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.filter-tab:hover {
    color: var(--color-text);
    background: var(--color-bg-tertiary);
}

.filter-tab.active {
    /* same selected state as the nav */
    color: var(--color-accent-strong);
    background: var(--color-accent-soft);
    border-color: transparent;
    font-weight: 600;
}

/* Publication Category */
.publication-category {
    margin-bottom: var(--space-12);
}

.category-title {
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.2;
    color: var(--color-text);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.publication-list {
    display: flex;
    flex-direction: column;
}

.publication-card {
    position: relative;
    display: flex;
    gap: var(--space-5);
    background: none;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-5) 0;
}

/* Cards that link somewhere get a pointer + accent title on hover of the whole box */
.publication-card:has(.publication-link) {
    cursor: pointer;
}

.publication-card:has(.publication-link):hover .publication-title {
    color: var(--color-accent);
}

.publication-card:has(.publication-link):hover .publication-link-icon {
    opacity: 1;
}

.publication-year {
    font-size: var(--fs-small);
    font-weight: 500;
    line-height: 1.6;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    width: 2.75rem;
}

.publication-content {
    flex: 1;
}

.publication-title {
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text);
    margin-bottom: var(--space-1);
    text-wrap: pretty;
}

.publication-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.publication-link:hover {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.publication-link-icon {
    display: inline-block;
    margin-left: 0.35em;
    vertical-align: baseline;
    color: var(--color-text-tertiary);
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.publication-link:hover .publication-link-icon {
    opacity: 1;
    color: var(--color-accent);
}

.publication-authors {
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.publication-details {
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--color-text-tertiary);
}

/* Presentations - Year Grouped */
.presentations-grouped {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.year-group {
    position: relative;
}

.year-heading {
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.2;
    color: var(--color-text);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.presentations-list {
    display: flex;
    flex-direction: column;
}

.presentation-card {
    background: none;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-5) 0;
}

.presentation-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.presentation-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    text-wrap: pretty;
}

.presentation-meta {
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--color-text-tertiary);
}

/* date · location · role: the dot stays at the end of a line, never starts one */
.presentation-meta > *:not(:last-child)::after {
    content: "\a0·";
}

.presentation-date,
.presentation-role {
    white-space: nowrap;
}

.presentation-event {
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.presentation-date {
    font-variant-numeric: tabular-nums;
}

/* Language tag: flags the language a talk was actually delivered in */
.lang-tag {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    position: relative;
    bottom: 1px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 3px 5px;
    border: 1px solid var(--color-border-hover);
    border-radius: 4px;
    color: var(--color-text-tertiary);
    cursor: default;
}

/* Microblog */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Reading pages share the 1000px container (same left edge and title position as
   every other page); only the text column is capped at a reading measure */
.mb-container > * {
    max-width: 720px;
}

.mb-feed-link {
    margin-top: var(--space-3);
    font-size: var(--fs-small);
}

.mb-feed-link a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-text-tertiary);
}

.mb-feed-link a:hover {
    color: var(--color-accent);
}

.mb-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.mb-list {
    display: flex;
    flex-direction: column;
}

.mb-card {
    background: none;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-8) 0;
}

.mb-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-small);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
    margin-bottom: var(--space-2);
}

.mb-date {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.mb-date:hover {
    color: var(--color-accent);
}

.mb-sep {
    opacity: 0.6;
}

/* Byline on a post page */
.mb-author {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.mb-author:hover {
    color: var(--color-accent);
}

.mb-title {
    font-size: var(--fs-lead);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-2);
    text-wrap: balance;
}

.mb-title a {
    color: var(--color-text);
}

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

.mb-summary {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
    line-height: 1.65;
    text-wrap: pretty;
}

.mb-more {
    display: inline-block;
    margin-top: var(--space-3);
    font-size: var(--fs-small);
    font-weight: 500;
}

.mb-cover {
    display: block;
    width: 100%;
    height: auto; /* width/height attributes only reserve the aspect ratio */
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
}

.mb-cover--hero {
    margin: var(--space-2) 0 var(--space-6);
}

.mb-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    margin-top: var(--space-5);
    font-size: var(--fs-label);
}

.mb-tag {
    color: var(--color-text-secondary);
}

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

.mb-linkedin {
    margin-left: auto;
    color: var(--color-text-tertiary);
}

.mb-linkedin:hover {
    color: var(--color-accent);
}

.mb-empty {
    text-align: center;
    color: var(--color-text-tertiary);
}

/* Markdown body */
.prose {
    font-size: var(--fs-base);
    line-height: 1.7;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.prose > * + * {
    margin-top: var(--space-4);
}

.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: var(--space-8);
}

.prose h2 { font-size: var(--fs-h2); }
.prose h3 { font-size: var(--fs-lead); }
.prose h4,
.prose h5,
.prose h6 { font-size: var(--fs-base); }

/* Feed cards: body headings are shifted to h4+ (below the card's h3 title) */
.mb-card .prose h4 { font-size: var(--fs-lead); }

.prose a {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.prose ul,
.prose ol {
    padding-left: var(--space-6);
}

.prose li + li {
    margin-top: var(--space-1);
}

.prose blockquote {
    border-left: 2px solid var(--color-accent);
    padding-left: var(--space-4);
    color: var(--color-text-secondary);
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
}

.prose pre {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow-x: auto;
}

.prose pre code {
    background: none;
    padding: 0;
}

.prose img {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

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

/* Privacy statement: prose with the reading measure; first heading flush */
.privacy-body > h2:first-child {
    margin-top: 0;
}

/* Item page */
.mb-back {
    display: inline-block;
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

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

.mb-article-title {
    font-size: var(--fs-h1);
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.15;
    margin-bottom: var(--space-6);
    text-wrap: balance;
    hyphens: manual;
    max-width: 40rem;
}

.mb-article--article .prose {
    font-size: 1.0625rem;
}

.mb-article-foot {
    padding-top: var(--space-5);
    margin-top: var(--space-8);
    border-top: 1px solid var(--color-border);
}

/* Related posts (shared tags), between the article and the pager */
.mb-related {
    margin-top: var(--space-12);
}

.mb-related-title {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.mb-related-list {
    list-style: none;
}

.mb-related-list a {
    font-size: var(--fs-base);
    line-height: 1.45;
    color: var(--color-text);
}

.mb-related-list li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.mb-related-list a:hover {
    color: var(--color-accent);
}

.mb-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-10);
}

.mb-related + .mb-pager {
    margin-top: var(--space-8);
}

.mb-pager-link {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    transition: border-color var(--transition-base);
}

.mb-pager-link:hover {
    border-color: var(--color-border-hover);
}

.mb-pager-newer {
    text-align: right;
}

.mb-pager-label {
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--color-text-tertiary);
}

.mb-pager-title {
    font-size: var(--fs-small);
    line-height: 1.45;
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Home: the newest items as one-line teasers under the work cards */
.mb-teasers {
    display: flex;
    flex-direction: column;
    margin-top: var(--space-12);
}

.mb-teaser-label {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.mb-teaser {
    display: flex;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

/* "View all posts": the work-card CTA as a link of its own */
.mb-teasers-all {
    align-self: flex-start;
    margin-top: var(--space-2);
    padding: var(--space-2) 0;
}

.mb-teasers-all:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mb-teaser-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
}

.mb-teaser-date {
    flex-shrink: 0;
    font-size: var(--fs-label);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.mb-teaser:hover .mb-teaser-text {
    color: var(--color-accent);
}

@media (max-width: 640px) {
    .mb-teaser {
        flex-wrap: wrap;
        gap: var(--space-1) var(--space-3);
    }
    .mb-teaser-text {
        flex-basis: 100%;
        order: 3;
        white-space: normal;
    }
    .mb-pager {
        grid-template-columns: 1fr;
    }
}

/* Home: contact block (work email, phone, firm) */
.contact-section {
    padding-top: 0; /* the work section above already ends with section spacing */
    padding-bottom: 0;
    scroll-margin-top: 96px; /* clears the floating nav when reached via #contact */
}

.contact-label {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.contact-intro {
    margin-top: var(--space-5);
    max-width: 40rem;
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
}

.contact-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-4) var(--space-6);
    margin-top: var(--space-6);
    list-style: none;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.contact-item-label svg {
    flex: none;
}

.contact-item-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-label);
    color: var(--color-text-tertiary);
}

.contact-item-value {
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

a.contact-item-value {
    color: var(--color-accent);
}

a.contact-item-value:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.contact-item-value .contact-at {
    color: var(--color-text-tertiary);
    font-weight: 400;
}

/* CV Page */
.cv-page {
    padding-top: var(--space-12);
}

.cv-header {
    margin-bottom: var(--space-12);
}

.cv-title {
    font-size: var(--fs-h1);
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.15;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.cv-name {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
}

.cv-section {
    margin-bottom: var(--space-16);
}

.cv-section-title {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.cv-item {
    margin-bottom: var(--space-12);
}

.cv-item:last-child {
    margin-bottom: 0;
}

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.cv-logo {
    display: block;
    height: 26px;
    width: auto;
    max-width: 150px;
    margin-bottom: var(--space-3);
    opacity: 0.75;
    filter: grayscale(1);
    transition: opacity var(--transition-base);
}

.cv-item:hover .cv-logo {
    opacity: 1;
}

/* Multiple logos on one experience entry (e.g. joint internships) */
.cv-logos {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin-bottom: var(--space-3);
}

.cv-logo--sm {
    height: 18px;
    margin-bottom: 0;
}

/* Teaching group labels (current / former) */
.cv-teach-group {
    font-size: var(--fs-label);
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
    margin: var(--space-8) 0 var(--space-4);
}

.cv-teach-group:first-of-type {
    margin-top: 0;
}

/* Teaching list with an aligned logo column */
.cv-teach-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.cv-teach-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.cv-teach-logo {
    flex-shrink: 0;
    width: 108px;
    display: inline-flex;
    align-items: center;
}

.cv-teach-logo img {
    height: 18px;
    width: auto;
    max-width: 108px;
    opacity: 0.75;
    filter: grayscale(1);
}

.cv-teach-text {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.cv-item-title {
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text);
}

.cv-item-subtitle {
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.cv-item-meta {
    text-align: right;
    flex-shrink: 0;
}

.cv-period {
    font-size: var(--fs-small);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.cv-location {
    font-size: var(--fs-small);
    color: var(--color-text-tertiary);
    display: block;
}

.cv-list {
    list-style: none;
    max-width: 44rem; /* reading measure */
}

.cv-list li {
    position: relative;
    padding-left: var(--space-4);
    margin-bottom: var(--space-2);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--color-text-secondary);
    text-wrap: pretty;
}

.cv-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.68em;
    width: 4px;
    height: 4px;
    background: var(--color-text-tertiary);
    border-radius: 50%;
}

.cv-profile-text {
    font-size: var(--fs-base);
    line-height: 1.7;
    color: var(--color-text-secondary);
    max-width: 44rem;
}

.cv-description {
    font-size: var(--fs-small);
    color: var(--color-text-secondary);
    max-width: 44rem;
    text-wrap: pretty;
}

.cv-info {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
}

/* 404 page: the same sentence in each language, then the newest posts */
.not-found-line + .not-found-line {
    margin-top: var(--space-2);
}

.not-found-all {
    margin-top: var(--space-4);
    font-size: 0.85rem;
}

/* Footer */
.footer {
    padding: var(--space-16) 0 var(--space-8);
    margin-top: auto;
}

.footer-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3) var(--space-6);
    padding-top: var(--space-6);
}

/* hairline as wide as the text column, not the padded container */
.footer-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--space-6);
    right: var(--space-6);
    height: 1px;
    background: var(--color-border);
}

.footer-contact,
.footer-contact a {
    font-size: var(--fs-small);
    color: var(--color-text-tertiary);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-5);
    list-style: none;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-1) 0;
}

.footer-links a[aria-current="page"] {
    color: var(--color-text);
}

@media (max-width: 480px) {
    .footer-links {
        gap: var(--space-1) var(--space-4);
    }
}

.footer-copyright {
    font-size: var(--fs-small);
    color: var(--color-text-tertiary);
}

.footer-copyright a {
    color: inherit;
}

.footer-contact a:hover,
.footer-copyright a:hover {
    color: var(--color-accent);
}

/* Responsive */
/* The full nav (name + role, four links, Contact, language, theme) needs the whole
   968px pill; below that it collapses into the menu button */
@media (max-width: 1000px) {
    .nav {
        width: calc(100% - var(--space-6));
    }

    .nav-container {
        padding-right: 4px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: calc(100% + var(--space-2));
        left: 0;
        right: 0;
        background: var(--color-bg-secondary);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-xl);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-2);
        gap: 0;
        display: none;
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        display: flex;
        height: 48px;
        padding: 0 var(--space-4);
        font-size: var(--fs-base);
        border-radius: var(--radius-md);
    }

    .nav-cta {
        height: 48px;
        margin: var(--space-2) 0 0;
        padding: 0 var(--space-4);
        font-size: var(--fs-base);
        justify-content: center;
    }

    .nav-actions {
        height: auto;
        margin: var(--space-2) 0 0;
        padding: var(--space-2) var(--space-1) 0;
        border-left: none;
        border-top: 1px solid var(--color-border);
        justify-content: space-between;
        width: 100%;
    }

    .lang-current,
    .theme-toggle {
        height: 44px;
    }

    .theme-toggle {
        width: 44px;
    }

    .lang-menu {
        left: 0;
        right: auto;
        top: calc(100% + 4px);
    }
}

@media (max-width: 768px) {
    .cv-item-header {
        flex-direction: column;
        gap: var(--space-1);
    }

    .cv-item-meta {
        text-align: left;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
}

@media (max-width: 640px) {
    /* tag/filter chips wrap: every chip stays visible, nothing hides off-screen */
    .filter-tabs {
        gap: 6px;
        margin-bottom: var(--space-8);
    }

    .filter-tab {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-4);
    }

    .footer-content::before {
        left: var(--space-4);
        right: var(--space-4);
    }

    .publication-card {
        flex-direction: column;
        gap: var(--space-1);
    }

    .publication-year {
        width: auto;
        line-height: 1.4;
    }
}

/* CV Links Row */
.cv-links-row {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Link to the openly readable full text of a publication */
.publication-fulltext {
    position: relative;
    z-index: 2; /* above the whole-row link overlay */
    margin-top: var(--space-2);
    font-size: var(--fs-small);
}

.publication-fulltext a {
    color: var(--color-accent);
    font-weight: 500;
}

.publication-fulltext a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.publication-fulltext-source {
    color: var(--color-text-tertiary);
    font-weight: 400;
}
