/* index2-theme.css
   Visual theme borrowed from index2.html, applied on top of the existing
   Bootstrap-based layout in index.html. Loaded AFTER mystyle.css so its
   tokens, fonts, and color treatments win without changing the page structure.
*/

:root {
    --bg: #f5f1e8;
    --bg-soft: #ece5d7;
    --ink: #101216;
    --ink-soft: #2e3440;
    --muted: #5d6573;
    --line: #ccd2dc;
    --accent: #c5372d;
    --accent-2: #2f7a72;
    --card: #fbf8f1;
    --gold: #c79a3a;
    --shadow: 0 14px 42px rgba(16, 18, 22, 0.12);
}

/* ── Base typography & background ─────────────────────────── */
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter Tight', 'Open Sans', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Subtle paper-grain overlay matching index2 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99;
    opacity: 0.18;
    mix-blend-mode: multiply;
    background-image: radial-gradient(rgba(0, 0, 0, 0.07) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
}

/* Headings use editorial serif */
h1, h2, h3, h4, h5, h6,
.col-md-3 h5, .col-md-9 h5,
.col-md-3 h6, .col-md-9 h6 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 450;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.col-md-9 h5 { font-size: 1.35rem; }
.col-md-3 h5 { font-size: 1.15rem; }
.col-md-3 h6, .col-md-9 h6 { font-size: 1rem; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover { color: var(--ink); }

/* ── Navbar: light paper bar (overrides Bootstrap bg-dark) ── */
.navbar.bg-dark {
    background: rgba(245, 241, 232, 0.86) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(16, 18, 22, 0.08);
    box-shadow: none !important;
}

.navbar-dark .navbar-brand,
.navbar-dark .navbar-nav .nav-link {
    color: var(--ink-soft);
    font-family: 'Inter Tight', sans-serif;
    font-weight: 500;
    font-size: 14px;
}

.navbar-dark .navbar-brand {
    font-family: 'Fraunces', serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.navbar-dark .navbar-nav .nav-link {
    position: relative;
    padding-bottom: 4px;
    text-decoration: none !important;
}
.navbar-dark .navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    transition: width .25s ease;
    margin: 0 auto;
}
.navbar-dark .navbar-nav .nav-link:hover { color: var(--ink); }
.navbar-dark .navbar-nav .nav-link:hover::after { width: calc(100% - 1rem); }
.navbar-dark .navbar-nav .nav-item.active .nav-link { color: var(--accent); }
.navbar-dark .navbar-nav .nav-item.active .nav-link::after { width: calc(100% - 1rem); }

.navbar-toggler {
    border-color: rgba(16, 18, 22, 0.25) !important;
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2816,18,22,0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

#dark-mode-toggle {
    background: transparent;
    border: 1px solid rgba(16, 18, 22, 0.2);
    color: var(--ink-soft);
    padding: 6px 9px;
    margin-left: 12px;
    border-radius: 4px;
}
#dark-mode-toggle:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Sidebar profile photo ─────────────────────────────────── */
.profile-photo {
    width: 168px;
    height: 168px;
    object-fit: cover;
    object-position: center 30%;
    border: 0 !important;
    /* Layered ring: cream paper inner gap + warm gold ring + soft drop */
    box-shadow:
        0 0 0 4px var(--bg),
        0 0 0 5px rgba(199, 154, 58, 0.55),
        0 12px 28px rgba(16, 18, 22, 0.18) !important;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    transition: transform .25s ease, box-shadow .25s ease !important;
}
.profile-photo:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 4px var(--bg),
        0 0 0 5px rgba(197, 55, 45, 0.6),
        0 16px 36px rgba(16, 18, 22, 0.24) !important;
}

/* Sidebar text */
.col-md-3 {
    font-family: 'Inter Tight', sans-serif;
    color: var(--ink-soft);
    font-size: .9rem;
}

.col-md-3 p.small { color: var(--muted); }
.col-md-3 p.small a { color: var(--ink-soft); }
.col-md-3 p.small a:hover { color: var(--accent); }

/* ── Social icons: minimal, no chip background ─────────────── */
.social-icons {
    gap: 14px !important;
    margin-top: 10px !important;
}
.social-icons .social-icon {
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.15rem;
    transition: transform .2s ease, color .2s ease;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
.social-icons .social-icon:hover {
    background: transparent;
    transform: translateY(-2px);
    box-shadow: none;
    border-color: transparent;
}
.social-icons .social-scholar:hover { color: #4285f4; }
.social-icons .social-s2:hover      { color: #e05a2b; }
.social-icons .social-github:hover  { color: #1a1a1a; }
.social-icons .social-twitter:hover { color: #1da1f2; }

/* ── Affiliated groups section ─────────────────────────────── */
.affil-section {
    margin-top: 14px;
    margin-bottom: 4px;
    text-align: center;
}
.affil-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
    padding: 0 12px;
}
.affil-label::before,
.affil-label::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px;
    height: 1px;
    background: rgba(16, 18, 22, 0.16);
}
.affil-label::before { right: 100%; }
.affil-label::after  { left: 100%; }

/* ── Affiliation pills: warm cream with accent underline on hover ── */
.affil-pills-wrap {
    gap: 7px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}
.affil-pill {
    position: relative;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border: 1px solid rgba(16, 18, 22, 0.14);
    padding: 6px 11px;
    color: var(--ink-soft);
    background: linear-gradient(180deg, #fffdf6 0%, #f1ead7 100%);
    border-radius: 999px;
    transition: transform .2s ease, color .2s ease, background .25s ease, box-shadow .2s ease;
    box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 2px 4px rgba(16,18,22,0.05);
}
.affil-pill:hover {
    background: linear-gradient(135deg, var(--accent) 0%, #e0563d 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(197,55,45,0.28);
    text-decoration: none;
}

/* ── News list ─────────────────────────────────────────────── */
#datalist_news {
    padding-left: 0;
    list-style: none;
}
#datalist_news li {
    padding: 10px 0;
    border-bottom: 1px dashed rgba(16, 18, 22, 0.16);
    line-height: 1.55;
    font-size: 14px;
    color: var(--ink-soft);
}
#datalist_news li:last-child { border-bottom: 0; }
#datalist_news .news-date {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #7b8699;
    margin-bottom: 2px;
}
#datalist_news a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

span#extension {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    cursor: pointer;
}
span#extension:hover { color: var(--accent); }

/* ── Students list (no separators, tight spacing) ─────────── */
#section_students ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
#section_students li {
    padding: 1px 0;
    border-bottom: 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.35;
}
#section_students .member-note,
#section_students .member-note a {
    font-size: 0.78em;
    color: var(--muted) !important;
    font-weight: 400;
    background: none;
}
#section_students .member-note a:hover {
    color: var(--ink-soft) !important;
}
#section_students a {
    color: var(--ink);
    font-weight: 400;
    text-decoration: none;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .25s ease, color .2s ease;
}
#section_students a:hover {
    color: var(--accent);
    background-size: 100% 1px;
    text-decoration: none;
}

/* ── Intro / main prose ────────────────────────────────────── */
.col-md-9 {
    font-family: 'Inter Tight', sans-serif;
    font-size: 1rem;
    color: var(--ink-soft);
    line-height: 1.65;
}

/* More breathing room between sidebar (col-md-3) and main (col-md-9) */
@media (min-width: 768px) {
    .row > .col-md-3 { padding-right: 28px; }
    .row > .col-md-9 { padding-left: 28px; }
}

/* ── Intro hero (mirrors index2.html hero) ─────────────────── */
.intro-hero {
    position: relative;
    padding: 6px 0 18px;
    margin-bottom: 14px;
    animation: introFadeUp 0.7s ease both;
    overflow: visible;
    z-index: 0;
}
/* Red + teal radial gradient halos (borrowed from index2 hero) */
.intro-hero::before,
.intro-hero::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: -1;
    border-radius: 50%;
    filter: blur(8px);
}
.intro-hero::before {
    width: 460px;
    height: 460px;
    right: -180px;
    top: -120px;
    background: radial-gradient(circle at 30% 30%, rgba(197, 55, 45, 0.32), transparent 68%);
}
.intro-hero::after {
    width: 360px;
    height: 360px;
    left: -160px;
    bottom: -140px;
    background: radial-gradient(circle at 70% 30%, rgba(47, 122, 114, 0.28), transparent 70%);
}
html.dark .intro-hero::before {
    background: radial-gradient(circle at 30% 30%, rgba(255, 107, 91, 0.28), transparent 68%);
}
html.dark .intro-hero::after {
    background: radial-gradient(circle at 70% 30%, rgba(79, 179, 168, 0.24), transparent 70%);
}

@keyframes introFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.intro-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}
.intro-kicker::before {
    content: "";
    width: 32px;
    height: 1px;
    background: var(--accent);
}

.intro-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 350;
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 14px;
}
.intro-title em {
    color: var(--accent);
    font-style: italic;
    font-weight: 400;
}

.intro-lead {
    max-width: 760px;
    color: var(--ink-soft);
    font-size: 1.02rem;
    line-height: 1.65;
    margin: 0 0 12px;
}
.intro-lead a {
    color: var(--accent);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .25s ease, color .2s ease;
    text-decoration: none;
}
.intro-lead a:hover {
    color: var(--ink);
    background-size: 100% 1px;
    text-decoration: none;
}

/* "Current focus:" on its own line, typed word stays on a single line */
.intro-focus {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 1.65em;
    margin-top: -2px;
    overflow: hidden;
}
.intro-focus-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    flex: 0 0 auto;
}
.intro-typing {
    display: inline-block;
    color: var(--accent-2);
    border-right: 2px solid var(--accent-2);
    padding-right: 4px;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 500;
    font-style: italic;
    font-size: 1.1rem;
    white-space: nowrap;
    animation: introBlink 0.85s step-end infinite;
}
@keyframes introBlink {
    50% { border-color: transparent; }
}

/* ── Hero CTA buttons (Explore / CV / Join / MN NLP) ───────── */
.intro-cta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 16px 0 4px;
}
.intro-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--ink);
    background: var(--card);
    color: var(--ink) !important;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 500;
    font-size: 12px;
    text-decoration: none !important;
    border-radius: 4px;
    line-height: 1.3;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.intro-btn i { font-size: 11px; }
.intro-btn:hover {
    background: var(--ink);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 18, 22, 0.18);
}
.intro-btn.primary {
    background: var(--ink);
    color: #fff !important;
}
.intro-btn.primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Research Pillars grid (mirrors index2.html Core Agenda) ─ */
.pillars-head {
    margin: 28px 0 16px;
}
.pillars-kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.17em;
    margin-bottom: 6px;
}
.pillars-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 360;
    font-size: clamp(22px, 2.4vw, 32px);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
}
.pillars-title em {
    color: var(--accent);
    font-style: italic;
}

.pillar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    background: transparent;
    border: 0;
    margin: 0 0 6px;
    /* Sub-grid keeps title / heading / description / chips rows aligned across cards */
    grid-template-rows: auto;
}
.pillar {
    background: var(--card);
    border: 1px solid rgba(16, 18, 22, 0.12);
    border-radius: 6px;
    padding: 16px 14px 14px;
    display: grid;
    /* Fixed row sizes so heading / description / chips all line up across cards */
    grid-template-rows: 44px minmax(2.6em, auto) 1fr minmax(78px, auto);
    row-gap: 8px;
    height: 100%;
    align-self: stretch;
    transition: background .25s ease, box-shadow .25s ease, transform .2s ease;
    box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 8px rgba(16,18,22,0.04);
}
.pillar:hover {
    background: #fffdf8;
    transform: translateY(-2px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 10px 24px rgba(16,18,22,0.1);
}

.pillar-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    border-bottom: 1px dashed rgba(16, 18, 22, 0.2);
    padding-bottom: 8px;
    min-height: 40px;
}
.pillar-num {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 28px;
    line-height: 1;
    color: var(--accent);
    font-weight: 400;
}
.pillar-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: 0.12em;
    color: var(--muted);
    text-transform: uppercase;
    line-height: 1.3;
}
.pillar-h {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 17px;
    font-weight: 450;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--ink);
    margin: 0;
    min-height: 2.4em;
    display: flex;
    align-items: flex-start;
}
.pillar-p {
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}
.pillar-chips {
    align-self: stretch;
    align-content: start;
    gap: 3px;
    margin: 0;
    overflow: hidden;
}
.pillar-chips a {
    font-size: 8.5px;
    padding: 2px 6px;
    letter-spacing: 0.05em;
    border-radius: 999px;
    line-height: 1.4;
}

@media (max-width: 900px) {
    .pillar-grid { grid-template-columns: 1fr; }
}

.research-area {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    color: var(--ink);
    font-style: italic;
}

/* Recolor the underline accent on research-area text */
.area-cognition { color: var(--accent-2); }
.area-thinking  { color: var(--gold); }
.area-alignment { color: var(--accent); }

/* Project tag pills (CogBench, MPO etc.) — same style as .affil-pill */
.project-list {
    display: flex;            /* block so chips appear under bullet text */
    flex-wrap: wrap;
    gap: 7px;
    margin: 8px 0 4px;
}
.project-list a,
.affil-pill {
    position: relative;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border: 1px solid rgba(16, 18, 22, 0.14);
    padding: 6px 11px;
    background: linear-gradient(180deg, #fffdf6 0%, #f1ead7 100%);
    color: var(--ink-soft);
    border-radius: 999px;
    transition: transform .2s ease, color .2s ease, background .25s ease, box-shadow .2s ease;
    box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 2px 4px rgba(16,18,22,0.05);
    text-decoration: none;
    line-height: 1.2;
}
.project-list a:hover,
.affil-pill:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #e0563d 100%);
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(197,55,45,0.28);
    text-decoration: none;
}

/* Bullet list with better breathing room */
.col-md-9 > div > ul {
    padding-left: 1.4em;
    margin: 12px 0 18px;
}
.col-md-9 > div > ul > li {
    margin-bottom: 18px;
    line-height: 1.6;
}
.col-md-9 > div > ul > li:last-child { margin-bottom: 0; }
.col-md-9 > div > ul > li::marker {
    color: var(--accent);
}

/* ── Publication section heading row ───────────────────────── */
#section_pub h5 {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    font-weight: 450;
    letter-spacing: -0.01em;
}
span#publication {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
span#publication a { color: var(--ink-soft); }
span#publication a:hover { color: var(--accent); }

/* Topic tag chips at top of publications */
.tag[data-v-tag] {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 0;
    opacity: 0.95;
    font-weight: 500;
    color: #fff;
}

/* Year / Preprint section labels (inside timeline templates) — same style as filter buttons */
[data-v-tag].Tag {
    display: inline-block;
    background: transparent !important;
    color: var(--ink-soft) !important;
    border: 1px solid rgba(16, 18, 22, 0.22);
    border-radius: 3px;
    padding: 3px 8px !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    margin: 8px 0 4px;
    opacity: 1;
    float: none;
    line-height: 1.3;
}
/* First Tag chip right under the controls: no top margin */
.pubs-list-wrap .text.anchor:first-child > [data-v-tag].Tag:first-child,
#pubs > div:first-child > [data-v-tag].Tag:first-child,
#pubs > .text.anchor:first-of-type > [data-v-tag].Tag {
    margin-top: 0 !important;
}
/* Pull pubs container closer to the controls row */
.pubs-section .pubs-controls { margin-bottom: 6px; }
.pubs-list-wrap > script + div,
#pubs { margin-top: 0; }
[id^="publication_"].timeline {
    margin-top: 0;
}
html.dark [data-v-tag].Tag {
    color: var(--ink-soft) !important;
    border-color: rgba(255, 255, 255, 0.2);
    background: transparent !important;
}

/* Hide the year ::before label baked into [data-year] since we now print the year inline as a chip */
[id^="publication_"].timeline[data-year]::before {
    display: none;
}

/* ── Publication timeline cards on paper bg ────────────────── */
[id^="publication_"].timeline ul::before {
    background: rgba(16, 18, 22, 0.14);
}
[id^="publication_"].timeline[data-year]::before {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-transform: uppercase;
}
[id^="publication_"].timeline li::before {
    box-shadow: 0 0 0 2px var(--bg), 0 0 5px var(--marker-color);
}
[id^="publication_"].timeline li:hover div.publication {
    background: rgba(16, 18, 22, 0.04);
}

/* ── Footer ────────────────────────────────────────────────── */
hr {
    border-color: rgba(16, 18, 22, 0.12);
}
footer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* ── Footer: copyright + small scroll-top inline ──────────── */
footer .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0;
}
footer .footer-inner p,
footer .footer-inner .alignleft {
    margin: 0;
    float: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--muted);
}

#scroll-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(16, 18, 22, 0.18);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
#scroll-top-btn:hover {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    transform: translateY(-1px);
}

html.dark #scroll-top-btn {
    color: var(--muted);
    border-color: rgba(255, 255, 255, 0.2);
}
html.dark #scroll-top-btn:hover {
    background: var(--ink);
    color: #15171b;
    border-color: var(--ink);
}

/* ── Dark mode harmony (keep tokens consistent if toggled) ── */
html.dark {
    --bg: #15171b;
    --bg-soft: #1a1d22;
    --card: #1c1f24;
    --ink: #ecf0f5;
    --ink-soft: #d3d9e1;
    --muted: #8b94a3;
    --line: #2a2f38;
    --accent: #ff6b5b;
    --accent-2: #4fb3a8;
    --gold: #e1b25c;
}
html.dark body {
    background: var(--bg);
    color: var(--ink);
}
html.dark body::before { opacity: 0.05; }

html.dark .navbar.bg-dark {
    background: rgba(21, 23, 27, 0.86) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
html.dark .navbar-dark .navbar-brand { color: var(--ink); }
html.dark .navbar-dark .navbar-nav .nav-link { color: var(--ink-soft); }
html.dark .navbar-dark .navbar-nav .nav-link:hover { color: var(--ink); }

/* Pills: dark surface with cream text, accent hover */
html.dark .affil-pill,
html.dark .project-list a {
    background: linear-gradient(180deg, #23272f 0%, #1a1d22 100%);
    color: var(--ink-soft);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
html.dark .affil-pill:hover,
html.dark .project-list a:hover {
    background: linear-gradient(135deg, var(--accent) 0%, #e0563d 100%);
    color: #fff;
    border-color: transparent;
}

/* Social icons stay transparent in dark too — just lighter base color */
html.dark .social-icons .social-icon {
    background: transparent;
    border: 0;
    color: var(--ink-soft);
    box-shadow: none;
}

/* Buttons */
html.dark .intro-btn {
    background: #1c1f24;
    border-color: var(--ink-soft);
    color: var(--ink) !important;
}
html.dark .intro-btn:hover {
    background: var(--ink);
    color: #15171b !important;
}
html.dark .intro-btn.primary {
    background: var(--ink);
    color: #15171b !important;
}
html.dark .intro-btn.primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff !important;
}

/* Headings & hero text */
html.dark .intro-title { color: var(--ink); }
html.dark .intro-title em { color: var(--accent); }
html.dark .intro-lead { color: var(--ink-soft); }
html.dark .intro-lead a { color: var(--accent); }
html.dark .intro-lead a:hover { color: var(--ink); }
html.dark .intro-kicker,
html.dark .pillars-kicker,
html.dark .pubs-section-kicker { color: var(--accent); }
html.dark .pillars-title em,
html.dark .pubs-section-title em { color: var(--accent); }

/* Pillars */
html.dark .pillar {
    background: var(--card);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
html.dark .pillar:hover {
    background: #20242b;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
html.dark .pillar-num { color: var(--accent); }
html.dark .pillar-tag { color: var(--muted); }
html.dark .pillar-h { color: var(--ink); }
html.dark .pillar-p { color: var(--ink-soft); }
html.dark .pillar-top { border-bottom-color: rgba(255, 255, 255, 0.1); }

/* Affil section */
html.dark .affil-label { color: var(--muted); }
html.dark .affil-label::before,
html.dark .affil-label::after { background: rgba(255, 255, 255, 0.14); }

/* Profile photo */
html.dark .profile-photo {
    box-shadow:
        0 0 0 4px var(--bg),
        0 0 0 5px rgba(225, 178, 92, 0.45),
        0 12px 28px rgba(0, 0, 0, 0.5) !important;
}

/* Sidebar text */
html.dark .col-md-3 { color: var(--ink-soft); }
html.dark .col-md-3 p.small { color: var(--muted); }
html.dark .col-md-3 p.small a { color: var(--ink-soft); }
html.dark .col-md-3 p.small a:hover { color: var(--accent); }

/* News list */
html.dark #datalist_news li {
    color: var(--ink-soft);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
html.dark #datalist_news .news-date { color: var(--muted); }
html.dark #datalist_news a { color: var(--accent); }

/* Students */
html.dark #section_students li { color: var(--ink-soft); }
html.dark #section_students a { color: var(--ink); }
html.dark #section_students a:hover { color: var(--accent); }

/* Publication filter buttons */
html.dark .pubs-filter-btn {
    background: transparent;
    color: var(--ink-soft) !important;
    border-color: rgba(255, 255, 255, 0.2);
}
html.dark .pubs-filter-btn:hover,
html.dark .pubs-filter-btn.active {
    background: var(--ink);
    color: #15171b !important;
    border-color: var(--ink);
}
html.dark .pubs-section-sub { color: var(--muted); }
html.dark .pubs-section-title { color: var(--ink); }

/* Footer / hr */
html.dark hr { border-color: rgba(255, 255, 255, 0.1); }
html.dark footer { color: var(--muted); }

/* Research area accents */
html.dark .research-area { color: var(--ink); }
html.dark .area-cognition { color: var(--accent-2); }
html.dark .area-thinking  { color: var(--gold); }
html.dark .area-alignment { color: var(--accent); }

/* Generic link visibility */
html.dark a { color: var(--accent); }
html.dark a:hover { color: var(--ink); }

/* Tooltip / preview cards */
html.dark #paper_preview_tooltip {
    background: #1c1f24;
    color: var(--ink);
    border-color: rgba(255, 255, 255, 0.12);
}
html.dark #paper_preview_tooltip .preview_authors,
html.dark #paper_preview_tooltip .preview_abstract { color: var(--ink-soft); }
html.dark #paper_preview_tooltip .preview_title { color: var(--ink); }

/* ── Bio page right-rail profile card ─────────────────────── */
.bio-photo-col {
    padding-top: 14px;
    text-align: center;
}
.bio-profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 30%;
    margin: 0 auto 16px;
}
.bio-photo-caption {
    font-family: 'Inter Tight', sans-serif;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
}
.bio-photo-name {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 4px;
}
.bio-photo-meta { color: var(--muted); font-size: 12.5px; }
html.dark .bio-photo-name { color: var(--ink); }
html.dark .bio-photo-meta { color: var(--muted); }

/* ── Subpage polish (publication / awards / teaching / talks / bio / recruit / research) ── */
/* Add room under fixed navbar, max-width, breathing room */
body > .container,
body > .container-fluid:not(.garden-page) {
    padding-top: 24px;
    padding-bottom: 24px;
}

/* Treat the first <h5> in a single-column subpage as a hero title */
.container > .row > .col:only-child > h5:first-child,
.container > .row > .col:first-child:last-child > h5:first-child {
    font-family: 'Fraunces', Georgia, serif !important;
    font-size: clamp(28px, 3.4vw, 44px) !important;
    font-weight: 380 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.1 !important;
    color: var(--ink) !important;
    margin: 18px 0 18px !important;
    position: relative;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(16, 18, 22, 0.08);
}
.container > .row > .col:only-child > h5:first-child::before,
.container > .row > .col:first-child:last-child > h5:first-child::before {
    content: "";
    display: block;
    width: 36px;
    height: 2px;
    background: var(--accent);
    margin-bottom: 12px;
    border-radius: 2px;
}

/* Soft card for body lists on subpages — awards, teaching, talks */
.container > .row > .col > ul {
    list-style: none;
    padding-left: 0;
    margin-top: 6px;
}
.container > .row > .col > ul > li {
    padding: 9px 14px;
    margin-bottom: 6px;
    border-left: 2px solid rgba(16, 18, 22, 0.1);
    background: linear-gradient(90deg, rgba(251, 248, 241, 0.6) 0%, transparent 80%);
    line-height: 1.55;
    transition: border-color .2s ease, background .25s ease, transform .15s ease;
    border-radius: 0 4px 4px 0;
}
.container > .row > .col > ul > li:hover {
    border-left-color: var(--accent);
    background: linear-gradient(90deg, rgba(197, 55, 45, 0.06) 0%, transparent 80%);
    transform: translateX(2px);
}

/* Body prose paragraphs (e.g. bio) */
.container > .row > .col > p {
    line-height: 1.7;
    color: var(--ink-soft);
    margin-bottom: 14px;
    max-width: 880px;
}
.container > .row > .col > p a {
    color: var(--accent);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .25s ease, color .2s ease;
}
.container > .row > .col > p a:hover {
    color: var(--ink);
    background-size: 100% 1px;
}

/* Dark mode for subpage polish */
html.dark .container > .row > .col:only-child > h5:first-child,
html.dark .container > .row > .col:first-child:last-child > h5:first-child {
    color: var(--ink) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
html.dark .container > .row > .col > ul > li {
    background: linear-gradient(90deg, rgba(28, 31, 36, 0.6) 0%, transparent 80%);
    border-left-color: rgba(255, 255, 255, 0.12);
}
html.dark .container > .row > .col > ul > li:hover {
    background: linear-gradient(90deg, rgba(255, 107, 91, 0.08) 0%, transparent 80%);
    border-left-color: var(--accent);
}
html.dark .container > .row > .col > p {
    color: var(--ink-soft);
}

/* Publication-page subtitle and topic-row list */
.pub-page-sub {
    color: var(--muted);
    font-size: 14px;
    margin: 4px 0 18px;
    max-width: 720px;
    line-height: 1.55;
}
.pub-topics-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}
.pub-topic-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 4px;
    border: 1px solid rgba(16, 18, 22, 0.08);
    background: rgba(251, 248, 241, 0.5);
    font-size: 13px;
    color: var(--ink-soft) !important;
    text-decoration: none !important;
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.pub-topic-item:hover {
    background: rgba(251, 248, 241, 0.9);
    border-color: rgba(16, 18, 22, 0.14);
    transform: translateX(2px);
}
.pub-topic-chip {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
    color: #fff;
    flex: 0 0 auto;
    line-height: 1.3;
}
.pub-topic-item.tag-writing     .pub-topic-chip { background: rgb(219, 64, 90); }
.pub-topic-item.tag-alignment   .pub-topic-chip { background: rgb(209, 95, 224); }
.pub-topic-item.tag-interaction .pub-topic-chip { background: rgb(224, 177, 88); }
.pub-topic-item.tag-perception  .pub-topic-chip { background: rgb(138, 203, 136); }
.pub-topic-item.tag-others      .pub-topic-chip { background: #9aa0a8; }

html.dark .pub-topic-item {
    background: rgba(28, 31, 36, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}
html.dark .pub-topic-item:hover {
    background: rgba(28, 31, 36, 0.9);
    border-color: rgba(255, 255, 255, 0.14);
}

/* ── Publication section (borrowed from index2 Publication List) ── */
.pubs-section {
    background: transparent;
    border: 0;
    padding: 0;
    margin-top: 24px;
}

.pubs-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.pubs-section-kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.17em;
    margin-bottom: 6px;
}
.pubs-section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(22px, 2.6vw, 32px);
    font-weight: 360;
    letter-spacing: -0.02em;
    line-height: 1.06;
    color: var(--ink);
    margin: 0;
}
.pubs-section-title em {
    color: var(--accent);
    font-style: italic;
}
.pubs-section-sub {
    max-width: 360px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
}

/* Controls row: filter on left, topic tags on right, same line */
.pubs-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* Filter button row (By Date / By Topic / Full List / etc.) */
.pubs-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pubs-filter-btn {
    appearance: none;
    border: 1px solid rgba(16, 18, 22, 0.2);
    background: transparent;
    color: var(--ink-soft) !important;
    padding: 3px 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    text-decoration: none !important;
    border-radius: 3px;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.pubs-filter-btn:hover {
    background: var(--ink);
    color: #fff !important;
    border-color: var(--ink);
}
.pubs-filter-btn.active {
    background: var(--ink);
    color: #fff !important;
    border-color: var(--ink);
}

/* Topic tag chips (Writing & Thinking / Alignment / ...) */
.pubs-topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.pubs-topic-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
    color: #fff !important;
    background: var(--muted);
    text-decoration: none !important;
    transition: opacity .2s ease, transform .15s ease;
    opacity: 0.9;
    line-height: 1.3;
}
.pubs-topic-tag:hover { opacity: 1; transform: translateY(-1px); }
.pubs-topic-tag.tag-writing     { background: rgb(219, 64, 90); }
.pubs-topic-tag.tag-alignment   { background: rgb(209, 95, 224); }
.pubs-topic-tag.tag-interaction { background: rgb(224, 177, 88); }
.pubs-topic-tag.tag-perception  { background: rgb(138, 203, 136); }

/* Publication list container — flat, matches page background */
.pubs-list-wrap {
    border: 0;
    background: transparent;
    padding: 8px 0 0;
    border-radius: 0;
}

/* Publication-list visual hierarchy ------------------------ */
[id^="publication_"] .publication {
    padding: 3px 0 3px 4px;
}
[id^="publication_"] .publication .title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 14.5px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin: 0 0 1px;
}
[id^="publication_"] .publication .title a,
[id^="publication_"] .publication a.pub-title-link {
    color: inherit !important;
    text-decoration: none;
    background-image: none;
}
[id^="publication_"] .publication .title a:hover,
[id^="publication_"] .publication a.pub-title-link:hover {
    color: var(--accent) !important;
    text-decoration: none;
}

[id^="publication_"] .publication .authors,
[id^="publication_"] div.authors {
    font-family: 'Inter Tight', sans-serif;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.35;
    margin: 0 0 1px;
}
[id^="publication_"] .publication .authors a {
    color: var(--ink-soft);
}
[id^="publication_"] .publication .authors a:hover { color: var(--accent); }

/* Venue line — small mono chip + slash-separated action tags */
[id^="publication_"] .publication span.venue {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-right: 4px;
}
[id^="publication_"] .publication span.venue a {
    color: inherit;
    text-decoration: none;
}
[id^="publication_"] .publication span.venue a:hover { color: var(--accent); }
[id^="publication_"] .publication span.venue .highlight,
[id^="publication_"] .publication .highlight {
    color: var(--ink-soft);
    background: rgba(199, 154, 58, 0.18);
    border: 1px solid rgba(199, 154, 58, 0.5);
    padding: 0 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}
[id^="publication_"] .publication .highlight-note {
    color: var(--ink-soft);
    background: rgba(47, 122, 114, 0.18);
    border: 1px solid rgba(47, 122, 114, 0.5);
    padding: 0 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}
html.dark [id^="publication_"] .publication .highlight {
    color: var(--ink);
    background: rgba(225, 178, 92, 0.18);
    border-color: rgba(225, 178, 92, 0.55);
}
html.dark [id^="publication_"] .publication .highlight-note {
    color: var(--ink);
    background: rgba(79, 179, 168, 0.18);
    border-color: rgba(79, 179, 168, 0.55);
}

[id^="publication_"] .publication span.tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
}
[id^="publication_"] .publication span.tag a {
    color: var(--ink-soft);
    text-decoration: none;
}
[id^="publication_"] .publication span.tag a:hover { color: var(--accent); }

[id^="publication_"] .publication .action-tags {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
[id^="publication_"] .publication .action-tags a {
    color: var(--ink-soft);
    text-decoration: none;
    margin: 0 2px;
}
[id^="publication_"] .publication .action-tags a:hover { color: var(--accent); }
[id^="publication_"] .publication .action-tags .sep {
    color: rgba(16, 18, 22, 0.25);
    margin: 0 2px;
}
html.dark [id^="publication_"] .publication .action-tags { color: var(--muted); }
html.dark [id^="publication_"] .publication .action-tags a { color: var(--ink-soft); }
html.dark [id^="publication_"] .publication .action-tags .sep { color: rgba(255,255,255,0.2); }

/* Tighter spacing per item in the timeline */
[id^="publication_"].timeline li {
    margin-bottom: 8px;
}
[id^="publication_"] .publication > .text > div:last-child {
    line-height: 1.3;
}

/* Dark variants */
html.dark [id^="publication_"] .publication .title { color: var(--ink); }
html.dark [id^="publication_"] .publication .authors,
html.dark [id^="publication_"] div.authors,
html.dark [id^="publication_"] .publication .authors a { color: var(--ink-soft); }
html.dark [id^="publication_"] .publication span.venue { color: var(--accent-2); }
html.dark [id^="publication_"] .publication span.tag { color: var(--muted); }
html.dark [id^="publication_"] .publication span.tag a { color: var(--ink-soft); }
html.dark [id^="publication_"].timeline li:hover div.publication {
    background: rgba(255, 255, 255, 0.04);
}

/* Dark mode for pub section — flat, no box */
html.dark .pubs-list-wrap {
    background: transparent;
    border-color: transparent;
}
html.dark .pubs-filter-btn {
    background: #1c1f24;
    color: var(--ink-soft) !important;
    border-color: rgba(255, 255, 255, 0.16);
}
