/*
 * Base
 */

:root {
    color-scheme: light dark;

    --background: light-dark(#fafafa, #111);
    --surface: light-dark(#ffffff, #181818);
    --surface-hover: light-dark(#f3f3f3, #202020);

    --text: light-dark(#171717, #ededed);
    --text-muted: light-dark(#666, #aaa);

    --border: light-dark(#ddd, #333);

    --accent: light-dark(#2563eb, #60a5fa);

    --max-width: 1000px;
    --radius: 10px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    min-height: 100vh;
    margin: 0;

    background: var(--background);
    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.6;
}

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

a {
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}


/*
 * Layout
 */

.section {
    width: min(
        calc(100% - 2rem),
        var(--max-width)
    );

    margin-inline: auto;
    padding-block: 6rem;
}

.section + .section {
    border-top: 1px solid var(--border);
}


/*
 * Header / navigation
 */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;

    border-bottom: 1px solid var(--border);

    background: color-mix(
        in srgb,
        var(--background) 90%,
        transparent
    );

    backdrop-filter: blur(10px);
}

.navbar {
    width: min(
        calc(100% - 2rem),
        var(--max-width)
    );

    min-height: 4rem;
    margin-inline: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.site-title {
    font-weight: 700;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu a,
.theme-toggle {
    color: var(--text-muted);
    font: inherit;
    text-decoration: none;

    background: none;
    border: 0;

    cursor: pointer;
}

.nav-menu a:hover,
.theme-toggle:hover {
    color: var(--text);
}

.nav-toggle {
    display: none;

    padding: 0.5rem;

    background: none;
    border: 0;

    cursor: pointer;
}

.nav-toggle span {
    display: block;

    width: 1.5rem;
    height: 2px;

    margin-block: 4px;

    background: var(--text);
}


/*
 * About
 */

.about-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 4rem;
    align-items: start;
}

.about-image img {
    width: 220px;
    height: 220px;
    object-fit: cover;

    border-radius: 12px;
}

.about-content {
    max-width: 700px;
}

.eyebrow {
    margin: 0 0 0.5rem;

    color: var(--accent);

    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

h1 {
    margin: 0 0 1.5rem;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    letter-spacing: -0.04em;
}

h2 {
    margin: 0 0 2rem;
    font-size: 2rem;
    letter-spacing: -0.02em;
}

h3 {
    margin: 0 0 0.4rem;
}

.lead {
    color: var(--text-muted);
    font-size: 1.25rem;
}

.about-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;

    margin-top: 5rem;
}

.education-item {
    display: flex;
    justify-content: space-between;
    gap: 2rem;

    padding-block: 1rem;

    border-bottom: 1px solid var(--border);
}

.education-item p {
    margin: 0;
    color: var(--text-muted);
}

.education-item time {
    color: var(--text-muted);
    white-space: nowrap;
}


/*
 * Tags
 */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    margin: 1.5rem 0 0;
    padding: 0;

    list-style: none;
}

.tag-list li {
    padding: 0.3rem 0.7rem;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--text-muted);

    font-size: 0.85rem;
}


/*
 * Projects
 */

.section-heading {
    margin-bottom: 3rem;
}

.section-heading > p:last-child {
    margin: 0;
    color: var(--text-muted);
}

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

.project-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    min-height: 280px;

    padding: 1.5rem;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    transition:
        transform 150ms ease,
        background 150ms ease;
}

.project-card:hover {
    transform: translateY(-3px);
    background: var(--surface-hover);
}

.project-card-content > p {
    color: var(--text-muted);
}

.project-links {
    margin-top: 2rem;
}

.project-links a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.project-links a:hover {
    text-decoration: underline;
}

.external-link-icon {
    width: 0.9em;
    height: 0.9em;

    fill: currentColor;

    vertical-align: -0.1em;
}

/*
 * Footer
 */

.site-footer {
    width: min(
        calc(100% - 2rem),
        var(--max-width)
    );

    margin-inline: auto;
    padding-block: 2rem;

    display: flex;
    justify-content: space-between;
    gap: 1rem;

    color: var(--text-muted);

    border-top: 1px solid var(--border);
}

.site-footer p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    display: flex;
    width: 24px;
    height: 24px;

    color: var(--text-muted);

    transition: color 150ms ease;
}

.footer-links svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: currentColor;
}


/*
 * Mobile
 */

@media (max-width: 700px) {
    .section {
        padding-block: 4rem;
    }

    .nav-toggle {
        display: block;
    }

    .nav-menu {
        position: absolute;
        inset: 4rem 0 auto;

        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;

        padding: 1rem;

        background: var(--background);
        border-bottom: 1px solid var(--border);
    }

    .nav-menu.is-open {
        display: flex;
    }

    .nav-menu a,
    .theme-toggle {
        padding: 0.75rem;
        text-align: left;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        display: flex;
        justify-content: center;
    }

    .about-image img {
        width: 160px;
        height: 160px;
    }

    .about-details {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

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

    .site-footer {
        flex-direction: column;
    }
}


/*
 * Reduced motion
 */

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

    .project-card {
        transition: none;
    }
}
