:root {
  --bg: #060907;
  --bg-panel: #0b1310;
  --bg-inset: #081009;
  --edge: #2c322e; /* neutral board-edge line — NOT copper */
  --trace: #2ee6a0;
  --trace-dim: #175c46;
  --pad: #ffb454;
  --text: #cdf5e1;
  --text-dim: #5f8a76;
  --text-faint: #3a5a4a;
  --danger: #ff6b6b;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

/* global fallback so an unconstrained <img> can't overflow its container; .photo-box-img has its own rule for the photo feed */
img {
  max-width: 100%;
  height: auto;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(46, 230, 160, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 230, 160, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
}

/* faint CRT scanlines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 50;
}

/* subtle vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 49;
}

.page {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 58px;
  width: 100%;
  padding: 88px clamp(1rem, 5vw, 3rem) 3rem;
}

/* about.html/downloads.html: tighter gap + bottom padding to fit one screen. Top padding (88px) untouched — .lead-top/.lead-bottom are sized to it exactly. */
.page.compact-page {
  gap: 56px;
  padding-bottom: 1.25rem;
}

/* ---------- top nav (full-width bar, like the footer) ---------- */

.pcb-nav {
  position: relative;
  width: 100%;
  background: var(--bg-panel);
  /* board-edge outline, not copper — J1/J2 fingers run to it without being bussed together */
  border-bottom: 1px solid var(--edge);
}

/* copper bus along nav's bottom edge, terminates short of J1/J2 fingers to keep them electrically separate */
.nav-edge-trace {
  position: absolute;
  /* = logo left(36) + connect-trace x(219) * scale(svg width/260). Recompute if .nav-logo svg width changes — not a CSS var. */
  left: 294px;
  right: 78px;
  bottom: -1.5px;
  height: 2px;
  background: var(--trace-dim);
  overflow: hidden;
}

.nav-edge-trace::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--trace) 45%, #d6fff0 50%, var(--trace) 55%, transparent);
  background-size: 18% 100%;
  background-repeat: no-repeat;
  background-position: -18% 0;
  animation: nav-sweep 3s linear 1s 1 forwards;
}

@keyframes nav-sweep {
  to { background-position: 118% 0; }
}

/* terminates the bus before it reaches the connector fingers */
.via-end {
  position: absolute;
  bottom: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--pad);
  z-index: 3;
}

.via-end-r { right: 70px; }

.nav-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.95rem clamp(1.25rem, 3vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 2;
}

/* left pad aligns with left side rail (x=40); trace drops through nav's bottom edge onto it */
.nav-logo {
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: block;
  text-decoration: none;
}

.nav-logo svg {
  display: block;
  overflow: visible;
  width: 307px;
  height: auto;
}

/* hand-drawn stroke letterforms, not font glyphs */
.logo-glyph {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lg1 { stroke: var(--text); }
.lg2 {
  stroke: var(--trace);
  filter: drop-shadow(0 0 4px rgba(46, 230, 160, 0.45));
}
.lg3 { stroke: var(--text-dim); }

.nav-links {
  display: flex;
  gap: 4.5rem;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 1.05rem;
  padding-bottom: 3px;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a::before {
  content: "~/";
  color: var(--text-faint);
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--trace);
  border-bottom-color: var(--trace);
}

/* positioned against .pcb-nav's true right edge, not .nav-inner's 1200px cap — same as .nav-logo/.via-end-r */
.nav-search {
  position: absolute;
  right: clamp(1.25rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
}

.nav-search-icon {
  display: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-search input {
  background: var(--bg-inset);
  border: 1px solid var(--trace-dim);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  border-radius: 2px;
}

.nav-search input::placeholder {
  color: var(--text-faint);
}

.nav-search input:focus {
  outline: none;
  border-color: var(--trace);
}

/* via where the center trace actually leaves the nav board edge */
.via-nav-top {
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translate(-50%, 50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--pad);
  z-index: 3;
}

/* series resistor sitting inline in the nav bus trace */
.nav-res {
  position: absolute;
  left: 360px;
  bottom: -6px;
  width: 26px;
  height: 11px;
  background: var(--bg-panel);
  border: 1.5px solid var(--text-dim);
  border-radius: 2px;
  z-index: 2;
}

.nav-res::before,
.nav-res::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
}

.nav-res::before { left: 6px; background: var(--pad); }
.nav-res::after { left: 13px; background: var(--trace); }

.pcb-label.nav-res-label {
  bottom: -20px;
  left: 392px;
}

@media (max-width: 700px) {
  .nav-res,
  .pcb-label.nav-res-label {
    display: none;
  }
}

/* ---------- PCB trace panel ---------- */

.pcb-panel {
  position: relative;
  width: 100%;
  max-width: 1200px;
  padding: 30px;
  filter:
    drop-shadow(0 22px 40px rgba(0, 0, 0, 0.9))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.75));
}

/* chamfered bezel fill. clip-path is on ::before, not .pcb-panel itself, so overflowing descendants (lead-in traces) aren't clipped too. drop-shadow offset implies board thickness. */
.pcb-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-inset);
  clip-path: polygon(
    22px 0, calc(100% - 22px) 0, 100% 22px,
    100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%,
    0 calc(100% - 22px), 0 22px
  );
  filter: drop-shadow(5px 7px 0 #14201a);
  pointer-events: none;
}

/* border can't follow a clip-path chamfer, so this is a 1.5px-larger copy of the same shape behind .panel-face — only the ring peeks out */
.panel-face-outline {
  position: absolute;
  inset: -1.5px;
  background: linear-gradient(135deg, #7bffcf 0%, var(--trace) 35%, var(--trace-dim) 100%);
  clip-path: polygon(
    22px 0, calc(100% - 22px) 0, 100% 22px,
    100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%,
    0 calc(100% - 22px), 0 22px
  );
  pointer-events: none;
}

/* masks .panel-face-outline down to a ~2px ring */
.panel-face-outline::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--bg-inset);
  clip-path: polygon(
    20px 0, calc(100% - 20px) 0, 100% 20px,
    100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%,
    0 calc(100% - 20px), 0 20px
  );
}

/* square, no chamfer — only .pcb-panel/.panel-face-outline get chamfered corners */
.panel-face {
  position: relative;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 2rem;
  background: var(--bg-panel);
  box-shadow:
    inset 0 8px 22px rgba(0, 0, 0, 0.85),
    inset 0 -3px 10px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(160, 255, 220, 0.12);
}

/* LCD bezel dashed outline — .cast-lead-in stops at the outer of this pair */
.panel-face::before {
  content: "";
  position: absolute;
  inset: -9px;
  border: 1px dashed var(--trace-dim);
  pointer-events: none;
  opacity: 0.6;
}

/* downloads.html: tighter padding for its shorter AGENT_IC content */
.panel-face.compact {
  padding-top: 1.75rem;
  padding-bottom: 1.5rem;
}

/* about.html: less top padding still. Layers on .compact, doesn't change it */
.panel-face.compact-tight {
  padding-top: 0.875rem;
}

.panel-face::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px dashed var(--trace-dim);
  pointer-events: none;
  opacity: 0.6;
}

/* module-ID label in the bezel, not on the glass. Was "DSP_LCD_003-v2"
   (part-number stamp, class .lcd-tag) on every page; now a location
   stamp ("HOBART, TASMANIA") on all 7. Extends .pcb-label. */
.origin-tag {
  right: 88px;
  bottom: 6px;
  line-height: 1;
}

/* ---------- daughter-board castellated edges ----------
   Pads sit on the panel's border: .cast-lead-in ties inward, .cast-lead-out fades outward. Only .lead-top is a real connection — the rest is implied routing. */
.cast-pad {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--pad);
  z-index: 2;
}

.cast-pad.left   { left: -4px; transform: translateY(-50%); }
.cast-pad.right  { right: -4px; transform: translateY(-50%); }
.cast-pad.bottom { bottom: -4px; transform: translateX(-50%); }
.cast-pad.top    { top: -4px; left: 50%; transform: translateX(-50%); }

.cast-lead-in {
  position: absolute;
  background: var(--trace-dim);
  z-index: 1;
}

.cast-lead-in.left   { left: 0; width: 21px; height: 1.5px; transform: translateY(-50%); }
.cast-lead-in.right  { right: 0; width: 21px; height: 1.5px; transform: translateY(-50%); }
.cast-lead-in.bottom { bottom: 0; width: 1.5px; height: 21px; transform: translateX(-50%); }
.cast-lead-in.top    { top: 0; left: 50%; width: 1.5px; height: 21px; transform: translateX(-50%); }

/* ~20mm (76px) run so it reads as routed, not a decorative nub */
.cast-lead-out {
  position: absolute;
  z-index: 1;
}

.cast-lead-out.left {
  right: 100%; width: 76px; height: 2px; transform: translateY(-50%);
  background: linear-gradient(270deg, var(--trace-dim), transparent);
}
.cast-lead-out.right {
  left: 100%; width: 76px; height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--trace-dim), transparent);
}
.cast-lead-out.bottom {
  top: 100%; width: 2px; height: 76px; transform: translateX(-50%);
  background: linear-gradient(180deg, var(--trace-dim), transparent);
}

/* about.html/downloads.html: reused as link-in to the boxes below, repositioned to their centers. 56px = .page.compact-page's gap exactly. */
.cast-lead-out.bottom.link-down {
  height: 56px;
  background: var(--trace-dim);
}

/* terminates .link-down, straddling the box's border below. Positioned outside .pcb-panel so the box's own overflow:hidden doesn't clip it. */
.cast-via-out {
  position: absolute;
  top: calc(100% + 56px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--pad);
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Position-along-the-edge percentages for .cast-pad/.cast-lead-in/
   .cast-lead-out/.cast-via-out — these used to be inline style="top: X%"/
   "left: X%" attributes, which violate the root CSP's style-src 'self'
   (no unsafe-inline, by design — see .htaccess). Fixed values only (the
   two standard 32/68% top positions, the standard 30/70% bottom position,
   plus about.html's/downloads.html's own computed percentages from the
   formula documented in the root CLAUDE.md), so plain classes cover it
   without needing inline styles anywhere. */
.cast-top-32     { top: 32%; }
.cast-top-68     { top: 68%; }
.cast-left-30    { left: 30%; }
.cast-left-70    { left: 70%; }
.cast-left-28-3  { left: 28.3%; }
.cast-left-71-7  { left: 71.7%; }
.cast-left-29-2  { left: 29.2%; }
.cast-left-70-8  { left: 70.8%; }

@media (max-width: 900px) {
  .cast-via-out {
    display: none;
  }
}

@media (max-width: 900px) {
  .cast-pad, .cast-lead-in, .cast-lead-out {
    display: none;
  }
}

/* trace leads connecting nav + panels into one circuit */
.lead {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--trace-dim);
  z-index: 1;
}

.lead-top { top: -46px; height: 46px; }
.lead-bottom { bottom: -46px; height: 46px; }

/* ---------- terminal chrome ---------- */

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--trace-dim);
  color: var(--text-dim);
  font-size: 0.8rem;
}

.term-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--trace-dim);
  border: 1px solid var(--trace);
}

.term-bar .dot.on {
  background: var(--trace);
  box-shadow: 0 0 6px var(--trace);
}

.term-bar .path {
  margin-left: 0.25rem;
}

/* ---------- terminal content ---------- */

.line {
  margin: 0 0 0.9rem;
  white-space: pre-wrap;
}

.prompt {
  color: var(--trace);
}

.cmd {
  color: var(--text);
}

.out {
  color: var(--text-dim);
  margin: 0.15rem 0 0;
}

.brand {
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand strong {
  color: var(--trace);
}

.tag {
  color: var(--text-dim);
  margin-top: -0.3rem;
}

/* ---------- about page service blocks ----------
   Left trace + via dot per block, reusing .lead/.cast-lead-in vocabulary */
.about-block {
  position: relative;
  margin: 0 0 1.4rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--trace-dim);
}

.about-block:last-child {
  margin-bottom: 0;
}

.about-block::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1.5px solid var(--pad);
}

.about-block-title {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--trace);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-shadow: 0 0 6px rgba(46, 230, 160, 0.35);
}

.about-block-text {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ---------- contact card ----------
   Pin-numbered rows, echoing the side rails' DIP/IC footprints. Values injected by js/contact.js from base64 — not in raw HTML. */
.ic-card {
  margin-top: 1.5rem;
  max-width: 26rem;
  border: 1px solid var(--trace-dim);
  background: var(--bg-inset);
}

.ic-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--trace-dim);
}

.ic-card-name {
  color: var(--trace);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.ic-card-pkg {
  color: var(--text-faint);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.ic-pins {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ic-pin + .ic-pin {
  border-top: 1px dashed var(--edge);
}

/* the whole row is the click target, not just the value text — num and
   label used to sit outside the <a>, so clicking them did nothing. */
.ic-pin-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.ic-pin-link:hover,
.ic-pin-link:focus {
  background: var(--bg-panel);
}

.ic-pin-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--pad);
  color: var(--text-faint);
  font-size: 0.6rem;
}

.ic-pin-label {
  width: 5.5rem;
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.ic-pin-value {
  color: var(--pad);
  border-bottom: 1px dashed var(--pad);
  font-size: 0.85rem;
  word-break: break-all;
}

.ic-pin-link:hover .ic-pin-value,
.ic-pin-link:focus .ic-pin-value {
  color: var(--trace);
  border-bottom-color: var(--trace);
}

/* placeholder shown until js/contact.js fills it in */
.ic-pin-value:empty::before {
  content: "\2026";
  color: var(--text-faint);
}

/* ---------- large ic-card variant (downloads.html AGENT_IC) ----------
   Full-width, larger type. Scoped to .lg so contact.html's card is untouched. */
.ic-card.lg {
  max-width: none;
  width: 100%;
}

.ic-card.lg .ic-card-name {
  font-size: 1rem;
}

.ic-card.lg .ic-card-pkg {
  font-size: 0.8rem;
}

.ic-card.lg .ic-pin-link {
  padding: 0.9rem 1.1rem;
}

.ic-card.lg .ic-pin-num {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.ic-card.lg .ic-pin-label {
  width: 7.5rem;
  font-size: 0.9rem;
  color: #8fb8a0;
}

.ic-card.lg .ic-pin-value {
  font-size: 1.15rem;
  color: #ffcf85;
  text-shadow: 0 0 8px rgba(255, 180, 84, 0.45);
}

/* ---------- legal / prose content (terms, privacy, disclaimer) ----------
   Keeps the PCB shell, drops the $-prompt terminal format for normal paragraphs */
.legal-content {
  max-width: 68ch;
  margin: 0 auto;
}

.legal-content h1 {
  margin: 0 0 0.35rem;
  font-size: 1.3rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.legal-content .updated {
  margin: 0 0 2rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.legal-content h2 {
  margin: 2rem 0 0.75rem;
  font-size: 0.95rem;
  color: var(--trace);
  letter-spacing: 0.02em;
}

.legal-content h2:first-of-type {
  margin-top: 0;
}

.legal-content p,
.legal-content li {
  margin: 0 0 1rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.legal-content ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal-content a {
  color: var(--pad);
  text-decoration: none;
  border-bottom: 1px dashed var(--pad);
}

.legal-content a:hover {
  color: var(--trace);
  border-bottom-color: var(--trace);
}

.legal-content strong {
  color: var(--text);
}

/* ---------- self-hosted services (index page only) ----------
   Trunk/bus/branch trace at fixed 12.5/37.5/62.5/87.5% points, matching the 4-col grid. Hidden once the grid reflows below 900px. */
.service-section {
  width: 100%;
  max-width: 1200px;
}

/* extra gap below .pcb-panel so the section isn't flush against it. Scoped here, not .page's shared gap (58px), so other pages aren't affected. */
.service-section:not(.two-col) {
  margin-top: 24px;
}

/* .page has no justify-content, so on a viewport taller than the content
   needs, leftover space collects below the cards (after the last flex
   child) rather than being shared with the gap above — can't fix that with
   justify-content:center without also breaking the nav->panel trace, which
   is calibrated to a fixed 88px gap. Bumping the gap further only above
   700px, where a tall/short-content window is more likely, rather than
   eating into limited vertical space on mobile. */
@media (min-width: 700px) {
  .service-section:not(.two-col) {
    margin-top: 56px;
  }
}

.service-bus-label {
  margin: 0 0 0.5rem;
  color: var(--text-faint);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-align: center;
}

.service-bus {
  position: relative;
  width: 100%;
  height: 46px;
}

.service-bus-trunk {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 20px;
  background: var(--trace-dim);
  transform: translateX(-50%);
}

.service-bus-line {
  position: absolute;
  left: 12.5%;
  right: 12.5%;
  top: 19px;
  height: 2px;
  background: var(--trace-dim);
}

.service-branch {
  position: absolute;
  top: 20px;
  width: 2px;
  height: 18px;
  background: var(--trace-dim);
  transform: translateX(-50%);
}

.service-branch.b1 { left: 12.5%; }
.service-branch.b2 { left: 37.5%; }
.service-branch.b3 { left: 62.5%; }
.service-branch.b4 { left: 87.5%; }

.service-via {
  position: absolute;
  top: 34px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--pad);
  transform: translateX(-50%);
}

.service-via.b1 { left: 12.5%; }
.service-via.b2 { left: 37.5%; }
.service-via.b3 { left: 62.5%; }
.service-via.b4 { left: 87.5%; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  width: 100%;
}

.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  text-align: center;
  text-decoration: none;
  background: var(--bg-panel);
  border: 1px solid var(--trace-dim);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.service-card:hover,
.service-card:focus {
  border-color: var(--trace);
  transform: translateY(-2px);
}

.service-icon {
  width: 40px;
  height: 40px;
}

/* forces the green family here — .svg-comp is grey and .svg-junc is amber elsewhere (side-rail art), scoped so those stay unchanged globally */
.service-icon .svg-comp { stroke: var(--trace-dim); }
.service-icon .svg-trace { stroke-width: 2.5; }

.service-name {
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.service-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.72rem;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .service-bus { display: none; }
}

@media (max-width: 480px) {
  .service-grid { grid-template-columns: 1fr; }
}

/* ---------- 2-card peripheral variant (downloads page) ----------
   Narrowed to 640px, centered, for a 2-branch bus (25%/75%, inline in markup) */
.service-section.two-col {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.service-section.two-col .service-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 15rem;
}

.service-section.two-col .service-card {
  padding: 2rem 1.5rem;
}

.service-section.two-col .service-icon {
  width: 50px;
  height: 50px;
}

.service-section.two-col .service-name {
  font-size: 1rem;
}

@media (max-width: 480px) {
  .service-section.two-col .service-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* ---------- photo feed (about page) ----------
   Two boxes cycling /images/ on independent timers (js/photo-feed.js). Reuses .service-section's trunk/bus vocabulary. */
.photo-section {
  width: 100%;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

.photo-grid {
  display: flex;
  justify-content: center;
  gap: 16.25rem;
  width: 100%;
}

.photo-box {
  position: relative;
  overflow: hidden;
  width: 260px;
  height: 260px;
  flex: 0 0 auto;
  background: var(--bg-inset);
  border: 1px solid var(--trace-dim);
}

.photo-box-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

@media (max-width: 620px) {
  .photo-grid { gap: 1.25rem; }
  .photo-box { width: 45vw; height: 45vw; max-width: 260px; max-height: 260px; }
}

@media (max-width: 400px) {
  .photo-grid { flex-direction: column; align-items: center; }
  .photo-box { width: 70vw; height: 70vw; max-width: 260px; max-height: 260px; }
}

/* ---------- phosphor glow ---------- */

.prompt,
.brand strong {
  text-shadow: 0 0 8px rgba(46, 230, 160, 0.4);
}

/* ---------- silkscreen reference labels ---------- */

.pcb-label {
  position: absolute;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

/* ---------- side rails (nav to footer) ---------- */

.side-rail {
  position: absolute;
  top: 0;
  bottom: 8px;
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 0;
}

.rail-left { left: 20px; }
.rail-right { right: 20px; }

.rail-trace {
  width: 2px;
  flex: 1 1 auto;
  background: var(--trace-dim);
}

.rail-trace.short {
  flex: 0 0 24px;
}

/* The leading spacer at the top of each rail (before the first SVG
   block) needs no visible trace - nothing routes into it from above.
   Was an inline style="background: transparent;" override; moved to a
   class for the same CSP reason as the .cast-* utilities above. */
.rail-trace.short.spacer {
  background: transparent;
}

/* ---------- SVG rail blocks (fixed-size circuit clusters) ----------
   Fixed pixel size, joined by stretchy .rail-trace runs. Left-rail: trace at x=20, flex-start. Right-rail: x=130/150, flex-end. */

.rail-svg {
  flex: 0 0 auto;
  overflow: visible;
}

.rail-left .rail-svg { align-self: flex-start; }
.rail-right .rail-svg { align-self: flex-end; }

.svg-trace {
  stroke: var(--trace-dim);
  stroke-width: 2;
  fill: none;
}

.svg-pin {
  stroke: var(--trace-dim);
  stroke-width: 1.5;
  fill: none;
}

.svg-chip {
  fill: var(--bg-panel);
  stroke: var(--trace);
  stroke-width: 1.5;
}

.svg-comp {
  fill: var(--bg-panel);
  stroke: var(--text-dim);
  stroke-width: 1.5;
}

.svg-cap {
  stroke: var(--text-dim);
  stroke-width: 2;
  fill: none;
}

.svg-gnd {
  stroke: var(--text-dim);
  stroke-width: 1.5;
  fill: none;
}

.svg-junc { fill: var(--pad); }

.svg-pad {
  fill: var(--bg-panel);
  stroke: var(--pad);
  stroke-width: 2;
}

.svg-tp {
  fill: var(--bg);
  stroke: var(--trace-dim);
  stroke-width: 1.5;
}

.svg-band1 { stroke: var(--pad); stroke-width: 3; }
.svg-band2 { stroke: var(--trace); stroke-width: 3; }

.svg-arrow { fill: var(--trace-dim); }

/* solid green node dot — avoids .svg-junc's amber, reserved for PCB via markers */
.svg-node { fill: var(--trace-dim); }

/* solid shape + scaled-down mask cutout = ring, reusing the same silhouette path */
.svg-cloud { fill: var(--trace-dim); }

.svg-led {
  fill: var(--trace-dim);
  stroke: var(--trace);
  stroke-width: 1;
}

.svg-led.amber { stroke: var(--pad); }

.svg-label {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* each LED animates independently: heartbeat = activity, double-blip = status */
@keyframes led-heartbeat {
  0%, 100% { fill: var(--trace-dim); }
  50% { fill: var(--trace); }
}

@keyframes led-blip {
  0%, 86%, 100% { fill: var(--trace-dim); }
  88%, 90% { fill: var(--pad); }
  91%, 93% { fill: var(--trace-dim); }
  94%, 96% { fill: var(--pad); }
}

.led-d1 { animation: led-heartbeat 3.2s ease-in-out infinite; }
.led-d2 { animation: led-blip 9s linear infinite; }
.led-d3 { animation: led-heartbeat 4.6s ease-in-out infinite; animation-delay: 1.2s; }

@media (max-width: 1500px) {
  .side-rail,
  .logo-drop,
  .footer-edge-trace,
  .footer-chamfer {
    display: none;
  }
}

@media (max-width: 700px) {
  .nav-logo svg { width: 175px; height: auto; }
  .lg-connect { display: none; }
  .nav-edge-trace { left: 78px; }
}

/* collapse threshold = 1200 + 2*(nav-search unfocused width, ~194px) ≈ 1590px, rounded up — viewport width where .nav-search first overlaps .nav-links' right edge. Separate from the 700px step below (.nav-logo vs .nav-links). */
@media (max-width: 1600px) {
  .nav-search-icon {
    display: block;
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .nav-search input {
    width: 1.9rem;
    padding-left: 1.9rem;
    color: transparent;
    cursor: pointer;
    transition: width 0.2s ease, color 0.2s ease;
  }

  .nav-search input::placeholder {
    color: transparent;
  }

  .nav-search input:focus,
  .nav-search input:not(:placeholder-shown) {
    width: 8.5rem;
    color: var(--text);
    cursor: text;
  }

  .nav-search input:focus::placeholder {
    color: var(--text-faint);
  }
}

/* .nav-logo and .nav-links don't reserve space for each other (both out of flex flow / fixed-width). 700px's 175px logo still isn't small enough below ~650px — shrink both further. */
@media (max-width: 560px) {
  .nav-logo svg { width: 120px; }
  .nav-links { gap: 1.5rem; }
  .nav-links a { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-edge-trace::after,
  .svg-led,
  body::before {
    animation: none;
  }
}

/* ---------- status bar footer ---------- */

footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-inset);
  color: var(--bg);
  font-size: 0.78rem;
}

/* footer-top copper bus, matches .rail-trace weight/color, no animation. Generous insets so it passes under both rails' vias. */
.footer-edge-trace {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1.5px;
  padding: 0;
  background: var(--trace-dim);
}

/* terminates each side rail onto .footer-edge-trace. footer children, same coordinate system, so the via lands exactly on the line. 8px offset = 8px overlap into the rail's trace. */
.footer-chamfer {
  position: absolute;
  top: -8px;
}

.footer-chamfer-l { left: 20px; }
.footer-chamfer-r { right: 20px; }

footer .status-left,
footer .status-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* low-key link group, footer status bar not main nav */
.footer-legal {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.footer-legal a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  opacity: 0.85;
}

.footer-legal a:hover {
  color: var(--trace);
  opacity: 1;
}

footer span,
.status-badge,
.mode {
  padding: 0.15rem 0.6rem;
  background: var(--trace-dim);
  color: var(--text);
}

footer .mode {
  background: var(--trace);
  color: #04140d;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

footer .mode:hover,
footer .mode:focus {
  opacity: 0.8;
}

/* status-bar pills as links, both slots — a real editor's status bar has clickable indicators too */
.status-badge {
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.status-badge:hover,
.status-badge:focus {
  background: var(--trace);
  color: #04140d;
}

@media (max-width: 520px) {
  .panel-face { padding: 2rem 1.25rem 1.5rem; }
  footer { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}

/* ---------- fault pages (error/*.html) ----------
   Not the shared PCB shell — full-viewport alarm state, danger-red grid instead of green. Keeps base font/scanlines/vignette. */
.fault-body {
  background-image:
    linear-gradient(rgba(255, 107, 107, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 107, 107, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}

.fault-page {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 2.5rem;
  text-align: center;
}

.fault-home {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.fault-home:hover,
.fault-home:focus {
  color: var(--trace);
}

.fault-alert {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--danger);
  background: rgba(255, 107, 107, 0.08);
  color: var(--danger);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
}

.fault-led {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: fault-blink 1s steps(1) infinite;
}

@keyframes fault-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

.fault-code {
  font-size: clamp(4rem, 15vw, 7rem);
  line-height: 1;
  font-weight: 700;
  color: var(--danger);
  text-shadow: 0 0 26px rgba(255, 107, 107, 0.55);
}

.fault-title {
  margin-top: -0.75rem;
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--text);
}

.fault-art {
  width: clamp(190px, 34vw, 260px);
  height: auto;
  margin: 0.25rem 0;
  overflow: visible;
}

.fault-desc {
  max-width: 46ch;
  margin: 0;
  color: var(--text-dim);
  line-height: 1.7;
}

.fault-hint {
  margin: 0;
  max-width: 100%;
  padding: 0.9rem 1.1rem;
  background: var(--bg-inset);
  border: 1px dashed var(--trace-dim);
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.6;
  text-align: left;
}

.fault-hint-cmd { color: var(--text); }
.fault-hint-out { color: var(--danger); }

.fault-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  padding: 0.75rem 1.75rem;
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #1a0505;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.15s ease, color 0.15s ease;
}

.fault-cta:hover,
.fault-cta:focus {
  background: transparent;
  color: var(--danger);
}

.fault-footer {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

.fault-footer a {
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.72rem;
}

.fault-footer a:hover,
.fault-footer a:focus {
  color: var(--trace);
}

/* broken-server icon, same vocabulary as side rails, --danger red instead of --trace green */
.fault-svg-chip {
  fill: var(--bg-panel);
  stroke: var(--danger);
  stroke-width: 2;
}

.fault-svg-line {
  stroke: var(--danger);
  stroke-width: 2;
  fill: none;
}

.fault-svg-vent {
  stroke: var(--text-faint);
  stroke-width: 1.5;
  fill: none;
}

.fault-svg-crack {
  stroke: var(--danger);
  stroke-width: 2.5;
  fill: none;
  filter: drop-shadow(0 0 4px rgba(255, 107, 107, 0.6));
}

.fault-svg-spark {
  stroke: var(--danger);
  stroke-width: 1.5;
}

.fault-svg-led-dead {
  fill: var(--bg-inset);
  stroke: var(--text-faint);
  stroke-width: 1.5;
}

.fault-svg-led-live {
  fill: var(--danger);
  stroke: var(--danger);
  stroke-width: 1;
  filter: drop-shadow(0 0 6px var(--danger));
  animation: fault-blink 1s steps(1) infinite;
}

.fault-svg-smoke {
  stroke: var(--text-faint);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.5;
}

.fault-svg-label {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

@media (max-width: 480px) {
  .fault-page { padding-top: 4rem; }
  .fault-home { position: static; margin-bottom: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fault-led,
  .fault-svg-led-live {
    animation: none;
  }
}
