/* ──────────────────────────────────────────────────────────────
   Kamaya Gogna
   Two worlds: the circuit board (what I build) and the
   clothbound classic (what I read and write). Same green, same gold.
   ────────────────────────────────────────────────────────────── */

:root {
  /* board */
  --mask: #0f3d2c;
  --mask-deep: #0a2b1f;
  --cu: #d9ad52;
  --cu-dim: #b48f45;
  --silk: #f3efe4;
  --pkg: #18191b;

  /* book */
  --paper: #efe7d5;
  --paper-hi: #f6f0e3;
  --ink: #221f19;
  --ink-soft: #5f584a;
  --rule: #d5c9ae;
  --foil: #92702a;
  --cloth: #0f3d2c;

  --text: "Libre Caslon Text", "Baskerville", Georgia, serif;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --mono: "Martian Mono", ui-monospace, monospace;

  --measure: 36rem;
  color-scheme: light;
}

/* The pages are paper, so they stay light even in dark mode. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-color: var(--foil); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--foil); }
:focus-visible { outline: 2px solid var(--cu); outline-offset: 3px; border-radius: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; }
.skip:focus { left: 16px; background: var(--paper); padding: 6px 10px; }

/* ── Board strips (header and footer on every page) ─────────── */

.strip {
  position: relative;
  background-color: var(--mask);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 1px, transparent 1px 6px);
  color: var(--silk);
  font-family: var(--mono);
}
/* castellated edge: half-holes along the board edge, plated in gold */
.strip::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 9px;
  background: radial-gradient(circle at 50% 100%, var(--paper) 4.5px, var(--cu) 5px, var(--cu) 7.5px, transparent 8px) 0 0 / 26px 9px repeat-x;
}
.strip-top::after { bottom: 0; }
.strip-bottom::after { top: 0; transform: scaleY(-1); }

.strip-inner {
  width: min(100% - 32px, 72rem);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}

.strip-top .strip-inner { padding: 18px 0 24px; }

.wordmark {
  font-weight: 700;
  font-size: 1rem;
  font-stretch: 112.5%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--silk);
}
.wordmark span { font-weight: 400; font-size: 0.7rem; color: var(--cu); margin-left: 0.5rem; letter-spacing: 0.08em; }
.wordmark:hover { color: var(--silk); }

.strip nav { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.strip nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--silk);
}
/* each link sits on a gold pad; the current page's pad is a lit LED */
.strip nav a::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 2px;
  background: var(--cu);
  box-shadow: inset 0 0 0 3px var(--cu), inset 0 0 0 5px var(--mask-deep);
}
.strip nav a:hover { color: var(--cu); }
.strip nav a[aria-current="page"]::before {
  border-radius: 50%;
  background: #ffc35c;
  box-shadow: 0 0 0 2px #fff3d6, 0 0 12px 3px rgba(255, 190, 80, 0.7);
}

.strip-bottom { margin-top: 7rem; }
.strip-bottom .strip-inner { padding: 34px 0 30px; flex-direction: column; align-items: flex-start; }
.strip-bottom .links { margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; font-size: 0.78rem; letter-spacing: 0.04em; }
.strip-bottom .links a { text-decoration: none; color: var(--silk); }
.strip-bottom .links a:hover { color: var(--cu); }
.silk-note { margin: 0; font-size: 0.66rem; letter-spacing: 0.08em; color: var(--cu); text-transform: uppercase; }

/* ── The board ──────────────────────────────────────────────── */

/* the home page is the board and nothing else, sized to fit one screen */
body.home { min-height: 100vh; min-height: 100svh; display: grid; }
body.home main { display: grid; place-items: center; padding: clamp(10px, 2.5vmin, 32px); }
.board-wrap { width: min(100%, 1280px, (100svh - 2 * clamp(10px, 2.5vmin, 32px)) * 1200 / 740); margin: 0 auto; }
@media (max-width: 720px) {
  .board-wrap { width: min(100%, 460px, (100svh - 2 * clamp(10px, 2.5vmin, 32px)) * 420 / 1000); }
}

.board {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 28px rgba(30, 25, 10, 0.28)) drop-shadow(0 3px 4px rgba(30, 25, 10, 0.2));
  font-family: var(--mono);
}
.board.tall { display: none; }
@media (max-width: 720px) {
  .board.wide { display: none; }
  .board.tall { display: block; }
}

.board .mask { fill: var(--mask); }
.board .weave { stroke: rgba(255, 255, 255, 0.022); stroke-width: 1; }
.board .edge { fill: none; stroke: #c8b98a; stroke-opacity: 0.5; stroke-width: 2; }
.board .hole-ring { fill: var(--cu); }
.board .hole { fill: var(--paper); }

.board .cu {
  fill: none;
  stroke: var(--cu-dim);
  stroke-opacity: 0.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms, stroke-opacity 160ms;
}
.board .via { fill: var(--mask-deep); stroke: var(--cu-dim); stroke-width: 4; }

.board .silk { fill: var(--silk); }
.board .name { font-size: 78px; font-weight: 800; font-stretch: 112.5%; letter-spacing: 0.01em; }
.board.tall .name { font-size: 60px; }
.board .meta { font-size: 13px; letter-spacing: 0.14em; fill: var(--cu); }
.board.tall .meta { font-size: 11px; letter-spacing: 0.1em; }
.board .intro { font-size: 15px; font-weight: 400; fill-opacity: 0.92; }
.board.tall .intro { font-size: 13.5px; }
.board .hint { font-size: 12px; fill: var(--cu); letter-spacing: 0.04em; }
.board .refdes { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.board .refdes.small { font-size: 10px; }
.board .tiny { font-size: 9.5px; letter-spacing: 0.1em; fill-opacity: 0.8; }
.board .conn-label { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; fill: var(--cu); }
.board .led-label { font-size: 9.5px; letter-spacing: 0.08em; }

.board .pad, .board .thpad { fill: var(--cu); }
.board .drill { fill: var(--mask-deep); }
.board .pkg { fill: var(--pkg); stroke: #000; stroke-opacity: 0.4; transition: stroke 160ms; }
.board .pin1 { fill: #3d3f43; }
.board .mark { fill: #d5d4ce; font-size: 13px; font-weight: 700; letter-spacing: 0.05em; }
.board .mark-sub { fill: #8f918b; font-size: 8.5px; letter-spacing: 0.1em; }
.board.tall .mark { font-size: 11.5px; }
.board.tall .mark-sub { font-size: 7.5px; }
.board .smd { fill: #2c2b28; }
.board .hdr-outline { fill: none; stroke: var(--silk); stroke-width: 1.5; }
.board .shell { fill: #c7cad0; stroke: #8b9097; stroke-width: 1.5; }
.board .slot { fill: #26282c; }

.board .led-body { fill: #ebe8df; }
.board .led-lens { fill: #b8ae95; transition: fill 200ms; }
.board .led-glow { fill: #ffb846; opacity: 0; filter: blur(7px); transition: opacity 200ms; }

/* the photo on the board: a little screen module */
.board .bezel { fill: #101112; stroke: #000; stroke-opacity: 0.5; transition: stroke 160ms; }
.board .glass { fill: rgba(255, 255, 255, 0.04); stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; pointer-events: none; }
.board .display { cursor: pointer; }
.board .display image { filter: saturate(0.85) contrast(1.03); transition: filter 200ms; }
.board .display:hover image, .board .display:focus-visible image { filter: none; }
.board .display:hover .bezel, .board .display:focus-visible .bezel { stroke: var(--cu); stroke-opacity: 1; stroke-width: 2.5; }

/* interaction: chips light up, connectors take you places */
.board .part { outline: none; }
.board .chip { cursor: default; }
.board a.chip { cursor: pointer; }
.board .conn { cursor: pointer; }
.board .hit { fill: transparent; }
.board .socket-glow { fill: none; stroke: #ffc768; stroke-width: 3; opacity: 0; transition: opacity 200ms; }
@keyframes socket { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.85; } }
.board.ready .usb .socket-glow { animation: socket 2.6s ease-in-out infinite; }
.board.ready .usb:nth-of-type(2n) .socket-glow { animation-delay: 0.4s; }
.board .usb:hover .socket-glow, .board .usb:focus-visible .socket-glow { animation: none; opacity: 1; }
.board .usb:hover .shell, .board .usb:focus-visible .shell { transform: translateY(-4px); }
.board .usb .shell, .board .usb .slot { transition: transform 160ms ease; }
.board .usb:hover .slot, .board .usb:focus-visible .slot { transform: translateY(-4px); }
.board .usb:hover .conn-label, .board .usb:focus-visible .conn-label { fill: #fff3d6; }
@media (prefers-reduced-motion: reduce) { .board.ready .usb .socket-glow { animation: none; opacity: 0.6; } }
.board .part:hover .pkg, .board .part:focus-visible .pkg { stroke: var(--cu); stroke-opacity: 1; stroke-width: 2.5; }
.board .part:hover .shell, .board .part:focus-visible .shell { fill: #e4e6ea; stroke: var(--cu); }
.board .part:hover .hdr-outline, .board .part:focus-visible .hdr-outline { stroke: var(--cu); }
.board .part:focus-visible .pkg, .board .part:focus-visible .shell { stroke-width: 4; }
.board[data-active] .cu { stroke-opacity: 0.32; }
.board .cu.on { stroke: #ffd27a; stroke-opacity: 1; }
.board .via.on { stroke: #ffd27a; }

.board .led { cursor: default; outline: none; }
.board .led.lit .led-lens, .board .led:hover .led-lens, .board .led:focus .led-lens { fill: #ffc768; }
.board .led.lit .led-glow { opacity: 0.55; }
.board .led:hover .led-lens, .board .led:focus .led-lens { fill: #fff6df; }
.board .led:hover .led-glow, .board .led:focus .led-glow { opacity: 0.9; }

/* power-on: traces route themselves, then the LED chain lights up */
/* data pulses and the breathing LED chain (board.js starts them after power-on) */
.board .pulse { fill: none; stroke: #fff3d6; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px #ffc768) drop-shadow(0 0 6px rgba(255, 190, 80, 0.6)); pointer-events: none; }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.8; } }
@keyframes breathe-lens { 0%, 100% { fill: #f4b452; } 50% { fill: #ffd27a; } }
.board .led.lit .led-glow { animation: breathe 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * 0.3s); }
.board .led.lit .led-lens { animation: breathe-lens 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * 0.3s); }
.board .led:hover .led-lens, .board .led:focus .led-lens, .board .led:hover .led-glow, .board .led:focus .led-glow { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .board .led.lit .led-glow, .board .led.lit .led-lens { animation: none; }
}

/* traces draw themselves on load; board.js sets the lengths */
.board .cu.drawing { transition: stroke-dashoffset 900ms cubic-bezier(.6,0,.3,1), stroke 160ms, stroke-opacity 160ms; }

/* ── Book pages ─────────────────────────────────────────────── */

.book {
  width: min(100% - 40px, var(--measure));
  margin: clamp(4rem, 9vw, 6.5rem) auto 0;
}
.book.wide-book { width: min(100% - 40px, 56rem); }

.chapter, .page-head h1, .essay-head h1 {
  font-family: var(--display);
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.005em;
}
.chapter {
  margin: 0 0 2rem;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.1;
}
/* ornament: a trace with a via in the middle */
.chapter::after, .ornament {
  content: "";
  display: block;
  width: 7rem;
  height: 12px;
  margin: 1rem auto 0;
  background:
    radial-gradient(circle, transparent 3px, var(--foil) 3.5px, var(--foil) 5.5px, transparent 6px) center / 12px 12px no-repeat,
    linear-gradient(var(--foil), var(--foil)) left center / calc(50% - 8px) 1.5px no-repeat,
    linear-gradient(var(--foil), var(--foil)) right center / calc(50% - 8px) 1.5px no-repeat;
}

.page-head { margin-bottom: 3rem; text-align: center; }
.page-head h1 { margin: 0; font-size: clamp(2.8rem, 7vw, 4.4rem); line-height: 1; }
.page-head h1::after { content: ""; }
.page-head p { margin: 1.2rem auto 0; max-width: 34rem; color: var(--ink-soft); font-style: italic; }

.hint { margin: -1rem 0 1.5rem; text-align: center; font-style: italic; color: var(--ink-soft); font-size: 0.98rem; }
.more { margin-top: 1.8rem; text-align: center; font-style: italic; }
.empty { text-align: center; font-style: italic; color: var(--ink-soft); }

/* About */
.about { display: grid; gap: 2.5rem; width: min(100% - 40px, 56rem); align-items: start; }
@media (min-width: 820px) { .about { grid-template-columns: 17rem 1fr; gap: 3.5rem; } .about .chapter { text-align: left; } .about .chapter::after { margin-left: 0; } }
.plate { margin: 0; padding: 12px; background: var(--paper-hi); border: 1px solid var(--rule); box-shadow: 0 1px 0 var(--rule), 0 12px 24px -16px rgba(30, 25, 10, 0.5); max-width: 20rem; justify-self: center; }
.plate img { display: block; width: 100%; height: auto; filter: sepia(0.12) contrast(1.02); }
.plate figcaption { padding: 0.6rem 0 0.75rem; text-align: center; font-style: italic; font-size: 0.92rem; color: var(--ink-soft); }
.about-text p { margin: 0 0 1.1em; }
.about-links { font-style: italic; }

/* Contents (essay list) */
.contents { list-style: none; margin: 0; padding: 0; }
.contents li { margin: 0 0 1.4rem; }
.contents a { display: flex; align-items: baseline; gap: 0.5rem; text-decoration: none; }
.c-title { font-size: 1.22rem; line-height: 1.35; }
.c-dots { flex: 1; min-width: 1.5rem; border-bottom: 1.5px dotted var(--ink-soft); transform: translateY(-0.3em); opacity: 0.6; }
.contents time { font-variant: small-caps; letter-spacing: 0.04em; color: var(--ink-soft); white-space: nowrap; }
.contents a:hover .c-title { color: var(--foil); }
.contents p { margin: 0.15rem 0 0; font-style: italic; color: var(--ink-soft); font-size: 1rem; }
.draft { color: var(--foil); font-size: 0.9em; }

/* ── Bookshelf ──────────────────────────────────────────────── */

.shelf-label { margin: 3rem 0 0.25rem; font-family: var(--text); font-style: italic; font-weight: 400; font-size: 1.15rem; color: var(--ink-soft); }
.shelf-label:first-of-type { margin-top: 0; }

.spines {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 370px;
  padding: 20px 10px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.spine {
  flex: none;
  position: relative;
  width: var(--w);
  height: var(--h);
  padding: 30px 0;
  border: 0;
  border-radius: 3px 3px 1px 1px;
  background-color: var(--c);
  /* cloth grain + rounded spine shading + two gold-stamped bands */
  background-image:
    linear-gradient(to bottom, transparent 14px, #c9a24f 14px, #e6c675 15.5px, transparent 17px, transparent 20px, #c9a24f 20px, #e6c675 21px, transparent 22px),
    linear-gradient(to top, transparent 14px, #c9a24f 14px, #e6c675 15.5px, transparent 17px, transparent 20px, #c9a24f 20px, #e6c675 21px, transparent 22px),
    linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.1) 22%, rgba(255,255,255,0) 45%, rgba(0,0,0,.08) 70%, rgba(0,0,0,.32)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
  color: #e6c675;
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--text);
}
.spine-title {
  display: block;
  max-inline-size: calc(var(--h) - 100px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.spine-author { font-variant: small-caps; font-size: 0.78rem; letter-spacing: 0.06em; opacity: 0.9; }

/* the shelf is a strip of PCB, castellated along the top */
.plank {
  position: relative;
  height: 16px;
  background: var(--mask);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 10px 18px -10px rgba(30, 25, 10, 0.55);
}
.plank::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(var(--cu), var(--cu-dim));
}


.book-list { list-style: none; margin: 0; padding: 0; }
.book-list li { display: grid; grid-template-columns: 10px 1fr; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--rule); }
.book-list li:last-child { border-bottom: 1px solid var(--rule); }
.swatch { width: 10px; height: 1.5rem; margin-top: 0.25rem; background: var(--c); border-radius: 1px; box-shadow: inset 0 3px 0 -1px #c9a24f, inset 0 -3px 0 -1px #c9a24f; }
.book-line { margin: 0; }
.status { margin-left: 0.6rem; font-variant: small-caps; letter-spacing: 0.04em; color: var(--ink-soft); font-size: 0.95rem; }
.book-note { margin: 0.3rem 0 0; font-style: italic; color: var(--ink-soft); }

/* ── Work: datasheets ───────────────────────────────────────── */

.datasheet {
  margin: 0 0 2.5rem;
  background: var(--paper-hi);
  border: 1px solid var(--rule);
  box-shadow: 0 14px 30px -24px rgba(30, 25, 10, 0.6);
  scroll-margin-top: 1.5rem;
}
.datasheet:target { outline: 2px solid var(--cu); outline-offset: 4px; }

.ds-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.2rem;
  background: var(--mask);
  color: var(--silk);
  font-family: var(--mono);
}
.ds-ref { font-weight: 800; font-size: 0.85rem; color: var(--cu); letter-spacing: 0.06em; }
.ds-head h3 { margin: 0; flex: 1; font-size: 0.92rem; font-weight: 600; letter-spacing: 0.03em; line-height: 1.4; }
.ds-when { font-size: 0.72rem; letter-spacing: 0.06em; color: var(--cu); }

.ds-body { display: grid; gap: 1.5rem; padding: 1.4rem 1.3rem 1.5rem; }
@media (min-width: 760px) { .has-image .ds-body { grid-template-columns: 15rem 1fr; gap: 2rem; } }
.ds-fig { margin: 0; }
.ds-fig img { display: block; width: 100%; max-height: 22rem; object-fit: cover; border: 1px solid var(--rule); }
.ds-text p { margin: 0 0 0.9em; hyphens: auto; }
.ds-role { font-style: italic; color: var(--ink-soft); margin-bottom: 0.6em !important; }

.specs { width: 100%; margin-top: 1.2rem; border-collapse: collapse; font-size: 0.95rem; }
.specs th, .specs td { padding: 0.45rem 0; border-top: 1px solid var(--rule); vertical-align: top; text-align: left; }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 1px solid var(--rule); }
.specs th { width: 9.5rem; padding-right: 1rem; font-family: var(--mono); font-weight: 600; font-size: 0.7rem; letter-spacing: 0.03em; color: var(--ink-soft); padding-top: 0.62rem; }
.ds-link { margin: 1rem 0 0 !important; font-style: italic; }

.awards { list-style: none; margin: 0; padding: 0; }
.awards li { position: relative; padding: 0.45rem 0 0.45rem 2rem; border-top: 1px solid var(--rule); }
.awards li:last-child { border-bottom: 1px solid var(--rule); }
/* each prize gets a lit LED */
.awards li::before {
  content: "";
  position: absolute; left: 0.25rem; top: 1rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: #ffc35c;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--cu-dim), 0 0 10px 2px rgba(255, 190, 80, 0.55);
}
.book .chapter + .awards, .book .chapter + .toolkit { margin-bottom: 1rem; }
.awards + .chapter, .toolkit + .chapter { margin-top: 4.5rem; }

.toolkit { display: grid; grid-template-columns: 1fr; gap: 0.2rem 1.5rem; margin: 0; }
@media (min-width: 600px) { .toolkit { grid-template-columns: 11rem 1fr; } }
.toolkit dt { font-family: var(--mono); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.03em; padding-top: 0.42rem; }
.toolkit dd { margin: 0 0 0.8rem; }

/* ── Essays ─────────────────────────────────────────────────── */

.essay-head { text-align: center; margin-bottom: 3rem; }
.essay-head h1 { margin: 0; font-size: clamp(2.4rem, 6.5vw, 3.8rem); line-height: 1.05; text-wrap: balance; }
.dek { margin: 1.1rem auto 0; max-width: 30rem; font-style: italic; font-size: 1.2rem; line-height: 1.5; color: var(--ink-soft); text-wrap: balance; }
.essay-meta { margin: 1.2rem 0 0; font-variant: small-caps; letter-spacing: 0.06em; color: var(--ink-soft); }
.essay-meta::after { content: ""; display: block; width: 7rem; height: 12px; margin: 1.6rem auto 0;
  background:
    radial-gradient(circle, transparent 3px, var(--foil) 3.5px, var(--foil) 5.5px, transparent 6px) center / 12px 12px no-repeat,
    linear-gradient(var(--foil), var(--foil)) left center / calc(50% - 8px) 1.5px no-repeat,
    linear-gradient(var(--foil), var(--foil)) right center / calc(50% - 8px) 1.5px no-repeat; }

.prose { font-size: 1.14rem; line-height: 1.75; }
.prose p { margin: 0 0 1.15em; text-align: justify; hyphens: auto; }
.prose p + p { text-indent: 1.5em; margin-top: -1.15em; }
.prose h2 { margin: 2.4em 0 0.8em; font-family: var(--display); font-weight: 400; font-size: 1.7rem; line-height: 1.2; text-align: center; }
.prose h3 { margin: 2em 0 0.6em; font-style: italic; font-weight: 400; font-size: 1.2rem; }
.prose h2 + p, .prose h3 + p { text-indent: 0; margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose blockquote { margin: 1.8em 1.5em; font-style: italic; color: var(--ink-soft); }
.prose blockquote p { text-indent: 0 !important; margin-top: 0 !important; }
.prose img { display: block; max-width: 100%; height: auto; margin: 2em auto; border: 1px solid var(--rule); }
.prose hr { border: 0; margin: 2.6em auto; height: 12px; width: 7rem;
  background:
    radial-gradient(circle, transparent 3px, var(--foil) 3.5px, var(--foil) 5.5px, transparent 6px) center / 12px 12px no-repeat,
    linear-gradient(var(--foil), var(--foil)) left center / calc(50% - 8px) 1.5px no-repeat,
    linear-gradient(var(--foil), var(--foil)) right center / calc(50% - 8px) 1.5px no-repeat; }
.prose hr + p { text-indent: 0; margin-top: 0; }
.prose code { font-family: var(--mono); font-size: 0.75em; background: var(--paper-hi); border: 1px solid var(--rule); padding: 0.05em 0.35em; border-radius: 3px; }
.prose pre { background: var(--mask); color: var(--silk); padding: 1rem 1.2rem; overflow-x: auto; border-radius: 4px; font-size: 0.95rem; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose sup a { text-decoration: none; color: var(--foil); padding: 0 0.1em; }

/* margin notes: in the margin on wide screens, inline on phones */
.margin-note {
  display: block;
  margin: 0.6em 0;
  padding-left: 1em;
  border-left: 2px solid var(--foil);
  font-size: 0.9rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
  text-indent: 0;
  text-align: left;
}
@media (min-width: 1100px) {
  .margin-note { float: right; clear: right; width: 13rem; margin: 0.2em -16rem 0.8em 0; padding-left: 0; border: 0; }
  .margin-note::before { content: "† "; color: var(--foil); font-style: normal; }
}

.footnotes { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.95rem; color: var(--ink-soft); }
.footnotes ol { padding-left: 1.2em; }
.footnotes p { text-align: left; text-indent: 0 !important; margin: 0 0 0.5em !important; }
.footnotes a.reversefootnote, .footnotes .footnote-backref { text-decoration: none; color: var(--foil); }

.essay-foot { margin-top: 4rem; text-align: center; font-style: italic; }
.essay-foot .ornament { margin-bottom: 1.5rem; }

/* ── Travel: postcards ──────────────────────────────────────── */

.trip { margin-top: 4.5rem; scroll-margin-top: 1.5rem; }
.trip:first-of-type { margin-top: 0; }
.trip-head { text-align: center; margin-bottom: 2.2rem; }
.trip-head .chapter { margin-bottom: 0.6rem; }
.trip-head .chapter::after { display: none; }
.trip-country { color: var(--ink-soft); }
.trip-meta { margin: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-variant: small-caps; letter-spacing: 0.05em; color: var(--ink-soft); }
.trip-meta .coords { font-family: var(--mono); font-variant: normal; font-size: 0.72rem; letter-spacing: 0.06em; color: var(--foil); padding-top: 0.2rem; }
.trip-note { margin: 0.8rem auto 0; max-width: 34rem; font-style: italic; }

.plates { columns: 3 15rem; column-gap: 1.6rem; }
.postcard {
  break-inside: avoid;
  margin: 0 0 1.8rem;
  padding: 10px 10px 0;
  background: #fbf8f1;
  border: 1px solid var(--rule);
  box-shadow: 0 14px 22px -16px rgba(30, 25, 10, 0.55), 0 1px 2px rgba(30, 25, 10, 0.12);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 200ms ease;
}
.postcard:nth-child(3n+1) { --tilt: -0.8deg; }
.postcard:nth-child(3n+2) { --tilt: 0.6deg; }
.postcard:nth-child(4n) { --tilt: -0.3deg; }
.postcard:hover { transform: rotate(0deg) translateY(-3px); }
.postcard-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.postcard img { display: block; width: 100%; height: auto; }
.postcard figcaption { padding: 0.55rem 0.2rem 0.75rem; font-style: italic; font-size: 0.95rem; line-height: 1.4; color: var(--ink-soft); }
.postcard:not(:has(figcaption)) { padding-bottom: 10px; }

.lightbox { max-width: min(92vw, 1100px); max-height: 92vh; padding: 14px 14px 0; border: 0; background: #fbf8f1; box-shadow: 0 30px 60px rgba(0,0,0,.5); }
.lightbox::backdrop { background: rgba(10, 30, 22, 0.88); }
.lightbox figure { margin: 0; }
.lightbox img { display: block; max-width: 100%; max-height: calc(92vh - 90px); margin: 0 auto; }
.lightbox figcaption { padding: 0.7rem 0.2rem 0.9rem; font-style: italic; color: var(--ink-soft); }
.lightbox-close { position: absolute; top: 10px; right: 10px; padding: 0.35rem 0.7rem; border: 0; border-radius: 3px; background: var(--mask); color: var(--silk); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.05em; cursor: pointer; }
.lightbox-close:hover { color: var(--cu); }

@media (prefers-reduced-motion: reduce) { .postcard { transform: none; transition: none; } }

/* ── Travel: atlas ──────────────────────────────────────────── */

.odometer {
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 6vw, 4rem);
  margin: 0 auto 2.2rem;
  padding: 1.3rem 1.5rem 1.2rem;
  max-width: 34rem;
  background-color: var(--mask);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 1px, transparent 1px 6px);
  border-radius: 10px;
  box-shadow: 0 14px 26px -18px rgba(30, 25, 10, 0.7);
  font-family: var(--mono);
  color: var(--silk);
}
.odometer > div { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.odo-num {
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 800;
  font-stretch: 112.5%;
  line-height: 1;
  color: #ffc768;
  text-shadow: 0 0 14px rgba(255, 190, 80, 0.45);
  font-variant-numeric: tabular-nums;
}
.odo-label { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--silk); opacity: 0.85; }

.country-index { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1.1rem; margin: 0 auto 1rem; max-width: 46rem; font-size: 0.98rem; }
.country-index a { text-decoration: none; color: var(--ink-soft); }
.country-index a:hover { color: var(--foil); text-decoration: underline; }

.country { margin-top: 3.6rem; scroll-margin-top: 1.5rem; }
.country-name {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  line-height: 1.15;
}
.country-count { margin-left: auto; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--foil); white-space: nowrap; }

.places { list-style: none; margin: 0; padding: 0; columns: 3 12rem; column-gap: 2rem; }
.places li {
  break-inside: avoid;
  position: relative;
  padding: 0.28rem 0 0.28rem 1.3rem;
  font-size: 1.06rem;
  line-height: 1.45;
}
/* each place sits on a little gold pad */
.places li::before {
  content: "";
  position: absolute; left: 0.1rem; top: 0.78rem;
  width: 8px; height: 8px; border-radius: 1.5px;
  background: var(--cu);
  box-shadow: inset 0 0 0 2px var(--cu), inset 0 0 0 4px var(--paper);
}
.places li.has-photos::before { border-radius: 50%; background: #ffc35c; box-shadow: 0 0 0 1.5px var(--cu-dim), 0 0 8px 1px rgba(255, 190, 80, 0.6); }
.visits { margin-left: 0.35rem; font-family: var(--mono); font-size: 0.7rem; font-weight: 700; color: var(--foil); vertical-align: 0.1em; }
.place-note { margin-left: 0.4rem; font-style: italic; color: var(--ink-soft); font-size: 0.95rem; }
.place-note::before { content: "("; }
.place-note::after { content: ")"; }

.place-photos { margin-top: 2rem; scroll-margin-top: 1.5rem; }
.place-photos h3 { margin: 0 0 1rem; font-style: italic; font-weight: 400; font-size: 1.25rem; }

/* ── Travel: maps ───────────────────────────────────────────── */

.atlas { margin: 0 auto 2rem; filter: drop-shadow(0 16px 22px rgba(30, 25, 10, 0.3)); }
.atlas svg { display: block; width: 100%; height: auto; font-family: var(--mono); }
.atlas-europe { max-width: 40rem; }
.atlas .ocean { fill: var(--mask); stroke: #c8b98a; stroke-opacity: 0.45; stroke-width: 2; }
.atlas .land path { fill: #175a40; stroke: #0b3022; stroke-width: 0.7; stroke-linejoin: round; }
.atlas .land path:hover { fill: #1d6b4c; }
.atlas .routes path { fill: none; stroke: #ffd27a; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; }
.atlas .pin circle { fill: var(--mask-deep); stroke: #ffc768; stroke-width: 1.6; transition: fill 120ms; }
.atlas-europe .pin circle { stroke-width: 2.2; }
.atlas .pin.home circle { fill: var(--cu); stroke: #fff3d6; stroke-width: 2; }
.atlas .pin:hover circle, .atlas .pin:focus circle { fill: #ffc768; }
.atlas .pin { outline: none; cursor: pointer; }
.atlas .map-label { fill: var(--silk); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; paint-order: stroke; stroke: var(--mask); stroke-width: 3px; }
.atlas .home-label { fill: #ffc768; font-weight: 800; }
.atlas .home-label.big { font-size: 15px; }
.atlas .pin-label { fill: #fff3d6; font-size: 15px; font-weight: 700; opacity: 0; pointer-events: none; paint-order: stroke; stroke: var(--mask-deep); stroke-width: 4px; transition: opacity 120ms; }
.atlas .pin:hover .pin-label, .atlas .pin:focus .pin-label { opacity: 1; }
.atlas .map-silk { fill: var(--silk); font-size: 10px; letter-spacing: 0.12em; opacity: 0.7; }
.atlas-europe .map-silk { font-size: 13px; }

/* map card */
.atlas { position: relative; }
.atlas .pin.selected circle { fill: #ffc768; stroke: #fff3d6; }
.atlas .pin.selected .pin-label { opacity: 1; }
.atlas .land path.selected { fill: var(--cu) !important; }
.map-card {
  position: absolute;
  z-index: 5;
  width: min(19rem, calc(100% - 16px));
  background: var(--paper-hi);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 18px 34px -14px rgba(10, 30, 22, 0.65);
  overflow: hidden;
  font-family: var(--text);
}
.mc-head { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.6rem 0.5rem 0.55rem 0.9rem; background: var(--mask); color: var(--silk); }
.mc-head h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.25rem; line-height: 1.2; }
.mc-count { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.05em; color: var(--cu); white-space: nowrap; }
.mc-close { margin-left: auto; width: 1.8rem; height: 1.8rem; border: 0; border-radius: 3px; background: transparent; color: var(--silk); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.mc-close:hover { color: var(--cu); background: rgba(255,255,255,.06); }
.mc-places { list-style: none; margin: 0; padding: 0.6rem 0.9rem 0.3rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.4rem; max-height: 11rem; overflow-y: auto; }
.mc-places li { padding: 0.12rem 0.5rem; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.92rem; line-height: 1.4; }
.mc-places li.here { background: var(--mask); border-color: var(--mask); color: var(--silk); }
.mc-visits { font-family: var(--mono); font-size: 0.66rem; font-weight: 700; color: var(--foil); }
.mc-places li.here .mc-visits { color: var(--cu); }
.mc-note { font-style: italic; color: var(--ink-soft); font-size: 0.85rem; }
.mc-places li.here .mc-note { color: var(--silk); }
.mc-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0.4rem 0.9rem 0; }
.mc-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 2px; }
.mc-more { display: block; padding: 0.55rem 0.9rem 0.75rem; font-style: italic; font-size: 0.95rem; }

.atlas .pin-count { fill: var(--mask-deep); font-size: 11px; font-weight: 800; pointer-events: none; }
.atlas-world .pin-count { font-size: 9px; }
.atlas .country-pin circle, .atlas .cluster circle { fill: #ffc768; stroke: #fff3d6; stroke-width: 2; }
.atlas .country-pin:hover circle, .atlas .cluster:hover circle,
.atlas .country-pin.selected circle, .atlas .cluster.selected circle { fill: #fff3d6; }
.atlas .home-pad { fill: var(--cu); stroke: #fff3d6; stroke-width: 1.5; }
.atlas .eu-box rect { fill: rgba(255, 199, 104, 0.06); stroke: var(--silk); stroke-width: 1.2; stroke-dasharray: 5 4; transition: fill 150ms; }
.atlas .eu-box:hover rect { fill: rgba(255, 199, 104, 0.16); }
.atlas .eu-box { cursor: pointer; outline: none; }
.atlas .eu-label { font-size: 9px; fill: #ffc768; }
.mc-places.last { padding-bottom: 0.85rem; }
.photos-chapter { margin-top: 4rem; }
.place-photos h3 span { color: var(--ink-soft); }

/* datasheet photo gallery */
.ds-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; padding: 0 1.3rem 1.6rem; align-items: start; }
.ds-gallery .postcard { margin: 0; }
.ds-gallery .postcard img, .ds-gallery .postcard video { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.ds-gallery figcaption { font-size: 0.85rem; padding: 0.45rem 0.1rem 0.6rem; }
.ds-gallery .postcard img.contain { object-fit: contain; background: #fff; }
@media (max-width: 640px) { .ds-gallery { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; padding: 0 0.9rem 1.2rem; } }

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 640px) {
  body { font-size: 1.04rem; }
  .strip-top .strip-inner { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
  .strip nav { gap: 0.9rem; }
  .strip nav a { font-size: 0.72rem; gap: 0.4rem; }
  .atlas-world { overflow-x: auto; -webkit-overflow-scrolling: touch; filter: none; }
  .atlas-world svg { width: 780px; max-width: none; }
  .map-card { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; z-index: 30; }
  .prose { font-size: 1.06rem; }
  .prose p { text-align: left; }
  .contents a { flex-wrap: wrap; }
  .c-dots { display: none; }
  .contents time { width: 100%; }
  .spines { min-height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
}
.board.tall .conn-label { font-size: 12px; letter-spacing: 0.03em; }
.board.tall .usb .refdes { display: none; }
