/* ==========================================================================
   Jean-Victor Alipour — personal site
   ========================================================================== */

/* Self-hosted fonts (SIL Open Font License) */
@font-face {
    font-family: 'Crimson Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/crimson-text-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Crimson Text';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/crimson-text-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Crimson Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/crimson-text-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('fonts/inter-variable.woff2') format('woff2');
}

:root {
    --bg: #f6f3ec;
    --surface: #ece7dc;
    --text: #24221e;
    --muted: #5f5a51;
    --faint: #6b655b;
    --line: #ddd6c8;
    --rule: #b9b1a2;
    --accent: #1f4e79;
    --accent-soft: rgba(31, 78, 121, 0.08);
    --serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #191918;
    --surface: #232321;
    --text: #eee9df;
    --muted: #bdb8ad;
    --faint: #8f8a80;
    --line: #393934;
    --rule: #57554e;
    --accent: #8fb8e0;
    --accent-soft: rgba(143, 184, 224, 0.14);
    color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15.5px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }
/* in-text links: visible underline so they do not rely on colour alone (WCAG 1.4.1) */
.bio a, .news-item p a, .paper-meta a, .page-intro a, .section-note a {
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-underline-offset: 3px;
}
.bio a:hover, .news-item p a:hover, .paper-meta a:hover, .page-intro a:hover, .section-note a:hover { text-decoration-color: currentColor; }

button { font: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

.skip {
    position: absolute;
    left: -999px;
    top: 0;
}
.skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 20;
    background: var(--bg);
    border: 1px solid var(--accent);
    padding: 0.4rem 0.8rem;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

nav.site-nav {
    position: relative;
    max-width: 1060px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    margin-right: auto;
    white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.4rem;
}

.nav-links a {
    position: relative;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.2rem 0;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--text); text-decoration: none; }

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.25rem 0.7rem;
    cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--rule); }
.theme-toggle svg { width: 13px; height: 13px; }

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: 0;
    padding: 6px;
    cursor: pointer;
}
.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
}

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

.main-container {
    max-width: 1060px;
    margin: 0 auto;
    padding: 3rem 1.5rem 0;
}

.section-title {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
    scroll-margin-top: 5rem;
}
.section-title:not(:first-child) { margin-top: 3.5rem; }
h1.section-title { border-bottom: 0; padding-bottom: 0; font-size: 2.4rem; margin-bottom: 1rem; }

.section-note {
    color: var(--muted);
    font-size: 0.9rem;
    margin: -1rem 0 1rem;
}

.page-intro {
    color: var(--muted);
    max-width: 680px;
    margin: -0.5rem 0 2rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

.profile-img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 4px;
    background: var(--surface);
    display: block;
}

.profile-fallback {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 4px;
    background: var(--surface);
    color: var(--faint);
    font-family: var(--serif);
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-cv {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--muted);
}
.mini-cv li {
    display: grid;
    grid-template-columns: 3.1rem 1fr;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-top: 1px solid var(--line);
}
.mini-cv li:last-child { border-bottom: 1px solid var(--line); }
.mini-cv-year { font-family: var(--mono); color: var(--faint); }

.content-section h1 {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 4vw, 2.9rem);
    font-weight: 600;
    line-height: 1.1;
    margin: 0 0 1.2rem;
}

.aff-rows {
    border-top: 1px solid var(--line);
    margin-bottom: 1.2rem;
}

.aff {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}
.aff b { font-weight: 600; }
.aff > span { color: var(--muted); }


.cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.5rem;
}
.btn {
    display: inline-block;
    border: 1px solid var(--accent);
    border-radius: 3px;
    padding: 0.3rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.btn:hover { background: var(--accent-soft); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--bg); opacity: 0.9; }

.keywords {
    font-size: 0.9rem;
    color: var(--faint);
    margin: 0 0 1rem;
}

.bio p { margin: 0 0 1rem; }
.bio strong { font-weight: 600; color: var(--text); }

.news {
    margin-top: 2.25rem;
    padding: 1.1rem 1.3rem 0.4rem;
    background: var(--surface);
    border-radius: 6px;
    border: 1px solid var(--line);
}
.news-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}
.news-head {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}
.news-tag {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faint);
}
.news-list {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.4rem;
    position: relative;
}
.news-list::before {                     /* timeline rail */
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 0.45rem;
    bottom: 1rem;
    width: 2px;
    background: var(--line);
    border-radius: 1px;
}
.news-item {
    position: relative;
    padding: 0 0 1rem;
}
.news-item::before {                     /* timeline dot */
    content: "";
    position: absolute;
    left: -1.4rem;
    top: 0.3rem;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--rule);
    box-sizing: border-box;
}
.news-item.is-new::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
    animation: news-pulse 2.4s ease-out 3;
}
@keyframes news-pulse {
    0% { box-shadow: 0 0 0 0 var(--accent-soft); }
    70% { box-shadow: 0 0 0 9px rgba(0, 0, 0, 0); }
    100% { box-shadow: 0 0 0 4px var(--accent-soft); }
}
.news-date {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--faint);
    margin-bottom: 0.2rem;
}
.news-item.is-new .news-date { color: var(--accent); font-weight: 600; }
.news-item p { margin: 0; font-size: 0.9rem; line-height: 1.6; }
.news-item strong { font-weight: 600; color: var(--text); }
.news-item p a { font-weight: 500; }

/* show the newest ~3 items; older ones are reached by scrolling and fade with age */
.news-scroll {
    max-height: 16rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
    margin-right: -0.6rem;
    padding-right: 0.6rem;
}
.news-scroll.has-more {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3.5rem), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 3.5rem), transparent);
}
.news-scroll.has-prev {
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 2.5rem);
    mask-image: linear-gradient(to bottom, transparent, #000 2.5rem);
}
.news-scroll.has-prev.has-more {
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 2.5rem, #000 calc(100% - 3.5rem), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 2.5rem, #000 calc(100% - 3.5rem), transparent);
}
.news-item { transition: opacity 0.2s ease; }
.news-item:nth-child(3) { opacity: 0.85; }
.news-item:nth-child(4) { opacity: 0.7; }
.news-item:nth-child(n+5) { opacity: 0.55; }
.news-item:hover,
.news-item:focus-within { opacity: 1; }

/* --------------------------------------------------------------------------
   Section index
   -------------------------------------------------------------------------- */

.section-index {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.section-index a {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}
.section-index span {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--faint);
    margin-right: 0.5rem;
}

/* --------------------------------------------------------------------------
   Papers
   -------------------------------------------------------------------------- */

.paper-item {
    padding: 1.3rem 0;
    border-bottom: 1px solid var(--line);
}
.paper-item:last-child { border-bottom: 0; }

.paper-title {
    font-family: var(--serif);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.3rem;
}
.paper-title a, a.entry-title { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.paper-title a:hover, a.entry-title:hover { color: var(--accent); text-decoration-color: currentColor; }

.paper-authors {
    color: var(--muted);
    font-size: 0.9rem;
}
.paper-authors a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule); }
.paper-authors a:hover { color: var(--accent); text-decoration-color: currentColor; }

.paper-venue {
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.paper-state {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.paper-status {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 3px;
    padding: 0.08rem 0.5rem;
    margin-right: 0.35rem;
}

.status-journal {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--muted);
}

.paper-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    margin-top: 0.6rem;
    font-size: 0.9rem;
}

.paper-meta {
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 0.5rem;
}
.meta-label { color: var(--faint); }

.abstract-toggle {
    background: none;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.1rem 0.6rem;
    cursor: pointer;
}
.abstract-toggle::after { content: " ▾"; }
.abstract-toggle[aria-expanded="true"]::after { content: " ▴"; }
.abstract-toggle:hover { color: var(--text); border-color: var(--rule); }
.abstract-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }

.paper-abstract {
    margin-top: 0.8rem;
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border-left: 2px solid var(--accent);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--muted);
}

.paper-bibtex {
    margin: 0.8rem 0 0;
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border-left: 2px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--muted);
    overflow-x: auto;
    white-space: pre;
}

/* --------------------------------------------------------------------------
   Lists (policy, software)
   -------------------------------------------------------------------------- */

.entry-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.entry-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
}
.entry-list li:last-child { border-bottom: 0; }

.entry-title {
    font-weight: 500;
    color: var(--text);
}
a.entry-title:hover { color: var(--accent); }

.entry-meta {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.software-name {
    font-family: var(--mono);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Media page
   -------------------------------------------------------------------------- */

.outlets {
    font-size: 0.9rem;
    color: var(--muted);
    padding: 0.9rem 1.1rem;
    background: var(--surface);
    border-radius: 4px;
    margin: 0 0 1.5rem;
}
.outlets b { color: var(--text); font-weight: 600; }

.media-tools {
    position: sticky;
    top: 3.6rem;
    z-index: 5;
    background: var(--bg);
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.filters button {
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.15rem 0.75rem;
    cursor: pointer;
}
.filters button:hover { border-color: var(--rule); color: var(--text); }
.filters button[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.year-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    align-items: center;
}

.media-year h2 {
    font-family: var(--mono);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--faint);
    margin: 2rem 0 0.3rem;
    scroll-margin-top: 7.5rem;
}

.media-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.media-list li {
    display: grid;
    grid-template-columns: 4.5rem 1.25rem 1fr;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}
.media-date {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--faint);
    padding-top: 0.15rem;
}
.media-outlet { font-weight: 600; }
span.media-outlet { color: var(--text); }
.media-headline { display: block; color: var(--muted); }
.media-icon { color: var(--faint); padding-top: 0.1rem; }
.media-icon .icon { width: 1.1rem; height: 1.1rem; }

.media-empty { color: var(--muted); padding: 1rem 0; }

/* --------------------------------------------------------------------------
   TV screenshots
   -------------------------------------------------------------------------- */

.shot {
    margin: 0;
}
.shot img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    background: var(--surface);
}
.shot a:hover img { outline: 2px solid var(--accent); outline-offset: 2px; }
.shot figcaption {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--faint);
}
.shot figcaption b { color: var(--text); font-weight: 600; }
.shot figcaption span { display: block; color: var(--muted); }

.highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
    margin: 0 0 1.75rem;
}

.shot-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 260px));
    gap: 1rem;
    margin-top: 0.8rem;
}

.paper-item.has-figure,
.entry-list li.has-figure {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 0.5rem 2rem;
    align-items: start;
}
.shot-side { margin: 0.2rem 0 0; }
.shot-below { max-width: 260px; margin: 0.8rem 0 0; }
.shot-side img { aspect-ratio: auto; object-fit: contain; }

.entry-meta .outlet { color: var(--text); font-weight: 600; }
.entry-meta a.coauthor,
.paper-authors a.coauthor { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.entry-meta a.coauthor:hover,
.paper-authors a.coauthor:hover { color: var(--accent); text-decoration-color: currentColor; }

.shot-inline {
    max-width: 260px;
    margin-top: 0.8rem;
}
.shot-inline img { aspect-ratio: auto; object-fit: contain; }

/* --------------------------------------------------------------------------
   Icons, pills, badges, findings, policy groups
   -------------------------------------------------------------------------- */

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    flex: none;
}

.profile-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.6rem;
}
.icon-link {
    display: inline-flex;
    padding: 0.35rem;
    border-radius: 4px;
    color: var(--muted);
}
.icon-link .icon { width: 1.25rem; height: 1.25rem; }
.icon-link:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }

.pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 0 0.4rem;
    vertical-align: 0.05em;
}
.pill-python { color: #2b5b84; border-color: #9fb7cf; }
.pill-stata { color: #1a5f91; border-color: #a6c1d6; }
:root[data-theme="dark"] .pill-python,
:root[data-theme="dark"] .pill-stata { color: var(--accent); border-color: var(--rule); }

.paper-takeaway {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
    color: var(--text);
    padding-left: 0.7rem;
    border-left: 2px solid var(--accent);
}

/* collapsed "until-found" panels must not leave empty padded boxes */
.paper-abstract[hidden],
.paper-bibtex[hidden] {
    padding: 0;
    margin: 0;
    border: 0;
}

.sub-head {
    font-family: var(--serif);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 2.25rem 0 0.5rem;
}

.featured-list li.featured {
    background: var(--surface);
    border: 0;
    border-radius: 4px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.75rem;
}
.featured-list li.featured .entry-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.3; }

.coverage { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.coverage summary { cursor: pointer; color: var(--faint); width: max-content; }
.coverage summary:hover { color: var(--accent); }
.coverage[open] summary { margin-bottom: 0.2rem; }

.outlet-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1rem;
}
.outlet-badges button,
.filters button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
}
.outlet-badges button span,
.filters button span { font-weight: 400; color: var(--faint); }
.outlet-badges button:hover,
.filters button:hover { border-color: var(--rule); }
.outlet-badges button[aria-pressed="true"],
.filters button[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}
.outlet-badges button[aria-pressed="true"] span,
.filters button[aria-pressed="true"] span { color: var(--bg); opacity: 0.8; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    max-width: 1060px;
    margin: 4rem auto 0;
    padding: 1.5rem 1.5rem 3rem;
}
.site-footer-inner {
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--faint);
}
.site-footer p { margin: 0; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
    .menu-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        padding: 0.5rem 1.5rem 1rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a { display: block; padding: 0.6rem 0; font-size: 1rem; }
    .nav-links a::after { display: none; }

    .theme-label { display: none; }
    /* tap targets >= 44px */
    .menu-toggle, .theme-toggle { min-width: 44px; min-height: 44px; justify-content: center; align-items: center; }
    .icon-link { padding: 0.6rem; }
    .abstract-toggle { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
    .news-scroll { max-height: 22rem; }

    .hero {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    /* phone/tablet: photo, then name and bio, then the mini CV */
    .profile-section { display: contents; }
    .profile-img, .profile-fallback { max-width: 160px; order: 0; }
    .content-section { order: 1; }
    .mini-cv { order: 2; margin-top: 0; }
    .profile-fallback { display: none; }

    .paper-item.has-figure,
    .entry-list li.has-figure { grid-template-columns: 1fr; }
    .shot-side { max-width: 260px; margin-top: 0.6rem; }

    .main-container { padding-top: 2rem; }

    .media-tools { position: static; }
}

@media (max-width: 480px) {
    body { font-size: 15px; }
    nav.site-nav { padding: 0.75rem 1rem; gap: 0.75rem; }
    .main-container { padding: 1.5rem 1rem 0; }
    .site-footer { padding: 1.5rem 1rem 2.5rem; }
    .profile-img { max-width: 150px; }
    .content-section h1 { font-size: 2rem; }
    .aff { flex-direction: column; gap: 0; }
    .profile-icons { margin-left: 0; width: 100%; }
    .section-title { font-size: 1.7rem; }

    .highlights {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 0.9rem;
        padding-bottom: 0.4rem;
    }
    .highlights .shot { flex: 0 0 75%; scroll-snap-align: start; }

    .filters, .outlet-badges { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.3rem; }
    .filters button, .outlet-badges button { flex: none; }

    .media-list li { grid-template-columns: 1.25rem 1fr; row-gap: 0.1rem; }
    .media-date { grid-column: 1 / -1; }
}

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