/* Shopfloor — text-first industrial publication. One stylesheet; SVG motion is optional.

   Design brief: the page is a plant floor. Concrete neutrals (a green-grey hue
   bias, like poured slab), oily black ink, and ONE signal colour: floor-marking
   safety yellow, used the way tape is used — as plates behind dark labels, as
   marker highlights on interaction, and as a hazard strip once per page.
   Type is signage: Barlow Condensed for headings/labels, Barlow for reading,
   IBM Plex Mono for tags, dates, and code. Self-hosted, ~47 KB total.

   Rules of the system: yellow is never text on light backgrounds; every tape
   plate carries ink text; motion only where it represents motion (a vehicle on
   a route, parts on a belt, packets on a bus) and never under reduced-motion. */

@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/assets/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("/assets/fonts/barlow-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600 700; font-style: normal; font-display: swap;
  src: url("/assets/fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600 800; font-style: normal; font-display: swap;
  src: url("/assets/fonts/barlow-condensed-700.woff2") format("woff2"); }
@font-face { font-family: "Plex Mono"; font-weight: 400 500; font-style: normal; font-display: swap;
  src: url("/assets/fonts/plex-mono-400.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #e9ebe5;          /* poured concrete */
  --bg-soft: #dde0d8;
  --card: #f6f7f2;
  --ink: #10120e;         /* machine-shop black */
  --body: #262922;
  --muted: #50564a;
  --faint: #636a5a;
  --line: #c6cabd;
  --line-strong: #10120e;
  --tape: #ffc20e;        /* ANSI/ISO safety yellow */
  --on-tape: #10120e;
  --ul: #10120e;          /* link underline */
  --code-bg: #dfe2d9;
  --mark: #fff0b3;
  --alert: #b3261e;
  --input-bg: #f6f7f2;
  --plant-line: #3b4034;
  --plant-fill: #f6f7f2;
  --plant-dim: #9aa08d;
  --maxw: 66rem;
  --prose: 68ch;
  --touch: 2.75rem;
  --r: 3px;
  --display: "Barlow Condensed", "Arial Narrow", "Liberation Sans Narrow", "Roboto Condensed", Impact, sans-serif;
  --sans: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e100c;
    --bg-soft: #151812;
    --card: #161912;
    --ink: #f2f3ec;
    --body: #c6cabc;
    --muted: #9aa08d;
    --faint: #868c7a;
    --line: #2a2f23;
    --line-strong: #5a604f;
    --ul: #ffc20e;
    --code-bg: #1b1f16;
    --mark: #3a3110;
    --alert: #ff8a80;
    --input-bg: #161912;
    --plant-line: #aab09b;
    --plant-fill: #161912;
    --plant-dim: #4d5343;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.62;
  text-rendering: optimizeLegibility; font-kerning: normal;
}
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.14s; }
  html { scroll-behavior: smooth; }
}

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ul);
    text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { background: var(--tape); color: var(--on-tape); text-decoration-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--tape); border-radius: 1px;
}
img, svg { max-width: 100%; }
::selection { background: var(--tape); color: var(--on-tape); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 1.75rem); }
main.wrap { padding-top: 0.2rem; padding-bottom: 3rem; }

/* ---- ebook bar: slim, black, always the same two books ---- */
.bookbar { background: #10120e; color: #c6cabc; font-size: 0.86rem; line-height: 1.3; }
.bookbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 1.4rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.bookbar a { color: #f2f3ec; text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2rem; }
.bookbar a:hover { background: var(--tape); color: #10120e; }
.bookbar img { display: block; width: 22px; height: 29px; flex: none; border: 1px solid #3a3f31; }
.bookbar strong { font-weight: 600; }
.bb-meta { font-family: var(--mono); font-size: 0.72rem; color: #9aa08d; letter-spacing: 0.02em; }
.bookbar a:hover .bb-meta { color: #10120e; }
.bb-alt { margin-left: auto; }
@media (max-width: 40rem) { .bookbar .bb-alt { display: none; } }

/* ---- masthead ---- */
.masthead { background: var(--bg); border-bottom: 2px solid var(--ink); }
@media (min-width: 48.01rem) { .masthead { position: sticky; top: 0; z-index: 30; } }
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.7rem; letter-spacing: 0.04em;
            text-transform: uppercase; line-height: 1; margin: 0; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand:hover { background: none; color: var(--ink); }
.brand img { display: block; width: 34px; height: 34px; image-rendering: auto; }
nav.main { display: flex; flex-wrap: wrap; gap: 0 0.1rem; margin: 0 0 0 0.2rem; font-family: var(--display); font-weight: 600;
           font-size: 1.05rem; letter-spacing: 0.05em; text-transform: uppercase; }
nav.main a { color: var(--body); text-decoration: none; min-height: var(--touch); display: inline-flex; align-items: center; padding: 0 0.5rem; }
nav.main a:hover { background: var(--ink); color: var(--bg); }
nav.main a[aria-current="page"] { background: var(--tape); color: var(--on-tape); }
.sitesearch { margin-left: auto; display: flex; gap: 0; align-items: stretch; flex: 0 1 13rem; min-width: 10rem; }
.sitesearch input {
  width: 100%; min-width: 0; min-height: 2.4rem; font: inherit; font-size: 0.95rem; color: var(--ink);
  padding: 0.3rem 0.65rem; background: var(--input-bg); border: 2px solid var(--ink); border-right: 0; border-radius: var(--r) 0 0 var(--r);
}
.sitesearch input::placeholder { color: var(--faint); }
.sitesearch button {
  min-height: 2.4rem; font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0 0.85rem; color: var(--on-tape); background: var(--tape); border: 2px solid var(--ink); border-radius: 0 var(--r) var(--r) 0; cursor: pointer;
}
.sitesearch button:hover { background: var(--ink); color: var(--tape); }
.menuwrap { display: none; }
@media (max-width: 48rem) {
  .masthead .wrap { gap: 0.5rem 0.8rem; }
  nav.main { display: none; }
  .sitesearch { order: 3; flex: 1 0 100%; margin-left: 0; }
  .menuwrap { display: block; margin-left: auto; position: relative; }
  .menuwrap summary { list-style: none; cursor: pointer; min-height: var(--touch); display: flex; align-items: center; padding: 0 0.9rem;
    font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.08em; text-transform: uppercase;
    border: 2px solid var(--ink); border-radius: var(--r); color: var(--ink); }
  .menuwrap summary::-webkit-details-marker { display: none; }
  .menuwrap[open] summary { background: var(--ink); color: var(--bg); }
  .menuwrap nav { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 40; width: min(16rem, 86vw); background: var(--card);
    border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--tape); display: grid; font-family: var(--display); font-weight: 600;
    font-size: 1.2rem; letter-spacing: 0.06em; text-transform: uppercase; }
  .menuwrap nav a { display: flex; align-items: center; min-height: var(--touch); padding: 0 1rem; text-decoration: none; color: var(--body); border-bottom: 1px solid var(--line); }
  .menuwrap nav a:last-child { border-bottom: 0; }
  .menuwrap nav a[aria-current="page"] { background: var(--tape); color: var(--on-tape); }
}
.skip { position: absolute; left: -9999px; }
.skip:focus { position: fixed; left: 0.5rem; top: 0.5rem; z-index: 99; padding: 0.6rem 1rem; background: var(--tape); color: var(--on-tape); font-weight: 600; }

/* reading progress: a tape strip that fills as you scroll (progressive enhancement) */
.read-progress { display: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .read-progress { display: block; position: fixed; z-index: 50; left: 0; top: 0; height: 4px; width: 100%; background: var(--tape);
      transform-origin: 0 50%; transform: scaleX(0); animation: read-fill linear both; animation-timeline: scroll(root block); }
    @keyframes read-fill { to { transform: scaleX(1); } }
  }
}

/* ---- homepage hero: a topic map drawn as a plant floor ---- */
.hero { display: grid; gap: 1.8rem 3rem; align-items: center; padding: 2.2rem 0 1.6rem; }
@media (min-width: 62rem) { .hero { grid-template-columns: minmax(0, 25rem) minmax(0, 1fr); padding: 2.6rem 0 2rem; } }
.hero h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; color: var(--ink);
           font-size: clamp(2.8rem, 6.4vw, 4.3rem); line-height: 0.98; letter-spacing: 0; hyphens: manual; margin: 0 0 1rem; text-wrap: balance; }
.hero h1 span { background: var(--tape); color: var(--on-tape); padding: 0 0.14em; margin-left: -0.04em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lede { font-size: 1.15rem; line-height: 1.5; color: var(--body); margin: 0 0 1.2rem; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1.2rem; padding: 0; list-style: none; }
.btn, a.btn {
  display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 1.1rem; cursor: pointer; text-decoration: none;
  font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--on-tape); background: var(--tape); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover, a.btn:hover { background: var(--ink); color: var(--tape); box-shadow: 3px 3px 0 var(--tape); border-color: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-quiet, a.btn-quiet { background: transparent; color: var(--ink); box-shadow: none; }
.btn-quiet:hover, a.btn-quiet:hover { background: var(--ink); color: var(--bg); box-shadow: none; }
.topic-line { font-size: 0.9rem; color: var(--muted); margin: 0; max-width: 34rem; }
.topic-line a { color: var(--body); }

/* ---- field illustrations: prebuilt solids, one camera, purposeful motion ---- */
.field-figure {
  --v-top: #f0f2e9;
  --v-front: #d6dccc;
  --v-side: #b8c1ac;
  --v-edge: #4b5541;
  --v-base: #e0e5d7;
  --v-base-front: #c6ceba;
  --v-base-side: #aab59a;
  --v-dark: #30392a;
  --v-screen: #25301f;
  --v-contact: #a2af8f;
  margin: 1.7rem 0 2rem;
  padding: 0.1rem 0 0;
  border-top: 1px solid var(--line-strong);
  color: var(--body);
  isolation: isolate;
}
@media (prefers-color-scheme: dark) {
  .field-figure {
    --v-top: #37422c;
    --v-front: #283321;
    --v-side: #1c2617;
    --v-edge: #a9b897;
    --v-base: #242d1d;
    --v-base-front: #1b2415;
    --v-base-side: #131c0e;
    --v-dark: #10170c;
    --v-screen: #111a0c;
    --v-contact: #8fa477;
  }
}
.figure-head { display: flex; align-items: center; gap: 0.65rem; min-height: 2.75rem; line-height: 1.2; }
.figure-id { font: 500 0.65rem var(--mono); color: var(--faint); white-space: nowrap; }
.figure-title { font: 600 0.95rem var(--display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); }
.figure-motion { margin-left: auto; min-height: 2.75rem; padding: 0.4rem 0.1rem 0.4rem 0.4rem; border: 0;
  background: transparent; color: var(--muted); font: 400 0.65rem var(--mono); text-decoration: underline;
  text-underline-offset: 0.2em; white-space: nowrap; cursor: pointer; border-radius: var(--r); }
.figure-motion:hover { color: var(--ink); text-decoration-color: var(--tape); }
.figure-motion[hidden] { display: none; }
.field-figure .v-scene { display: block; width: 100%; height: auto; overflow: hidden; }
.field-figure figcaption { font: 400 0.8rem/1.5 var(--sans); color: var(--muted); padding: 0.7rem 0 0; margin: 0;
  border-top: 1px solid var(--line); text-wrap: pretty; }
.field-figure figcaption strong { font-weight: 600; color: var(--body); }
.field-figure .v-top, .field-figure .v-front, .field-figure .v-side {
  stroke: var(--v-edge); stroke-width: 0.9; stroke-linejoin: round; }
.field-figure .v-top { fill: var(--v-top); }
.field-figure .v-front { fill: var(--v-front); }
.field-figure .v-side { fill: var(--v-side); }
.field-figure .v-base .v-top { fill: var(--v-base); }
.field-figure .v-base .v-front { fill: var(--v-base-front); }
.field-figure .v-base .v-side { fill: var(--v-base-side); }
.field-figure .v-foot .v-top, .field-figure .v-foot .v-front, .field-figure .v-foot .v-side { fill: var(--v-side); }
.field-figure .v-inset { fill: none; stroke: var(--v-edge); stroke-width: 0.65; opacity: 0.4; }
.field-figure .v-dark .v-top, .field-figure .v-dark .v-front, .field-figure .v-dark .v-side { fill: var(--v-dark); }
.field-figure .v-panel .v-front, .field-figure .v-panel .v-side { fill: var(--v-top); }
.field-figure .v-screen .v-top, .field-figure .v-screen .v-front, .field-figure .v-screen .v-side { fill: var(--v-screen); }
.field-figure .v-accent .v-top, .field-figure .v-label .v-top { fill: var(--tape); stroke: #10120e; }
.field-figure .v-accent .v-front, .field-figure .v-accent .v-side { fill: #d69f00; stroke: #10120e; }
.field-figure .v-rule, .field-figure .v-etch, .field-figure .v-vent, .field-figure .v-roller, .field-figure .v-tick {
  fill: none; stroke: var(--v-edge); stroke-width: 0.75; stroke-linecap: round; stroke-linejoin: round; }
.field-figure .v-vent-slot { fill: var(--v-edge); stroke: none; }
.field-figure .v-roller { stroke-width: 2.2; }
.field-figure .v-cable { fill: none; stroke: var(--v-edge); stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.field-figure .v-flow { fill: none; stroke: var(--tape); stroke-width: 2.2; stroke-dasharray: 3 97; stroke-linecap: round; }
.field-figure .v-dot { fill: var(--v-edge); }
.field-figure .v-screw { fill: var(--v-top); stroke: var(--v-edge); stroke-width: 0.65; }
.field-figure .v-contact { fill: var(--v-contact); stroke: var(--v-edge); stroke-width: 0.65; }
.field-figure .v-led, .field-figure .v-accent-dot { fill: var(--tape); stroke: #10120e; stroke-width: 0.65; }
.field-figure .v-trace { fill: none; stroke: var(--tape); stroke-width: 1.3; stroke-linejoin: round; }
.field-figure .v-port { fill: var(--v-contact); stroke: none; }
.field-figure .v-engraving { fill: var(--v-contact); font: 500 4px var(--mono); letter-spacing: 0.1px; }
.field-figure .v-field { fill: var(--tape); opacity: 0.2; stroke: none; }
.field-figure .v-floor-tape { fill: var(--tape); stroke: none; }
.field-figure .v-dial { fill: var(--card); stroke: var(--v-edge); stroke-width: 1; }
.field-figure .v-pivot { fill: var(--ink); }
.field-figure .v-needle { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; transform-origin: 0 0; }
.field-figure .v-link { cursor: pointer; text-decoration: none; }
.field-figure .v-link:hover { background: none; }
.field-figure .v-link:hover .v-enclosure > .v-top,
.field-figure .v-link:focus-visible .v-enclosure > .v-top { fill: var(--tape); stroke: var(--on-tape); }
.field-figure .v-link:focus-visible { outline: none; box-shadow: none; }
.field-figure .v-link:focus-visible > .v-solid > path { stroke: var(--ink); stroke-width: 2; }
.field-figure .v-move { animation-play-state: paused !important; }
.field-figure.v-active .v-move { animation-play-state: running !important; }
.field-figure.v-static .v-move { animation: none !important; }
.plant.field-figure { margin: 0; }
.plant-key { display: grid; grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr)); gap: 0 0.3rem;
  margin: 0.7rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.plant-key li { margin: 0; padding: 0; }
.plant-key a { min-height: 2.75rem; display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.35rem;
  font: 500 0.68rem var(--mono); text-decoration: none; border-bottom: 1px solid var(--line); }
.plant-key a::before { content: ''; width: 4px; height: 4px; background: var(--v-edge); flex: none; }
.plant-key a:hover::before, .plant-key a:focus-visible::before { background: var(--on-tape); }
.field-figure--compact { border-top: 0; margin: 0; min-width: 0; }
.field-figure--compact figcaption { font: 400 0.67rem/1.4 var(--mono); text-align: right; border: 0; padding: 0; }
.page-head.illustrated-head { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem;
  align-items: center; max-width: none; }
@media (max-width: 48rem) {
  .page-head.illustrated-head { grid-template-columns: 1fr; gap: 0.5rem; }
  .illustrated-head .field-figure--compact { max-width: 30rem; width: 100%; justify-self: center; }
}
@media (max-width: 30rem) {
  .figure-head { gap: 0.45rem; }
  .figure-title { font-size: 0.88rem; }
  .figure-id { font-size: 0.61rem; }
  .field-figure figcaption { font-size: 0.78rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .v-flow { animation: v-packet 9s linear infinite; }
  .v-cargo { animation: v-convey 8s cubic-bezier(0.45, 0, 0.2, 1) infinite; }
  .v-cargo--plant { animation-name: v-convey-plant; animation-duration: 10s; }
  .v-amr { animation: v-deliver 20s cubic-bezier(0.45, 0, 0.2, 1) infinite alternate; }
  .v-field { animation: v-inspect 8s ease-in-out infinite; }
  .v-needle { animation: v-measure 7s ease-in-out infinite alternate; }
  .v-status-0, .v-status-1, .v-status-2 { animation: v-scan 9s ease-in-out infinite; }
  .v-status-1 { animation-delay: -6s; }
  .v-status-2 { animation-delay: -3s; }
  @keyframes v-packet { to { stroke-dashoffset: -100; } }
  @keyframes v-convey { 0%, 15% { transform: translate(0, 0); } 80%, 100% { transform: translate(66.3px, 38.28px); } }
  @keyframes v-convey-plant { 0%, 15% { transform: translate(0, 0); } 80%, 100% { transform: translate(44.96px, 25.96px); } }
  @keyframes v-deliver { 0%, 12% { transform: translate(0, 0); } 88%, 100% { transform: translate(91.97px, 53.1px); } }
  @keyframes v-inspect { 0%, 15%, 80%, 100% { opacity: 0.13; } 35%, 60% { opacity: 0.32; } }
  @keyframes v-measure { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
  @keyframes v-scan { 0%, 26%, 100% { opacity: 1; } 34%, 91% { opacity: 0.28; } }
}
@media (prefers-reduced-motion: reduce) {
  .field-figure .v-move { animation: none !important; }
  .figure-motion { display: none; }
}
@media print {
  .field-figure { break-inside: avoid; }
  .field-figure .v-move { animation: none !important; }
  .figure-motion { display: none; }
}

/* ---- section heads: a label-maker plate ---- */
.section-head { display: flex; align-items: center; gap: 1rem; margin: 2.8rem 0 0.4rem; border-bottom: 2px solid var(--ink); }
.section-head h2 {
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--on-tape); background: var(--tape); margin: 0; padding: 0.22rem 0.8rem 0.18rem; line-height: 1.2;
}
.section-head .more { margin-left: auto; font-size: 0.92rem; white-space: nowrap; }
.section-sub { color: var(--muted); font-size: 0.95rem; margin: 0.5rem 0 0; max-width: 60ch; }

/* ---- feed rows: ruled ledger, not cards ---- */
ol.feed, ul.feed { list-style: none; margin: 0; padding: 0; }
.feed > li { border-bottom: 1px solid var(--line); }
.feed > li:last-child { border-bottom: 0; }
.feed article { display: grid; grid-template-columns: 7.6rem minmax(0, 1fr); gap: 0 1.4rem; padding: 1.05rem 0.5rem 1.1rem; position: relative; }
.feed article:hover { background: var(--card); }
.item-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; padding-top: 0.28rem; font-family: var(--mono);
             font-size: 0.74rem; color: var(--faint); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.kind { display: inline-block; font-family: var(--mono); font-size: 0.66rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
        border: 1px solid var(--line-strong); border-radius: 2px; padding: 0.12em 0.5em; color: var(--muted); white-space: nowrap; }
.kind-orig { background: var(--tape); border-color: var(--ink); color: var(--on-tape); font-weight: 500; }
.feed h3 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.12; letter-spacing: 0.002em; margin: 0; color: var(--ink);
           overflow-wrap: break-word; text-wrap: balance; }
.feed h3 a { text-decoration: none; }
.feed h3 a::after { content: ""; position: absolute; inset: 0; } /* whole row is the hit area */
.feed h3 a:hover { background: var(--tape); }
.feed .src { font-family: var(--sans); font-weight: 400; font-size: 0.85rem; letter-spacing: 0; color: var(--faint); white-space: nowrap; }
.feed .dek { margin: 0.3rem 0 0; font-size: 0.98rem; line-height: 1.5; color: var(--body); max-width: 62ch; }
.feed .meta { margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--faint); position: relative; z-index: 1; }
.feed .meta a { color: var(--muted); text-decoration-thickness: 1px; }
.feed .tags { display: inline; }
@media (max-width: 40rem) {
  .feed article { grid-template-columns: 1fr; padding: 0.95rem 0 1rem; }
  .item-meta { flex-direction: row; align-items: center; gap: 0.7rem; padding: 0 0 0.35rem; }
  .feed h3 { font-size: 1.4rem; }
}

/* ---- article ---- */
.crumbs { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); margin: 1rem 0 0; letter-spacing: 0.01em; }
.crumbs a { color: var(--muted); text-decoration-thickness: 1px; }
.article-head { margin: 1.6rem 0 1.5rem; max-width: 52rem; }
.article-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.5rem, 6vw, 4.2rem); line-height: 0.98; letter-spacing: 0; color: var(--ink);
                   margin: 0 0 0.9rem; overflow-wrap: break-word; text-wrap: balance; }
.article-head .dek { font-size: 1.22rem; line-height: 1.45; color: var(--body); margin: 0 0 0.9rem; max-width: 46rem; text-wrap: pretty; }
.byline { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); margin: 0; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.byline a { color: var(--muted); text-decoration-thickness: 1px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem 3.5rem; }
@media (min-width: 62rem) {
  .article-layout { grid-template-columns: minmax(0, var(--prose)) 15.5rem; }
  .article-layout .toc { grid-column: 2; grid-row: 1; position: sticky; top: 5rem; align-self: start; max-height: calc(100vh - 6.5rem); overflow: auto; }
  .article-layout .prose { grid-column: 1; grid-row: 1; }
}
.toc { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--tape); border-radius: 0; padding: 0.8rem 1rem 0.9rem; font-size: 0.9rem; line-height: 1.4; }
.toc h2 { font-family: var(--display); font-weight: 700; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); margin: 0 0 0.5rem; }
.toc ol { margin: 0; padding-left: 1.15rem; }
.toc li { margin: 0.3rem 0; }
.toc li::marker { font-family: var(--mono); font-size: 0.8em; color: var(--faint); }
.toc a { text-decoration: none; color: var(--body); }
.prose { min-width: 0; max-width: var(--prose); font-size: 1.125rem; line-height: 1.68; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-family: var(--display); font-weight: 700; font-size: 2.05rem; line-height: 1.05; letter-spacing: 0.002em; color: var(--ink); margin: 2.3em 0 0.5em; scroll-margin-top: 5rem; text-wrap: balance; }
.prose h2::before { content: ""; display: block; width: 2.4rem; height: 6px; background: var(--tape); margin-bottom: 0.55rem; }
.prose h3 { font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1.15; color: var(--ink); margin: 1.8em 0 0.4em; scroll-margin-top: 5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose li { margin: 0 0 0.4em; }
.prose li::marker { color: var(--faint); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose blockquote { margin: 1.4em 0; padding: 0.2em 0 0.2em 1.1rem; border-left: 4px solid var(--ink); color: var(--muted); font-style: italic; }
.prose blockquote p { margin: 0.4em 0; }
.prose code { font-family: var(--mono); font-size: 0.82em; background: var(--code-bg); padding: 0.1em 0.38em; border-radius: 2px; overflow-wrap: break-word; }
.prose pre { font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; background: var(--code-bg); padding: 0.95rem 1.1rem; border: 1px solid var(--line); border-left: 4px solid var(--ink); overflow-x: auto; border-radius: 0; }
.prose pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.prose table { border-collapse: collapse; margin: 1em 0; font-size: 0.95rem; width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.45em 0.7em; text-align: left; vertical-align: top; }
.prose th { color: var(--on-tape); background: var(--tape); font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.05em; text-transform: uppercase; border-color: var(--ink); }
.prose hr { border: none; border-top: 2px solid var(--ink); margin: 2.2em 0; }
.prose img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border: 1px solid var(--line); background: var(--card); padding: 0.4rem; }
.article-hero { margin: 0 0 2rem; max-width: 52rem; }
.article-hero img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--line); background: var(--card); padding: 0.4rem; }
.article-figure { margin: 2.2em 0; }
.article-figure img { display: block; width: 100%; height: auto; margin: 0; border: 1px solid var(--line); background: var(--card); padding: 0.4rem; }
.article-hero figcaption, .article-figure figcaption { font: 400 0.82rem/1.5 var(--sans); color: var(--muted); padding: 0.6rem 0 0; max-width: 62ch; overflow-wrap: break-word; }
.article-figure figcaption { max-width: var(--prose); }
.article-hero figcaption a, .article-figure figcaption a { color: var(--body); }
.prose a { overflow-wrap: break-word; }
a.gl { text-decoration-style: dotted; text-decoration-thickness: 2px; text-decoration-color: var(--faint); }
a.gl:hover { text-decoration-color: transparent; }
.footnote { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); border-top: 1px solid var(--line); margin-top: 2.6rem; padding-top: 0.8rem; overflow-wrap: break-word; max-width: var(--prose); }

/* ---- discovery, ebooks, share ---- */
.article-discovery { max-width: var(--prose); margin: 2.4rem 0 0; padding: 1rem 0 0; border-top: 2px solid var(--ink); }
.article-discovery h2 { margin: 0 0 0.4rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.article-discovery p { margin: 0.3rem 0; font-size: 0.95rem; color: var(--muted); }
.article-discovery a { color: var(--body); }
.book-box { max-width: var(--prose); margin: 2rem 0 0; border: 2px solid var(--ink); background: var(--card); }
.book-box > h2 { margin: 0; padding: 0.3rem 0.9rem 0.25rem; font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; background: var(--tape); color: var(--on-tape); }
.book-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.4rem 1rem; align-items: start; padding: 0.9rem 0.9rem; }
.book-row + .book-row { border-top: 1px solid var(--line); }
.book-row.no-cover { grid-template-columns: minmax(0, 1fr); }
.book-row img { display: block; width: 78px; height: auto; border: 1px solid var(--line-strong); box-shadow: 3px 3px 0 var(--ink); }
.book-row p { margin: 0; font-size: 0.97rem; line-height: 1.5; }
.book-row .lead { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.2rem; }
.book-row .t { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.1; color: var(--ink); }
.book-row .facts { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); margin-top: 0.35rem; }
.ebook-note { font-size: 0.9rem; color: var(--muted); margin: 0 0 1.4rem; max-width: var(--prose); }
.share { font-size: 0.92rem; color: var(--muted); margin: 1.6rem 0 0.4rem; }
.share span { font-family: var(--display); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.share-link { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); margin: 0 0 1rem; max-width: var(--prose); }
.share-link input { flex: 1; min-width: 0; min-height: 2.5rem; font-family: var(--mono); font-size: 0.76rem; background: var(--code-bg); color: var(--body); border: 1px solid var(--line); border-radius: var(--r); padding: 0.32rem 0.5rem; }

/* ---- books shelf (homepage + /books/) ---- */
.shelf { display: grid; gap: 1.2rem; margin: 1.2rem 0 0; }
@media (min-width: 48rem) { .shelf { grid-template-columns: 1.25fr 1fr; } }
.book { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: 1.4rem; padding: 1.2rem; background: var(--card); border: 2px solid var(--ink); align-items: start; }
.book.no-cover { grid-template-columns: minmax(0, 1fr); }
.book .cover img { display: block; width: 100%; height: auto; border: 1px solid var(--line-strong); box-shadow: 5px 5px 0 var(--ink); }
.book h2, .book h3 { font-family: var(--display); font-weight: 700; font-size: 1.85rem; line-height: 1.02; color: var(--ink); margin: 0 0 0.5rem; text-wrap: balance; }
.book p { margin: 0 0 0.8rem; font-size: 0.98rem; line-height: 1.5; }
.book .facts { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.02em; color: var(--muted); margin: 0 0 0.9rem; }
@media (max-width: 30rem) { .book { grid-template-columns: 1fr; } .book .cover { max-width: 11rem; } }

/* ---- topic / index pages ---- */
.page-head { margin: 1.8rem 0 1.2rem; max-width: 52rem; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.4rem, 5.5vw, 3.8rem); line-height: 0.98; color: var(--ink); margin: 0 0 0.6rem; overflow-wrap: break-word; text-wrap: balance; }
.page-head p { margin: 0 0 0.5rem; color: var(--body); font-size: 1.1rem; line-height: 1.5; max-width: 60ch; }
.topic-grid { margin: 1.1rem 0 2rem; padding: 0; list-style: none; columns: 2; column-gap: 2.5rem; }
.topic-grid li { break-inside: avoid; padding: 0.75rem 0 0.8rem; border-top: 1px solid var(--line); font-size: 1rem; }
.topic-grid li > a { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.1; text-decoration: none; }
.topic-grid .count { font-family: var(--mono); color: var(--faint); font-size: 0.74rem; margin-left: 0.3rem; }
.topic-grid .t-desc { display: block; font-size: 0.9rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.4; }
@media (max-width: 36rem) { .topic-grid { columns: 1; } }
.rel-topics { font-size: 0.95rem; margin: 0.4rem 0 0; }

/* ---- glossary ---- */
.glossary-index { display: flex; flex-wrap: wrap; gap: 0.2rem; margin: 1.2rem 0 0; padding: 0.5rem 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.glossary-index a { min-width: 2.5rem; min-height: var(--touch); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.gloss-letter { font-family: var(--display); font-weight: 700; font-size: 2.2rem; line-height: 1; color: var(--on-tape); background: var(--tape); display: inline-block; margin: 2rem 0 0.2rem; padding: 0.1em 0.45em; scroll-margin-top: 5rem; }
dl.gloss { margin: 0.6rem 0 1.5rem; padding: 0; }
dl.gloss dt { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin-top: 1rem; color: var(--ink); line-height: 1.15; }
dl.gloss dt a { text-decoration: none; }
dl.gloss dd { margin: 0.15rem 0 0; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); color: var(--body); max-width: 66ch; }

/* ---- tables, forms, tools (server-rendered, no JavaScript) ---- */
.table-scroll { overflow-x: auto; margin: 1em 0; }
.table-scroll table { margin: 0; min-width: 34rem; }
.table-scroll table, .result table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.table-scroll th, .table-scroll td { border: 1px solid var(--line); padding: 0.4em 0.65em; text-align: left; }
.table-scroll th { background: var(--tape); color: var(--on-tape); font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.05em; text-transform: uppercase; border-color: var(--ink); }
.filters, .tool-form { background: var(--card); border: 2px solid var(--ink); padding: 1rem 1.1rem; margin: 1.2rem 0 1.6rem; font-size: 0.92rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: end; }
.filters .field, .tool-form .field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.filters label, .tool-form label { font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.filters input[type="search"], .filters input[type="text"], .filters select,
.tool-form input[type="text"], .tool-form input[type="number"], .tool-form select, .tool-form textarea, .page-search input {
  min-height: var(--touch); font: inherit; font-size: 0.95rem; padding: 0.4rem 0.6rem; color: var(--ink);
  background: var(--input-bg); border: 2px solid var(--ink); border-radius: var(--r); max-width: 100%;
}
.tool-form .field-row { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; margin-bottom: 0.9rem; }
.tool-form .field-row .field { flex: 1 1 10rem; }
.calculator-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.8rem 1rem; margin-bottom: 1rem; }
.calculator-fields .field-wide { grid-column: 1 / -1; }
.calculation-inputs { display: none; }
.tool-form textarea { width: 100%; resize: vertical; font-family: var(--mono); }
.tool-reset { display: inline-block; padding: 0.6rem; min-height: var(--touch); }
.result th, .result td { overflow-wrap: anywhere; }
.result th { width: 58%; }
.workbench-grid { display: grid; gap: 0 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.workbench-grid li { border-top: 3px solid var(--ink); padding: 1rem 0; }
.workbench-grid h3 { font-size: 1.7rem; }
.workbench-grid p + p { margin-top: 0.7rem; }
.section-jumps { margin: 1rem 0 1.7rem; line-height: 2; }
.topic-resources { margin: 0 0 1.4rem; max-width: none; }
.search-filters { margin-top: 0.7rem; }
.search-filters .field { flex: 1 1 12rem; }
.tool-form .hint { font-size: 0.82rem; color: var(--faint); margin: 0.6rem 0 0; }
.form-error { background: var(--mark); border: 2px solid var(--alert); padding: 0.6rem 0.8rem; margin: 0 0 0.9rem; color: var(--ink); font-size: 0.92rem; }
.result { background: var(--card); border: 2px solid var(--ink); border-left: 10px solid var(--tape); padding: 1rem 1.2rem; margin: 0 0 1.5rem; font-size: 0.95rem; }
.result h2, .result h3 { font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin: 0 0 0.5rem; }
.result table { font-variant-numeric: tabular-nums; }
.result th, .result td { border: 1px solid var(--line); padding: 0.35em 0.6em; text-align: left; }
.result th { color: var(--ink); background: var(--code-bg); }
.result .big { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1.1; color: var(--ink); }
.result .mono { font-family: var(--mono); font-size: 0.85em; overflow-wrap: break-word; }
.tool-grid { margin: 1.1rem 0 2rem; padding: 0; list-style: none; }
.tool-grid li { padding: 1rem 0.5rem; border-top: 1px solid var(--line); }
.tool-grid li:hover { background: var(--card); }
.tool-grid h2, .tool-grid h3 { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.1; margin: 0 0 0.2rem; color: var(--ink); }
.tool-grid h2 a, .tool-grid h3 a { text-decoration: none; }
.tool-grid p { margin: 0.15rem 0 0; font-size: 0.97rem; color: var(--body); max-width: 62ch; }
.tool-grid .meta { font-size: 0.82rem; color: var(--faint); }
details.promo { margin: 1.8rem 0 0; border-top: 2px solid var(--ink); padding-top: 0.3rem; }
details.promo summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); padding: 0.4rem 0; }
.page-search { display: flex; gap: 0; margin: 1.2rem 0; max-width: 36rem; align-items: stretch; }
.page-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.page-search input { flex: 1; border-right: 0; border-radius: var(--r) 0 0 var(--r); }
.page-search button { min-height: var(--touch); }
.stamp { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); font-variant-numeric: tabular-nums; margin: 0.9rem 0 0; }

/* ---- Modbus register decoder: the one tool that computes in the browser.
   Readings are rows on a ledger; the 4 × 3 candidate grid is the result, and a
   tape plate marks only candidates that survive every reading. ---- */
.rd-form fieldset { border: 0; margin: 0 0 0.6rem; padding: 0; min-width: 0; }
.rd-fmt legend { float: left; margin: 0 0.9rem 0 0; padding: 0; line-height: var(--touch); font-family: var(--display); font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.rd-fmt label { display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--touch); margin: 0 0.4rem 0.3rem 0; padding: 0 0.8rem;
  border: 2px solid var(--ink); border-radius: var(--r); cursor: pointer; letter-spacing: 0.06em; }
.rd-fmt label:has(input:checked) { background: var(--tape); color: var(--on-tape); }
.rd-fmt label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--tape); }
.rd-fmt input { accent-color: var(--ink); margin: 0; }
.rd-eg { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
.rd-fmt label:has(input:checked) .rd-eg { color: var(--on-tape); }
.rd-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 0.8rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.rd-rowlabel { grid-column: 1 / -1; margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.rd-form small, .rd-rowlabel small { font-family: var(--sans); font-weight: 400; font-size: 0.78rem; letter-spacing: 0; text-transform: none; color: var(--faint); }
.rd-form .rd-row input { width: 100%; font-family: var(--mono); font-size: 0.92rem; }
.rd-form input::placeholder { color: var(--faint); }
.rd-form input[aria-invalid="true"] { border-color: var(--alert); background: var(--mark); }
@media (max-width: 45.99rem) {
  .rd-row label small { display: block; line-height: 1.3; }
  .rd-fmt legend { float: none; line-height: 1.3; margin-bottom: 0.45rem; }
}
@media (min-width: 46rem) {
  .rd-row { grid-template-columns: 6.6rem repeat(4, minmax(0, 1fr)); align-items: end; }
  .rd-rowlabel { grid-column: auto; align-self: center; padding-top: 1.5rem; line-height: 1.15; }
  .rd-rowlabel small { display: block; }
  .rd-row + .rd-row .rd-rowlabel { padding-top: 0; }
  /* rows 2–3 sit under row 1's labels, which act as column heads */
  .rd-row + .rd-row label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.rd-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.form-error ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.form-error p { margin: 0; font-weight: 600; }
.rd-card h2 { font-size: 1.15rem; margin-bottom: 0.15rem; }
.rd-card h3 { margin-top: 1.3rem; }
.rd-stamp { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); margin: 0 0 0.4rem; }
.rd-print-only { display: none; }
.rd-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.rd-table th[scope="row"] { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.rd-val { font-family: var(--mono); font-size: 0.86rem; overflow-wrap: anywhere; }
.rd-val sup { font-size: 0.72em; line-height: 0; }
.rd-flag { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--faint); }
.rd-mark { display: inline-block; margin-left: 0.4rem; padding: 0.02em 0.4em; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--muted); vertical-align: 0.1em; }
.rd-mark.rd-fit { background: var(--tape); color: var(--on-tape); border-color: var(--ink); }
.result td.rd-cell-fit, .rd-row-fit > * { background: var(--mark); }
td.rd-cell-out .rd-val, td.rd-cell-out .rd-flag { color: var(--faint); }
.rd-ok { font-weight: 600; color: var(--ink); }
.rd-no, .rd-out { color: var(--alert); }
.rd-out { font-family: var(--mono); font-size: 0.72rem; white-space: nowrap; }
.rd-verdict { margin: 1.1rem 0 0.4rem; padding: 0.7rem 0.9rem 0.2rem; border: 2px solid var(--ink); background: var(--bg); }
.rd-verdict p { margin: 0 0 0.55rem; max-width: 70ch; }
.rd-verdict ul { margin: 0 0 0.55rem; padding-left: 1.2rem; }
.rd-vh { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.15; color: var(--ink); }
.rd-state { display: inline-block; margin-right: 0.3rem; padding: 0.1em 0.5em; font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; vertical-align: 0.3em; border: 1px solid var(--line-strong); color: var(--muted); }
.rd-v-single .rd-state { background: var(--tape); color: var(--on-tape); border-color: var(--ink); }
.rd-v-ambiguous .rd-state { border: 2px dashed var(--ink); color: var(--ink); }
.rd-v-none { border-color: var(--alert); }
.rd-v-none .rd-state { border-color: var(--alert); color: var(--alert); }
.rd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.1rem; }
.rd-copied { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.rd-plain { margin-top: 0.8rem; }
.rd-plain summary::before { content: "+"; display: inline-block; width: 1.1rem; font-family: var(--mono); }
.rd-plain[open] summary::before { content: "−"; }
.rd-plain summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); min-height: var(--touch); display: flex; align-items: center; }
.rd-plain textarea { display: block; width: 100%; font-family: var(--mono); font-size: 0.74rem; line-height: 1.45; white-space: pre; overflow: auto;
  background: var(--code-bg); color: var(--body); border: 1px solid var(--line); border-radius: var(--r); padding: 0.6rem; resize: vertical; }
/* phones: each table row becomes a labelled block instead of a sideways scroll */
@media (max-width: 40rem) {
  .rd-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rd-table, .rd-table tbody, .rd-table tr, .rd-table th, .rd-table td { display: block; width: 100%; }
  .rd-table tr { border: 1px solid var(--line); margin: 0 0 0.6rem; }
  .result .rd-table th[scope="row"] { border: 0; border-bottom: 1px solid var(--line); }
  .result .rd-table td { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; border: 0; border-top: 1px solid var(--line); }
  .rd-table td::before { content: attr(data-label); flex: 0 0 6.2rem; font-family: var(--display); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .rd-cv { flex: 1 1 0; min-width: 0; }
  .rd-check td::before { flex-basis: 100%; }
}

/* ---- footer ---- */
footer.site { margin-top: 4rem; background: #10120e; color: #c6cabc; font-size: 0.92rem; }
footer.site::before { content: ""; display: block; height: 14px;
  background: repeating-linear-gradient(135deg, #10120e 0 14px, var(--tape) 14px 28px); }
footer.site .wrap { padding-top: 2rem; padding-bottom: 2.6rem; }
.foot-grid { display: grid; gap: 1.8rem 2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 52rem) { .foot-grid { grid-template-columns: 1.5fr repeat(4, 1fr); } }
footer.site h2 { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tape); margin: 0 0 0.5rem; }
footer.site p { margin: 0 0 0.6rem; max-width: 34ch; line-height: 1.5; }
footer.site ul { list-style: none; margin: 0; padding: 0; }
footer.site li { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; }
footer.site a { color: #f2f3ec; text-decoration: none; display: inline-block; padding: 0.2rem 0; min-height: 1.9rem; }
footer.site a:hover { background: var(--tape); color: #10120e; }
footer.site .brandline { display: flex; align-items: center; gap: 0.6rem; font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.05em; text-transform: uppercase; color: #f2f3ec; margin-bottom: 0.7rem; }
footer.site .brandline img { width: 30px; height: 30px; display: block; }
.foot-fine, footer.site p.foot-fine { max-width: none; margin-top: 1.8rem; padding-top: 1rem; border-top: 1px solid #2a2f23; font-family: var(--mono); font-size: 0.74rem; color: #868c7a; }
.foot-fine a { color: #c6cabc; text-decoration: underline; text-decoration-color: #5a604f; display: inline; }

/* ---- misc ---- */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.beacon { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tape-rule { height: 14px; margin: 2rem 0; background: repeating-linear-gradient(135deg, var(--ink) 0 14px, var(--tape) 14px 28px); }
.notfound .code { font-family: var(--display); font-weight: 700; font-size: clamp(6rem, 22vw, 14rem); line-height: 0.85; color: var(--ink); margin: 0; }

/* ---- print: articles read well on paper ---- */
@media print {
  :root { --bg: #fff; --bg-soft: #fff; --card: #fff; --ink: #000; --body: #222; --muted: #444; --faint: #555; --line: #bbb; --line-strong: #000; --ul: #000; --code-bg: #f2f2f2; --mark: #fff0b3; --alert: #b3261e; }
  body { font-size: 11pt; }
  .bookbar, .sitesearch, nav.main, .menuwrap, .share, .share-link, .beacon, .filters, .tool-form, .read-progress, .plant, footer.site .foot-grid, .toc, .article-discovery { display: none; }
  .result, .result tr { break-inside: avoid; }
  .calculation-inputs { display: block; }
  .calculation-inputs dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 1rem; }
  .calculation-inputs dd { margin: 0; overflow-wrap: anywhere; }
  .masthead { position: static; border-bottom: 1px solid #000; }
  footer.site { background: none; color: #000; margin-top: 1rem; }
  footer.site::before { display: none; }
  .foot-fine { color: #444; border-color: #bbb; }
  .article-layout { display: block; }
  .feed article:hover { background: none; }
  a { text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
  main.wrap { padding-bottom: 0; }
  /* register decoder: "Print card" prints the comparison card alone */
  main:has(.rd-card:not([hidden])) > :not(.regdec), .regdec > :not(.rd-card), .rd-actions, .rd-plain { display: none !important; }
  .rd-card { border: 1px solid #000; border-left-width: 6px; }
  .rd-card .rd-print-only { display: block; overflow-wrap: anywhere; }
  .rd-table tr, .rd-verdict { break-inside: avoid; }
}
