/* Minimal academic theme (Option A) */

:root {
    /* Warm, academic “paper” palette */
    --bg: #fbf7f1;
    /* page background (warm off-white) */
    --surface: #fffaf2;
    /* cards/surfaces (slightly brighter paper) */
    --text: #111827;
    /* near-black */
    --muted: #4b5563;
    /* gray */
    --border: rgba(17, 24, 39, 0.12);
    --accent: #0f3d91;
    /* academic navy */
    --accent-weak: rgba(15, 61, 145, 0.12);

    --max: 980px;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
    background: rgba(17, 24, 39, 0.06);
    padding: 0.12em 0.35em;
    border-radius: 8px;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    background: var(--text);
    color: white;
    padding: 10px 12px;
    border-radius: 10px;
    z-index: 9999;
}

.skip-link:focus {
    top: 12px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(251, 247, 241, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.nav__home {
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}

.nav__links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav__menu {
    display: none;
    position: relative;
}

.nav__menu-toggle {
    list-style: none;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
}

/* Hide default disclosure triangle in WebKit */
.nav__menu-toggle::-webkit-details-marker {
    display: none;
}

.nav__menu[open] .nav__menu-toggle {
    border-color: rgba(15, 61, 145, 0.35);
    background: rgba(15, 61, 145, 0.05);
}

.nav__menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 220px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 250, 242, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 14px 50px rgba(0, 0, 0, 0.12);
    display: grid;
    gap: 6px;
    z-index: 200;
}

.nav__menu-panel a {
    color: var(--text);
    padding: 10px 10px;
    border-radius: 10px;
    font-weight: 560;
}

.nav__menu-panel a:hover {
    background: rgba(17, 24, 39, 0.05);
    text-decoration: none;
}

.nav__links a {
    color: var(--muted);
    font-weight: 520;
    font-size: 0.95rem;
    padding: 6px 8px;
    border-radius: 10px;
}

.nav__links a:hover {
    background: rgba(17, 24, 39, 0.05);
    text-decoration: none;
}

.nav__cta {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text) !important;
}

.main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px 18px 64px;
}

.hero {
    padding: 18px 0 6px;
}

.hero__grid {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 26px;
    align-items: start;
    grid-template-areas: "portrait text";
}

.hero__portrait {
    grid-area: portrait;
}

.hero__text {
    grid-area: text;
}

.hero__title {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: clamp(2.0rem, 3vw, 2.6rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}

.hero__subtitle {
    margin: 0 0 14px;
    color: var(--muted);
    font-weight: 560;
}

.hero__lede {
    margin: 0 0 18px;
    color: var(--text);
    max-width: 64ch;
}

.hero__meta {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px 14px;
    margin: 0 0 16px;
}

.meta-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 6px 0;
}

.meta-label {
    color: var(--muted);
    font-weight: 560;
    font-size: 0.95rem;
}

.meta-value {
    color: var(--text);
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-links a {
    border: 1px solid var(--border);
    background: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--text);
    font-weight: 560;
    font-size: 0.95rem;
}

.quick-links a:hover {
    text-decoration: none;
    border-color: rgba(11, 87, 208, 0.35);
    background: rgba(11, 87, 208, 0.04);
}

.icon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex: 0 0 auto;
}

.icon-link span {
    line-height: 1.1;
}

.hero__portrait {
    margin: 0;
    width: 100%;
    max-width: 180px;
    justify-self: center;
    align-self: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface);
}

.hero__portrait img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.section {
    padding: 30px 0;
    border-top: 1px solid var(--border);
}

.section__title {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: 1.35rem;
    margin: 0 0 12px;
    letter-spacing: -0.01em;
}

.section__body {
    color: var(--text);
}

.muted {
    color: var(--muted);
}

.bullets {
    margin: 12px 0 0;
    padding-left: 18px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px 14px;
}

.card__title {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.card__desc {
    margin: 0 0 10px;
    color: var(--muted);
}

.card__links a {
    font-weight: 600;
}

.pubs {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 12px;
}

.pub {
    border-left: 3px solid var(--accent-weak);
    padding-left: 12px;
}

.pub__title {
    font-weight: 650;
    letter-spacing: -0.01em;
}

.pub__meta {
    color: var(--muted);
    margin-top: 4px;
}

.pub__venue {
    color: var(--text);
}

.pub__links {
    margin-top: 6px;
}

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.list__item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 14px;
    background: #fff;
}

.list__title {
    font-weight: 650;
    margin-bottom: 4px;
}

.list__item--split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.project-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.project-logo {
    height: 54px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    display: block;
}

.project-logo--side {
    flex: 0 0 auto;
    align-self: center;
}

.list__desc {
    color: var(--muted);
    margin-bottom: 6px;
}

.timeline {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.timeline li {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    align-items: baseline;
}

.timeline__date {
    color: var(--muted);
    font-weight: 650;
}

.timeline__content {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.timeline__text {
    max-width: 55ch;
    min-width: 0;
}

.timeline__media {
    margin: 0;
}

.timeline__media img {
    display: block;
    width: min(150px, 100%);
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.contact-links a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--text);
    font-weight: 560;
    background: #fff;
}

.contact-links a:hover {
    text-decoration: none;
    border-color: rgba(11, 87, 208, 0.35);
    background: rgba(11, 87, 208, 0.04);
}

.footer {
    padding: 20px 0 0;
    color: var(--muted);
}

#back-to-top-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--accent);
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 220;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

#back-to-top-button::before {
    content: "↑";
    font-size: 21px;
    line-height: 1;
    font-weight: 700;
    transform: translateY(-1px);
}

#back-to-top-button:hover {
    background: #fff;
    border-color: rgba(15, 61, 145, 0.45);
    box-shadow: 0 10px 26px rgba(15, 61, 145, 0.18);
}

#back-to-top-button:focus-visible {
    outline: 3px solid rgba(15, 61, 145, 0.35);
    outline-offset: 2px;
}

@media (max-width: 980px) {
    .main {
        padding-top: 14px;
    }

    .hero {
        padding-top: 6px;
    }

    .hero__grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "text"
            "portrait";
    }

    .hero__portrait {
        justify-self: start;
    }

    .nav__links--desktop {
        display: none;
    }

    .nav__menu {
        display: block;
    }

    .meta-row {
        grid-template-columns: 110px 1fr;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    #back-to-top-button {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(14px, env(safe-area-inset-bottom));
    }

    .list__item--split {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "title title"
            "desc desc"
            "logo links";
        column-gap: 10px;
        row-gap: 6px;
        align-items: end;
    }

    .list__item--split .project-main {
        display: contents;
    }

    .list__item--split .list__title {
        grid-area: title;
    }

    .list__item--split .list__desc {
        grid-area: desc;
    }

    .list__item--split .list__links {
        grid-area: links;
        justify-self: end;
    }

    .list__item--split .project-logo--side {
        grid-area: logo;
        justify-self: start;
        align-self: end;
        margin-left: 0;
    }

    .project-logo {
        height: 28px;
        max-width: 180px;
    }
}

@media (max-width: 640px) {

    .quick-links,
    .contact-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .quick-links .icon-link,
    .contact-links .icon-link {
        justify-content: center;
        min-width: 0;
        padding: 6px 8px;
        font-size: 0.82rem;
    }

    .quick-links .icon-link span,
    .contact-links .icon-link span {
        white-space: nowrap;
    }

    /* Keep Email chip on a separate line while first 3 stay in one row */
    .quick-links .icon-link:nth-child(4),
    .contact-links .icon-link:nth-child(4) {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}