/* Homepage theme with two color modes: blue (default) and pink ([data-theme="pink"]).
   Hues come from a reference poster (pink #f3d9e1 / rose #e8b0b8, sky #a0d8f8 /
   blue #2878a8); page backgrounds are those hues mixed with 65 to 90% white. Text
   accents are slightly deeper so small text stays readable (>= 4.5:1).
   --swatch is the other mode's color, shown on the toggle. */

:root {
    --bg: #eff8fe;
    --page-left: #eff8fe;
    --page-right: #f6fbfe;
    --desk: linear-gradient(120deg, #e2f3fd, #f4fafe);
    --surface: #e8f6fd;
    --ink: #14283a;
    --ink-2: #33495c;
    --muted: #4f6475;
    --accent: #1f6797;
    --accent-2: #1d6a8c;
    --accent-2-soft: rgba(40, 120, 168, 0.08);
    --link-rule: rgba(31, 103, 151, 0.35);
    --rule: rgba(20, 40, 58, 0.11);
    --rule-strong: rgba(20, 40, 58, 0.36);
    --map-empty: #dff2fd;
    --map-low: #a0d8f8;
    --map-high: #2878a8;
    --spine: rgba(20, 40, 58, 0.05);
    --swatch: #e8b0b8;
    --serif: "Newsreader", Georgia, "Times New Roman", serif;
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --profile-width: 560px;
    color-scheme: light;
}

:root[data-theme="pink"] {
    --bg: #fbf2f5;
    --page-left: #fbf2f5;
    --page-right: #fdf8fa;
    --desk: linear-gradient(120deg, #f8eaee, #fcf6f8);
    --surface: #faeef2;
    --ink: #2b1d2a;
    --ink-2: #4f3a4b;
    --muted: #725c6b;
    --accent: #a8405f;
    --accent-2: #8f3352;
    --accent-2-soft: rgba(143, 51, 82, 0.07);
    --link-rule: rgba(168, 64, 95, 0.35);
    --rule: rgba(43, 29, 42, 0.11);
    --rule-strong: rgba(43, 29, 42, 0.36);
    --map-empty: #f7e6ec;
    --map-low: #e8b0b8;
    --map-high: #b03a62;
    --spine: rgba(43, 29, 42, 0.05);
    --swatch: #a0d8f8;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

p, h1, h2, h3, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--link-rule);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.panel-title:focus { outline: none; }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* ---- Shared text styles ------------------------------------------------ */

.eyebrow, .label {
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.fact-small {
    font-size: 13px;
    color: var(--muted);
}

.section-title, .panel-title, .name, .headline, .fact-title {
    font-family: var(--serif);
    font-weight: 400;
}

/* ---- Layout ------------------------------------------------------------ */

.shell {
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.profile {
    width: 100%;
    max-width: var(--profile-width);
    padding: 56px 40px 64px;
}

.js .panel { display: none; }
.js .panel-open .panel { display: block; }
.panel { padding: 0 20px 48px; }
.panel-view { max-width: 720px; }
.panel-view + .panel-view { margin-top: 64px; }
.js .panel-view + .panel-view { margin-top: 0; }

.when-narrow { display: none !important; }

/* Desktop: a book. Closed, the profile is a single centered page; opening a
   view adds an equal right page, and each page scrolls independently. */
@media (min-width: 1024px) {
    body { background: var(--desk); background-attachment: fixed; }
    .book { overflow: hidden; }
    /* Grid areas (not flex) so the percentage padding below resolves against
       the page width, which keeps the text block centered on each page. */
    .shell {
        display: grid;
        grid-template-columns: 50%;
        justify-content: center;
        height: 100vh;
        max-width: 1680px;
        margin: 0 auto;
    }
    .panel-open .shell { grid-template-columns: 1fr 1fr; }
    .profile, .js .panel-open .panel {
        width: auto;
        height: 100vh;
        max-width: none;
        overflow-y: auto;
        scrollbar-width: thin;
        padding: 72px max(48px, calc((100% - 600px) / 2)) 88px;
    }
    .profile { scrollbar-width: none; background: var(--page-left); box-shadow: 0 0 48px rgba(29, 34, 56, 0.08); }
    .profile::-webkit-scrollbar { display: none; }
    .panel-open .profile { background: linear-gradient(to left, var(--spine), transparent 56px), var(--page-left); }
    .js .panel-open .panel {
        padding-top: 28px;
        background: linear-gradient(to right, var(--spine), transparent 56px), var(--page-right);
        border-left: 1px solid var(--rule);
        box-shadow: 0 0 48px rgba(29, 34, 56, 0.08);
        animation: page-open 0.35s ease-out;
    }
    .panel-view { max-width: none; }
    .panel-bar {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 20px;
    }
}

@keyframes page-open {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: none; }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
    .profile .name { font-size: 48px; }
    .profile .identity { gap: 16px; }
    .profile .portrait { width: 64px; height: 64px; }
}

@media (max-width: 1023.98px) {
    .when-wide { display: none !important; }
    .when-narrow { display: inline-flex !important; }
    .profile { padding: 32px 20px 48px; }
    .js .panel-open { overflow: hidden; }
    .js .panel-open .panel {
        position: fixed;
        inset: 0;
        z-index: 10;
        overflow-y: auto;
        background: var(--page-right);
    }
    .panel-bar {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 -20px 24px;
        padding: 14px 20px;
        background: var(--page-right);
        border-bottom: 1px solid var(--rule);
    }
    .panel-close .when-narrow {
        gap: 10px;
        font-family: var(--serif);
        font-size: 22px;
    }
}

html:not(.js) .panel-bar { display: none; }

.panel-close {
    font-size: 13px;
    color: var(--muted);
}
.panel-close:hover { color: var(--ink); }

/* ---- Profile column ---------------------------------------------------- */

.identity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 24px;
    margin-bottom: 14px;
}
.portrait {
    flex: none;
    width: 76px;
    height: 76px;
    margin-right: clamp(0px, 2.8vw, 40px);
    border-radius: 50%;
    object-fit: cover;
}

.name {
    margin: 0;
    font-size: 56px;
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13.5px;
    color: var(--ink-2);
}
.contact a { text-decoration: none; }
.contact a:hover { text-decoration: underline; }

.headline {
    margin: 32px 0 36px;
    font-size: 26px;
    line-height: 1.45;
    color: var(--ink-2);
    letter-spacing: -0.005em;
}

.facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--rule);
    padding-top: 20px;
}
.fact { position: relative; min-width: 0; }
.fact + .fact {
    border-left: 1px solid var(--rule);
    padding-left: 18px;
    margin-left: 18px;
}
.fact .label { margin-bottom: 10px; }
.fact-title {
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.fact-meta {
    margin-top: 4px;
    font-size: 15px;
    color: var(--ink-2);
}
.fact .fact-small { margin-top: 2px; }

.more > summary {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 12.5px;
    color: var(--muted);
    list-style: none;
    cursor: pointer;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: " ⌄"; }
.more[open] > summary::after { content: " ⌃"; }
.more-item { margin-top: 14px; }
.tag {
    display: inline-block;
    margin-left: 4px;
    padding: 0 7px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--accent-2);
    border: 1px solid currentColor;
    border-radius: 999px;
    vertical-align: 0.15em;
    white-space: nowrap;
}

.exp-item + .exp-item { margin-top: 14px; }
.exp-title {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.3;
}
.exp-title a { text-decoration-color: var(--rule); }

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin: 36px 0 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
    font-size: 14.5px;
}
.nav a {
    text-decoration: none;
    padding-bottom: 6px;
    border-bottom: 1px solid transparent;
}
.nav a:hover { border-bottom-color: var(--rule-strong); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    font-size: 13px;
    color: var(--muted);
    border: 1px solid var(--rule);
    border-radius: 999px;
    transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }
.theme-swatch {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--swatch);
}
.theme-toggle .when-pink, [data-theme="pink"] .theme-toggle .when-blue { display: none; }
[data-theme="pink"] .theme-toggle .when-pink { display: inline; }

.news { margin-top: 28px; }
.section-title {
    font-size: 24px;
    letter-spacing: -0.015em;
    margin-bottom: 14px;
}
.news-list li {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 12px;
    padding: 9px 0;
}
.news-list time {
    font-size: 12px;
    color: var(--muted);
    padding-top: 4px;
}
.news-list div {
    font-family: var(--serif);
    font-size: 17.5px;
    line-height: 1.45;
    color: var(--ink-2);
}
.news-list strong { font-weight: 500; color: var(--ink); }

.visitors {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
}
.visitors-map { height: 220px; margin: 8px 0 4px; }

/* ---- Panel: shared ----------------------------------------------------- */

.panel-head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 28px;
}
.panel-head > .fact-small, .panel-head > a { white-space: nowrap; }
.panel-title {
    font-size: 38px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* ---- Panel: publications ----------------------------------------------- */

.filter-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}
.all-papers {
    font-size: 13px;
    color: var(--muted);
}
.all-papers[aria-pressed="true"] {
    color: var(--accent-2);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.count {
    margin-left: 6px;
    font-size: 11.5px;
    color: var(--muted);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}
.chip {
    padding: 6px 11px;
    font-size: 13.5px;
    color: var(--ink-2);
    border: 1px solid var(--rule);
    border-radius: 3px;
    transition: border-color 0.15s, background-color 0.15s;
}
.chip:hover { border-color: var(--rule-strong); }
.chip[aria-pressed="true"] {
    color: var(--accent-2);
    background: var(--accent-2-soft);
    border-color: var(--accent-2);
}

.search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule-strong);
    color: var(--muted);
}
.search input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    font: inherit;
    font-size: 15.5px;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: none;
}
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-bottom-color: var(--accent); }

.pub-status {
    margin-top: 10px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}

.pub {
    padding: 26px 0 22px;
    border-bottom: 1px solid var(--rule);
}
.pub-venue {
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--accent-2);
}
.pub-venue .badge {
    margin-left: 8px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
}
.pub-title {
    margin: 8px 0 10px;
    font-family: var(--serif);
    font-size: 29px;
    font-weight: 400;
    line-height: 1.22;
    letter-spacing: -0.012em;
}
.pub-title a { text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.pub-title .arrow {
    padding-left: 4px;
    font-family: var(--sans);
    font-size: 15px;
    color: var(--accent-2);
    vertical-align: 0.35em;
}
.pub-summary {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.5;
    color: var(--ink-2);
}

.pub-authors {
    margin-bottom: 10px;
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink-2);
}
.pub-authors a, .pub-authors span { color: inherit; }
.pub-authors strong { font-weight: 500; color: var(--ink); }
.pub-links a { color: var(--accent); }
.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 10px;
    font-size: 13.5px;
}
.pub-note {
    margin-top: 10px;
    font-size: 13.5px;
    color: var(--muted);
}
.pub-empty {
    padding: 32px 0;
    font-family: var(--serif);
    font-size: 19px;
    color: var(--muted);
}

/* ---- Panel: collaborators & CV ---------------------------------------- */

.home-block { margin-top: 40px; }
.entries li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    font-family: var(--serif);
    font-size: 17.5px;
    line-height: 1.4;
    color: var(--ink-2);
}
.entries .fact-small {
    flex: none;
    max-width: 45%;
    text-align: right;
    font-family: var(--sans);
}

.home-block .label { margin-bottom: 8px; }

.cv-pages canvas {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 2px;
}
.cv-status { padding: 24px 0; }

/* ---- Standalone pages (blog) ------------------------------------------ */

.page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 40px 96px;
}
.page-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
}
.page-home {
    font-family: var(--serif);
    font-size: 22px;
    text-decoration: none;
}
.page-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    font-size: 14.5px;
}
.page-nav a { text-decoration: none; padding-bottom: 4px; border-bottom: 1px solid transparent; }
.page-nav a:hover { border-bottom-color: var(--rule-strong); }
.page-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.page-nav .theme-toggle { margin: 0; }
.page-title { margin: 48px 0 8px; }

.coming-soon { max-width: 640px; }
.coming-soon .eyebrow { margin-bottom: 20px; }

.prose p {
    font-family: var(--serif);
    font-size: 19.5px;
    line-height: 1.6;
    color: var(--ink-2);
}
.prose p + p, .prose p + ul { margin-top: 16px; }
.prose ul { padding-left: 1.2em; list-style: disc; }
.prose li {
    font-family: var(--serif);
    font-size: 19.5px;
    line-height: 1.6;
    color: var(--ink-2);
}
.prose li + li { margin-top: 10px; }
.prose strong { font-weight: 500; color: var(--ink); }
.prose a, .news-list a { color: var(--accent); }
[data-view="about"] .eyebrow { margin-bottom: 10px; }
[data-view="about"] .panel-title { margin-bottom: 24px; }

.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.cat-grid img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 3px;
}

/* ---- Small screens ----------------------------------------------------- */

@media (max-width: 560px) {
    .name { font-size: clamp(30px, 10vw, 42px); }
    .identity { gap: 12px; }
    .portrait { width: clamp(48px, 16vw, 60px); height: clamp(48px, 16vw, 60px); }
    .headline { font-size: 22px; margin: 26px 0 30px; }
    .facts { grid-template-columns: 1fr; gap: 22px; }
    .fact + .fact {
        border-left: 0;
        padding-left: 0;
        margin-left: 0;
        border-top: 1px solid var(--rule);
        padding-top: 20px;
    }
    .panel-title { font-size: 32px; }
    .pub-title { font-size: 24px; }
    .pub-summary { font-size: 17.5px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
