/* Base: colour tokens, page, links, headings and the site header.
   Every page uses it; the 503 page uses only this file (inline). */

:root {
   color-scheme: light dark;
   /* contrast on --bg: fg 11.8, muted 5.5, link 7.6 */
   --bg: #f5f6f7;
   --fg: #2e3338;
   --muted: #5b6470;
   --link: #1f4f8a;
   --code-bg: #eceef1;          /* syntax keywords 4.6 */
   --rule: #d3d7dc;
   --heading: #22344a;          /* 11.7, darker and less saturated than links */
   --note: #1f4f8a;
   --tip: #2f6f3e;
   --warning: #b03a12;          /* red-orange; title 5.0 on the box */
}

@media (prefers-color-scheme: dark) {
   :root {
      /* contrast on --bg: fg 14.2, muted 7.0, link 8.3 */
      --bg: #16181b;
      --fg: #e3e6ea;
      --muted: #9aa3ad;
      --link: #8db4e6;
      --code-bg: #23272c;
      --rule: #353a40;
      --heading: #c3d2e4;
      --note: #8db4e6;
      --tip: #7fc79a;
      --warning: #f09a6a;
   }
}

/* 18px on phones, up to 21px on wide screens */
html { font-size: clamp(1.125rem, 0.95rem + 0.6vw, 1.3125rem); }

body {
   max-width: 38em;
   margin: 0 auto;
   padding: 1.5rem 1rem 3rem;
   background: var(--bg);
   color: var(--fg);
   font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
   line-height: 1.5;  /* WCAG 2.2 SC 1.4.8 minimum; Butterick: 120-145% */
}

a { color: var(--link); text-underline-offset: 0.15em; }

h1, h2, h3 { line-height: 1.25; color: var(--heading); }
h1 { font-size: 1.9rem; margin: 1.3em 0 0.4em; }   /* clear of the site header */
h2 { font-size: 1.4rem; margin-top: 2em; }
h3 { font-size: 1.15rem; margin-top: 1.6em; }

header.site {
   display: flex;
   flex-wrap: wrap;
   gap: 0.5rem 1.25rem;
   align-items: baseline;
   justify-content: space-between;
   padding-bottom: 0.75rem;
   border-bottom: 1px solid var(--rule);
}
/* Larger than h2 (1.4rem), so the site title outranks "Latest articles" */
header.site .name {
   font-size: 1.75rem;
   font-weight: bold;
   color: var(--fg);
   text-decoration: none;
}
/* Content: menu and footer, article metadata, lists, code, tables,
   term links, OS labels and alert boxes. Tokens are in base.css. */

/* Menu and footer link lists: vertical bars between the links (not part of
   the link text); flex, so markup whitespace adds no extra space */
.bar { display: flex; flex-wrap: wrap; }
.bar a + a::before {
   content: "|";
   content: "|" / "";
   display: inline-block;
   margin: 0 0.4em;
   color: var(--muted);
}

footer {
   margin-top: 4rem;
   padding-top: 0.75rem;
   border-top: 1px solid var(--rule);
   color: var(--muted);
   font-size: 0.85rem;
   display: flex;
   flex-wrap: wrap;
   justify-content: space-between;
   gap: 0.5rem 1rem;
}

.meta, .count, ul.posts time { color: var(--muted); font-size: 0.85rem; }
/* Article metadata: OS labels left and "Posted by … on …" right above the
   title; below it the objectives and tags as a label column + term links */
.meta-top {
   display: flex;
   flex-wrap: wrap;
   justify-content: space-between;
   align-items: baseline;
   gap: 0.25em 1em;
   margin-top: 1.5rem;
}
article h1 { margin-top: 0.25em; }
.meta-terms {
   display: grid;
   grid-template-columns: max-content 1fr;
   gap: 0 0.8em;
   align-items: baseline;
   line-height: 1.35;
   margin: 0 0 1.5em;
}
.meta-terms dt { margin: 0; }
.meta-terms dd { margin: 0; }

ul.posts, ul.terms { list-style: none; padding: 0; }
ul.posts li { margin: 0.6em 0; }
ul.posts time { display: inline-block; min-width: 6.5em; font-variant-numeric: tabular-nums; }

code, pre {
   font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
   font-size: 0.85em;
}
code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }
/* Code blocks smaller than inline code: about 82 columns fit the text column;
   tabs at 3, the site-wide indentation */
pre {
   font-size: 0.75em;
   tab-size: 3;
   background: var(--code-bg);
   padding: 0.75em;
   overflow-x: auto;           /* phones: swipe sideways */
   line-height: 1.45;
   border: 1px solid var(--rule);
   border-radius: 4px;
}
pre code { background: none; padding: 0; font-size: 1em; }

/* Wide screens: a longer block grows into the right margin instead of scrolling.
   50vw + 18rem = from the column's left edge to 1rem before the window edge. */
@media (min-width: 60em) {
   pre {
      box-sizing: border-box;
      width: max-content;
      min-width: 100%;
      max-width: calc(50vw + 18rem);
   }
}

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

table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.4em 0.6em; text-align: left; }

img { max-width: 100%; height: auto; }

/* Objective and tag links in the article metadata: quiet, so the title leads */
.term {
   margin-right: 0.6em;
   color: var(--muted);
   text-decoration-color: var(--rule);
   font-variant-numeric: tabular-nums;
}
.term:hover, .term:focus-visible { color: var(--link); text-decoration-color: currentColor; }

/* OS labels in the project colours:
   FreeBSD  #aa2b28 "Strong Red", FreeBSD Foundation brand page (logo SVG: #ab2b28)
   NetBSD   #f26711 RGB 242 103 17 in the official flag logo, NetBSD-flag.eps
   OpenBSD  no official colour published; yellow is our own choice (Puffy) */
.os {
   display: inline-block;
   margin-right: 0.4em;
   padding: 0 0.45em;
   border-radius: 3px;
   font-size: 0.68rem;          /* rem: same size in the article and in lists */
   font-weight: bold;
   letter-spacing: 0.02em;
   text-decoration: none;
   vertical-align: 0.1em;
}
.os-freebsd { background: #aa2b28; color: #ffffff; }   /* 6.9 */
.os-openbsd { background: #f2ca30; color: #000000; }   /* 13.3 */
.os-netbsd  { background: #f26711; color: #000000; }   /* 6.7 */
ul.posts .os { margin: 0 0 0 0.4em; }

/* Alert boxes: > [!NOTE], [!TIP], [!WARNING] */
.callout {
   --c: var(--note);
   margin: 1.5em 0;
   padding: 0.6em 1em;
   border-left: 4px solid var(--c);
   border-radius: 0 4px 4px 0;
   background: color-mix(in srgb, var(--c) 8%, var(--bg));
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 0.3em; font-weight: bold; color: var(--c); }
.callout-tip { --c: var(--tip); }
.callout-warning { --c: var(--warning); }
/* Syntax highlighting: Chroma 'github' (light) and 'github-dark' (dark),
   generated with hugo gen chromastyles; backgrounds removed (pre uses --code-bg) */
.chroma .lnlinks { outline:none;text-decoration:none;color:inherit }
.chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; }
.chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; }
.chroma .hl { background-color:#dedede }
.chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
.chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
.chroma .line { display:flex; }
.chroma .k { color:#cf222e }
.chroma .kc { color:#cf222e }
.chroma .kd { color:#cf222e }
.chroma .kn { color:#cf222e }
.chroma .kp { color:#cf222e }
.chroma .kr { color:#cf222e }
.chroma .kt { color:#cf222e }
.chroma .na { color:#1f2328 }
.chroma .nc { color:#1f2328 }
.chroma .no { color:#0550ae }
.chroma .nd { color:#0550ae }
.chroma .ni { color:#6639ba }
.chroma .nl { color:#900;font-weight:bold }
.chroma .nn { color:#24292e }
.chroma .nx { color:#1f2328 }
.chroma .nt { color:#0550ae }
.chroma .nb { color:#6639ba }
.chroma .bp { color:#6a737d }
.chroma .nv { color:#953800 }
.chroma .vc { color:#953800 }
.chroma .vg { color:#953800 }
.chroma .vi { color:#953800 }
.chroma .vm { color:#953800 }
.chroma .nf { color:#6639ba }
.chroma .fm { color:#6639ba }
.chroma .s { color:#0a3069 }
.chroma .sa { color:#0a3069 }
.chroma .sb { color:#0a3069 }
.chroma .sc { color:#0a3069 }
.chroma .dl { color:#0a3069 }
.chroma .sd { color:#0a3069 }
.chroma .s2 { color:#0a3069 }
.chroma .se { color:#0a3069 }
.chroma .sh { color:#0a3069 }
.chroma .si { color:#0a3069 }
.chroma .sx { color:#0a3069 }
.chroma .sr { color:#0a3069 }
.chroma .s1 { color:#0a3069 }
.chroma .ss { color:#032f62 }
.chroma .m { color:#0550ae }
.chroma .mb { color:#0550ae }
.chroma .mf { color:#0550ae }
.chroma .mh { color:#0550ae }
.chroma .mi { color:#0550ae }
.chroma .il { color:#0550ae }
.chroma .mo { color:#0550ae }
.chroma .o { color:#0550ae }
.chroma .ow { color:#0550ae }
.chroma .or { color:#0550ae }
.chroma .p { color:#1f2328 }
.chroma .c { color:#57606a }
.chroma .ch { color:#57606a }
.chroma .cm { color:#57606a }
.chroma .c1 { color:#57606a }
.chroma .cs { color:#57606a }
.chroma .cp { color:#57606a }
.chroma .cpf { color:#57606a }
.chroma .ge { color:#1f2328 }
.chroma .go { color:#1f2328 }
.chroma .gl { text-decoration:underline }
.chroma .w { color:#fff }

@media (prefers-color-scheme: dark) {
   .chroma .err { color:#f85149 }
   .chroma .lnlinks { outline:none;text-decoration:none;color:inherit }
   .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; }
   .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; }
   .chroma .hl { background-color:#6e7681 }
   .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#737679 }
   .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#6e7681 }
   .chroma .line { display:flex; }
   .chroma .k { color:#ff7b72 }
   .chroma .kc { color:#79c0ff }
   .chroma .kd { color:#ff7b72 }
   .chroma .kn { color:#ff7b72 }
   .chroma .kp { color:#79c0ff }
   .chroma .kr { color:#ff7b72 }
   .chroma .kt { color:#ff7b72 }
   .chroma .nc { color:#f0883e;font-weight:bold }
   .chroma .no { color:#79c0ff;font-weight:bold }
   .chroma .nd { color:#d2a8ff;font-weight:bold }
   .chroma .ni { color:#ffa657 }
   .chroma .ne { color:#f0883e;font-weight:bold }
   .chroma .nl { color:#79c0ff;font-weight:bold }
   .chroma .nn { color:#ff7b72 }
   .chroma .nx { color:#e6edf3 }
   .chroma .py { color:#79c0ff }
   .chroma .nt { color:#7ee787 }
   .chroma .nv { color:#79c0ff }
   .chroma .vc { color:#79c0ff }
   .chroma .vg { color:#79c0ff }
   .chroma .vi { color:#79c0ff }
   .chroma .vm { color:#79c0ff }
   .chroma .nf { color:#d2a8ff;font-weight:bold }
   .chroma .fm { color:#d2a8ff;font-weight:bold }
   .chroma .l { color:#a5d6ff }
   .chroma .ld { color:#79c0ff }
   .chroma .s { color:#a5d6ff }
   .chroma .sa { color:#79c0ff }
   .chroma .sb { color:#a5d6ff }
   .chroma .sc { color:#a5d6ff }
   .chroma .dl { color:#79c0ff }
   .chroma .sd { color:#a5d6ff }
   .chroma .s2 { color:#a5d6ff }
   .chroma .se { color:#79c0ff }
   .chroma .sh { color:#79c0ff }
   .chroma .si { color:#a5d6ff }
   .chroma .sx { color:#a5d6ff }
   .chroma .sr { color:#79c0ff }
   .chroma .s1 { color:#a5d6ff }
   .chroma .ss { color:#a5d6ff }
   .chroma .m { color:#a5d6ff }
   .chroma .mb { color:#a5d6ff }
   .chroma .mf { color:#a5d6ff }
   .chroma .mh { color:#a5d6ff }
   .chroma .mi { color:#a5d6ff }
   .chroma .il { color:#a5d6ff }
   .chroma .mo { color:#a5d6ff }
   .chroma .o { color:#ff7b72;font-weight:bold }
   .chroma .ow { color:#ff7b72;font-weight:bold }
   .chroma .or { color:#ff7b72;font-weight:bold }
   .chroma .c { color:#8b949e;font-style:italic }
   .chroma .ch { color:#8b949e;font-style:italic }
   .chroma .cm { color:#8b949e;font-style:italic }
   .chroma .c1 { color:#8b949e;font-style:italic }
   .chroma .cs { color:#8b949e;font-weight:bold;font-style:italic }
   .chroma .cp { color:#8b949e;font-weight:bold;font-style:italic }
   .chroma .cpf { color:#8b949e;font-weight:bold;font-style:italic }
   .chroma .ge { font-style:italic }
   .chroma .gr { color:#ffa198 }
   .chroma .gh { color:#79c0ff;font-weight:bold }
   .chroma .go { color:#8b949e }
   .chroma .gp { color:#8b949e }
   .chroma .gs { font-weight:bold }
   .chroma .gu { color:#79c0ff }
   .chroma .gt { color:#ff7b72 }
   .chroma .gl { text-decoration:underline }
   .chroma .w { color:#6e7681 }
}
