/* ---------------------------------------------------------------
   Tokens
--------------------------------------------------------------- */

:root {
    --bg: #fbfbfa;
    --fg: #16161a;
    --muted: #6f6f78;
    --line: #e2e2de;
    --accent: #16161a;

    --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

    --measure: 62ch;
    --page: 46rem;
    --gap: 1rem;
    --space: clamp(4rem, 10vw, 7rem);
}

:root[data-theme="dark"] {
    --bg: #101013;
    --fg: #ececeb;
    --muted: #8f8f99;
    --line: #26262c;
    --accent: #ececeb;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #101013;
        --fg: #ececeb;
        --muted: #8f8f99;
        --line: #26262c;
        --accent: #ececeb;
    }
}

/* ---------------------------------------------------------------
   Base
--------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0 1.5rem;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
}

p {
    margin: 0 0 1rem;
    max-width: var(--measure);
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------------------------------------------------------------
   Header
--------------------------------------------------------------- */

.site-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 2rem 0;
}

.wordmark {
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-right: auto;
}

.site-header nav ul {
    display: flex;
    gap: 1.5rem;
}

.site-header nav a,
.site-footer a {
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.site-header nav a:hover,
.site-footer a:hover {
    color: var(--fg);
}

#theme-toggle {
    background: none;
    border: 0;
    padding: 0.25rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

#theme-toggle:hover {
    color: var(--fg);
}

/* ---------------------------------------------------------------
   Layout
--------------------------------------------------------------- */

main {
    max-width: var(--page);
    margin: 0 auto;
}

.section {
    padding-top: var(--space);
}

.section-title {
    font-size: 0.78rem;
    font-family: var(--mono);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: 1rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--line);
}

/* ---------------------------------------------------------------
   Hero
--------------------------------------------------------------- */

.hero {
    padding: clamp(3rem, 8vw, 5rem) 0 0;
}

.hero-profile {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 15px;
    margin-bottom: 1rem;
}

.hero-name {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: flex-start;
    color: var(--muted);
}

.avatar {
    display: block;
    width: clamp(5rem, 14vw, 6.5rem);
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--line);
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.hero h1 {
    font-size: clamp(1.9rem, 5.5vw, 2.9rem);
    max-width: 20ch;
    margin-bottom: 1.75rem;
}

.lede {
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin-top: 2.25rem;
}

.button {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

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

.link {
    font-size: 0.9rem;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.link:hover {
    color: var(--fg);
    border-color: var(--accent);
}

/* ---------------------------------------------------------------
   Work
--------------------------------------------------------------- */

.project {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: var(--gap);
    padding: 2rem 0;
    border-bottom: 1px solid var(--line);
}

.project:first-child {
    padding-top: 0;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding-top: 0.3rem;
}

.project h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.project h3 a {
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.project h3 a:hover {
    border-color: var(--accent);
}

.project p {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags li {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
}

/* ---------------------------------------------------------------
   About
--------------------------------------------------------------- */

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

.about-text p {
    color: var(--muted);
}

.about-side h4 {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg);
    margin-bottom: 0.6rem;
}

.about-side h4+.plain-list {
    margin-bottom: 2rem;
}

.plain-list li {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.9;
}

/* ---------------------------------------------------------------
   Contact
--------------------------------------------------------------- */

.contact-list {
    margin-top: 2rem;
    border-top: 1px solid var(--line);
}

.contact-list li {
    display: flex;
    align-items: baseline;
    gap: var(--gap);
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
}

.contact-list span {
    flex: 0 0 6rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
}

.contact-list a {
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.contact-list a:hover {
    border-color: var(--accent);
}

/* ---------------------------------------------------------------
   Footer
--------------------------------------------------------------- */

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: var(--gap);
    max-width: var(--page);
    margin: var(--space) auto 0;
    padding: 1.5rem 0 3rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer p {
    margin: 0;
}

/* ---------------------------------------------------------------
   Small screens
--------------------------------------------------------------- */

@media (max-width: 40rem) {
    .site-header {
        flex-wrap: wrap;
        gap: 0.75rem 1.25rem;
    }

    .project,
    .about-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .project-meta {
        flex-direction: row;
        gap: 0.75rem;
        padding-top: 0;
    }

    .project figure {
        grid-column: 1;
    }

    .about-grid {
        gap: 2.5rem;
    }

    .hero-actions {
        flex-wrap: wrap;
        gap: 1.25rem;
    }
}

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

    * {
        transition: none !important;
    }
}

/* ---------------------------------------------------------------
   Case study page
--------------------------------------------------------------- */

.case .hero h1 {
    max-width: 16ch;
}

.case .section p {
    color: var(--muted);
}

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

.facts span {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.facts p {
    margin: 0;
    font-size: 0.95rem;
}

/* Steps ------------------------------------------------------- */

.steps>li {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: var(--gap);
    padding-bottom: 3.5rem;
}

.step-meta {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding-top: 0.35rem;
}

.step-body h3 {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}

.step-body p {
    font-size: 0.95rem;
}

.step-body em {
    font-family: var(--mono);
    font-size: 0.85em;
    font-style: normal;
    color: var(--fg);
}

/* Figures ----------------------------------------------------- */

figure {
    margin: 1.75rem 0 0;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.project figure {
    grid-column: 2;
    max-width: 28rem;
}

figure a {
    display: block;
    transition: opacity 0.2s ease;
}

figure a:hover {
    opacity: 0.85;
}

figcaption {
    margin-top: 0.75rem;
    max-width: var(--measure);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted);
}

/* Screenshots breathe wider than the text column on large screens */
@media (min-width: 64rem) {
    .step-body figure {
        width: min(64rem, calc(100vw - 3rem));
        margin-left: calc(50% - 3.5rem);
        transform: translateX(-50%);
    }
}

/* Notes ------------------------------------------------------- */

.notes {
    display: grid;
    gap: 1.75rem;
}

.notes h4 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.notes p {
    margin: 0;
    font-size: 0.95rem;
}

@media (max-width: 40rem) {
    .facts {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .steps>li {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}