/*
 * The Workbench: grid paper, ink, and the favicon's green. docs/design.md is the brief; the
 * token names below are the contract that templates and later styles use.
 */

/* --- tokens ---------------------------------------------------------------------------- */

:root {
  /* paper and ink */
  --paper:       #f1f1e7;   /* page background, cream with a slight green bias */
  --paper-2:     #fafaf4;   /* cards, raised surfaces */
  --ink:         #1a1c15;   /* text */
  --ink-2:       #55594a;   /* secondary text */
  --ink-3:       #737862;   /* labels, dates */
  --rule:        #d5d6c5;   /* hairlines */
  --grid:        rgb(96 124 40 / 0.08);  /* grid paper lines */
  /* the favicon's green, the one accent */
  --leaf:        #94b34d;   /* exactly the favicon: fills, underlines, highlighter, solid chips on hover */
  --leaf-strong: #6f8f2a;   /* green glyphs and dots that must show on paper */
  --leaf-ink:    #4a6716;   /* green text: link hover, current nav item, the hero's emphasis */
  --leaf-on:     #1a1c15;   /* text on a --leaf fill */
  --blueprint:   #3552c9;   /* secondary: "shipped" status dots, focus rings */
  --shadow:      3px 3px 0 var(--ink);   /* hard offset shadow for cards, used sparingly */
  /* type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body:    "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* layout */
  --measure: 40rem;   /* reading width */
  --wide:    68rem;   /* home and list pages */
  --radius:  4px;
  --grid-size: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121410; --paper-2: #1a1d16; --ink: #e8eadb; --ink-2: #b0b39f; --ink-3: #868a74;
    --rule: #30342a; --grid: rgb(170 200 100 / 0.05);
    --leaf: #94b34d; --leaf-strong: #a9c862; --leaf-ink: #b9d675; --leaf-on: #121410;
    --blueprint: #93a6ff; --shadow: 3px 3px 0 #000;
    color-scheme: dark;
  }
}

/* --- base ------------------------------------------------------------------------------ */

/* Generated textures: SVG filters drawn as alpha, layered over a colour token. */
:root {
  --tex-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1.8' lighting-color='#fff'%3E%3CfeDistantLight azimuth='45' elevation='58'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  -0.3 0 0 0 0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --tex-fibres: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .22' numOctaves='2' seed='8' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 1.25'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.16'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --tex-card: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.03 .9' numOctaves='2' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.6 .95'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.22'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --tex-linen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9 .03' numOctaves='1' seed='2' stitchTiles='stitch' result='a'/%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.03 .9' numOctaves='1' seed='4' stitchTiles='stitch' result='b'/%3E%3CfeBlend in='a' in2='b' mode='multiply'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  -1.4 0 0 0 .75'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.95'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --tex-wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='40'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .35' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  -2 0 0 0 1.3'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.7'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --tex-tape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='30'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8 .2' numOctaves='2' seed='6' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 -1 .7'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.35'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
  --grain-blend: multiply;
  --grain-opacity: 0.11;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tex-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='1.8' lighting-color='#fff'%3E%3CfeDistantLight azimuth='45' elevation='58'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0.09 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(#f)'/%3E%3C/svg%3E");
    --grain-blend: screen;
    --grain-opacity: 0.08;
  }
}

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

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    var(--tex-fibres), var(--tex-paper),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 320px 320px, 260px 260px, var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size);
  font: 400 1.125rem/1.6 var(--font-body);
  font-variation-settings: "opsz" 14;
  -webkit-font-smoothing: antialiased;
}

/* Grain: a fixed layer of fine noise over everything. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1;
  font-weight: 600; letter-spacing: -0.01em; line-height: 1.2;
}

a { color: inherit; text-decoration-color: var(--leaf); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { color: var(--leaf-ink); }
:focus-visible { outline: 2px solid var(--blueprint); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

.wrap {
  max-width: var(--wide); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--paper-2); color: var(--ink); padding: 0.5rem 1rem; z-index: 101; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.label, .mono { font-family: var(--font-mono); }
.label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.chip {
  font: 0.75rem/1 var(--font-mono); color: var(--ink); text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.45rem 0.6rem;
  background: var(--paper-2); display: inline-flex; gap: 0.4rem; align-items: center;
}
.chip.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.solid:hover { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-on); }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--leaf-strong); display: inline-block; }
.dot.shipped { background: var(--blueprint); }
.dot.resting { background: var(--ink-3); }

/* Highlighter: a soft full-height tint, never a stripe or an underline. */
mark, .hl {
  color: var(--ink); background: color-mix(in srgb, var(--leaf) 24%, transparent);
  border-radius: 3px; padding: 0.05em 0.25em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Crop marks: four L-shaped corners; the element holds <span class="c1"> and <span class="c2">. */
.marked { position: relative; }
.marked::before, .marked::after, .marked > .c1, .marked > .c2 {
  content: ""; position: absolute; width: 14px; height: 14px; border-color: var(--ink-3); border-style: solid;
}
.marked::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.marked::after { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.marked > .c1 { top: 0; right: 0; border-width: 1px 1px 0 0; }
.marked > .c2 { bottom: 0; left: 0; border-width: 0 0 1px 1px; }

/* ASCII art: pictures drawn in text, animated by site.js. */
.ascii-figure { margin: 1.5rem 0; padding: 1.25rem; }
.ascii {
  font-family: var(--font-mono); font-size: clamp(0.55rem, 1.35vw, 0.9rem); line-height: 1.15;
  color: var(--ink-2); white-space: pre; margin: 0; overflow-x: auto;
}
.ascii .hot { color: var(--leaf-strong); }
.ascii-figure.small .ascii { font-size: 0.68rem; }
.ascii-figure figcaption { margin-top: 0.75rem; }
.not-found .ascii-figure { display: inline-block; max-width: 100%; text-align: left; }

/* Leaders: a dotted line between a title and its date. */
.leader { flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-0.3em); min-width: 1rem; }

/* Sections are numbered by the stylesheet, never the template. */
main { counter-reset: section; }
.section-head .label::before { counter-increment: section; content: counter(section, decimal-leading-zero) " — "; }

/* --- header & footer ------------------------------------------------------------------- */

.site-header { padding: 1.25rem 0; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 2rem; }
.wordmark { text-decoration: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; }
.wordmark b {
  font-family: var(--font-display); font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  font-size: 1.5rem; font-weight: 650;
}
.site-nav ul {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; list-style: none; margin: 0; padding: 0;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.site-nav a { text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--leaf-ink); }

main { padding-top: 2rem; padding-bottom: 3rem; }

/* The top edge is a row of punched holes over a dashed rule, like a page torn from a pad. */
.site-footer {
  background:
    radial-gradient(circle at 6px 0, var(--paper) 3px, transparent 3.5px) top left / 12px 8px repeat-x,
    var(--tex-card), var(--paper-2);
  border-top: 1px dashed var(--ink-3);
  box-shadow: 0 -1px 0 var(--ink);
  margin-top: 2rem; padding: 2rem 0 3rem;
}
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1.5rem 3rem; }
.site-footer p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.footer-bio { max-width: 44rem; display: flex; gap: 1.5rem; align-items: center; }
.footer-text { display: grid; gap: 0.75rem; }
/* The ASCII portrait; hover or focus fades the photo in over it. */
.portrait { margin: 0; position: relative; flex: none; display: grid; justify-items: center; gap: 0.4rem; outline-offset: 4px; }
.portrait .ascii-figure { margin: 0; }
.portrait .ascii { font-size: 0.4rem; line-height: 1.1; color: var(--ink-2); overflow: visible; }
.portrait img {
  position: absolute; top: 50%; left: 50%; width: 9.5rem; height: 9.5rem;
  transform: translate(-50%, calc(-50% - 0.7rem)) scale(0.96);
  border-radius: 50%; border: 1px solid var(--ink); box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.5s, transform 0.5s; pointer-events: none;
}
.portrait:hover img, .portrait:focus-visible img { opacity: 1; transform: translate(-50%, calc(-50% - 0.7rem)) scale(1); }
.portrait-photo { flex: none; width: 4.5rem; height: 4.5rem; border-radius: 50%; border: 1px solid var(--ink); box-shadow: var(--shadow); }
@media (max-width: 34rem) {
  .footer-bio { flex-direction: column; align-items: flex-start; }
}
.footer-bio b { color: var(--ink); font-family: var(--font-display); font-weight: 600; }
.site-footer .copyright { font-size: 0.72rem; color: var(--ink-3); }
.social {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.55rem; text-align: right;
  list-style: none; padding: 0; margin: 0; font: 0.8rem var(--font-mono);
}

/* Webrings and friends' buttons: a row under the rest, only when webrings.yml lists some. */
.site-footer .webrings { grid-column: 1 / -1; }
.webrings {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem;
  border-top: 1px dotted var(--rule); padding-top: 1rem;
}
.ring { display: flex; flex-wrap: wrap; gap: 0.75rem; font: 0.8rem var(--font-mono); }
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.buttons img { display: block; }
.buttons img[src$=".gif"], .buttons img[src$=".png"] { image-rendering: pixelated; }

@media (max-width: 34rem) {
  .site-footer .wrap { grid-template-columns: 1fr; }
  .social { flex-direction: row; flex-wrap: wrap; align-items: baseline; text-align: left; gap: 0.4rem 1rem; }
}

/* --- shared lists ---------------------------------------------------------------------- */

.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem;
  border-bottom: 1px solid var(--ink); padding-bottom: 0.5rem; margin-bottom: 1.25rem;
}
.section-head .label { color: var(--ink); font-weight: 600; }
.more { font: 0.8rem var(--font-mono); text-decoration: none; color: var(--ink-2); }

.page-title { font-size: 2.5rem; line-height: 1.1; margin: 0 0 1.5rem; }
.lede { color: var(--ink-2); font-size: 1.15rem; margin-top: -0.75rem; }

/* A section page's title, with its small ASCII piece beside it like a plate number. */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; }
.page-head > div { min-width: 0; }
.page-head .page-art { margin: 0; padding: 0; flex: none; }
.page-head .page-art .ascii { overflow: hidden; }
@media (max-width: 40rem) {
  .page-head { flex-direction: column-reverse; gap: 0.75rem; }
}
@media (max-width: 24rem) { .page-head .page-art { display: none; } }
.muted { color: var(--ink-2); }

/* --- lists of posts -------------------------------------------------------------------- */

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.tags a, .tags li:not(:has(a)) {
  display: inline-block; font: 0.75rem/1 var(--font-mono); color: var(--ink-2); text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.4rem 0.55rem; background: var(--paper-2);
}
.tags a:hover { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-on); }
.tags-large a, .tags-large li:not(:has(a)) { font-size: 0.9rem; }
.tag-cloud { margin-bottom: 2rem; }

/* The writing list: every title, grouped by year, the year sticky in its own column. */
.writing { display: grid; grid-template-columns: 6rem 1fr; gap: 0 1.5rem; }
.year { font: 600 1.5rem/1 var(--font-mono); color: var(--ink-3); margin: 0; padding-top: 0.65rem; position: sticky; top: 1rem; align-self: start; }
.posts { list-style: none; margin: 0 0 1.75rem; padding: 0; }
.posts li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.4rem 0; }
.posts a { text-decoration: none; font-size: 1.08rem; }
.posts a:hover { text-decoration: underline; text-decoration-color: var(--leaf); }
.posts time { font: 0.8rem var(--font-mono); color: var(--ink-3); white-space: nowrap; }

@media (max-width: 34rem) {
  .writing { grid-template-columns: 1fr; }
  .year { position: static; padding: 1rem 0 0.25rem; }
  .posts li { flex-wrap: wrap; gap: 0 0.75rem; }
  .posts .leader { display: none; }
}

/* Older and newer: two cards side by side. */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.post-nav a {
  display: grid; gap: 0.35rem; align-content: start; text-decoration: none;
  font: 600 1.05rem/1.3 var(--font-display); background: var(--tex-card), var(--paper-2);
  border: 1px solid var(--ink); border-radius: var(--radius); padding: 0.85rem 1rem;
}
.post-nav a:hover { box-shadow: var(--shadow); }
.post-nav .label { font-weight: 400; }
.post-nav a[rel="next"] { grid-column: 2; text-align: right; }
.post-nav a:has(.topo) { grid-template-columns: 3rem 1fr; column-gap: 0.75rem; }
.post-nav a[rel="next"]:has(.topo) { grid-template-columns: 1fr 3rem; }
.post-nav .topo, .related .topo { width: 3rem; height: 3rem; flex: none; border: 1px solid var(--ink); background: var(--paper); }
.post-nav .topo { grid-row: span 2; }
.post-nav a[rel="next"] .topo { grid-column: 2; }
.related .posts li:has(.topo) { align-items: center; }
@media (max-width: 34rem) { .post-nav { grid-template-columns: 1fr; } .post-nav a[rel="next"] { grid-column: 1; } }

/* --- likes ----------------------------------------------------------------------------- */

.like { display: inline-block; margin: 0; }
.like button {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  font: 0.75rem/1 var(--font-mono); color: var(--ink-2);
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.4rem 0.6rem;
}
.like-icon { fill: none; stroke: currentColor; stroke-width: 2; }
.like button:hover { color: var(--ink); border-color: var(--ink-3); }
.like button[aria-pressed="true"] { color: var(--ink); }
.like button[aria-pressed="true"] .like-icon { fill: var(--leaf-strong); stroke: var(--leaf-strong); }
.like button:disabled { opacity: 0.6; }

/* --- posts and pages ------------------------------------------------------------------- */

.post, .page, .comments, .post-nav, .related { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.post-header { margin-bottom: 2rem; }
.post-header .label { margin: 0 0 0.6rem; }
.post-header .label a { color: inherit; }
.post-header h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 0.9rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font: 0.8rem var(--font-mono); color: var(--ink-3); }
/* A generated contour map (templates/partials/topo.html), for posts without an image. */
.topo { display: block; width: 100%; height: 100%; }
.post-topo {
  position: relative; height: 9rem; margin-bottom: 1.5rem; overflow: hidden;
  border: 1px solid var(--ink); box-shadow: var(--shadow); background: var(--paper);
}
.title-block {
  position: absolute; right: 0; bottom: 0; margin: 0; display: grid;
  background: var(--paper-2); border-left: 1px solid var(--ink); border-top: 1px solid var(--ink);
  font: 0.68rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2);
}
.title-block span { padding: 0.2rem 0.55rem; }
.title-block span + span { border-top: 1px solid var(--rule); }
@media (max-width: 34rem) { .post-topo { height: 6rem; } }
.post-image { display: block; width: 100%; margin-top: 1.5rem; border: 1px solid var(--ink); box-shadow: var(--shadow); }
.draft-flag { display: inline-block; background: var(--leaf); color: var(--leaf-on); padding: 0.1rem 0.5rem; border-radius: var(--radius); }
.post-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--ink); }
.chip.toot:hover { border-color: var(--ink-3); }

/* Contents: a box with crop marks. */
.toc { padding: 1rem 1.5rem; margin: 0 0 2rem; font-size: 0.95rem; }
.toc h2.label { font-weight: 400; margin: 0 0 0.4rem; }
.toc ul { margin: 0.25rem 0; padding-left: 1.1rem; }

.prose { overflow-wrap: break-word; line-height: 1.7; counter-reset: h2 1; }
.prose h2 { font-size: 1.7rem; margin: 2.5rem 0 0.75rem; }
/* Sections numbered from 02: what comes before the first heading is 01. */
.prose h2::before {
  counter-increment: h2; content: counter(h2, decimal-leading-zero) ".";
  font: 400 0.85rem var(--font-mono); color: var(--ink-3); margin-right: 0.6rem; vertical-align: 0.3em;
}
.prose h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }
.prose .anchor { display: none; }
.prose img { border: 1px solid var(--rule); border-radius: var(--radius); }
.prose blockquote { margin: 1.75rem 0; padding-left: 1.25rem; border-left: 3px solid var(--leaf); color: var(--ink-2); font-style: italic; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 1rem; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.4rem 0.75rem 0.4rem 0; text-align: left; }
.prose th { font: 600 0.72rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; border-bottom-color: var(--ink); }
.prose hr { border: 0; margin: 2.5rem 0; text-align: center; color: var(--ink-3); }
.prose hr::after { content: "· · ·"; font-family: var(--font-mono); letter-spacing: 0.4em; }
/* ASCII art in a post: crop marks round it; on phones the drawing scrolls, never the page. */
.prose .ascii-figure, .post-cover { margin: 1.75rem 0; padding: 1.25rem; max-width: 100%; }
.prose .ascii-figure .ascii, .post-cover .ascii {
  font-size: clamp(0.55rem, 1.6vw, 0.85rem); overflow-x: auto;
  background: none; border: 0; border-radius: 0; padding: 0;
}
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--paper-2); border: 1px solid var(--rule); padding: 0.05em 0.3em; border-radius: 3px; }
pre { position: relative; font-family: var(--font-mono); background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; overflow-x: auto; line-height: 1.45; }
pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; }
/* The fence's language, written on the block's corner. */
pre[data-lang] { padding-top: 1.5rem; }
pre[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 0.35rem; right: 0.6rem;
  font: 0.68rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
}
/* The About photo, as a print taped to the page. */
.print {
  position: relative; float: right; width: 14rem; margin: 0.5rem 0 1.5rem 1.75rem;
  background: var(--paper-2); padding: 0.6rem 0.6rem 1.6rem; box-shadow: var(--shadow); transform: rotate(1.5deg);
}
.print img { display: block; width: 100%; height: auto; }
.print::before {
  content: ""; position: absolute; top: -0.6rem; left: -1.2rem; width: 5.5rem; height: 1.4rem;
  transform: rotate(-35deg);
  background: var(--tex-tape), color-mix(in srgb, var(--leaf) 60%, transparent);
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 18% 0, 82% 4%, 88% 0, 94% 9%, 100% 2%, 100% 92%, 94% 100%, 88% 90%, 82% 100%, 18% 96%, 12% 100%, 6% 92%, 0 100%);
}

.related { margin-top: 2.5rem; }
.related h2.label { font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 0.5rem; margin: 0 0 0.5rem; }

/* --- comments -------------------------------------------------------------------------- */

.comments { margin-top: 3rem; }
.comment-list { list-style: none; padding: 0; }
.comment { border-top: 1px dotted var(--rule); padding: 1rem 0; }
.comment header { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.comment-name { font-weight: 600; }
.comment-date { font: 0.75rem var(--font-mono); color: var(--ink-3); }
.comment-body p { margin: 0.5rem 0; }
.by-author { background: var(--tex-card), var(--paper-2); border: 1px solid var(--rule); padding-left: 1rem; padding-right: 1rem; border-radius: var(--radius); }
.badge { font: 0.68rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; background: var(--leaf); color: var(--leaf-on); border-radius: var(--radius); padding: 0.15rem 0.45rem; }

.notice { background: var(--paper-2); border: 1px solid var(--leaf-strong); padding: 0.75rem 1rem; border-radius: var(--radius); }
.error { color: #b00020; font-weight: 600; }
@media (prefers-color-scheme: dark) { .error { color: #ff8a80; } }

/* --- forms ----------------------------------------------------------------------------- */

form label { display: block; font: 0.72rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); margin-bottom: 0.25rem; }
input:not([type="hidden"]), textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--ink); border-radius: var(--radius); padding: 0.5rem 0.65rem;
}
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--blueprint); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }
.comment-form button[type="submit"], .admin button, .admin-login button {
  font: 0.85rem var(--font-mono); background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: var(--radius); padding: 0.5rem 1rem;
}
.comment-form button[type="submit"]:hover, .admin button:hover, .admin-login button:hover { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-on); }
.admin button.secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.admin button.danger { background: #b00020; border-color: #b00020; color: #fff; }
.form-note { color: var(--ink-2); font-size: 0.85rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- now ------------------------------------------------------------------------------ */

.now { list-style: none; margin: 0; padding: 0; }
.now li { padding: 0.55rem 0 0.55rem 1.4rem; border-bottom: 1px dotted var(--rule); position: relative; font-size: 1.02rem; }
.now li::before { content: "→"; position: absolute; left: 0; font-family: var(--font-mono); color: var(--leaf-strong); }

/* --- books, links, projects ------------------------------------------------------------ */

/* /books/: favourites on the shelf with their notes, then every cover in a grid. */
.favourites { margin-bottom: 2.5rem; }
.favourites .shelf { flex-wrap: wrap; }
.favourites .shelf p { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--ink-2); }
.book-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 1.75rem 1.25rem; }
.book-grid li { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.book-grid .cover { width: 7rem; margin-bottom: 0.4rem; }
.book-grid h2 { font-size: 0.95rem; line-height: 1.2; margin: 0; overflow-wrap: break-word; }
.book-grid .favourite h2::before { content: "★ "; color: var(--leaf-strong); }
.book-grid .like { align-self: flex-start; }
/* /links/: a group's rows, name … domain and heart, the description under the name. */
.link-groups { display: grid; gap: 2.5rem 3rem; align-items: start; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 0.45rem 0; min-width: 0; }
.link-row { display: flex; gap: 0.75rem; align-items: baseline; min-width: 0; }
.link-row .like { align-self: center; }
.link-list .domain { font: 0.75rem var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.link-list p { margin: 0.15rem 0 0; font-size: 0.9rem; color: var(--ink-2); }
@media (min-width: 60rem) {
  .link-groups { grid-template-columns: 1fr 1fr; }
}
.projects-grid + .project-list { margin-top: 1.75rem; }
/* Libraries, tools and the archive: one line each, title … chips and heart. */
.project-list { list-style: none; margin: 0; padding: 0; }
.project-list > li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.4rem 0; }
.project-list > li > a { text-decoration: none; font-size: 1.08rem; }
.project-list > li > a:hover { text-decoration: underline; text-decoration-color: var(--leaf); }
.project-list .tags { flex: none; }
.project-list .like { align-self: center; }
.build-together { margin-top: 1rem; }
@media (max-width: 34rem) {
  .project-list > li { flex-wrap: wrap; gap: 0.4rem 0.75rem; }
  .project-list .leader { display: none; }
}

/* --- ideas --------------------------------------------------------------------------- */

.idea { padding: 1.25rem 0; border-top: 1px dotted var(--rule); }
.idea h2 { font-size: 1.3rem; margin: 0.6rem 0 0.25rem; }
.idea .summary { margin: 0 0 0.5rem; color: var(--ink-2); }
.idea .prose p { margin: 0.4rem 0; }
.idea footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.dot.prototyping { background: var(--leaf-strong); }
.dot.brewing { background: var(--ink-3); }
.dot.built { background: var(--blueprint); }
.dot.dropped { background: transparent; border: 1px solid var(--ink-3); }
.chip.dropped { text-decoration: line-through; color: var(--ink-3); }

.not-found { text-align: center; padding: 3rem 0; }

/* --- home ----------------------------------------------------------------------------- */

.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; padding: 1rem 0 3.5rem; }
.hero > div { min-width: 0; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.02; margin: 0.5rem 0 1.25rem; letter-spacing: -0.025em; }
.hero h1 em { font-style: italic; color: var(--leaf-ink); }
.hero p { color: var(--ink-2); max-width: 32rem; margin: 0 0 1.5rem; }
.hero .stats { margin: 1.25rem 0 0; color: var(--ink-3); }
.hero .ascii-figure { margin: 0; min-width: 0; }

main > section, main > .split > section, main > .talk-row > section { padding: 2.25rem 0; }
.split { display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; }
.split.even { grid-template-columns: 1fr 1fr; }
.split > * { min-width: 0; }
.updated { margin-top: 0.75rem; }

.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(14.5rem, 100%), 1fr)); gap: 1.75rem 1.25rem;
  list-style: none; margin: 0; padding: 0.5rem 0 0;
}
.project-card {
  position: relative; background: var(--tex-card), var(--paper-2); border: 1px solid var(--ink); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
/* A strip of tape pins each card, tilted one way then the other. */
.project-card::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 5.5rem; height: 1.4rem;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--tex-tape), color-mix(in srgb, var(--leaf) 60%, transparent);
  clip-path: polygon(0 8%, 6% 0, 12% 10%, 18% 0, 82% 4%, 88% 0, 94% 9%, 100% 2%, 100% 92%, 94% 100%, 88% 90%, 82% 100%, 18% 96%, 12% 100%, 6% 92%, 0 100%);
}
.project-card:nth-child(2n)::before { transform: translateX(-40%) rotate(2.5deg); }
.project-card:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.project-card .ascii-figure { margin: 0.35rem 0 0; padding: 0 0 0.6rem; border-bottom: 1px dashed var(--rule); }
.project-card .ascii { font-size: 0.68rem; overflow: hidden; }
.project-card h3 { margin: 0.1rem 0 0; font-size: 1.3rem; }
.project-card h3 a { text-decoration: none; }
.project-card p { margin: 0; color: var(--ink-2); font-size: 0.95rem; flex: 1; }
.project-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.dot.archived { background: transparent; border: 1px solid var(--ink-3); }

ul.ideas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr)); gap: 0 2.5rem; }
ul.ideas li { padding: 0.9rem 0; border-bottom: 1px dotted var(--rule); }
ul.ideas h3 { font-size: 1.15rem; margin: 0.35rem 0 0.2rem; }
ul.ideas h3 a { text-decoration: none; }
ul.ideas p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }

.talk { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.talk li { background: var(--tex-card), var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.85rem 1rem; display: grid; gap: 0.4rem; }
.talk p { margin: 0; font-size: 1rem; overflow-wrap: break-word; }
.talk .who { font: 0.75rem var(--font-mono); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
.talk .who b { color: var(--ink-2); font-weight: 600; }
.talk.comments p::before { content: "\201C"; font: 600 1.6rem/0 var(--font-display); color: var(--leaf-strong); vertical-align: -0.45rem; margin-right: 0.15rem; }
.talk.toots li { border-left: 3px solid var(--leaf); }

/* Books on a wooden plank, each tilted a little, straightening on hover. */
.shelf {
  display: flex; gap: 1.1rem; list-style: none; margin: 0; padding: 0.5rem 0.75rem 0.9rem;
  background:
    var(--tex-wood) bottom / 600px 16px repeat-x,
    linear-gradient(color-mix(in srgb, var(--ink-3) 55%, var(--paper)), color-mix(in srgb, var(--ink-3) 55%, var(--paper))) bottom / 100% 16px no-repeat;
  box-shadow: inset 0 -16px 0 -14px var(--ink-2);
}
.shelf li { width: 6.5rem; min-width: 0; }
.shelf .label { display: block; margin-top: 0.6rem; }
.cover {
  display: flex; align-items: flex-end; aspect-ratio: 2 / 3; overflow: hidden; text-decoration: none;
  border: 1px solid var(--ink); box-shadow: var(--shadow); padding: 0.5rem;
  font: 600 0.8rem/1.15 var(--font-display); overflow-wrap: anywhere;
  background: var(--tex-linen), #e6e0c8; background-blend-mode: multiply; color: #1a1c15;
  transition: transform 0.2s;
}
.cover.has-image { padding: 0; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shelf li:nth-child(1) .cover { transform: rotate(-1.5deg); }
.shelf li:nth-child(2) .cover { transform: rotate(1deg); background: var(--tex-linen), #24301d; color: #eef0e0; }
.shelf li:nth-child(3) .cover { transform: rotate(-0.5deg); background: var(--tex-linen), #94b34d; }
.shelf li:nth-child(4) .cover { transform: rotate(2deg); background: var(--tex-linen), #d9dccd; }
.shelf li:hover .cover, .shelf .cover:focus-visible { transform: none; }

.links-mini { list-style: none; margin: 0; padding: 0; }
.links-mini li { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.45rem 0; min-width: 0; }
.links-mini a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.links-mini .label { white-space: nowrap; }

@media (max-width: 52rem) {
  .hero, .split, .split.even { grid-template-columns: 1fr; gap: 2rem; }
  .hero { padding-top: 0.5rem; }
}
@media (max-width: 34rem) {
  .shelf { flex-wrap: wrap; }
  .links-mini li { flex-wrap: wrap; gap: 0 0.75rem; }
  .links-mini .leader { display: none; }
  .link-row { flex-wrap: wrap; gap: 0 0.75rem; }
  .link-row .leader { display: none; }
}

/* --- admin ----------------------------------------------------------------------------- */

.admin { max-width: var(--measure); margin: 0 auto; }
.admin-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; }
.admin-comments { list-style: none; padding: 0; }
.admin-comment { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.75rem; background: var(--paper-2); }
.admin-comment header { font: 0.75rem var(--font-mono); color: var(--ink-3); }
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-likes { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.admin-likes th, .admin-likes td { text-align: left; border-bottom: 1px solid var(--rule); padding: 0.3rem 0.5rem; }
.admin-likes th { font: 0.72rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.admin-login { max-width: 20rem; }

@media (max-width: 40rem) {
  .page-title { font-size: 1.9rem; }
  .print { float: none; width: auto; margin: 0.5rem 0 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
