/* Light is the default; dark follows the OS unless the toggle pinned data-theme. */
:root {
    --bg: #f5f7f9;
    --surface: #ffffff;
    --ink: #0f1720;
    --muted: #4a5563;
    --line: #d5dbe1;
    --accent: #0e6a85;
    --code-bg: #eef2f5;
    --harnessed: #7c3aed;
    --enums: #0d9488;
    --photo-filter: none;
    --hero-ink: #0f1720;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1016;
        --surface: #121a23;
        --ink: #e6ecf2;
        --muted: #9aa6b2;
        --line: #26323f;
        --accent: #7dd3fc;
        --code-bg: #0e151d;
        --harnessed: #a78bfa;
        --enums: #2dd4bf;
        --photo-filter: brightness(0.45) contrast(1.15);
        --hero-ink: #f3f6f9;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0b1016;
    --surface: #121a23;
    --ink: #e6ecf2;
    --muted: #9aa6b2;
    --line: #26323f;
    --accent: #7dd3fc;
    --code-bg: #0e151d;
    --harnessed: #a78bfa;
    --enums: #2dd4bf;
    --photo-filter: brightness(0.45) contrast(1.15);
    --hero-ink: #f3f6f9;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 1.0625rem/1.65 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    color: var(--accent);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

a:hover {
    text-decoration-thickness: 2px;
}

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

h1, h2, h3 {
    line-height: 1.2;
    letter-spacing: -0.015em;
}

code, pre {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
}

.wrap {
    width: min(100% - 2rem, 46rem);
    margin-inline: auto;
}

/* ---- top bar ---- */

.topbar {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
    color: var(--hero-ink);
}

.topbar.solid {
    position: static;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.topbar nav {
    display: flex;
    gap: 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
}

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

.topbar a:hover, .topbar a[aria-current] {
    text-decoration: underline;
}

.theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.8;
}

.theme-toggle:hover {
    opacity: 1;
}

.theme-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

.theme-toggle .moon, [data-theme-active="dark"] .theme-toggle .sun {
    display: none;
}

[data-theme-active="dark"] .theme-toggle .moon {
    display: block;
}

/* ---- hero: the photo is the page ---- */

.hero {
    position: relative;
    min-height: min(80svh, 50rem);
    display: flex;
    align-items: flex-start;
    color: var(--hero-ink);
    overflow: hidden;
}

.hero > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 35% 70%;
    filter: var(--photo-filter);
}

/* soft haze behind the name so it reads over the ridgeline */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(100deg, color-mix(in srgb, var(--bg) 80%, transparent) 0%, color-mix(in srgb, var(--bg) 45%, transparent) 45%, transparent 75%);
}

/* melt the bottom of the photo into the page */
.hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 30%;
    background: linear-gradient(to bottom, transparent, var(--bg));
}

.hero-text {
    position: relative;
    z-index: 2;
    padding-top: clamp(6rem, 16svh, 10rem);
    padding-bottom: 7rem; /* clears the trail's negative margin */
}

.hero .avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--hero-ink);
}

.hero h1 {
    margin: 1rem 0 0.25rem;
    font-size: clamp(2.75rem, 9vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.hero .role {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.hero .tagline {
    max-width: 34rem;
    margin: 1rem 0 0;
    font-size: 1.05rem;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    font-weight: 600;
}

.links a {
    color: inherit;
}

/* ---- the skin track: a dashed line the sections hang off ---- */

.track {
    position: relative;
    z-index: 2;
    margin-top: -5rem; /* start the trail inside the photo's fade */
    padding: 1rem 0 4rem 2rem;
}

.track::before {
    content: "";
    position: absolute;
    left: 0.4rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: repeating-linear-gradient(to bottom, var(--muted) 0 7px, transparent 7px 14px);
    opacity: 0.5;
}

.track > section {
    position: relative;
    margin-bottom: 3.5rem;
}

.track > section > h2::before {
    content: "";
    position: absolute;
    left: calc(-2rem + 0.4rem + 1px); /* centre of the 2px dashed line */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--ink);
}

.track h2 {
    position: relative;
    margin: 0 0 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
}

/* ---- project cards ---- */

.projects {
    display: grid;
    gap: 1.25rem;
}

.project {
    --tint: var(--accent);
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--tint);
    border-radius: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
}

.project.harnessed {
    --tint: var(--harnessed);
}

.project.enums {
    --tint: var(--enums);
}

.project h3 {
    margin: 0;
    font-size: 1.35rem;
}

.project h3 a {
    color: inherit;
    text-decoration: none;
}

.project p {
    margin: 0.4rem 0 0.9rem;
    color: var(--muted);
}

pre {
    margin: 0;
    padding: 0.9rem 1rem;
    background: var(--code-bg);
    border-radius: 0.5rem;
    overflow-x: auto;
    line-height: 1.55;
}

pre .c {
    color: var(--muted);
}

pre .k {
    color: var(--tint, var(--accent));
}

.project .links {
    margin-top: 0.9rem;
    font-size: 0.95rem;
}

.project .links a {
    color: var(--accent);
}

/* ---- general content ---- */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chips li {
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
}

ul.plain {
    padding-left: 1.1rem;
}

ul.plain li {
    margin-bottom: 0.5rem;
}

.prose {
    padding: 2.5rem 0 4rem;
}

.prose h1 {
    font-size: clamp(2rem, 6vw, 2.75rem);
    margin: 0 0 1.5rem;
}

.prose h2 {
    margin: 2.75rem 0 0.75rem;
    font-size: 1.4rem;
}

.prose h3 {
    margin: 1.75rem 0 0.4rem;
    font-size: 1.1rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose blockquote {
    margin: 2rem 0 0;
    padding-left: 1rem;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

.prose-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prose-header img {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    object-fit: cover;
}

/* ---- CV ---- */

.cv .meta {
    color: var(--muted);
    margin: -1rem 0 0;
}

.cv .job {
    margin-top: 1.75rem;
}

.cv .job h3 {
    margin: 0;
}

.cv .when {
    display: block;
    color: var(--muted);
    font-size: 0.95rem;
}

.footer {
    padding: 2rem 0 3rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

@media print {
    .topbar, .footer, .print-hide {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 10.5pt;
    }

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

    .prose {
        padding: 0;
    }
}
