:root {
    --bg: #f7f5f3;
    --fg: #2c2a28;
    --muted: #7a7370;
    --link: #5c4f4b;
    --rule: rgba(0, 0, 0, 0.12);
    --highlight: rgba(0, 0, 0, 0.04);
}
body.dark {
    --bg: #14171c;
    --fg: #e0dedc;
    --muted: #8e8987;
    --link: #b5aaa7;
    --rule: rgba(255, 255, 255, 0.12);
    --highlight: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family:
        "Lato",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    line-height: 1.55;
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}
a {
    color: var(--link);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
#about a {
    font-weight: 700;
}
em {
    font-style: italic;
}

/* Top navigation */
.topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
}
.topnav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topnav-brand {
    font-family: "Georgia", serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--fg);
}
.topnav-brand:hover {
    text-decoration: none;
}
.topnav-links {
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.topnav-links a {
    color: var(--fg);
    font-size: 0.95rem;
    position: relative;
    padding: 4px 0;
}
.topnav-links a:hover {
    text-decoration: none;
}
.topnav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5px;
    background: var(--fg);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.topnav-links a:hover::after {
    transform: scaleX(1);
}
.topnav-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* B/W slider */
.theme-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}
.theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.theme-toggle .track {
    position: absolute;
    inset: 0;
    background: #ffffff;
    border: 1.5px solid #000000;
    border-radius: 13px;
    transition:
        background 0.25s ease,
        border-color 0.25s ease;
}
.theme-toggle .thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #000000;
    border-radius: 50%;
    transition:
        transform 0.25s ease,
        background 0.25s ease;
}
.theme-toggle input:checked ~ .track {
    background: #000000;
    border-color: #ffffff;
}
.theme-toggle input:checked ~ .thumb {
    transform: translateX(26px);
    background: #ffffff;
}

/* Hamburger */
.hamburger {
    display: none;
    width: 32px;
    height: 32px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
}
.hamburger span {
    display: block;
    height: 2px;
    background: var(--fg);
    margin: 6px 0;
    transition:
        transform 0.25s,
        opacity 0.25s;
}
.topnav.open .hamburger span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.topnav.open .hamburger span:nth-child(2) {
    opacity: 0;
}
.topnav.open .hamburger span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.mobile-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}
.mobile-menu li {
    border-bottom: 1px solid var(--rule);
}
.mobile-menu a {
    display: block;
    padding: 14px 28px;
    color: var(--fg);
    font-size: 1rem;
}
.mobile-menu a:hover {
    background: var(--highlight);
    text-decoration: none;
}

/* Layout */
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px 80px;
}
.layout {
    display: flex;
    gap: 56px;
    padding-top: 40px;
}
.sidebar {
    flex: 0 0 240px;
    position: sticky;
    top: 92px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.sidebar img.portrait {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 18px;
}
.sidebar .icons {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    font-size: 1.1rem;
}
.sidebar .icons a {
    color: var(--muted);
}
.sidebar .icons a:hover {
    color: var(--fg);
    text-decoration: none;
}
.sidebar h1 {
    font-family: "Georgia", serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.sidebar .tagline {
    font-size: 0.98rem;
    color: var(--fg);
    margin: 0;
}
.content {
    flex: 1;
    min-width: 0;
    max-width: 880px;
}

.section {
    padding-top: 6px;
}
.section h2 {
    font-family: "Georgia", serif;
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 18px;
}
.section + .divider {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 40px 0;
}
.section p {
    margin: 0 0 12px;
}
.section p + p {
    margin-top: 12px;
}

/* Publications */
.pub-year {
    font-family: "Georgia", serif;
    font-size: 1rem;
    font-weight: 700;
    margin: 28px 0 12px;
}
.pub-list {
    padding-left: 14px;
    border-left: 1px solid var(--rule);
}
.pub-item {
    margin-bottom: 20px;
}
.pub-authors {
    font-size: 0.95rem;
    margin: 0 0 4px;
}
.pub-title {
    font-family: "Georgia", serif;
    font-size: 1rem;
    font-weight: 700;
    margin: 2px 0;
}
.pub-title a {
    color: var(--fg);
}
.pub-venue {
    font-size: 0.95rem;
    margin: 2px 0;
}
.pub-links {
    margin: 2px 0 0;
    font-size: 0.92rem;
}
.pub-links a {
    color: var(--muted);
    margin-right: 6px;
}
.pub-award {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.92rem;
    color: var(--muted);
    font-style: italic;
}
.pub-cofirst {
    font-size: 0.75rem;
    color: #999;
    margin: 2px 0;
}

/* Reviewing & CV */
.subhead {
    font-family: "Georgia", serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 22px 0 10px;
}
.plain-list {
    list-style: none;
    padding-left: 14px;
    border-left: 1px solid var(--rule);
    margin: 0;
}
.plain-list li {
    margin-bottom: 10px;
}
.plain-list b {
    color: var(--fg);
}

/* CV */
.cv-row {
    display: flex;
    gap: 20px;
    padding: 0 0 14px 14px;
    border-left: 1px solid var(--rule);
}
.cv-row .cv-date {
    flex: 0 0 140px;
    color: var(--muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-top: 1px;
}
.cv-row .cv-body {
    flex: 1;
    min-width: 0;
}
.cv-row .role {
    font-weight: 700;
}
.cv-row .meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

.cv-feature .role {
    font-size: 1.05rem;
}
.cv-desc {
    margin: 6px 0 0;
    font-size: 0.95rem;
}
.stats {
    display: flex;
    gap: 36px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.stat {
    display: flex;
    flex-direction: column;
}
.stat .num {
    font-family: "Georgia", serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}
.stat .lbl {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 2px;
}

/* Mobile */
@media (max-width: 820px) {
    .topnav-links {
        display: none;
    }
    .hamburger {
        display: block;
    }
    .topnav.open .mobile-menu {
        display: block;
    }
    .topnav-inner {
        padding: 12px 20px;
    }
    .layout {
        flex-direction: column;
        gap: 28px;
        padding-top: 28px;
    }
    .sidebar {
        position: static;
        flex: initial;
        width: 100%;
    }
    .page {
        padding: 0 20px 60px;
    }
    .section h2 {
        font-size: 1.3rem;
    }
    .cv-row {
        flex-direction: column;
        gap: 4px;
    }
    .cv-row .cv-date {
        flex: initial;
        font-size: 0.85rem;
    }
    html {
        scroll-padding-top: 64px;
    }
}
