:root {
    --bg: #000;
    --fg: #ccc;
    --strong: #eee;
    --dim: #777;
    /* Konsole BackgroundIntense */
    --code-bg: #151515;
    --blue: #28a1c5;
    --red: #b52c27;
    --orange: #df8a13;
    --line: #333;
    --mono: ui-monospace, "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", "Noto Sans", "DejaVu Sans", sans-serif;
    /* Long enough for any width; ASCII rules are clipped to their box. */
    --dashes: "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
}

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

html {
    font-family: var(--sans);
    font-size: 100%;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 2rem 1.25rem;
}

/* Layout: menu above the content on narrow screens, beside it on wide ones. */

@media (min-width: 64em) {
    body {
        display: grid;
        grid-template-columns: 18rem minmax(0, 42rem);
        column-gap: 4rem;
        padding: 3rem 2rem;
    }
    .sidebar {
        position: sticky;
        top: 3rem;
        align-self: start;
    }
}

/* Prose is proportional; everything that frames it stays monospace. */
.sidebar,
h1, h2, h3, h4,
code,
.notice::before,
.notice::after {
    font-family: var(--mono);
}

/* Sidebar */

.logo {
    display: inline-block;
    text-decoration: none;
}
.logo pre {
    margin: 0 0 1.5rem;
    padding: 0;
    background: none;
    border: 0;
    font-size: 1.6rem;
    font-weight: bold;
    line-height: 1.15;
    overflow: visible;
}
.logo .b { color: var(--blue); }
.logo .r { color: var(--red); }
.logo .w { color: #fefefc; }

nav a {
    display: block;
    color: var(--strong);
    text-decoration: none;
    white-space: pre;
}
nav a::before {
    content: "  ";
}
nav a.active::before {
    content: "> ";
    color: var(--blue);
}
nav a:hover,
nav a:focus {
    text-decoration: underline;
}

.sidebar footer {
    margin-top: 1.5rem;
    color: var(--dim);
    font-size: .875rem;
}

@media (max-width: 63.99em) {
    .sidebar {
        margin-bottom: 2.5rem;
    }
    .sidebar::after {
        content: var(--dashes);
        display: block;
        margin-top: 1.5rem;
        overflow: hidden;
        white-space: nowrap;
        color: var(--line);
    }
}

/* Content */

.content {
    max-width: 42rem;
}

h1, h2, h3, h4 {
    color: var(--strong);
    line-height: 1.3;
    margin: 2rem 0 1rem;
}
h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.25rem; }
h3, h4 { font-size: 1rem; }

strong { color: var(--strong); }

a {
    color: var(--blue);
}
a:hover,
a:focus {
    color: var(--strong);
}

code {
    font-size: .9em;
    color: var(--orange);
}

/* Code blocks are framed by text rules instead of a shaded box:
 * +-- config ----------
 * ...
 * +--------------------
 */
pre {
    margin: 1.25rem 0;
    padding: .5rem .75rem;
    background: var(--code-bg);
    overflow-x: auto;
    line-height: 1.4;
}
pre code {
    display: block;
    color: var(--fg);
    font-size: .9rem;
}
pre code::before,
pre code::after,
.notice::before,
.notice::after {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    color: var(--dim);
}
pre code::before {
    content: "+-- " attr(data-name) " " var(--dashes);
}

/* Giallo lines, line numbers and highlighted lines (hl_lines).
 * Colors from the design pass, paired with highlighting/hnet.json. */
pre.giallo .giallo-l {
    display: inline-block;
    box-sizing: border-box;
    min-height: 1lh;
    min-width: 100%;
    position: relative;
    vertical-align: top;
}

/* The 2ch gutter for the ">" marker only where a block has highlighted lines,
 * so ordinary blocks stay aligned with their ASCII frame. */
pre.giallo:has(.z-hl) .giallo-l {
    padding-left: 2ch;
}
pre.giallo .giallo-l.z-hl {
    background-color: #212121;
}
pre.giallo .giallo-l.z-hl::after {
    content: ">";
    position: absolute;
    top: 0;
    left: 0;
    color: var(--orange);
}

pre.giallo .giallo-ln {
    display: inline-block;
    min-width: 3ch;
    margin-right: 2ch;
    text-align: right;
    color: #555;
    -webkit-user-select: none;
    user-select: none;
}
pre.giallo .giallo-l.z-hl > .giallo-ln {
    color: #9a9a9a;
}

pre.giallo ::selection {
    background-color: #222c38;
}
pre code::after,
.notice::after {
    content: "+" var(--dashes);
}

blockquote {
    margin: 1rem 0 1rem 2ch;
    color: var(--dim);
}

ol, ul {
    padding-left: 2.5em;
}
li + li {
    margin-top: .4rem;
}

/* Section listings */

.posts li p {
    margin: .25rem 0 0;
    color: var(--dim);
}

/* Notices, replacing the markdown-notices plugin of the old site */

.notice {
    margin: 1.5rem 0;
}
.notice p {
    margin: .5rem 0;
}
.notice.info { color: var(--blue); }
.notice.warn { color: var(--orange); }
.notice::before,
.notice::after {
    color: inherit;
}
.notice.info::before { content: "+-- [i] " var(--dashes); }
.notice.warn::before { content: "+-- [!] " var(--dashes); }
.notice a { color: inherit; }

/* Shell prompt for command blocks; added by CSS so it isn't copied with the command. */
code[data-name="command"] .giallo-l::before {
    content: "$ ";
    color: var(--dim);
}
