/* Blog: article layout on top of /assets/site.css (tokens, fonts, top bar, theme switch). */

.post { padding-top: clamp(40px, 7vw, 88px); padding-bottom: var(--section-y); } /* keeps the .wrap side gutter */
.post-head, .prose, .post-foot { max-width: 720px; margin-left: auto; margin-right: auto; }
.post-head .kicker { margin-bottom: 18px; }
.post-head h1 {
  font-size: clamp(38px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 22px;
}
.dek { font-size: clamp(18px, 1.7vw, 21px); line-height: 1.5; color: var(--ink-2); margin: 0; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 26px 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.byline a { color: var(--signal-text); text-decoration: none; }
.byline a:hover { text-decoration: underline; text-underline-offset: 3px; }

.prose { font-size: 17.5px; line-height: 1.7; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin-bottom: 0; }
.prose h2 {
  font-weight: 500; font-size: clamp(26px, 2.6vw, 32px); line-height: 1.15; letter-spacing: -.015em;
  margin: 2.2em 0 0;
}
.prose h3 { font-weight: 600; font-size: 19px; margin: 1.8em 0 0; }
.prose a { color: inherit; text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.prose a:hover { color: var(--signal-text); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose strong { font-weight: 600; }
.prose code, .prose .mono { font-size: .88em; }
.prose .note {
  padding: 14px 18px; border-left: 2px solid var(--signal); background: color-mix(in srgb, var(--signal) 7%, transparent);
  font-size: 16px; color: var(--ink-2); border-radius: 0 10px 10px 0;
}
.prose .note strong { color: var(--ink); }

/* equations: MathML, centred, scrolls sideways on a narrow phone instead of overflowing */
.eq { display: block; overflow-x: auto; padding: 4px 0; text-align: center; font-size: 1.12em; }
.eq math { margin: 0 auto; }
math { font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", math; }
.eq-n { position: relative; }
.eq-n::after { content: attr(data-n); position: absolute; right: 0; top: 50%; transform: translateY(-50%); font: 13px "IBM Plex Mono", monospace; color: var(--ink-2); }

/* figures and interactive demos can be wider than the text */
.wide { max-width: 1100px; margin: 2.4em auto 0; }
.prose + .wide, .wide + .prose { margin-top: 2.4em; }
figure { margin: 0; }
figcaption, .cap { margin-top: 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
figcaption b, .cap b { color: var(--ink); font-weight: 600; }
.wide figcaption { max-width: 720px; }
.fig-img { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--card); }

.demo {
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); border-radius: var(--radius);
  background: var(--card); padding: 18px; position: relative;
}
.demo-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; margin: 0 0 14px; }
.demo-h .kicker { margin: 0; }
.demo-h .hint { font-size: 13px; color: var(--ink-2); }
.demo canvas { display: block; width: 100%; touch-action: none; }
.nocase { text-transform: none; letter-spacing: .02em; }
.nocase b { color: var(--ink); font-weight: 500; }
.panel-title { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

.controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; margin-top: 16px; }
.ctl { display: grid; gap: 6px; min-width: 180px; flex: 1 1 200px; max-width: 360px; font-size: 13px; color: var(--ink-2); }
.ctl .row { display: flex; justify-content: space-between; gap: 10px; }
.ctl output { color: var(--ink); font-family: "IBM Plex Mono", monospace; font-size: 12.5px; }
input[type="range"] { width: 100%; accent-color: var(--signal); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font: 500 12px/1 "IBM Plex Mono", monospace; letter-spacing: .05em; text-transform: uppercase;
  padding: 9px 14px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: transparent; color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.btn[aria-pressed="true"], .btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }

.legend-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend-row i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.legend-row i.dot { width: 9px; height: 9px; border: 0; border-radius: 50%; }
.readout { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--ink-2); }
.readout b { color: var(--ink); font-weight: 500; }
.loader { display: grid; place-items: center; gap: 12px; min-height: 220px; text-align: center; color: var(--ink-2); font-size: 14px; }

.grid2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.grid2 > * { min-width: 0; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.refs { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); padding-left: 1.4em; }
.refs li + li { margin-top: .6em; }
.refs a { color: var(--signal-text); text-decoration: none; word-break: break-word; }
.refs a:hover { text-decoration: underline; }

.post-foot { margin-top: 3.2em; padding-top: 22px; border-top: 1px dotted var(--route); display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: 14px; }
.post-foot a { color: var(--signal-text); text-decoration: none; }
.post-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* blog index */
/* the blog's landing page */
.blog-home { padding-bottom: 40px; }
.blog-hero { padding: clamp(40px, 8vh, 96px) 0 8px; max-width: 900px; }
.blog-hero h1 { font-size: clamp(42px, 7vw, 92px); line-height: .98; letter-spacing: -.035em; font-weight: 600; margin: 0 0 22px; }
.blog-hero h1 span { color: var(--ink-2); font-weight: 400; }
.blog-hero .dek { max-width: 640px; }
.blog-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 20px 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.blog-meta a { color: var(--signal-text); text-decoration: none; }
.blog-meta a:hover { text-decoration: underline; text-underline-offset: 4px; }
.series { padding: clamp(40px, 7vh, 72px) 0 0; }
.series-head { max-width: 760px; margin-bottom: 26px; }
.series-head h2 { margin: 6px 0 10px; font-weight: 500; font-size: var(--h3); line-height: 1.12; letter-spacing: -.015em; }
.series-head p:not(.kicker) { margin: 0; color: var(--ink-2); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; counter-reset: part; }
.cards a { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; color: inherit; text-decoration: none; background: var(--card); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 16px; overflow: hidden; transition: transform .2s, border-color .2s; outline: none; }
.cards a:hover, .cards a:focus-visible { transform: translateY(-3px); border-color: var(--signal); }
.cards img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.cards .part { display: block; margin: 18px 20px 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--signal-text); }
.cards h3 { margin: 8px 20px 10px; font-weight: 500; font-size: 22px; line-height: 1.18; letter-spacing: -.01em; }
.cards p { margin: 0 20px 22px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.cards a:hover h3, .cards a:focus-visible h3 { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.cards.solo { grid-template-columns: 1fr; }
.cards.solo a { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; }
.cards.solo img { height: 100%; border-bottom: 0; }
.cards.solo div { padding: 10px 14px; }
.cards.solo h3 { font-size: 26px; }
@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .cards, .cards.solo a { grid-template-columns: 1fr; }
  .cards.solo img { height: auto; }
  .cards.solo div { padding: 0; }
  .cards.solo h3 { font-size: 22px; }
}

.site-foot { padding-top: 28px; padding-bottom: 40px; border-top: 1px dotted var(--route); font-size: 12px; letter-spacing: .04em; color: var(--ink-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.site-foot a { color: var(--signal-text); text-decoration: none; }

@media (max-width: 720px) {
  .prose { font-size: 16.5px; }
  .demo { padding: 14px; border-radius: 12px; }

}

/* colour bar for the cold-to-warm overlays */
.cbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--ink-2); }
.cbar i { flex: 0 1 180px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #00f, #0ff, #0f0, #ff0, #f00); }

/* pipeline diagrams: inline SVG from tools/blog/diagrams.py, wide and phone layouts */
.dgm svg { display: block; width: 100%; height: auto; overflow: visible; }
.dgm .dgm-w { max-width: 880px; margin: 0 auto; }
.dgm .dgm-n { display: none; max-width: 420px; margin: 0 auto; }
@media (max-width: 600px) { .dgm .dgm-w { display: none; } .dgm .dgm-n { display: block; } }
.dgm text { font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .04em; fill: var(--ink-2); }
.dgm text.out { fill: var(--signal-text); font-weight: 500; font-size: 11.5px; }
.dgm text.trn-t { fill: var(--honey-text); }
.dgm text.rg { fill: var(--ink); }
.dgm .ln, .dgm .axis { fill: none; stroke: var(--ink-2); stroke-width: 1.3; }
.dgm .arh { fill: var(--ink-2); }
.dgm .trn { fill: none; stroke: var(--honey); stroke-width: 1.6; stroke-dasharray: 5 4; }
.dgm .shared { fill: none; stroke: var(--ink-2); stroke-width: 1.2; }
.dgm .slab { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.dgm .frame { fill: none; stroke: var(--route); stroke-width: 1; }
.dgm .box { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.2; }
.dgm .region { fill: none; stroke: var(--route); stroke-width: 1.2; stroke-dasharray: 6 5; }
.dgm .star circle { fill: var(--card); stroke: var(--ink); stroke-width: 1.4; }
.dgm .star polygon { fill: var(--ink); }
.dgm .bar { fill: var(--ink-2); opacity: .45; }
.dgm .bar.pk { fill: var(--signal); opacity: 1; }
.dgm .px { image-rendering: pixelated; }
.dgm figcaption, .flowfig figcaption { margin-left: auto; margin-right: auto; }

/* workflow comparison: two lanes of steps, side by side on wide screens, stacked on phones */
.flowfig { display: grid; gap: 22px; }
.flowfig .lane-h { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; gap: 26px; }
.flow li { position: relative; flex: 1 1 0; padding: 12px 14px 13px; border-radius: 10px; background: var(--card); border: 1.2px solid var(--route); border-top: 4px solid var(--signal); font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.flow li[data-where="server"] { border-top-color: var(--honey); }
.flow li b { display: block; margin-bottom: 3px; font-weight: 600; color: var(--ink); }
.flow li + li::before { content: "→"; position: absolute; left: -21px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-size: 16px; }
.flow-key { margin: 0; display: flex; gap: 18px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.flow-key span::before { content: ""; display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 7px; vertical-align: middle; background: var(--signal); }
.flow-key span[data-where="server"]::before { background: var(--honey); }
@media (max-width: 640px) {
  .flow { flex-direction: column; gap: 22px; }
  .flow li + li::before { content: "↓"; left: 50%; top: -19px; transform: translateX(-50%); }
}

/* a post that is still being written */
.wip { margin: 22px 0 0; max-width: 720px; padding: 14px 18px; border-radius: 12px; background: color-mix(in srgb, var(--honey) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--honey) 45%, transparent); border-left: 4px solid var(--honey); }
.wip p { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink); }
.wip p.mono { margin-bottom: 4px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--honey-text); }
.wip-tag { color: var(--honey-text); }
.cards a { position: relative; }
.wip-badge { position: absolute; top: 12px; left: 12px; padding: 5px 10px; border-radius: 999px; background: var(--honey); color: #1d1c19; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }

/* comparison table (opinion post): three columns on wide screens, one card per row on phones */
.cmp-fig { max-width: 820px; margin: 2em auto 0; }
.cmp { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.cmp thead th { font: 500 11.5px/1.3 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border-bottom: 1.5px solid var(--ink); }
.cmp thead th:nth-child(2) { color: var(--honey-text); }
.cmp thead th:nth-child(3) { color: var(--signal-text); }
.cmp tbody th { font-weight: 600; width: 28%; }
.cmp td { color: var(--ink-2); }
.cmp tr.sep > * { border-top: 1.5px solid var(--route); }
.cmp-fig figcaption { padding: 0 14px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  .cmp thead { display: none; }
  .cmp, .cmp tbody, .cmp tr, .cmp th, .cmp td { display: block; width: auto; }
  .cmp tr { padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
  .cmp tr.sep { border-top: 1.5px solid var(--route); margin-top: 10px; }
  .cmp tr.sep > * { border-top: 0; }
  .cmp th, .cmp td { padding: 2px 0; border: 0; }
  .cmp tbody th { width: auto; margin-bottom: 4px; }
  .cmp td::before { content: attr(data-k); display: block; font: 500 10.5px/1.6 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
  .cmp td:nth-of-type(1)::before { color: var(--honey-text); }
  .cmp td:nth-of-type(2)::before { color: var(--signal-text); }
  .cmp td + td { margin-top: 6px; }
  .cmp-fig figcaption { padding: 0; }
}

/* a short decision checklist: question on the left, the leaning on the right */
.prose ol.rule { list-style: none; padding: 0; counter-reset: q; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.prose .rule li { counter-increment: q; display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 10px 0; margin: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); font-size: 16px; line-height: 1.5; }
.rule li::before { content: counter(q); font: 500 12px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-2); }
.rule b { font: 500 11.5px/1.4 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-align: right; }
.rule b::before { content: "→ "; color: var(--ink-2); }
.rule .to-map { color: var(--honey-text); }
.rule .to-less { color: var(--signal-text); }
@media (max-width: 640px) {
  .prose .rule li { grid-template-columns: 1.6em minmax(0, 1fr); }
  .rule b { grid-column: 2; text-align: left; white-space: normal; }
}

/* line illustrations (opinion post): inline SVG in the style of the cover, coloured from the theme */
.ill svg { display: block; width: 100%; height: auto; overflow: visible; }
.ill .ill-w { max-width: 880px; margin: 0 auto; }
.ill .ill-n { display: none; max-width: 420px; margin: 0 auto; }
@media (max-width: 600px) { .ill .ill-w { display: none; } .ill .ill-n { display: block; } }
.ill figcaption { margin-left: auto; margin-right: auto; }
.ill .k { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ill .k2 { fill: none; stroke: var(--ink-2); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.ill .kd { fill: none; stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 3 4; stroke-linecap: round; }
.ill .kf { fill: var(--ink); }
.ill .grid { fill: none; stroke: var(--grid); stroke-width: 1; }
.ill .rt { fill: none; stroke: var(--honey); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ill .rtd { fill: none; stroke: var(--honey); stroke-width: 1.8; stroke-dasharray: 2 5; stroke-linecap: round; }
.ill .hf { fill: var(--honey); }
.ill .sg { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ill .sgf { fill: var(--signal); }
.ill .fov { fill: var(--signal); opacity: .15; }
.ill .water { fill: var(--signal); opacity: .35; }
.ill .card { fill: var(--card); stroke: var(--route); stroke-width: 1; }
.ill .paper { fill: var(--paper); }
.ill text { font: 500 11px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .04em; fill: var(--ink-2); }
.ill text.t-ink { fill: var(--ink); }
.ill text.t-sg { fill: var(--signal-text); }
.ill text.t-hn { fill: var(--honey-text); }
.ill text.t-h { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; fill: var(--ink); }
.ill text.t-big { font-size: 14px; }
