/* ═════════════════════════════════════════════════════════════
   Ammar Kheder — editorial/sketchy theme
   Inspired by N. Rougier's Quarto site (Bootswatch sketchy)
   ═════════════════════════════════════════════════════════════ */

:root {
    --font-head: 'Cabin Sketch', Georgia, serif;
    --font-body: 'Neucha', 'Comic Sans MS', 'Helvetica Neue', Arial, sans-serif;

    --ink: #1f1f1f;
    --ink-dark: #0a0a0a;
    --muted: #6b6b6b;
    --muted-2: #9a9a9a;
    --rule: #e4e0d7;
    --rule-strong: #0a0a0a;

    --link: #000088;
    --link-hover: #1d1dcc;
    --danger: #c62828;
    --accent-bg: #fffbea;
    --paper: #fffdf7;
    --paper-2: #ffffff;
    --nav-bg: #1a1a1a;
    --nav-ink: #f4f1e8;

    /* Hand-drawn irregular corners */
    --sketchy-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    --sketchy-radius-sm: 20px 6px 18px 8px / 8px 20px 6px 18px;
}

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

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

/* Offset anchor jumps so they don't hide behind the sticky navbar */
main section[id], main [id] {
    scroll-margin-top: 80px;
}

body {
    font-family: var(--font-body);
    background:
        radial-gradient(1200px 600px at 100% 0%, #f8f2e4 0%, transparent 60%),
        radial-gradient(900px 500px at 0% 100%, #f1ecdd 0%, transparent 55%),
        var(--paper);
    background-attachment: fixed;
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }

strong { color: var(--ink-dark); font-weight: 700; }
em { font-style: italic; }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--ink-dark);
    letter-spacing: 0.01em;
    line-height: 1.15;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
    background: var(--nav-bg);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--nav-ink);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.01em;
}
.brand:hover { color: var(--nav-ink); text-decoration: none; }
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--sketchy-radius-sm);
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center;
}
.nav-item {
    color: var(--nav-ink);
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 4px 2px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s, color 0.2s;
}
.nav-item:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-decoration: none;
}
.nav-sep {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: rgba(244, 241, 232, 0.25);
    margin: 0 4px;
}
.nav-icon {
    color: var(--nav-ink);
    display: inline-flex;
    padding: 4px;
    transition: color 0.2s, transform 0.2s;
}
.nav-icon:hover { color: #fff; transform: translateY(-1px); text-decoration: none; }
.nav-icon svg { width: 20px; height: 20px; display: block; }

/* Hamburger (hidden on desktop) */
.nav-toggle-check { display: none; }
.nav-toggle { display: none; }

/* ── Prose / main container ─────────────────────────────── */
.prose {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 32px 24px;
}

/* narrow the "reading" sections (header + intro) while keeping wide grid below */
.page-header,
.intro {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Home stats banner ──────────────────────────────────── */
.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 36px auto 28px;
    max-width: 820px;
}
.home-stats .stat-card {
    background: var(--paper-2);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    padding: 18px 16px 14px;
    text-align: center;
    box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.home-stats .stat-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.1);
}
.home-stats .stat-value {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 2.6rem;
    line-height: 1;
    color: var(--link);
    margin-bottom: 4px;
}
.home-stats .stat-value.stat-text {
    font-size: 1.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-dark);
}
.home-stats .stat-label {
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--ink-dark);
    line-height: 1.3;
}
.home-stats .stat-label span {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    font-family: var(--font-body);
    font-style: italic;
    margin-top: 2px;
}
@media (max-width: 720px) {
    .home-stats { grid-template-columns: 1fr; gap: 10px; }
    .home-stats .stat-value { font-size: 2.1rem; }
    .home-stats .stat-value.stat-text { font-size: 1.4rem; }
}

/* ── Featured paper card on home ───────────────────────── */
.featured-paper {
    margin: 8px 0 32px;
}
.featured-paper-card {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 0;
    background: var(--accent-bg);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}
.featured-paper-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 8px 9px 0 rgba(0, 0, 0, 0.12);
    text-decoration: none;
}
.featured-img {
    overflow: hidden;
    background: #0a0a0a;
    border-right: 2px solid var(--ink-dark);
    min-height: 260px;
}
.featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.featured-paper-card:hover .featured-img img { transform: scale(1.04); }

.featured-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.featured-kicker {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--danger);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.featured-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 2.6rem;
    color: var(--ink-dark);
    line-height: 1;
    margin-bottom: 10px;
    letter-spacing: 0.005em;
}
.featured-sub {
    font-size: 1rem;
    color: var(--ink);
    line-height: 1.55;
    margin-bottom: 12px;
}
.featured-venue {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 14px;
    font-style: italic;
}
.featured-venue em { color: var(--ink-dark); font-style: italic; font-weight: 700; }
.featured-cta {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    font-size: 1rem;
    letter-spacing: 0.02em;
}
.featured-cta .arrow { display: inline-block; transition: transform 0.2s; }
.featured-paper-card:hover .featured-cta .arrow { transform: translateX(5px); }

@media (max-width: 720px) {
    .featured-paper-card { grid-template-columns: 1fr; }
    .featured-img { border-right: none; border-bottom: 2px solid var(--ink-dark); min-height: 180px; aspect-ratio: 16 / 9; }
    .featured-title { font-size: 2.1rem; }
    .featured-body { padding: 20px 22px; }
}

/* ── Desktop: news & publications side by side ──────────── */
.main-grid {
    margin-top: 8px;
}
@media (min-width: 960px) {
    .main-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
        column-gap: 56px;
        row-gap: 0;
        align-items: stretch;
    }
    .main-grid > section { margin-top: 0; display: flex; flex-direction: column; }
    .main-grid > section h2 { margin-top: 16px; }
    .main-grid #news .news-wrap {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    .main-grid #news .news-wrap .news-list {
        flex: 0 0 auto;
    }
    .main-grid #news .news-wrap .news-all-link {
        margin-top: auto;
    }
}

/* ── Title ─────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--rule-strong);
}
.page-header h1 {
    font-size: 3.6rem;
    letter-spacing: 0.005em;
    margin-bottom: 6px;
}
.page-header .fw-light { font-weight: 400; color: #4a4a4a; }
.page-header .fw-bold { font-weight: 700; color: var(--ink-dark); }

.subtitle {
    font-size: 1.25rem;
    color: var(--muted);
    font-style: italic;
}
.tagline {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.45rem;
    color: var(--ink-dark);
    margin-top: 18px;
    line-height: 1.3;
    letter-spacing: 0.005em;
}
.tagline::before {
    content: "";
    display: inline-block;
    width: 36px;
    height: 3px;
    background: linear-gradient(90deg, var(--link), var(--danger));
    margin-right: 14px;
    vertical-align: 6px;
}
@media (max-width: 640px) {
    .tagline { font-size: 1.15rem; }
    .tagline::before { width: 24px; margin-right: 10px; vertical-align: 4px; }
}

/* ── Intro (photo + paragraphs) ──────────────────────────── */
.intro { margin-bottom: 44px; }
.intro::after { content: ''; display: block; clear: both; }

.intro .avatar {
    float: left;
    width: 200px;
    height: 200px;
    object-fit: cover;
    margin: 6px 22px 10px 0;
    border: 2.5px solid var(--ink-dark);
    border-radius: var(--sketchy-radius);
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.06);
}

/* ── Avatar swap (hover reveals Arita illustration) ────── */
.intro .avatar-swap {
    float: left;
    width: 200px;
    height: 200px;
    margin: 6px 22px 10px 0;
    position: relative;
    cursor: pointer;
    border-radius: var(--sketchy-radius);
}
.intro .avatar-swap .avatar {
    position: absolute;
    inset: 0;
    float: none;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    border: 2.5px solid var(--ink-dark);
    border-radius: var(--sketchy-radius);
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.06);
    transition: opacity 0.45s ease;
}
.intro .avatar-swap .avatar-back {
    /* Hidden by default. Hover or .is-flipped reveals it. */
    opacity: 0;
    transition: opacity 0.45s ease;
}
/* Hover or click-toggle: instant full reveal of Arita.
   .is-flipped is set by JS on click/tap and persists until next click. */
.intro .avatar-swap:hover .avatar-front,
.intro .avatar-swap:focus-within .avatar-front,
.intro .avatar-swap.is-flipped .avatar-front { opacity: 0 !important; }
.intro .avatar-swap:hover .avatar-back,
.intro .avatar-swap:focus-within .avatar-back,
.intro .avatar-swap.is-flipped .avatar-back { opacity: 1 !important; transition: opacity 0.45s ease; }
.intro .avatar-swap { cursor: pointer; }

/* Subtle "hover" hint badge that nudges visitors to discover the swap */
.intro .avatar-swap .avatar-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ink-dark);
    padding: 3px 8px;
    border-radius: var(--sketchy-radius-sm);
    pointer-events: none;
    opacity: 0;
    animation: avatarHintPulse 6s ease-in-out 1.5s infinite;
}
@keyframes avatarHintPulse {
    0%, 90%, 100% { opacity: 0; transform: translateY(4px); }
    8%, 25% { opacity: 0.85; transform: translateY(0); }
}
.intro .avatar-swap:hover .avatar-hint { animation: none; opacity: 0; }

/* One-shot "reveal" pulse on initial page load (set by home.js) */
.intro .avatar-swap.avatar-reveal-once .avatar-front {
    animation: avatarRevealFront 1.4s ease;
}
.intro .avatar-swap.avatar-reveal-once .avatar-back {
    animation: avatarRevealBack 1.4s ease;
}
@keyframes avatarRevealFront {
    0%, 100% { opacity: 1; }
    35%, 65% { opacity: 0; }
}
@keyframes avatarRevealBack {
    0%, 100% { opacity: 0; }
    35%, 65% { opacity: 1; }
}

.intro p {
    margin-bottom: 14px;
    font-size: 1.08rem;
    line-height: 1.65;
    text-align: justify;
    hyphens: auto;
}
.intro p.keywords {
    text-align: left;
    font-size: 1rem;
    color: var(--muted);
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px dashed var(--rule);
}
.intro p.keywords strong { color: var(--ink-dark); }

/* Download CV pill */
.intro p.cv-download {
    margin-top: 14px;
    text-align: left;
}
.intro p.cv-download a {
    display: inline-block;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    color: var(--link);
    border: 1.8px solid var(--link);
    border-radius: var(--sketchy-radius-sm);
    padding: 6px 16px;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all 0.18s;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}
.intro p.cv-download a:hover {
    background: var(--link);
    color: #fff;
    text-decoration: none;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

/* ── Section headings ───────────────────────────────────── */
h2 {
    font-size: 2.3rem;
    margin-top: 52px;
    margin-bottom: 22px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--rule-strong);
    display: flex;
    align-items: baseline;
    gap: 14px;
}
h2::after {
    content: '';
    flex: 1;
    height: 0;
    border-bottom: 1px dashed var(--rule);
    margin-bottom: 8px;
}
h3 {
    font-size: 1.7rem;
    margin-bottom: 16px;
    color: var(--ink-dark);
}

/* ── News (numbered list) ────────────────────────────────── */
.news-wrap { counter-reset: news; }
.news-list {
    list-style: none;
    padding-left: 0;
}
.news-list li {
    counter-increment: news;
    position: relative;
    padding: 7px 0 7px 3em;
    font-size: 1.02rem;
    line-height: 1.55;
    border-bottom: 1px dashed var(--rule);
}
.news-list li:last-child { border-bottom: none; }
.news-list li::before {
    content: counter(news, decimal-leading-zero) ".";
    position: absolute;
    left: 0;
    top: 7px;
    font-family: var(--font-head);
    font-weight: 400;
    color: var(--muted-2);
    font-size: 0.95rem;
}

.news-date {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    margin-right: 8px;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.news-badge {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: var(--danger);
    padding: 1px 9px;
    border-radius: var(--sketchy-radius-sm);
    margin-right: 8px;
    transform: rotate(-2deg);
    vertical-align: 1px;
}

.news-featured {
    background: var(--accent-bg);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    padding: 12px 14px 12px 3em !important;
    margin: 6px 0 10px -6px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}
.news-featured::before { left: 12px !important; top: 12px !important; }

/* "All news →" link below the home news list */
.news-all-link {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--rule);
    text-align: right;
}
.news-all-link a {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 0.18s;
}
.news-all-link a:hover { color: var(--link-hover); text-decoration: underline; }

/* ═════════════════════════════════════════════════════════════
   News archive page (news.html)
   ═════════════════════════════════════════════════════════════ */
.news-archive { padding-top: 32px; }

.news-toc {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 36px;
    background: var(--accent-bg);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}
.news-toc-label {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--ink-dark);
    margin: 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
}
.news-toc a {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    font-size: 1.05rem;
    text-decoration: none;
    padding: 2px 10px;
    border-radius: var(--sketchy-radius-sm);
    transition: background 0.15s, color 0.15s;
}
.news-toc a:hover {
    background: var(--link);
    color: #fff;
    text-decoration: none;
}

.news-year {
    margin-bottom: 36px;
    scroll-margin-top: 80px;
}
.news-year h2 {
    font-size: 2.4rem;
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 6px;
}
.news-year h3 {
    font-size: 1.2rem;
    margin-top: 22px;
    margin-bottom: 10px;
    color: var(--muted);
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.news-archive-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 4px;
}
.news-archive-list li {
    padding: 8px 0 8px 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    border-bottom: 1px dashed var(--rule);
}
.news-archive-list li:last-child { border-bottom: none; }
.news-archive-list a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 136, 0.25);
}
.news-archive-list a:hover {
    color: var(--link-hover);
    border-bottom-color: currentColor;
}

/* Category tags (#PUB, #TALK, #VISIT, etc.) */
.news-cat {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 9px;
    margin-right: 10px;
    border-radius: var(--sketchy-radius-sm);
    border: 1.5px solid currentColor;
    vertical-align: 1px;
    white-space: nowrap;
}
.cat-pub       { color: #4338ca; background: #eef2ff; }
.cat-talk      { color: #c2410c; background: #ffedd5; }
.cat-visit     { color: #047857; background: #ecfdf5; }
.cat-teach     { color: #7c3aed; background: #f5f3ff; }
.cat-event     { color: #0369a1; background: #e0f2fe; }
.cat-project   { color: #b91c1c; background: #fef2f2; }
.cat-milestone { color: #a16207; background: #fefce8; }

/* ── News expander (<details>) ──────────────────────────── */
.news-more { margin-top: 4px; }
.news-more summary {
    list-style: none;
    cursor: pointer;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    color: var(--link);
    letter-spacing: 0.02em;
    padding: 12px 0 10px;
    border-top: 1px dashed var(--rule);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.15s;
}
.news-more summary::-webkit-details-marker,
.news-more summary::marker { display: none; content: none; }
.news-more summary::before {
    content: "▸";
    display: inline-block;
    color: var(--link);
    transition: transform 0.2s ease;
    font-size: 0.9rem;
}
.news-more[open] summary::before { transform: rotate(90deg); }
.news-more summary:hover { color: var(--link-hover); }
.news-more-count {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
}
.news-more[open] summary { margin-bottom: 4px; }
.news-more .news-list { padding-top: 2px; }

/* ── Publications (bibliography) ─────────────────────────── */
.publications {
    list-style: none;
    counter-reset: pub;
    padding-left: 0;
}
.publications > li {
    counter-increment: pub;
    position: relative;
    padding: 8px 0 8px 2.6em;
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--rule);
}
.publications > li:last-child { border-bottom: none; }
.publications > li::before {
    content: "[" counter(pub) "]";
    position: absolute;
    left: 0;
    top: 8px;
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--muted);
    font-size: 0.9rem;
}

.pub-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink-dark);
    line-height: 1.25;
    margin-bottom: 3px;
    letter-spacing: 0.005em;
}
.pub-meta {
    font-size: 0.88rem;
    color: var(--ink);
    margin-bottom: 1px;
    line-height: 1.4;
}
.pub-meta strong { color: var(--ink-dark); font-weight: 700; }
.pub-venue {
    font-size: 0.86rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-style: normal;
}
.pub-venue em { color: var(--ink); font-style: italic; }
.pub-year { font-weight: 700; color: var(--ink-dark); }

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.92rem;
}
.pub-links a {
    color: var(--link);
    border: 1.5px solid var(--link);
    border-radius: var(--sketchy-radius-sm);
    padding: 1px 9px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-head);
    letter-spacing: 0.02em;
    transition: all 0.18s;
}
.pub-links a:hover {
    background: var(--link);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}
.pub-links .btn-nature {
    color: var(--danger);
    border-color: var(--danger);
}
.pub-links .btn-nature:hover { background: var(--danger); color: #fff; }
.pub-links .btn-arxiv {
    color: #b31b1b;
    border-color: #b31b1b;
}
.pub-links .btn-arxiv:hover { background: #b31b1b; color: #fff; }

.pub-featured {
    background: var(--accent-bg);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    padding: 10px 14px 10px 2.6em !important;
    margin-bottom: 14px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}
.pub-featured::before { left: 12px !important; top: 10px !important; }

/* Citation badge (live-fetched from OpenAlex) */
.cite-count {
    display: inline-block;
    margin-left: 10px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--link);
    background: var(--accent-bg);
    border: 1.5px solid var(--ink-dark);
    padding: 2px 9px;
    border-radius: var(--sketchy-radius-sm);
    vertical-align: 2px;
    white-space: nowrap;
}
.citation-total {
    font-family: var(--font-head);
    font-style: italic;
    font-size: 1rem;
    color: var(--link);
    margin-bottom: 16px;
    padding: 8px 14px;
    background: var(--accent-bg);
    border-left: 3px solid var(--link);
    border-radius: var(--sketchy-radius-sm);
}

/* ── Experience & Education (two-column tables) ─────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-top: 52px;
}
.two-col h3 {
    padding-bottom: 6px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--rule-strong);
}

.history table { width: 100%; border-collapse: collapse; }
.history tr { border: none; }
.history td {
    padding: 8px 0;
    vertical-align: top;
    border: none;
    border-bottom: 1px dashed var(--rule);
}
.history tr:last-child td { border-bottom: none; }
.history td:first-child {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    white-space: nowrap;
    width: 112px;
    padding-right: 14px;
    font-size: 0.95rem;
}
.history .role {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--ink-dark);
    display: block;
    line-height: 1.25;
}
.history .place {
    font-size: 0.96rem;
    color: var(--muted);
    font-style: italic;
}
.history .exp-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: color 0.18s;
}
.history .exp-link:hover { color: var(--link); text-decoration: none; }
.history .exp-link:hover .role { color: var(--link); }
.history .exp-arrow {
    display: inline-block;
    color: var(--link);
    font-weight: 400;
    transition: transform 0.18s;
    margin-left: 4px;
}
.history .exp-link:hover .exp-arrow { transform: translateX(4px); }

/* ── Footer ─────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 48px 24px 28px;
    margin-top: 48px;
    border-top: 2px solid var(--rule-strong);
    color: var(--muted);
}
footer p { margin: 2px 0; }
footer .footer-sub {
    font-size: 0.88rem;
    color: var(--muted-2);
    font-style: italic;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 820px) {
    .two-col { grid-template-columns: 1fr; gap: 28px; }
    .page-header h1 { font-size: 2.8rem; }
    .subtitle { font-size: 1.1rem; }
    .intro .avatar { width: 160px; height: 160px; }
    h2 { font-size: 1.9rem; }
}

@media (max-width: 640px) {
    html { font-size: 16px; }
    .navbar {
        padding: 12px 18px;
        position: sticky;
        top: 0;
    }
    .brand span { display: none; }

    /* Hamburger visible on mobile */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 26px;
        height: 20px;
        cursor: pointer;
        padding: 0;
        z-index: 102;
    }
    .nav-toggle span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--nav-ink);
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.2s ease;
        transform-origin: center;
    }
    .nav-toggle-check:checked ~ .nav-toggle span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .nav-toggle-check:checked ~ .nav-toggle span:nth-child(2) { opacity: 0; }
    .nav-toggle-check:checked ~ .nav-toggle span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Nav-links dropdown on mobile */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        border-bottom: 2px solid #000;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    }
    .nav-toggle-check:checked ~ .nav-links {
        max-height: 520px;
        padding: 4px 0 14px;
    }

    .nav-item {
        flex: 0 0 100%;
        padding: 12px 24px;
        font-size: 1rem;
    }
    .nav-item:hover { background: rgba(244, 241, 232, 0.06); }

    /* Full-width line that forces icons onto a new row */
    .nav-sep {
        display: block;
        flex: 0 0 100%;
        height: 0;
        width: auto;
        margin: 6px 20px 4px;
        border-top: 1px solid rgba(244, 241, 232, 0.12);
        background: none;
    }

    /* Icons laid out horizontally below the separator */
    .nav-links .nav-icon {
        padding: 8px 10px;
        margin-left: 14px;
    }

    .prose { padding: 32px 20px 20px; }
    .page-header h1 { font-size: 2.3rem; }
    .intro .avatar,
    .intro .avatar-swap {
        float: none;
        display: block;
        margin: 0 auto 20px;
        width: 180px;
        height: 180px;
    }
    .intro p { text-align: left; }
    .news-list li, .publications > li { padding-left: 2.3em; }
    .pub-title { font-size: 1.12rem; }
}

/* ═════════════════════════════════════════════════════════════
   Navbar — active state
   ═════════════════════════════════════════════════════════════ */
.nav-item.nav-active {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* ═════════════════════════════════════════════════════════════
   Projects hub (projects.html)
   ═════════════════════════════════════════════════════════════ */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
    margin-top: 12px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--paper-2);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.project-card:hover {
    transform: translate(-2px, -3px);
    box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.project-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
    border-bottom: 2px solid var(--ink-dark);
}
.project-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.project-card:hover .project-card-cover img { transform: scale(1.04); }

.project-card-body { padding: 20px 22px 22px; }
.project-card-kicker {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.project-card-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.55rem;
    color: var(--ink-dark);
    margin-bottom: 10px;
    line-height: 1.2;
}
.project-card-desc {
    font-size: 1rem;
    color: var(--ink);
    line-height: 1.55;
    margin-bottom: 14px;
}
.project-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.project-card-tags span {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--muted);
    border: 1.5px solid var(--rule);
    border-radius: var(--sketchy-radius-sm);
    padding: 1px 10px;
}
.project-card-cta {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
.project-card-cta .arrow { transition: transform 0.2s; display: inline-block; }
.project-card:hover .project-card-cta .arrow { transform: translateX(4px); }

/* ═════════════════════════════════════════════════════════════
   Project detail page
   ═════════════════════════════════════════════════════════════ */

/* Hero */
.project-hero {
    position: relative;
    width: 100%;
    min-height: 420px;
    max-height: 640px;
    overflow: hidden;
    background: #0a0a0a;
    border-bottom: 2px solid #000;
}

/* Text-only hero variant (no cover image) */
.project-hero-textonly {
    min-height: 380px;
    max-height: none;
    overflow: visible;
    background:
        radial-gradient(800px 400px at 85% 15%, rgba(67, 56, 202, 0.45) 0%, transparent 60%),
        radial-gradient(700px 380px at 10% 90%, rgba(198, 40, 40, 0.22) 0%, transparent 55%),
        linear-gradient(160deg, #0a0a2e 0%, #1a1a1a 60%, #0a0a0a 100%);
    display: flex;
    align-items: center;
}
.project-hero-textonly .hero-overlay {
    position: static;
    inset: auto;
    background: none;
    padding: 64px 32px;
    width: 100%;
    display: block;
}
.project-hero-textonly h1 {
    font-size: 5rem;
    letter-spacing: 0.01em;
}
@media (max-width: 900px) {
    .project-hero-textonly { min-height: 320px; }
    .project-hero-textonly h1 { font-size: 3.4rem; }
    .project-hero-textonly .hero-overlay { padding: 40px 24px; }
}
@media (max-width: 560px) {
    .project-hero-textonly h1 { font-size: 2.4rem; }
    .project-hero-textonly .hero-overlay { padding: 32px 20px; }
}

/* Stat card — when value is a word, not a number */
.stat-value.stat-text {
    font-size: 1.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-dark);
}
.project-hero .hero-img {
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: cover;
    object-position: center 30%;
    display: block;
    opacity: 0.6;
}
.project-hero .hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(180deg,
        rgba(10, 10, 10, 0.15) 0%,
        rgba(10, 10, 10, 0.35) 35%,
        rgba(10, 10, 10, 0.72) 65%,
        rgba(10, 10, 10, 0.92) 100%);
    padding: 44px 32px;
}
.project-hero .hero-content {
    max-width: 1180px;
    margin: 0 auto;
    color: #fffdf7;
    width: 100%;
}
.hero-kicker {
    font-family: var(--font-head);
    font-weight: 700;
    color: #fff;
    opacity: 0.85;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.project-hero h1 {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 4rem;
    color: #fff;
    line-height: 1.05;
    margin-bottom: 12px;
    letter-spacing: 0.005em;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}
.hero-tagline {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: rgba(255, 253, 247, 0.92);
    max-width: 720px;
    line-height: 1.5;
    margin-bottom: 14px;
}
.hero-breadcrumb { font-size: 0.92rem; }
.hero-breadcrumb a {
    color: rgba(255, 253, 247, 0.85);
    font-family: var(--font-head);
    font-weight: 700;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255, 253, 247, 0.3);
    padding-bottom: 2px;
}
.hero-breadcrumb a:hover {
    color: #fff;
    text-decoration: none;
    border-bottom-color: #fff;
}

/* Detail prose */
.project-detail { padding-top: 40px; }
.project-detail .project-intro {
    max-width: 820px;
    margin: 0 auto 40px;
}
.project-detail .project-intro p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 14px;
    text-align: justify;
    hyphens: auto;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 52px;
}
.stat-card {
    background: var(--paper-2);
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    padding: 22px 18px 18px;
    text-align: center;
    box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.06);
}
.stat-value {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 3rem;
    line-height: 1;
    color: var(--link);
    margin-bottom: 4px;
}
.stat-unit {
    font-size: 1.5rem;
    color: var(--ink-dark);
    margin-left: 2px;
}
.stat-label {
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 1rem;
    color: var(--ink-dark);
    line-height: 1.3;
}
.stat-label span {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    font-family: var(--font-body);
    font-style: italic;
    margin-top: 2px;
}

/* Generic project section */
.project-section {
    margin-top: 48px;
    margin-bottom: 8px;
}
.project-section h2 {
    font-size: 2.1rem;
    margin-top: 0;
    margin-bottom: 18px;
}
.project-section .section-desc {
    font-size: 1.02rem;
    color: var(--ink);
    margin-bottom: 18px;
    max-width: 740px;
}

/* Video embeds */
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.08);
    background: #000;
}
.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Presidential endorsement */
.presidential-wrap {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
}
.presidential-img {
    display: block;
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    overflow: hidden;
    box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #fff;
}
.presidential-img:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.12);
}
.presidential-img img { display: block; width: 100%; height: auto; }
.presidential-text p { font-size: 1.04rem; line-height: 1.65; margin-bottom: 12px; }
.presidential-quote {
    font-family: var(--font-head);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--ink-dark);
    border-left: 3px solid var(--danger);
    padding-left: 16px;
    margin: 16px 0 !important;
    line-height: 1.35;
}
.presidential-caption {
    font-size: 0.88rem !important;
    color: var(--muted);
    font-style: italic;
}

/* Feature list */
.feature-list {
    list-style: none;
    padding-left: 0;
    counter-reset: feat;
}
.feature-list li {
    counter-increment: feat;
    position: relative;
    padding: 10px 0 10px 3em;
    border-bottom: 1px dashed var(--rule);
    font-size: 1.02rem;
    line-height: 1.6;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
    content: counter(feat, decimal-leading-zero) ".";
    position: absolute;
    left: 0;
    top: 10px;
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--muted-2);
}
.feature-list strong { color: var(--ink-dark); }

/* Photo gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 2px solid var(--ink-dark);
    border-radius: var(--sketchy-radius-sm);
    box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #111;
}
.gallery-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 6px 0 rgba(0, 0, 0, 0.1);
    text-decoration: none;
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px;
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75));
    letter-spacing: 0.02em;
}

/* Credits */
.credits-list {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 20px;
    margin-bottom: 22px;
}
.credits-list dt {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--link);
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-top: 2px;
}
.credits-list dd {
    font-size: 1.02rem;
    color: var(--ink);
    border-bottom: 1px dashed var(--rule);
    padding-bottom: 10px;
}
.credits-list dd:last-of-type { border-bottom: none; }

.credits-outro {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.pill-link {
    display: inline-block;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--link);
    border: 1.8px solid var(--link);
    border-radius: var(--sketchy-radius-sm);
    padding: 4px 14px;
    letter-spacing: 0.02em;
    transition: all 0.18s;
}
.pill-link:hover {
    background: var(--link);
    color: #fff;
    text-decoration: none;
}

.back-link {
    text-align: center;
    margin-top: 52px;
    padding-top: 24px;
    border-top: 1px dashed var(--rule);
}
.back-link a {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: var(--link);
}

/* Responsive — project pages */
@media (max-width: 900px) {
    .project-hero {
        min-height: 360px;
        background: #0a0a0a;
    }
    .project-hero .hero-img {
        object-fit: contain;
        object-position: center top;
        opacity: 0.85;
        min-height: 0;
    }
    .project-hero .hero-overlay {
        background: linear-gradient(180deg,
            transparent 0%,
            transparent 55%,
            rgba(10, 10, 10, 0.85) 80%,
            rgba(10, 10, 10, 0.96) 100%);
        padding: 24px 22px;
    }
    .project-hero h1 { font-size: 2.4rem; }
    .hero-tagline { font-size: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .presidential-wrap { grid-template-columns: 1fr; gap: 20px; }
    .presidential-img { max-width: 380px; }
    .photo-gallery { grid-template-columns: repeat(2, 1fr); }
    .credits-list { grid-template-columns: 1fr; gap: 4px; }
    .credits-list dt { padding-top: 10px; }
    .credits-list dd { padding-bottom: 10px; }
}

@media (max-width: 560px) {
    .project-hero { min-height: 280px; padding: 0; }
    .project-hero .hero-overlay { padding: 24px 18px; }
    .project-hero h1 { font-size: 2.1rem; }
    .hero-tagline { font-size: 0.98rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 2.3rem; }
    .photo-gallery { grid-template-columns: 1fr; }
}
