/*
 * Minimal editorial. One sans, near-monochrome, generous whitespace.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-light: #999999;
    --link: #1a1a1a;
    --link-hover: #000000;
    --bg: #ffffff;
    --bg-subtle: #fafaf9;
    --border: #ececec;
    --border-strong: #d4d4d4;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #ededed;
        --text-muted: #9a9a9a;
        --text-light: #6b6b6b;
        --link: #ededed;
        --link-hover: #ffffff;
        --bg: #0f0f0f;
        --bg-subtle: #161616;
        --border: #262626;
        --border-strong: #3a3a3a;
    }
}

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

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    padding: 4rem 1.5rem 6rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 680px;
    margin: 0 auto;
}

/* ─────────── Side nav ─────────── */
.side-nav {
    position: fixed;
    top: 4rem;
    left: 2.5rem;
    z-index: 10;
    font-size: 0.82rem;
}

.side-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.side-nav a {
    color: var(--text-light);
    text-decoration: none;
    font-style: italic;
    font-weight: 400;
    transition: color 0.2s ease;
    display: inline-block;
    padding: 1px 0;
}

.side-nav a:hover {
    color: var(--text);
}

.side-nav a.active {
    color: var(--text);
    font-style: normal;
    font-weight: 500;
}

@media (max-width: 1100px) {
    .side-nav { display: none; }
}

/* ─────────── Header ─────────── */
header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.profile-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
    min-width: 0;
}

.header-text h1 {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.header-text .tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.header-links {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin-top: 0.4rem;
}

.header-links a {
    color: var(--text-muted);
    transition: color 0.2s ease;
    display: inline-flex;
}

.header-links a:hover {
    color: var(--link-hover);
}

.header-links svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* ─────────── Sections ─────────── */
section {
    margin-bottom: 3rem;
}

details { width: 100%; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }

section h2 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

/* ─────────── Prose ─────────── */
#profile-bio p,
.ai-stack p {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.7;
}

#profile-bio p:last-child,
.ai-stack p:last-child { margin-bottom: 0; }

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--border-strong);
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration-color: var(--text);
}

/* ─────────── Recent Builds ─────────── */
.building-item {
    margin-bottom: 1.75rem;
}

.building-item:last-child { margin-bottom: 0; }

.building-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
    letter-spacing: -0.005em;
}

.building-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ─────────── Education ─────────── */
.edu-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.edu-item:last-child { border-bottom: none; padding-bottom: 0; }
.edu-item:first-child { padding-top: 0; }

.edu-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.edu-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.education .school {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.education .degree {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.education .year {
    color: var(--text-light);
    font-size: 0.88rem;
    font-style: italic;
    white-space: nowrap;
}

.edu-highlights {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
}

.edu-highlights .highlight {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.edu-highlights .highlight:not(:last-child)::after {
    content: " · ";
    color: var(--text-light);
    margin-left: 0.4rem;
}

.favorite-courses {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    align-items: baseline;
}

.courses-label {
    font-size: 0.82rem;
    color: var(--text-light);
    font-style: italic;
}

.course {
    font-size: 0.88rem;
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
}

a.course:hover {
    color: var(--text);
    text-decoration-color: var(--text-muted);
}

/* ─────────── Research ─────────── */
.research-category {
    margin-bottom: 2.25rem;
}

.research-category:last-child { margin-bottom: 0; }
.research-category summary { cursor: default; list-style: none; }
.research-category summary::-webkit-details-marker { display: none; }

.research-category h3 {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.research-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.research-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    transition: opacity 0.2s ease;
}

.research-card:hover {
    opacity: 0.75;
}

.research-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center;
    background: var(--bg-subtle);
    margin-bottom: 0.55rem;
}

.research-card .card-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

/* ─────────── Projects ─────────── */
.project-category { margin-bottom: 2rem; }
.project-category:last-child { margin-bottom: 0; }

.project-category h3 {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project-item {
    display: block;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
    transition: opacity 0.2s ease;
}

.project-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-item:hover {
    opacity: 0.75;
}

.project-name {
    display: block;
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.project-subtitle {
    display: block;
    font-size: 0.92rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.55rem;
}

.project-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ─────────── Events ─────────── */
.events ul { list-style: none; }

.events li {
    border-bottom: 1px solid var(--border);
}

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

.events a {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.7rem 0;
    color: var(--text);
    text-decoration: none;
}

.events a:hover {
    opacity: 0.75;
}

.events strong {
    color: inherit;
    font-weight: 500;
    font-size: 0.95rem;
}

.event-meta {
    color: var(--text-light);
    font-size: 0.88rem;
    font-style: italic;
}

.badge {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
    margin-left: auto;
}

/* ─────────── Selection ─────────── */
::selection {
    background: var(--text);
    color: var(--bg);
}

/* ─────────── Responsive ─────────── */
@media (max-width: 600px) {
    body { padding: 2.5rem 1.25rem 4rem; }

    header {
        gap: 1.2rem;
        margin-bottom: 3rem;
    }

    .profile-photo {
        width: 64px;
        height: 64px;
    }

    .header-text h1 { font-size: 1.4rem; }
    .header-text .tagline { font-size: 0.9rem; }

    section { margin-bottom: 2.5rem; }

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

    .badge { margin-left: 0; }
}

@media (max-width: 420px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-links {
        margin-top: 0;
    }

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

    .research-card img {
        aspect-ratio: 16 / 10;
    }
}

/* ─────────── Scrollbar ─────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ─────────── Focus ─────────── */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 3px;
    border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─────────── Print ─────────── */
@media print {
    body { background: white; color: black; padding: 0; }
    .container { padding: 0; max-width: 100%; }
    a { color: inherit; }
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    .header-links, .badge { display: none; }
    details { display: block; }
    .research-card, .project-item, .edu-item { page-break-inside: avoid; }
    .research-cards { grid-template-columns: repeat(3, 1fr); }
}
