:root {
    color-scheme: light;
    --bg: #fbfaf7;
    --text: #1f1f1d;
    --muted: #676760;
    --rule: #dedbd2;
    --soft: #f1eee6;
    --link: #1d5f8f;
    --link-hover: #123e60;
    --button-bg: #1f1f1d;
    --button-text: #fbfaf7;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #151513;
    --text: #f2efe7;
    --muted: #b8b4aa;
    --rule: #393831;
    --soft: #20201c;
    --link: #8eb9dc;
    --link-hover: #c8def0;
    --button-bg: #f2efe7;
    --button-text: #151513;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: "Open Sans", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

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

.page {
    width: min(860px, calc(100% - 34px));
    margin: 0 auto;
    padding: 34px 0 54px;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    margin-bottom: 56px;
    font-family: "Raleway", system-ui, sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0;
}

.top-nav a {
    color: var(--muted);
    text-decoration: none;
}

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

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

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

.theme-icon {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow: inset 6px -6px 0 currentColor;
}

[data-theme="dark"] .theme-icon {
    box-shadow: none;
}

.intro {
    padding-bottom: 42px;
    border-bottom: 1px solid var(--rule);
}

h1,
h2,
h3,
.subtitle {
    font-family: "Montserrat", system-ui, sans-serif;
    letter-spacing: 0;
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(2.35rem, 6vw, 3.2rem);
    line-height: 1.12;
    font-weight: 700;
}

.subtitle {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 1.15rem;
    font-weight: 600;
}

.intro-text {
    max-width: 710px;
    margin: 0;
}

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

.links a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--text);
    font-family: "Raleway", system-ui, sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.links a:hover {
    background: var(--button-bg);
    color: var(--button-text);
}

.section {
    padding: 42px 0;
    border-bottom: 1px solid var(--rule);
}

.section.compact {
    padding: 34px 0;
}

h2 {
    margin: 0 0 22px;
    font-size: 1.34rem;
    line-height: 1.25;
    font-weight: 700;
}

.project-list {
    display: grid;
    gap: 28px;
}

.project {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    column-gap: 26px;
    row-gap: 6px;
}

.project h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
    font-weight: 700;
}

.project h3 a,
.publication h3 a {
    color: var(--text);
    text-decoration: none;
}

.project h3 a:hover,
.publication h3 a:hover {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.project p {
    margin: 0;
}

.project .meta {
    grid-column: 2;
    color: var(--muted);
    font-size: 0.9rem;
}

.publication h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.45;
}

.simple-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
}

.tool-line,
.section p {
    margin-top: 0;
}

.section p:last-child,
.simple-list:last-child {
    margin-bottom: 0;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-top: 30px;
    color: var(--muted);
    font-size: 0.9rem;
}

.footer a {
    color: var(--muted);
    font-family: "Raleway", system-ui, sans-serif;
    font-weight: 700;
    text-decoration: none;
}

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

@media (max-width: 720px) {
    .page {
        width: min(100% - 26px, 860px);
        padding-top: 22px;
    }

    .top-nav {
        justify-content: flex-start;
        gap: 14px;
        margin-bottom: 40px;
        overflow-x: auto;
    }

    .intro {
        padding-bottom: 34px;
    }

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

    .project .meta {
        grid-column: 1;
    }

    .section {
        padding: 34px 0;
    }

    .footer {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}

.date {
    display: block;
    font-family: "Raleway", system-ui, sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
}

.job-title {
    font-family: "Montserrat", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px 0;
}
