:root {
    --sans: ui-sans-serif, system-ui, sans-serif;
    --text: #1a1a1a;
    --muted: #5a6472;
    --background: #fdfdfc;
    --accent: #6b4d8f;
    --rule: #e2e2df;
    --hover: #f0f0ec;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e8e8e6;
        --muted: #9aa3b0;
        --background: #16181c;
        --accent: #b79ad6;
        --rule: #2c2f36;
        --hover: #23262c;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: ui-serif, Charter, Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.65;
}

main {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 5rem;
}

h1, h2, h3 {
    font-family: var(--sans);
    line-height: 1.25;
    margin: 2.5rem 0 1rem;
}

h1 {
    font-size: 1.9rem;
    margin-top: 1rem;
}

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1.1rem;
}

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

blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    border-left: 3px solid var(--rule);
    color: var(--muted);
}

/* The source images range from 744px to 2232px wide. A fixed max-width below
   the narrowest one makes every figure render at the same size, centred, with
   nothing upscaled. */
img {
    display: block;
    width: 100%;
    max-width: 42rem;
    height: auto;
    margin: 2rem auto;
    border-radius: 4px;
}

figure {
    margin: 2rem 0;
}

figure img {
    margin: 0 auto 0.5rem;
}

figcaption,
.meta {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}

figcaption {
    text-align: center;
}

/* "originally published here", on articles whose graph entry has a dct:source.
   Sits directly under the date, so it pulls up against it. */
.source {
    margin-top: -0.9rem;
    font-style: italic;
}

/* the "← All articles" breadcrumb on article pages */
main nav {
    font-family: var(--sans);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

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

.article-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--rule);
}

.article-list time {
    display: block;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}

/* top navigation (<site-nav>) */

site-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 2rem;
}

.bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    background: var(--background);
    border-bottom: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 0.9rem;
}

.bar a {
    text-decoration: none;
}

.navitems {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
}

/* hamburger toggle — hidden on desktop, shown below the mobile breakpoint */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 34px;
    margin-left: auto;
    padding: 7px 9px;
    background: none;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.burger span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
}

.burger:hover {
    background: var(--hover);
}

.brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin-right: 1rem;
    white-space: nowrap;
}

.navlink,
.repo {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
}

.repo {
    margin-left: auto;
}

.navlink:hover,
.repo:hover {
    background: var(--hover);
    color: var(--text);
}

.navlink[aria-current="page"],
.navlink.active {
    color: var(--text);
    font-weight: 600;
}

/* mobile: collapse the nav row into a burger-toggled panel */
@media (max-width: 640px) {
    .bar {
        flex-wrap: wrap;
    }

    .burger {
        display: flex;
    }

    .navitems {
        display: none; /* hidden until the burger opens it */
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.1rem;
        padding-top: 0.4rem;
    }

    .bar.open .navitems {
        display: flex;
    }

    .navitems .navlink,
    .navitems .repo {
        padding: 0.6rem 0.65rem;
    }

    .navitems .repo {
        margin-left: 0; /* no auto-push in a column */
    }
}
