/*
Deliberately plain. The old theme was plain and readable, and a redesign is a
separate project that should not ride along with a content migration.
*/
:root {
    --text: #1d2327;
    --muted: #646970;
    --link: #1c5f9e;
    --rule: #e0e2e5;
    --bg: #ffffff;
    --panel: #f6f7f8;
    /* The same blue the event pages use, so the two read as one product. */
    --blue: #2780e3;
    --measure: 44rem;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font:
        16px/1.6 -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

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

/*
Two bars, as the site this replaces had: a blue one with the logo and the links
off to the rest of zone4, and a grey one carrying the breadcrumb and search.

The blue matches the event pages exactly (--blue), down to the 4rem height and
the logo's 2rem x 200px box, so somebody arriving from an event page recognises
where they are.
*/
.site-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    padding: 0.5rem 1rem;
    background-color: var(--blue);
}

.site-nav {
    display: flex;
    gap: 2rem;
    padding-right: 0.5rem;
}

.site-nav a {
    color: var(--bg);
    text-decoration: none;
}

.site-nav a:hover {
    text-decoration: underline;
}

.crumb-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--rule);
}

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

/* The separator is generated rather than marked up: it is punctuation between
   links, not content, and a screen reader should not read it out. */
.crumb-bar .breadcrumb li + li::before {
    content: '›';
    margin-right: 0.5rem;
    color: var(--muted);
}

.crumb-bar .breadcrumb a {
    text-decoration: none;
}

.crumb-bar .breadcrumb a:hover {
    text-decoration: underline;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.zone4-logo {
    display: block;
    width: 200px;
    height: 2rem;
    background-image: url(/assets/zone4-logo.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: left center;
}

.site-search input {
    min-width: min(26rem, 60vw);
    padding: 0.55rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.site-main {
    max-width: calc(var(--measure) + 18rem);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/*
Article beside its contents list.

One column until there is genuinely room for two -- below this width the
sidebar would squeeze the prose, and a contents list is worth less than
readable body text.

The contents list comes first in the markup so that on a phone it lands above
the article, which is where a reader asking "does this page cover my problem"
wants it. `order` moves it to the right-hand column once there are two.
*/
.article-layout {
    display: grid;
    gap: 2.5rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr) 15rem;
        align-items: start;
    }

    .toc {
        position: sticky;
        top: 1.5rem;
        order: 2;
        max-height: calc(100vh - 3rem);
        overflow-y: auto;
    }
}

.toc {
    padding: 1.1rem 1.25rem;
    background: var(--panel);
    border-radius: 6px;
    font-size: 0.9rem;
}

.toc-title {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
}

.toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc li {
    padding: 0.2rem 0;
}

.toc a {
    color: var(--muted);
    text-decoration: none;
}

.toc a:hover {
    text-decoration: underline;
}

/* The section currently under the top of the viewport. */
.toc li.active > a {
    color: var(--link);
    font-weight: 600;
}

.toc-level-1 {
    padding-left: 0.9rem;
}

.toc-level-2 {
    padding-left: 1.8rem;
}

.toc-level-3 {
    padding-left: 2.7rem;
}

/* Anchored headings land under the sticky nothing, but give them air anyway. */
.article-body :is(h1, h2, h3, h4) {
    scroll-margin-top: 1.5rem;
}

h1 {
    margin: 0 0 1rem;
    font-size: 1.75rem;
    line-height: 1.25;
}

/*
Screenshots need an edge, and the old site already gave them one.

Not a design decision to make from scratch: the live theme frames every image
in a 4px #ddd border with 17px of padding and a soft 16px shadow, which is what
keeps a white screenshot from dissolving into a white page. It sits on the
`<figure>` that Gutenberg wraps around each image -- which is why looking for
rules on `img` found layout properties and nothing else, and why a first pass
here concluded, wrongly, that the old site had no image styling at all.

We have no figure to hang it on: the import writes plain markdown, so an image
is an `<img>` in a paragraph. The same numbers on the image itself produce the
same result, the padding standing in for the figure's inner gap.
*/
.article-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 0 1.1rem;
    padding: 17px;
    border: 4px solid #ddd;
    box-shadow: 0 0 16px rgb(0 0 0 / 15%);
}

/*
The caption, which the import writes as emphasis directly after the image so
that the markdown stays markdown. Live renders a `<figcaption>`; these are the
same numbers -- centred, grey, italic, a little below the frame.
*/
.article-body p > img + em {
    display: block;
    margin-bottom: 1.75rem;
    color: #808080;
    font-size: 0.9rem;
    text-align: center;
}

.article-body video {
    display: block;
    max-width: 100%;
    margin: 0 0 1.75rem;
    padding: 17px;
    border: 4px solid #ddd;
    box-shadow: 0 0 16px rgb(0 0 0 / 15%);
}

/*
Inside a table an image is a cell's content, not a figure. The frame stays --
these are screenshots too -- but at a size that does not push the rows apart.
*/
.article-body :is(td, th) img {
    margin: 0.3rem 0;
    padding: 5px;
    border-width: 1px;
    box-shadow: none;
}

/*
The tables kept as raw HTML, because GFM cannot express a cell holding an image
and two paragraphs. Unstyled they render as borderless columns of text.
*/
.article-body table {
    margin: 1.75rem 0;
    border-collapse: collapse;
}

.article-body :is(td, th) {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--rule);
    vertical-align: top;
    text-align: left;
}

.article-body :is(h1, h2, h3, h4) {
    scroll-margin-top: 1.5rem;
}

h1 {
    margin: 0 0 1rem;
    font-size: 1.75rem;
    line-height: 1.25;
}

/*
Screenshots need an edge.

Almost every image here is a capture of a white UI sitting on a white page, so
without a border the screenshot and the article bleed into each other and you
cannot tell where one stops. The old site had this problem too -- its theme
styles images for layout and gives them no edge at all -- so this is a fix
rather than a difference to preserve.

The padding is what makes the border read as a frame around the screenshot
instead of a line drawn on it.
*/
.article-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.75rem 0;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
}

/*
The caption, which the import writes as emphasis immediately after the image so
that the markdown stays markdown. Rendered as a block it reads as a caption;
left inline and italic it reads as a stray sentence.
*/
.article-body p > img + em {
    display: block;
    margin-bottom: 1.75rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-style: normal;
    text-align: center;
}

/* Close the gap when a caption follows, so the two read as one unit. */
.article-body img:has(+ em) {
    margin-bottom: 0.6rem;
}

.article-body video {
    display: block;
    max-width: 100%;
    margin: 1.75rem 0;
    border: 1px solid var(--rule);
    border-radius: 6px;
}

/*
Inside a table an image is a cell's content, not a figure: the margins that
separate a screenshot from prose just push the rows apart.
*/
.article-body td img,
.article-body th img {
    margin: 0.3rem 0;
}

/*
The tables kept as raw HTML, where cells hold images and paragraphs that GFM
cannot express. Unstyled they render as borderless columns of text.
*/
.article-body table {
    margin: 1.75rem 0;
    border-collapse: collapse;
}

.article-body :is(td, th) {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--rule);
    vertical-align: top;
    text-align: left;
}

.article-body h2,
.article-body h3 {
    margin-top: 2rem;
}

.tags {
    margin-top: 2rem;
    font-size: 0.875rem;
}

.tags a {
    display: inline-block;
    margin-right: 0.4rem;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
}

.updated {
    margin-top: 2.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.article-list,
.category-children,
.category-tiles {
    padding: 0;
    list-style: none;
}

.category-children li + li {
    border-top: 1px solid var(--rule);
}

.category-children a {
    display: block;
    padding: 1.1rem 0;
    color: inherit;
    text-decoration: none;
}

.child-title {
    display: block;
    color: var(--link);
    font-size: 1.2rem;
}

.child-description {
    display: block;
    margin-top: 0.35rem;
    color: var(--muted);
}

.category-children a:hover .child-title {
    text-decoration: underline;
}

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

.category-tiles {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.category-tiles a {
    display: block;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
}

.category-tiles h2 {
    margin: 0 0 0.5rem;
    color: var(--link);
    font-size: 1.125rem;
}

.count,
.empty {
    color: var(--muted);
    font-size: 0.875rem;
}

.feedback {
    margin-top: 3rem;
    padding: 1rem 1.25rem;
    background: var(--panel);
    border-radius: 6px;
}

.feedback p {
    margin: 0 0 0.5rem;
}

.feedback button {
    margin-right: 0.5rem;
    padding: 0.35rem 1.1rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--bg);
    font: inherit;
    cursor: pointer;
}

.site-footer {
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.875rem;
}
