/* A terminal-flavoured page: dark ground, one monospace family, one accent.
   No web fonts: the CSP in _headers allows same-origin fonts only, and the
   system monospace faces below are better drawn than Courier New anyway. */
:root {
    --bg: #0c0d0e;
    --text: #d6d6d6;
    --text-strong: #f2f2f2;
    --text-muted: #8e9399;   /* 6.3:1 on --bg, AA for body-size text */
    --rule: #2a2d31;
    --accent: #84aacb;       /* the link blue the site has always used */
    --accent-strong: #a9c7e3;
    --accent-visited: #7593ae;

    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    /* Spacing scale. Related items sit 4-8px apart, blocks 16-24px, sections 48px+ */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 72px;

    --gutter: 11rem;
    --measure: 68ch;
}

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

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

body {
    margin: 0 auto;
    max-width: 60rem;
    padding: var(--space-8) var(--space-6) var(--space-8);
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1.6;
}

::selection {
    background-color: var(--accent);
    color: var(--bg);
}

p,
ul,
ol,
dl,
dd,
h1,
h2,
h3 {
    margin: 0;
}

p,
li,
dd {
    /* Keeps a long token (email, URL) from forcing a horizontal scrollbar.
       Deliberately not on headings, which would then break mid-word. */
    overflow-wrap: break-word;
}

p {
    max-width: var(--measure);
}

b {
    color: var(--text-strong);
    font-weight: 600;
}

/* Links */

a {
    color: var(--accent);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

a:visited {
    color: var(--accent-visited);
}

a:hover {
    color: var(--accent-strong);
    text-decoration-color: currentColor;
}

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

/* Header */

.hero {
    display: grid;
    grid-template-columns: var(--gutter) minmax(0, 1fr);
    column-gap: var(--space-6);
    align-items: center;
    padding-bottom: var(--space-7);
}

.portrait {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    filter: contrast(1.05);
}

h1 {
    color: var(--text-strong);
    font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.role {
    margin-top: var(--space-2);
    color: var(--text-strong);
    font-size: 1.125rem;
}

.tagline {
    margin-top: var(--space-1);
    color: var(--text-muted);
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-5);
    margin-top: var(--space-4);
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
}

/* Sections: heading in the left gutter, content in one reading column */

.section {
    display: grid;
    grid-template-columns: var(--gutter) minmax(0, 1fr);
    column-gap: var(--space-6);
    padding-block: var(--space-6) var(--space-7);
    border-top: 1px solid var(--rule);
}

h2 {
    color: var(--text-strong);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.6;
    /* Sits on the same baseline as the first line of the section body */
    padding-top: 0.15em;
}

/* Markdown-style marker. The empty alt text keeps screen readers from announcing it. */
h2::before {
    content: "## ";
    content: "## " / "";
    color: var(--text-muted);
}

.section-body > * + * {
    margin-top: var(--space-4);
}

h3 {
    color: var(--text-strong);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
}

.meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.entry > * + * {
    margin-top: var(--space-3);
}

.entry > h3 + .meta {
    margin-top: var(--space-1);
}

.section-body > .entry + .entry {
    margin-top: var(--space-5);
}

/* Before: a vertical timeline */

.timeline {
    padding: 0;
    list-style: none;
}

.timeline > li {
    position: relative;
    padding-left: var(--space-5);
    padding-bottom: var(--space-5);
    border-left: 1px solid var(--rule);
}

.timeline > li:last-child {
    padding-bottom: 0;
}

.timeline > li::before {
    content: "";
    position: absolute;
    top: 0.55em;
    left: -4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--bg);
    border: 1px solid var(--text-muted);
}

.timeline > li > * + * {
    margin-top: var(--space-1);
}

/* Expertise */

.skills {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-3) var(--space-5);
}

.skills dt {
    color: var(--text-strong);
    font-weight: 600;
}

/* Print-only footer */

.only-if-print {
    display: none;
}

/* Narrow screens: headings move above their content */
@media screen and (max-width: 720px) {
    body {
        padding: var(--space-6) var(--space-5) var(--space-7);
    }

    .hero {
        grid-template-columns: 1fr;
        row-gap: var(--space-5);
        padding-bottom: var(--space-6);
    }

    .portrait {
        width: 112px;
    }

    .contact {
        flex-direction: column;
    }

    .section {
        grid-template-columns: 1fr;
        row-gap: var(--space-4);
        padding-block: var(--space-5) var(--space-6);
    }

    .skills {
        grid-template-columns: 1fr;
        row-gap: 0;
    }

    .skills dd + dt {
        margin-top: var(--space-3);
    }
}

@media print {
    @page {
        size: A4;
        margin: 14mm 16mm;
    }

    :root {
        --bg: #fff;
        --text: #1a1a1a;
        --text-strong: #000;
        --text-muted: #555;
        --rule: #cfcfcf;
        --accent: #1a1a1a;
        --accent-visited: #1a1a1a;
        --gutter: 10rem;
    }

    /* On the root, not body, so every rem-based size scales down with it */
    html {
        font-size: 9pt;
    }

    body {
        max-width: none;
        padding: 0;
        line-height: 1.45;
    }

    a {
        text-decoration: none;
    }

    h1 {
        font-size: 2rem;
    }

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

    .hero {
        padding-bottom: var(--space-4);
    }

    .portrait {
        filter: none;
    }

    .section {
        padding-block: var(--space-3) var(--space-4);
        break-inside: avoid;
    }

    .section-body > * + * {
        margin-top: var(--space-2);
    }

    .entry > * + * {
        margin-top: var(--space-1);
    }

    .section-body > .entry + .entry {
        margin-top: var(--space-3);
    }

    .timeline > li {
        padding-bottom: var(--space-2);
    }

    .only-if-print {
        display: flex;
        align-items: center;
        gap: var(--space-4);
        padding-top: var(--space-3);
        border-top: 1px solid var(--rule);
    }

    .qr {
        width: 64px;
        height: 64px;
    }
}

/* 404: the header without a portrait */
.hero-plain {
    grid-template-columns: minmax(0, 1fr);
}
