/* ================================ */
/* == Fonts                      == */
/* ================================ */
/* Self-hosted and trimmed to Latin and the axes this page uses. Licences are in fonts/. */
@font-face {
    font-family: "Archivo";
    src: url("fonts/archivo-var.woff2") format("woff2");
    font-weight: 400 800;
    font-stretch: 100% 125%;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Newsreader";
    src: url("fonts/newsreader-regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Newsreader";
    src: url("fonts/newsreader-italic.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* ================================ */
/* == Tokens                     == */
/* ================================ */
:root {
    color-scheme: light;

    --paper: #f1f4ef;
    --paper-raised: #e6ebe4;
    --ink: #13302a;
    --ink-soft: #3e564d;
    --ink-faint: #5a6f66;
    --rule: #cbd5cc;
    --node-line: #13302a;
    --edge: #3e564d;
    --signal: #f2c14e;
    --signal-ink: #8a5a00;
    --ok: #2a7049;
    --fail: #b23a22;
    --link-line: #d19a14;
    --button-bg: #13302a;
    --button-fg: #f1f4ef;
    --focus: #13302a;

    --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --font-text: "Newsreader", Georgia, "Times New Roman", serif;

    --page: 72rem;
    --measure: 38rem;
    --gutter: clamp(1rem, 4vw, 3rem);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --paper: #10251f;
        --paper-raised: #173229;
        --ink: #e4eee7;
        --ink-soft: #b5c8be;
        --ink-faint: #8fa89c;
        --rule: #2a4a40;
        --node-line: #8fa89c;
        --edge: #8fa89c;
        --signal-ink: #f2c14e;
        --ok: #7bd389;
        --fail: #ff8a73;
        --link-line: #f2c14e;
        --button-bg: #f2c14e;
        --button-fg: #10251f;
        --focus: #f2c14e;
    }
}

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

    --paper: #10251f;
    --paper-raised: #173229;
    --ink: #e4eee7;
    --ink-soft: #b5c8be;
    --ink-faint: #8fa89c;
    --rule: #2a4a40;
    --node-line: #8fa89c;
    --edge: #8fa89c;
    --signal-ink: #f2c14e;
    --ok: #7bd389;
    --fail: #ff8a73;
    --link-line: #f2c14e;
    --button-bg: #f2c14e;
    --button-fg: #10251f;
    --focus: #f2c14e;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem;
}

body {
    margin: 0;
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.125rem;
    line-height: 1.6;
    font-optical-sizing: auto;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    line-height: 1.15;
}

p, ul, ol, dl, dd, figure {
    margin: 0;
}

strong {
    font-weight: 600;
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: var(--link-line);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.22em;
}

a:hover {
    text-decoration-color: currentColor;
}

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

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 20;
    padding: 0.6rem 1rem;
    background: var(--button-bg);
    color: var(--button-fg);
    font-family: var(--font-display);
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
}

.skip-link:focus {
    top: 1rem;
}

.defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ================================ */
/* == Header                     == */
/* ================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--paper);
    background-color: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rule);
}

.site-header__inner {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0.7rem var(--gutter);
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 3vw, 2rem);
}

.site-header__name {
    margin-right: auto;
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    font-stretch: 112%;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.site-nav ul {
    display: flex;
    gap: clamp(0.9rem, 3vw, 1.75rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--link-line);
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 6px;
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--ink);
    border-color: var(--ink-faint);
}

.theme-toggle__sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
    display: block;
}

:root[data-theme="dark"] .theme-toggle__moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle__sun {
        display: block;
    }

    :root:not([data-theme="light"]) .theme-toggle__moon {
        display: none;
    }
}

/* ================================ */
/* == Hero                       == */
/* ================================ */
.hero {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(1rem, 3vw, 2rem);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 5rem);
    align-items: center;
}

.hero__name {
    font-size: clamp(3.25rem, 1.9rem + 5.2vw, 5.75rem);
    font-weight: 800;
    font-stretch: 125%;
    line-height: 0.97;
    letter-spacing: -0.035em;
}

.hero__name span {
    display: block;
}

.hero__lead {
    margin-top: 1.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.1875rem, 1rem + 0.7vw, 1.4375rem);
    font-weight: 600;
    line-height: 1.3;
}

.hero__summary {
    margin-top: 0.85rem;
    max-width: 34rem;
    color: var(--ink-soft);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-top: 1.75rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
}

.button {
    display: inline-block;
    padding: 0.7rem 1.25rem;
    background-color: var(--button-bg);
    color: var(--button-fg);
    border-radius: 6px;
    text-decoration: none;
}

.button:hover {
    background-color: var(--ink-soft);
}

:root[data-theme="dark"] .button:hover {
    background-color: #f7d37f;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .button:hover {
        background-color: #f7d37f;
    }
}

/* ================================ */
/* == Diagrams                   == */
/* ================================ */
.diagram {
    width: 100%;
    max-width: 25rem;
}

.diagram--hero {
    justify-self: end;
    max-width: 26rem;
}

.diagram figcaption {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.dg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.dg .node rect {
    fill: var(--paper-raised);
    stroke: var(--node-line);
    stroke-width: 1.25;
}

.dg .node--retry rect {
    stroke: var(--signal-ink);
    stroke-width: 1.5;
}

.dg .node--fail rect {
    stroke: var(--fail);
    stroke-width: 1.5;
}

.dg .node--ok rect {
    stroke: var(--ok);
    stroke-width: 1.5;
}

.dg .t {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    fill: var(--ink);
}

.dg .s {
    font-family: var(--font-display);
    font-size: 11.5px;
    font-weight: 400;
    fill: var(--ink-faint);
}

.dg .l {
    font-family: var(--font-text);
    font-size: 12.5px;
    font-style: italic;
    fill: var(--ink-soft);
}

.dg .e {
    fill: none;
    stroke: var(--edge);
    stroke-width: 1.25;
}

.dg .e--retry {
    stroke: var(--signal-ink);
}

.dg .e--fail {
    stroke: var(--fail);
}

.dg .e--ok {
    stroke: var(--ok);
}

.dg .e--guard {
    stroke-dasharray: 4 3;
}

.ah {
    fill: var(--edge);
}

.ah--retry {
    fill: var(--signal-ink);
}

.ah--fail {
    fill: var(--fail);
}

.ah--ok {
    fill: var(--ok);
}

.dg .tok {
    fill: var(--ink);
    stroke: var(--paper);
    stroke-width: 1.5;
}

.dg .tok.is-ok {
    fill: var(--ok);
}

.dg .tok.is-retry {
    fill: var(--signal);
    stroke: var(--ink);
    stroke-width: 1;
}

.dg .tok.is-fail {
    fill: var(--fail);
}

.dg .dot {
    transition: opacity 0.25s ease;
}

.dg .dot--ok {
    fill: var(--ok);
}

.dg .dot--fail {
    fill: var(--fail);
}

.replay {
    display: block;
    margin-top: 0.4rem;
    padding: 0;
    font: inherit;
    color: var(--ink);
    background: none;
    border: 0;
    text-decoration: underline;
    text-decoration-color: var(--link-line);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.22em;
    cursor: pointer;
}

.replay:hover {
    text-decoration-color: currentColor;
}

.replay[hidden] {
    display: none;
}

/* ================================ */
/* == Sections                   == */
/* ================================ */
.section {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(3.5rem, 8vw, 6rem) var(--gutter) 0;
}

.section__head {
    padding-top: 0.9rem;
    border-top: 2px solid var(--ink);
    margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

.section__title {
    font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
    font-weight: 700;
    font-stretch: 112%;
    letter-spacing: -0.02em;
}

.points {
    display: grid;
    gap: 0.55rem;
    margin-top: 1.1rem;
    padding: 0;
    list-style: none;
}

.points li {
    position: relative;
    padding-left: 1.25rem;
}

.points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.74em;
    width: 0.55rem;
    height: 2px;
    background-color: var(--ink-faint);
}

/* ================================ */
/* == Work                       == */
/* ================================ */
.job {
    max-width: 44rem;
}

.job + .job {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.job__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
}

.job__company {
    font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);
    font-weight: 700;
    font-stretch: 106%;
    letter-spacing: -0.01em;
}

.job__meta {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    color: var(--ink-faint);
}

.job--past p:not(.job__meta) {
    margin-top: 0.75rem;
}

.ladder {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 1.75rem;
    padding: 0;
    list-style: none;
    font-family: var(--font-display);
}

.ladder::before {
    content: "";
    position: absolute;
    top: 0.3125rem;
    left: 0.375rem;
    right: 0;
    height: 2px;
    background-color: var(--rule);
}

.ladder li {
    position: relative;
    padding-top: 1.5rem;
}

.ladder li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--paper);
    border: 2px solid var(--ink-faint);
}

.ladder li[aria-current]::before {
    background-color: var(--signal);
    border-color: var(--ink);
}

.ladder__role {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.ladder__when {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.875rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

/* ================================ */
/* == Projects                   == */
/* ================================ */
.project {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 25rem);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
    padding: clamp(2.25rem, 5vw, 3.25rem) 0;
    border-top: 1px solid var(--rule);
}

.section__head + .project {
    padding-top: 0;
    border-top: 0;
}

.project__text {
    max-width: var(--measure);
}

.project__name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    font-stretch: 106%;
}

.project__status {
    font-size: 0.9375rem;
    font-weight: 400;
    font-stretch: 100%;
    color: var(--ink-faint);
}

.project__summary {
    margin: 0.4rem 0 1rem;
    font-family: var(--font-display);
    font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
    font-weight: 600;
    font-stretch: 102%;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.project__stack {
    margin-top: 1.1rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink-faint);
}

.project__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 1rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
}

.project__private {
    font-weight: 400;
    color: var(--ink-faint);
}

.project .diagram {
    justify-self: end;
    margin-top: 0.35rem;
}

/* == More projects == */
.more {
    margin-top: clamp(1rem, 3vw, 2rem);
    padding-top: clamp(2.25rem, 5vw, 3rem);
    border-top: 1px solid var(--rule);
}

.more__title {
    font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);
    font-weight: 700;
    font-stretch: 106%;
    letter-spacing: -0.01em;
}

.more__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 clamp(2rem, 5vw, 4rem);
    margin-top: 1.25rem;
    padding: 0;
    list-style: none;
}

.more__item {
    padding: 1.25rem 0 1.5rem;
    border-top: 1px solid var(--rule);
}

.more__name {
    font-size: 1.125rem;
    font-weight: 700;
    font-stretch: 106%;
}

.more__item p {
    margin-top: 0.4rem;
    font-size: 1.0625rem;
}

.more__item .more__meta {
    margin-top: 0.6rem;
    font-family: var(--font-display);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--ink-faint);
}

.more__item .more__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin-top: 0.6rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
}

.earlier {
    max-width: 44rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    font-size: 1.0625rem;
    color: var(--ink-soft);
}

/* ================================ */
/* == Tools & education          == */
/* ================================ */
.tools {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: 0.9rem 2rem;
    max-width: 54rem;
}

.tools dt {
    padding-top: 0.2rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.education {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem clamp(2rem, 5vw, 4rem);
    max-width: 54rem;
}

.education strong {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

/* ================================ */
/* == Contact & footer           == */
/* ================================ */
.contact__note {
    color: var(--ink-soft);
}

.contact__email {
    display: inline-block;
    margin-top: 0.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 0.9rem + 3.4vw, 3.25rem);
    font-weight: 700;
    font-stretch: 108%;
    line-height: 1.15;
    letter-spacing: -0.025em;
    text-decoration-thickness: 0.08em;
    overflow-wrap: anywhere;
}

.contact__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    margin-top: 1.5rem;
    padding: 0;
    list-style: none;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
}

.site-footer {
    max-width: var(--page);
    margin: clamp(4rem, 9vw, 6.5rem) auto 0;
    padding: 1.25rem var(--gutter) 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    font-family: var(--font-display);
    font-size: 0.875rem;
    color: var(--ink-faint);
}

.site-footer p {
    margin: 0;
}

/* ================================ */
/* == Responsive                 == */
/* ================================ */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .diagram--hero {
        justify-self: start;
    }

    .project {
        grid-template-columns: minmax(0, 1fr);
    }

    .project .diagram {
        justify-self: start;
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .ladder {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.9rem;
    }

    .ladder::before {
        top: 0.375rem;
        bottom: 0.375rem;
        left: 0.3125rem;
        right: auto;
        width: 2px;
        height: auto;
    }

    .ladder li {
        padding: 0 0 0 1.6rem;
    }

    .more__list,
    .education {
        grid-template-columns: minmax(0, 1fr);
    }

    .tools {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.15rem;
    }

    .tools dd {
        margin-bottom: 0.85rem;
    }
}

@media (max-width: 400px) {
    .site-header__name {
        font-size: 1rem;
    }

    .site-nav a {
        font-size: 0.875rem;
    }
}

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

@media print {
    .site-header,
    .skip-link,
    .replay {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }
}
