/* ---------- Theme tokens ---------- */
:root {
    --bg: #ffffff;
    --surface: #f7f7f8;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #e6e6e6;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --shadow: rgba(0, 0, 0, 0.08);
    --max-width: 880px;
}

html.dark-mode {
    --bg: #14161a;
    --surface: #1c1f26;
    --text: #e8e8ea;
    --text-muted: #9aa0a6;
    --border: #2a2e37;
    --accent: #8ab4f8;
    --accent-soft: rgba(138, 180, 248, 0.12);
    --shadow: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    transition: background 0.25s ease, color 0.25s ease;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 16px;
}

.logo {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.logo:hover {
    text-decoration: none;
}

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

.nav-links a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    text-decoration: none;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.05rem;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

/* ---------- Sections ---------- */
section {
    padding-top: 48px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    max-width: var(--max-width);
    margin: 48px auto 0;
}

/* ---------- About ---------- */
.about-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.about-left {
    flex: 0 0 220px;
    text-align: center;
}

.profile-pic {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 6px 24px var(--shadow);
}

.about-left h2 {
    margin: 18px 0 2px;
    font-size: 1.3rem;
}

.role {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.social-icons {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 1.25rem;
}

.social-icons a {
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-icons a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.about-right {
    flex: 1;
}

.about-right p {
    margin: 0 0 16px;
}

.about-right p:first-child {
    margin-top: 4px;
}

/* ---------- News ---------- */
.news-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}

.news-list li {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.news-list li:last-child {
    border-bottom: none;
}

.news-date {
    flex: 0 0 96px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- Publications ---------- */
.publication {
    display: flex;
    gap: 20px;
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 10px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.publication:hover {
    transform: translateY(-4px);
    background: var(--surface);
    box-shadow: 0 10px 30px var(--shadow);
}

.pub-media {
    flex: 0 0 200px;
}

.pub-media img,
.pub-media video {
    width: 200px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

/* Still image sits over the clip and fades out while it plays */
.pub-thumb {
    position: relative;
    display: block;
    width: 200px;
    height: 120px;
}

.pub-thumb img,
.pub-thumb video {
    position: absolute;
    inset: 0;
}

.pub-thumb img {
    z-index: 1;
    transition: opacity 0.25s ease;
}

.pub-thumb.playing img {
    opacity: 0;
}

.pub-media-placeholder {
    width: 200px;
    height: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.pub-info {
    flex: 1;
}

.pub-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.pub-authors {
    font-size: 0.95rem;
}

.author.me {
    font-weight: 700;
    color: var(--text);
}

.pub-note {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.pub-venue {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pub-badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
}

.pub-links {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pub-link {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
}

.pub-link:hover {
    background: var(--accent-soft);
    text-decoration: none;
}

.pub-link summary {
    list-style: none;
}

.pub-link pre {
    white-space: pre-wrap;
    font-size: 0.8rem;
    background: var(--surface);
    padding: 12px;
    border-radius: 6px;
    margin-top: 8px;
    overflow-x: auto;
}

.empty-note {
    color: var(--text-muted);
    font-style: italic;
}

/* ---------- Standalone pages (CV) ---------- */
.page {
    padding: 48px 24px 0;
}

.page h1 {
    margin-top: 0;
}

.page blockquote {
    border-left: 3px solid var(--border);
    margin: 16px 0;
    padding: 4px 16px;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 64px;
    padding: 28px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* ---------- Toast ---------- */
#toast {
    visibility: hidden;
    min-width: 200px;
    background: var(--text);
    color: var(--bg);
    text-align: center;
    border-radius: 6px;
    padding: 12px 18px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 0.9rem;
    box-shadow: 0 4px 12px var(--shadow);
}

#toast.show {
    visibility: visible;
    animation: fadein 0.4s, fadeout 0.4s 2.4s;
}

@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
    from { bottom: 30px; opacity: 1; }
    to { bottom: 0; opacity: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .about-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 24px;
    }

    .about-right {
        text-align: left;
    }

    .nav-links {
        gap: 14px;
    }

    .nav-links li:nth-child(2) {
        display: none; /* hide "News" on very small screens to save room */
    }

    .publication {
        flex-direction: column;
    }

    .pub-media,
    .pub-media img,
    .pub-media video,
    .pub-media-placeholder {
        width: 100%;
    }

    .pub-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 5 / 3;
    }

    .pub-thumb img,
    .pub-thumb video {
        height: 100%;
    }
}
