/* arturberkovics.com. One stylesheet for every page: the home page, the About page and the blog
   (Engineering Notes), which is set like a newspaper: serif headlines, rules and columns. The theme
   follows the system until the visitor picks one with the toggle; theme.js sets data-theme on
   <html> before the first paint. No web fonts: the system's own faces (SF Pro and New York on
   Apple devices, Georgia and Segoe UI elsewhere) load instantly. */

:root {
  --bg: #f8f6f0;
  --bg-raised: #ffffff;
  --bg-sunken: #f3f1ec;
  --ink: #16161a;
  --ink-2: #4a4a52;
  --ink-3: #7c7c85;
  --rule: rgba(22, 22, 26, 0.1);
  --rule-strong: rgba(22, 22, 26, 0.18);
  --rule-ink: #16161a;
  --accent: #b8202f;
  --accent-soft: rgba(184, 32, 47, 0.08);
  --link: #9c1b28;
  --code-bg: #f4f2ed;
  --code-ink: #24242a;
  --tok-k: #a3214a;
  --tok-t: #6b3fa0;
  --tok-s: #b3541e;
  --tok-c: #8a8a80;
  --tok-n: #1d6fa5;
  --tok-f: #2f6b4f;
  --tok-a: #b8202f;
  --shadow: 0 1px 2px rgba(22, 22, 26, 0.04), 0 8px 24px rgba(22, 22, 26, 0.06);
  --shadow-lift: 0 2px 4px rgba(22, 22, 26, 0.05), 0 18px 40px rgba(22, 22, 26, 0.1);
  --serif: "New York", ui-serif, "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --measure: 680px;
  --wide: 1120px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --bg-raised: #151518;
  --bg-sunken: #111114;
  --ink: #ededf0;
  --ink-2: #b4b4bc;
  --ink-3: #85858f;
  --rule: rgba(237, 237, 240, 0.09);
  --rule-strong: rgba(237, 237, 240, 0.16);
  --rule-ink: rgba(237, 237, 240, 0.7);
  --accent: #ff5a5f;
  --accent-soft: rgba(255, 90, 95, 0.1);
  --link: #ff7a7e;
  --code-bg: #141417;
  --code-ink: #dedee4;
  --tok-k: #ff7aa2;
  --tok-t: #c9a2ff;
  --tok-s: #f0a868;
  --tok-c: #73737d;
  --tok-n: #79c0ff;
  --tok-f: #7fd4a8;
  --tok-a: #ff7a7e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Without JavaScript the system decides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0c0c0e; --bg-raised: #151518; --bg-sunken: #111114;
    --ink: #ededf0; --ink-2: #b4b4bc; --ink-3: #85858f;
    --rule: rgba(237, 237, 240, 0.09); --rule-strong: rgba(237, 237, 240, 0.16); --rule-ink: rgba(237, 237, 240, 0.7);
    --accent: #ff5a5f; --accent-soft: rgba(255, 90, 95, 0.1); --link: #ff7a7e;
    --code-bg: #141417; --code-ink: #dedee4;
    --tok-k: #ff7aa2; --tok-t: #c9a2ff; --tok-s: #f0a868; --tok-c: #73737d;
    --tok-n: #79c0ff; --tok-f: #7fd4a8; --tok-a: #ff7a7e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* Light and dark images: <img class="on-light"> and <img class="on-dark">. */
.on-dark { display: none !important; }
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: inline-block !important; }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  overflow-x: hidden;
}

::selection { background: var(--accent-soft); color: var(--ink); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img, svg { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -48px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.scrolled { border-bottom-color: var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; font-size: 16px; }
.wordmark:hover { text-decoration: none; }
.wordmark .mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
}

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--ink-2); font-size: 15px; padding: 6px 12px; border-radius: 999px; transition: color 0.15s, background 0.15s; }
.site-nav a:hover { color: var(--ink); background: var(--bg-sunken); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav .ext::after { content: "\2197"; font-size: 0.8em; margin-left: 3px; opacity: 0.6; }

.theme-toggle {
  width: 36px; height: 36px; margin-left: 6px; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); background: var(--bg-sunken); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

@media (max-width: 460px) {
  .wordmark .name { display: none; }
  .site-nav a { padding: 6px 9px; }
}

/* Reading progress, on post pages only. */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent); z-index: 60; pointer-events: none; }

/* ---------- Post header ---------- */

.post-hero { padding: 40px 0 0; }
.crumbs { font-size: 13.5px; color: var(--ink-3); margin: 0 0 18px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.post-hero .inner { max-width: 820px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
.eyebrow .muted { color: var(--ink-3); }

.post-hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(34px, 5.4vw, 60px); line-height: 1.06; letter-spacing: -0.025em;
  margin: 18px 0 20px; text-wrap: balance;
}
.dek { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.2vw, 23px); line-height: 1.5; color: var(--ink-2); margin: 0; max-width: 720px; text-wrap: pretty; }

.byline {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 28px; padding: 11px 0;
  border-top: 1px solid var(--rule-ink); border-bottom: 1px solid var(--rule-strong);
  font-size: 14px; color: var(--ink-3);
}
.byline a { color: var(--ink); font-weight: 600; }
.byline .sep { color: var(--ink-3); }

/* ---------- Post layout: article with a table of contents beside it on wide screens ---------- */

.post-body { display: grid; grid-template-columns: minmax(0, var(--measure)) 1fr; gap: 72px; padding-bottom: 96px; padding-top: 44px; }
.post-body.single { grid-template-columns: minmax(0, var(--measure)); }
.toc { position: sticky; top: 96px; align-self: start; font-size: 14px; max-width: 260px; }
.toc-title { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li a { display: block; padding: 5px 0 5px 16px; margin-left: -1px; color: var(--ink-3); border-left: 1px solid transparent; line-height: 1.4; transition: color 0.15s, border-color 0.15s; }
.toc li a:hover { color: var(--ink); text-decoration: none; }
.toc li a.active { color: var(--ink); border-left-color: var(--accent); }
@media (max-width: 1080px) {
  .post-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .post-body .prose { max-width: var(--measure); margin: 0 auto; width: 100%; }
  .toc { display: none; }
}

/* ---------- Prose ---------- */

.prose { font-family: var(--serif); font-size: 19px; line-height: 1.68; }
.prose .tldr, .prose .callout, .prose .table-wrap, .prose .figure, .prose .stats, .prose .steps,
.prose .footnotes, .prose .cta, .prose .author, .prose .code { font-family: var(--sans); }
.prose > * + * { margin-top: 1.25em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose > :first-child { margin-top: 0; }
.prose p { text-wrap: pretty; }
.prose h2 {
  font-family: var(--serif); font-weight: 700; font-size: 32px; line-height: 1.2; letter-spacing: -0.02em;
  margin: 2.2em 0 0; text-wrap: balance;
}
.prose h3 { font-family: var(--sans); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin: 1.9em 0 0; }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose h2 .anchor, .prose h3 .anchor { color: var(--ink-3); opacity: 0; margin-left: 8px; font-weight: 400; transition: opacity 0.15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; text-decoration: none; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-color: var(--link); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--ink-3); }
.prose hr { border: 0; height: 1px; background: var(--rule); margin: 3em 0; }

.prose blockquote {
  margin-left: 0; margin-right: 0; padding: 4px 0 4px 24px; border-left: 2px solid var(--accent);
  font-family: var(--serif); font-size: 22px; line-height: 1.5; color: var(--ink); font-style: italic;
}
.prose blockquote p { margin: 0; }

.lead { font-size: 21px; line-height: 1.65; color: var(--ink); }
.lead::first-letter { font-family: var(--serif); float: left; font-size: 3.3em; line-height: 0.9; padding: 0.06em 0.1em 0 0; font-weight: 600; color: var(--ink); }

/* Inline code and code blocks. highlight.js colours <pre><code data-lang="swift|js|python|json|shell">. */
.prose code { font-family: var(--mono); font-size: 0.82em; background: var(--code-bg); border: 1px solid var(--rule); padding: 0.1em 0.38em; border-radius: 6px; color: var(--code-ink); }
.code {
  position: relative; margin-left: -24px; margin-right: -24px;
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
}
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.code-head .file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { font: inherit; font-family: var(--sans); font-size: 12px; color: var(--ink-3); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.copy:hover { color: var(--ink); border-color: var(--rule-strong); }
.code pre { margin: 0; padding: 18px 20px 20px; overflow-x: auto; font-size: 14px; line-height: 1.65; tab-size: 4; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: var(--code-ink); border-radius: 0; }
.code pre mark, .code .hl { display: inline-block; min-width: 100%; background: var(--accent-soft); color: inherit; box-shadow: -20px 0 0 var(--accent-soft), 20px 0 0 var(--accent-soft); }
@media (max-width: 760px) { .code { margin-left: 0; margin-right: 0; } }
/* Logs and console output: <pre><code data-lang="log">, not highlighted, a little smaller. */
.code pre code[data-lang="log"], .code pre code[data-lang="text"] { color: var(--ink-2); font-size: 13px; }
.tok-k { color: var(--tok-k); }
.tok-t { color: var(--tok-t); }
.tok-s { color: var(--tok-s); }
.tok-c { color: var(--tok-c); font-style: italic; }
.tok-n { color: var(--tok-n); }
.tok-f { color: var(--tok-f); }
.tok-a { color: var(--tok-a); }

/* Figures: inline SVG diagrams drawn with the CSS colours, so they follow the theme. */
.figure { margin-left: -24px; margin-right: -24px; }
.figure .frame { background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.figure figcaption { font-size: 14px; color: var(--ink-3); margin-top: 12px; padding: 0 24px; line-height: 1.55; }
.figure figcaption strong { color: var(--ink-2); }
@media (max-width: 760px) { .figure { margin-left: 0; margin-right: 0; } .figure figcaption { padding: 0; } }
/* On a phone a diagram keeps a readable size and scrolls sideways inside its frame. */
@media (max-width: 560px) {
  .figure .frame { padding: 20px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .figure svg { min-width: 500px; }
}
.figure svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
/* Classes for drawing inside the SVGs. */
.d-box { fill: var(--bg-sunken); stroke: var(--rule-strong); stroke-width: 1; }
.d-box-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.25; }
.d-line { stroke: var(--ink-3); stroke-width: 1.25; fill: none; }
.d-line-accent { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.d-dash { stroke-dasharray: 4 4; }
.d-text { fill: var(--ink); font-size: 14px; font-weight: 500; }
.d-label { fill: var(--ink-2); font-size: 12.5px; }
.d-small { fill: var(--ink-3); font-size: 11.5px; }
.d-mono { font-family: var(--mono); }
/* Charts: gridlines, a data series, a threshold line and an area under a series. */
.d-grid { stroke: var(--rule); stroke-width: 1; fill: none; }
.d-series { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.d-threshold { stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 5 4; fill: none; }
.d-area { fill: var(--accent-soft); stroke: none; }
.d-accent { fill: var(--accent); }
.d-ink { fill: var(--ink); }

/* Tables. */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.5; }
.prose th, .prose td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-sunken); }
.prose tr:last-child td { border-bottom: 0; }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* The short version, at the top of a post. */
.tldr { background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 16px; padding: 22px 26px; box-shadow: var(--shadow); }
.tldr .label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.tldr ul { margin: 0; padding-left: 1.15em; font-size: 16.5px; line-height: 1.6; }
.tldr li + li { margin-top: 6px; }

/* Asides: .callout, with .callout.warn for a pitfall. */
.callout { position: relative; background: var(--bg-sunken); border-radius: 14px; padding: 18px 22px 18px 22px; font-size: 16.5px; line-height: 1.6; border: 1px solid var(--rule); }
.callout .label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.callout.warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.callout.warn .label { color: var(--accent); }
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0; }
.callout p + p { margin-top: 0.6em; }

/* A row of numbers that tell the story. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; }
.stat { background: var(--bg-raised); padding: 20px 22px; }
.stat .value { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .what { font-size: 14px; color: var(--ink-3); margin-top: 6px; line-height: 1.4; }

/* Numbered steps. */
.steps { list-style: none; padding: 0 !important; counter-reset: step; }
.steps > li { position: relative; padding-left: 48px; counter-increment: step; }
.steps > li + li { margin-top: 18px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0.1em; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; background: var(--bg-raised); border: 1px solid var(--rule-strong); color: var(--ink); }

/* Footnotes: <sup class="fn"><a href="#fn1" id="fnref1">1</a></sup> and <section class="footnotes">. */
.fn a { text-decoration: none !important; font-size: 0.75em; font-weight: 600; padding: 0 2px; }
.footnotes { font-size: 15px; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 24px; margin-top: 3em !important; }
.footnotes ol { padding-left: 1.2em; }

/* ---------- End of a post ---------- */

.cta {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center;
  background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 20px; padding: 24px 26px;
  box-shadow: var(--shadow); margin-top: 3em !important; transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.cta:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.cta img { width: 64px; height: 64px; border-radius: 15px; display: block; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.cta .kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.cta h3 { font-family: var(--serif); font-size: 22px; margin: 4px 0 6px !important; letter-spacing: -0.01em; }
.cta p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }
.cta .go { display: inline-block; margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--link); text-decoration: none !important; }
.cta .go::after { content: " \2192"; transition: margin 0.15s; }
.cta:hover .go::after { margin-left: 3px; }
@media (max-width: 520px) { .cta { grid-template-columns: 1fr; } }

.author { display: flex; gap: 18px; align-items: flex-start; margin-top: 2.5em !important; padding-top: 2em; border-top: 1px solid var(--rule); }
.author .avatar { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-family: var(--serif); font-weight: 600; font-size: 19px; }
.author p { margin: 0; font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }
.author strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 2px; }

.more { padding: 8px 0 24px; }
.more h2 { border-top: 3px double var(--rule-ink); padding-top: 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); margin: 0 0 22px; }

/* ---------- "More from" cards at the end of a post: columns divided by rules ---------- */

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; padding: 0 24px; border-left: 1px solid var(--rule-strong); color: var(--ink); }
.card:first-child { padding-left: 0; border-left: 0; }
.card:last-child { padding-right: 0; }
.card:hover { text-decoration: none; }
.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.card .eyebrow { font-size: 11.5px; letter-spacing: 0.14em; }
.card h3 { font-family: var(--serif); font-size: 22px; line-height: 1.2; letter-spacing: -0.015em; margin: 10px 0 8px; font-weight: 700; text-wrap: balance; }
.card p { font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; flex: 1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.card .meta { font-size: 13px; color: var(--ink-3); }
@media (max-width: 760px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px 0 0; margin-top: 18px; border-left: 0; border-top: 1px solid var(--rule-strong); }
  .card:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
}

/* ---------- Engineering Notes: the masthead ---------- */

/* The strip above every post: the blog's name under the site header. */
.strip-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0 10px; border-bottom: 3px double var(--rule-ink); }
.strip-name { font-family: var(--serif); font-weight: 700; font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -0.025em; line-height: 1.1; color: var(--ink); }
.strip-name:hover { text-decoration: none; }
.strip-link { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }

/* The front page's masthead. */
.masthead { text-align: center; padding-top: 18px; }
.masthead .ear { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--rule-ink); font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.nameplate { font-family: var(--serif); font-weight: 700; font-size: clamp(46px, 10.4vw, 120px); line-height: 0.98; letter-spacing: -0.04em; margin: 22px 0 10px; color: var(--ink); text-wrap: balance; }
.motto { font-family: var(--serif); font-style: italic; font-size: clamp(16px, 2vw, 20px); line-height: 1.45; color: var(--ink-2); margin: 0 auto 20px; max-width: 640px; text-wrap: balance; }
.dateline { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-top: 3px double var(--rule-ink); border-bottom: 1px solid var(--rule-ink); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
@media (max-width: 640px) {
  .dateline { justify-content: center; flex-wrap: wrap; gap: 2px 14px; }
  .dateline .count { display: none; }
}

/* ---------- Engineering Notes: the front page ---------- */

.front { padding-top: 28px; }
.front-top { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); }
.front-top > .story-lead { padding-right: 32px; border-right: 1px solid var(--rule-strong); }
.front-top > .inside { padding-left: 28px; }
.front-row { display: grid; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--rule-ink); }
.front-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.front-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.front-row > .story { padding: 0 24px; border-left: 1px solid var(--rule-strong); }
.front-row > .story:first-child { padding-left: 0; border-left: 0; }
.front-row > .story:last-child { padding-right: 0; }

.story .kicker { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.headline { font-family: var(--serif); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
.headline a { color: var(--ink); }
.headline a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.story-lead .headline { font-size: clamp(32px, 4.6vw, 56px); line-height: 1.04; letter-spacing: -0.028em; }
.story-second .headline { font-size: clamp(25px, 2.7vw, 32px); }
.story-brief .headline { font-size: 22px; line-height: 1.18; }
.story .deck { font-family: var(--serif); font-size: 17.5px; line-height: 1.45; color: var(--ink-2); margin: 12px 0 0; text-wrap: pretty; }
.story-lead .deck { font-style: italic; font-size: clamp(19px, 2vw, 22px); }
.story-brief .deck { font-size: 16px; }
.story-meta { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); margin: 12px 0 0; }
.story-meta .by { color: var(--ink); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11.5px; }
.story-text { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); font-family: var(--serif); font-size: 17px; line-height: 1.62; color: var(--ink); }
.story-text p { margin: 0; hyphens: auto; -webkit-hyphens: auto; }
.story-text p + p { margin-top: 0.8em; }
.story-meta time, .story-meta .nowrap { white-space: nowrap; }
.story-lead .story-text { column-count: 2; column-gap: 28px; column-rule: 1px solid var(--rule); }
.story-lead .story-text p:first-child::first-letter { font-weight: 700; float: left; font-size: 3.6em; line-height: 0.86; padding: 0.06em 0.08em 0 0; }
.continue { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--link); }
.continue::after { content: " \2192"; }

/* "In this issue": every story, numbered, beside the lead. */
.inside-title { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); margin: 0; padding-bottom: 10px; border-bottom: 3px double var(--rule-ink); }
.inside ol { list-style: none; margin: 0; padding: 0; counter-reset: inside; }
.inside li { border-bottom: 1px solid var(--rule); }
.inside li a { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; padding: 13px 0; color: var(--ink); }
.inside li a::before { counter-increment: inside; content: counter(inside); grid-row: 1 / span 3; font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.1; color: var(--ink-3); }
.inside li a:hover { text-decoration: none; }
.inside li a:hover .t { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.inside .k { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.inside .t { font-family: var(--serif); font-size: 16.5px; font-weight: 600; line-height: 1.3; margin-top: 3px; }
.inside .m { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.inside-feed { font-size: 14px; margin: 14px 0 0; }

@media (max-width: 960px) {
  .front-top { grid-template-columns: minmax(0, 1fr); }
  .front-top > .story-lead { padding-right: 0; border-right: 0; }
  .front-top > .inside { padding-left: 0; margin-top: 34px; }
}
@media (max-width: 760px) {
  .front-row.cols-2, .front-row.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .front-row > .story { padding: 20px 0 0; margin-top: 20px; border-left: 0; border-top: 1px solid var(--rule-strong); }
  .front-row > .story:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
  .story-lead .story-text { column-count: 1; }
}

/* The colophon under the stories: about the writer, and the house ad for the app. */
.colophon { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; margin-top: 48px; padding-top: 22px; border-top: 3px double var(--rule-ink); }
.label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.colophon-about p { font-family: var(--serif); font-size: 17px; line-height: 1.55; color: var(--ink-2); margin: 0 0 10px; max-width: 520px; }
.house { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; padding: 20px 22px; border: 1px solid var(--rule-ink); color: var(--ink); }
.house:hover { text-decoration: none; background: var(--bg-raised); }
.house img { width: 56px; height: 56px; border-radius: 13px; display: block; }
.house-title { display: block; font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.house-text { display: block; font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-top: 6px; }
.house .go { display: inline-block; margin-top: 10px; font-size: 14.5px; font-weight: 600; color: var(--link); }
.house .go::after { content: " \2192"; }
@media (max-width: 760px) { .colophon { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Home page: a directory of the site's sections ---------- */

.home-intro { padding-top: 72px; padding-bottom: 40px; }
.home-intro h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(46px, 8.6vw, 96px); line-height: 1; letter-spacing: -0.04em; margin: 0; text-wrap: balance; }
.home-intro p { font-family: var(--serif); font-size: clamp(19px, 2.3vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 660px; margin: 18px 0 0; text-wrap: pretty; }
.home-intro .dir-label { margin-bottom: 14px; }
.directory { border-top: 3px double var(--rule-ink); }
.dir-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; padding: 30px 0; border-bottom: 1px solid var(--rule-strong); }
.dir-label { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0; padding-top: 10px; }
.dir-body > p, .dir-app p { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink-2); margin: 8px 0 0; max-width: 640px; }
.dir-body > p.dir-title, .dir-app p.dir-title { font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.dir-title a { color: var(--ink); }
.dir-body > p.dir-more, .dir-app p.dir-more { font-family: var(--sans); font-size: 14.5px; font-weight: 600; margin-top: 14px; }
.dir-more .ext::after { content: "\2197"; font-size: 0.8em; margin-left: 3px; opacity: 0.6; }
.dir-app { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.dir-icon img { width: 56px; height: 56px; border-radius: 13px; display: block; }
.dir-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--rule); max-width: 720px; }
.dir-list li { border-bottom: 1px solid var(--rule); }
.dir-list a { display: block; padding: 11px 0; color: var(--ink); }
.dir-list a:hover { text-decoration: none; }
.dir-list a:hover .t { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.dir-list .t { display: block; font-family: var(--serif); font-size: 17.5px; font-weight: 600; line-height: 1.35; }
.dir-list .m { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 680px) {
  .home-intro { padding-top: 48px; padding-bottom: 28px; }
  .dir-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 24px 0; }
  .dir-label { padding-top: 0; }
}

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--rule-ink); padding: 32px 0 56px; margin-top: 64px; font-size: 14.5px; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--ink-2); }
.site-footer nav { display: flex; gap: 8px 20px; flex-wrap: wrap; }

/* ---------- Print ---------- */

@media print {
  .site-header, .masthead-strip, .toc, .progress, .cta, .more, .site-footer, .copy, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .post-body { display: block; border: 0; }
}

/* The reading time is in the byline; the eyebrow keeps the topic only (build.py still writes both). */
.post-hero .eyebrow .dot, .post-hero .eyebrow .muted { display: none; }
.dek code { font-family: var(--mono); font-style: normal; font-size: 0.8em; }
