:root {
    --bg: #fff;
    --fg: #001f2c;
    --accent: #B7410E;
    --accent-hover: #8F3208;
    --secondary: #6B7A3A;
    --secondary-muted: #8A9B4E;
    --code-bg: #f2f2f2;
    --code-fg: #222;
    --visited: #556B2F;
    /* Per-destination link colours. */
    --link-email: #C5221F;
    --link-blog: #6B7A3A;
    --link-github: #24292F;
    --link-linkedin: #0A66C2;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1612;
        --fg: #f0ebe4;
        --accent: #D97B4F;
        --accent-hover: #E89263;
        --secondary: #A8B567;
        --secondary-muted: #8A9B4E;
        --code-bg: #2a2520;
        --code-fg: #f0ebe4;
        --visited: #9CA86B;
        /* Brand hues lightened so they stay legible on the dark ground. */
        --link-email: #F28B82;
        --link-blog: #A8B567;
        --link-github: #E6EDF3;
        --link-linkedin: #5AAAF0;
    }
}

body {
    font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
    font-size: 1em;
    margin: 60px auto;
    padding: 30px;
    max-width: 700px;
    text-align: left;
    background-color: var(--bg);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
    color: var(--fg);
    border: 2px solid var(--fg);
    border-width: 2px !important;
}
h1, h2 {
    color: var(--accent);
}
h3, h4, h5, h6 {
    color: var(--secondary);
}
a {
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid;
    color: var(--accent);
}
a:hover {
    color: var(--accent-hover);
}
nav a {
    text-transform: uppercase;
    margin-right: 8px;
    padding: 10px 0;
    color: var(--fg);
}
nav a:hover {
    background-color: var(--accent);
    color: var(--bg);
}
button {
    margin: 0;
    cursor: pointer;
}
time {
    font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
    font-style: normal;
    font-size: 15px;
    color: var(--secondary);
}
nav {
    padding-top: 20px;
    padding-bottom: 60px;
    border-bottom: 2px solid;
}
main {
    padding-top: 20px;
    line-height: 1.6;
}
/* Name and links flush left. The portrait floats right out of the header so
   the intro paragraphs in <main> wrap alongside it too — a flex header would
   have confined the image to the header's own height. */
header {
    text-align: left;
    padding-top: 30px;
}
table {
    width: 100%;
}
hr {
    border: 0;
    border-top: 1px dashed var(--secondary);
}
img {
    max-width: 100%;
}
code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    padding: 2px 5px;
    background-color: var(--code-bg);
    color: var(--code-fg);
    border-radius: 3px;
}
blockquote {
    border-left: 3px solid var(--secondary);
    color: var(--fg);
    padding-left: 20px;
    font-style: italic;
    opacity: 0.9;
}
footer {
    padding: 25px 0;
    text-align: center;
}
.title:hover {
    text-decoration: none;
}
.title h1 {
    color: var(--accent);
    font-size: 1.9em;
    margin: 0;
}
.portrait {
    float: left;
    width: 195px;
    height: auto;
    margin: 0 30px 16px 0;
}
/* flow-root makes the intro its own block formatting context, so it sits
   beside the float as a rectangle instead of wrapping underneath it. If the
   text outruns the photo it keeps its column rather than going ragged. */
.intro {
    display: flow-root;
}
/* Stop the float before the Timeline so a tall photo can't overlap it. */
main hr {
    clear: both;
}
.inline {
    width: auto !important;
}
.highlight, .code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    padding: 1px 15px;
    background-color: var(--code-bg);
    color: var(--code-fg);
    border-radius: 3px;
    margin-block-start: 1em;
    margin-block-end: 1em;
    overflow-x: auto;
}
/* blog post list */
ul.blog-posts {
    list-style-type: none;
    padding: unset;
}
ul.blog-posts li {
    display: flex;
}
ul.blog-posts li span {
    flex: 0 0 130px;
}
ul.blog-posts li a:visited {
    color: var(--visited);
}

/* --- page-specific --- */

/* Timeline reuses the blog-post list rhythm: fixed-width date column,
   description flows in the remaining space. */
ul.timeline {
    list-style-type: none;
    padding: unset;
}
ul.timeline li {
    display: flex;
    margin-bottom: 12px;
}
ul.timeline li span.when {
    flex: 0 0 105px;
    color: var(--secondary);
    font-size: 15px;
    padding-top: 2px;
}
/* Organisation logo, pre-cropped to a white disc so every mark reads on
   either theme. The hairline ring keeps the white disc off a white page. */
ul.timeline li span.logo {
    flex: 0 0 32px;
    height: 32px;
    margin-right: 14px;
    display: inline-flex;
}
ul.timeline li span.logo img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 31, 44, 0.14);
}
@media (prefers-color-scheme: dark) {
    ul.timeline li span.logo img {
        box-shadow: 0 0 0 1px rgba(240, 235, 228, 0.22);
    }
}
ul.timeline li span.what {
    flex: 1;
}

/* Footnote under a timeline list. Flush left rather than aligned to the
   description column, so it reads as a note about the whole list instead of
   a continuation of the last entry. */
.aside {
    margin: 22px 0 0;
    font-size: 15px;
    color: var(--secondary);
}

/* Icon links: label + inline SVG sharing the link's color. */
ul.links {
    list-style-type: none;
    padding: unset;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}
ul.links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
}
/* Underline the label only — the icon sits outside the rule. */
ul.links a span {
    border-bottom: 2px solid;
}
ul.links svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

/* In the header the links sit flush left, tucked under the name. */
header ul.links {
    justify-content: flex-start;
    gap: 20px;
    margin: 12px 0 0;
}

/* Each link takes its destination's colour; the icon inherits it via
   currentColor. These beat the generic a:hover rule on specificity, so the
   colour holds on hover and only the opacity shifts. */
ul.links a.email { color: var(--link-email); }
ul.links a.blog { color: var(--link-blog); }
ul.links a.github { color: var(--link-github); }
ul.links a.linkedin { color: var(--link-linkedin); }
ul.links a:hover { opacity: 0.7; }

@media (max-width: 560px) {
    body {
        margin: 0 auto;
        padding: 20px;
    }
    /* Date and badge share a first line; the description wraps below. */
    ul.timeline li {
        flex-wrap: wrap;
        align-items: center;
    }
    ul.timeline li span.when {
        flex: 0 0 auto;
        margin-right: 10px;
    }
    ul.timeline li span.logo {
        margin-right: 0;
    }
    ul.timeline li span.what {
        flex: 1 0 100%;
        margin-top: 5px;
    }
    /* Floating leaves too little room for text at this width — unfloat and
       let the photo sit above the name. */
    .portrait {
        float: none;
        width: 150px;
        margin: 0 0 18px;
    }
    .title h1 {
        font-size: 1.5em;
    }
    header ul.links {
        gap: 16px;
    }
}
