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

/* ── THEME VARIABLES ── */
:root {
    --bg: #F7F6F2;
    --ink: #1A1A18;
    --ink-muted: #6B6A66;
    --accent: #1C3A5E;
    --accent-light: #E8EDF3;
    --rule: rgba(26, 26, 24, 0.12);
    --nav-bg: rgba(247, 246, 242, 0.92);
    --hover-bg: #ffffff;
    --serif: 'Cormorant Garamond', Georgia, serif;
    --sans: 'DM Sans', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #111110;
        --ink: #E8E7E3;
        --ink-muted: #888884;
        --accent: #7BAFD4;
        --accent-light: #152030;
        --rule: rgba(232, 231, 227, 0.1);
        --nav-bg: rgba(17, 17, 16, 0.92);
        --hover-bg: #1A1A18;
    }
}

[data-theme="dark"] {
    --bg: #111110;
    --ink: #E8E7E3;
    --ink-muted: #888884;
    --accent: #7BAFD4;
    --accent-light: #152030;
    --rule: rgba(232, 231, 227, 0.1);
    --nav-bg: rgba(17, 17, 16, 0.92);
    --hover-bg: #1A1A18;
}

[data-theme="light"] {
    --bg: #F7F6F2;
    --ink: #1A1A18;
    --ink-muted: #6B6A66;
    --accent: #1C3A5E;
    --accent-light: #E8EDF3;
    --rule: rgba(26, 26, 24, 0.12);
    --nav-bg: rgba(247, 246, 242, 0.92);
    --hover-bg: #ffffff;
}

/* ── BASE ── */
html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-weight: 400;
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── NAV ── */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 4rem;
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-bottom: 0.5px solid var(--rule);
}

.nav-logo {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--ink);
}

.theme-toggle {
    background: none;
    border: 0.5px solid var(--rule);
    border-radius: 20px;
    cursor: pointer;
    padding: 5px 12px;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    font-family: var(--sans);
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
    color: var(--ink);
    border-color: var(--ink-muted);
}

/* ── HAMBURGER ── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 1px;
    background: var(--ink);
    transition: transform 0.25s, opacity 0.25s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── HERO ── */
header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8rem 4rem 5rem;
    border-bottom: 0.5px solid var(--rule);
    position: relative;
    overflow: hidden;
}

.hero-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
    opacity: 0;
    animation: fadeUp 0.7s 0.1s forwards;
}

.hero-title {
    font-family: var(--serif);
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    max-width: 820px;
    opacity: 0;
    animation: fadeUp 0.7s 0.25s forwards;
}

.hero-title em {
    font-style: italic;
    color: var(--accent);
}

.hero-sub {
    margin-top: 2rem;
    max-width: 480px;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--ink-muted);
    opacity: 0;
    animation: fadeUp 0.7s 0.4s forwards;
}

.hero-bg-mark {
    position: absolute;
    right: 4rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--serif);
    font-size: clamp(8rem, 18vw, 18rem);
    font-weight: 600;
    color: rgba(28, 58, 94, 0.055);
    letter-spacing: -0.04em;
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── SECTIONS ── */
section {
    padding: 6rem 4rem;
    border-bottom: 0.5px solid var(--rule);
}

.section-label {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 3.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--rule);
    max-width: 60px;
}

/* ── RESEARCH ── */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0;
    border: 0.5px solid var(--rule);
}

.research-item {
    padding: 2.5rem;
    border-right: 0.5px solid var(--rule);
    border-bottom: 0.5px solid var(--rule);
    transition: background 0.2s;
}

.research-item:hover {
    background: var(--hover-bg);
}

.research-num {
    font-family: var(--serif);
    font-size: 2.2rem;
    color: rgba(28, 58, 94, 0.18);
    font-weight: 400;
    line-height: 1;
    margin-bottom: 1rem;
}

.research-item h3 {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.research-item p {
    font-size: 0.88rem;
    color: var(--ink-muted);
    line-height: 1.7;
    font-weight: 400;
}

/* ── MEMBERS ── */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2.5rem;
}

.member-card {
    text-align: center;
}

.member-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-light);
    border: 0.5px solid rgba(28, 58, 94, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-family: var(--serif);
    font-size: 1.4rem;
    color: var(--accent);
    font-weight: 500;
}

.member-card h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.member-card p {
    font-size: 0.78rem;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
    font-weight: 400;
}

.member-role-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 2px 10px;
    border: 0.5px solid rgba(28, 58, 94, 0.25);
    border-radius: 20px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    font-weight: 500;
}

/* ── PUBLICATIONS ── */
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pub-item {
    display: grid;
    grid-template-columns: 4rem 1fr auto;
    gap: 1.5rem;
    padding: 2rem 0;
    border-bottom: 0.5px solid var(--rule);
    align-items: start;
    transition: background 0.15s;
    cursor: pointer;
}

.pub-item:first-child {
    border-top: 0.5px solid var(--rule);
}

.pub-item:hover {
    background: var(--hover-bg);
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.pub-year {
    font-family: var(--serif);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--sans);
    color: var(--ink-muted);
    padding-top: 0.2rem;
}

.pub-title {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 0.4rem;
    color: var(--ink);
    text-decoration: none;
    display: inline;
}

.pub-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 0.4rem;
}

.pub-title-link:hover .pub-title {
    color: var(--accent);
}

.pub-title-link:hover .pub-title::after {
    content: ' ↗';
    font-size: 0.8em;
    color: var(--accent);
}

.pub-authors {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-muted);
    margin-bottom: 0.3rem;
}

.pub-venue {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    font-style: italic;
    /* font-family: var(--serif); */
}

.pub-meta {
    display: none;
}

.pub-doi {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--ink-muted);
    text-decoration: none;
    letter-spacing: 0.02em;
    border-bottom: 0.5px solid var(--rule);
    transition: color 0.15s, border-color 0.15s;
}

.pub-doi:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.pub-tag {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 2px;
    white-space: nowrap;
    align-self: start;
    margin-top: 0.2rem;
}

/* ── FOOTER ── */
footer {
    padding: 3rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
    font-family: var(--serif);
}

footer a {
    color: var(--ink-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--ink);
}

/* ── MOBILE ── */
@media (max-width: 768px) {
    nav {
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
        gap: 0;
    }

    .nav-hamburger {
        display: flex;
    }

    .theme-toggle {
        font-size: 0.65rem;
        padding: 4px 10px;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        border-top: 0.5px solid var(--rule);
        margin-top: 0.75rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 0.65rem 0;
        font-size: 0.85rem;
        border-bottom: 0.5px solid var(--rule);
    }

    .nav-links li:last-child a {
        border-bottom: none;
    }

    header {
        padding: 7rem 1.5rem 3.5rem;
        min-height: 90vh;
    }

    .hero-bg-mark {
        display: none;
    }

    section {
        padding: 3.5rem 1.5rem;
    }

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

    .research-item {
        border-right: none;
    }

    .members-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .pub-item {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }

    .pub-year {
        font-size: 0.75rem;
        color: var(--accent);
    }

    .pub-tag {
        order: -1;
        align-self: stretch;
        text-align: center;
        margin-top: 0;
        margin-bottom: 0.2rem;
    }

    footer {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        padding: 2rem 1.5rem;
    }
}

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