:root {
    --paper: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --line: #e2e8f0;
    --ink: #0f172a;
    --muted: #64748b;
    --head: #0f172a;
    --link: #2563eb;
    --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
    --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0f172a;
        --surface: #1e293b;
        --surface-2: #334155;
        --line: #334155;
        --ink: #f8fafc;
        --muted: #94a3b8;
        --head: #f8fafc;
        --link: #60a5fa;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
}

.hero {
    background: #1e293b;
    color: #f8fafc;
    padding: 2.2rem 0 1.8rem;
    position: relative;
}

.hero .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
}

.hero .dept {
    font-size: .85rem;
    color: #f8fafc;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    opacity: .9;
}

.hero .dept .mark {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    font-weight: 700;
    font-size: .75rem;
}

.hero .idwrap {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
    max-width: 72rem;
    margin: 0 auto;
    width: 100%;
}

.avatar {
    width: 180px;
    height: 240px;
    border-radius: 10px;
    background: #334155;
    border: 1px solid rgba(255, 255, 255, .15);
    flex: 0 0 auto;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: 3rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.identity h1 {
    margin: 0;
    font-size: 3rem;
    line-height: 1.1;
    font-weight: 700;
}

.identity h1 .post {
    font-size: 1.35rem;
    font-weight: 400;
    color: #cbd5e1;
    margin-left: .6rem;
}

.identity .role {
    margin: .5rem 0 0;
    font-size: 1.1rem;
    color: #94a3b8;
}

.identity .meta-row {
    margin-top: .8rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.badge {
    font-size: .75rem;
    color: #e2e8f0;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    padding: .2rem .6rem;
    border-radius: 999px;
}

/* ---------- Main Body & Sections ---------- */
.body {
    max-width: 72rem;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: .6rem;
    margin-bottom: 1rem;
}

.sec-head h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--head);
}

/* Facts Grid */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.fact {
    background: var(--surface);
    padding: 1rem 1.2rem;
}

.fact .k {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 .3rem;
}

.fact .v {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
}

.fact .v a {
    color: var(--link);
    text-decoration: none;
}

/* Overview Rows */
.ov-row {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1rem;
    padding: .8rem 0;
    border-top: 1px solid var(--line);
}

.ov-row:first-child {
    border-top: 0;
}

.ov-row .lab {
    font-weight: 700;
    color: var(--head);
}

.ov-row ul {
    margin: 0;
    padding: 0 0 0 1.2rem;
}

.ov-row li {
    margin-bottom: .3rem;
}

/* Work & Items */
.tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}

.tabs button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-size: .8rem;
    padding: .3rem .8rem;
    border-radius: 999px;
    cursor: pointer;
}

.tabs button[aria-pressed="true"] {
    background: var(--link);
    border-color: var(--link);
    color: #fff;
}

.work {
    display: flex;
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
    padding-right: .5rem;
}

.item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 1rem;
    padding: .8rem 0;
    border-top: 1px solid var(--line);
}

.item:first-child {
    border-top: 0;
}

.thumb {
    width: 56px;
    height: 40px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-family: var(--mono);
    font-size: .8rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.item .cite {
    margin: 0;
    font-size: .95rem;
    line-height: 1.5;
}

.proj {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: .6rem 0;
    border-top: 1px solid var(--line);
    font-size: .9rem;
}

.proj:first-child {
    border-top: 0;
}

.proj .yr {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--link);
}

.proj .role {
    color: var(--muted);
    font-size: .8rem;
}

/* Footer */
.foot {
    padding: 1.5rem;
    text-align: center;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    margin-top: 2rem;
}



@media (max-width: 640px) {
    .hero .idwrap {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .ov-row,
    .item {
        grid-template-columns: 1fr;
    }

    .thumb {
        width: 100%;
        height: 60px;
    }
}