:root {
  --bg: #15130f;
  --panel: #1f1c17;
  --line: #3a342a;
  --text: #e9e4d8;
  --muted: #a89f8c;
  --brass: #c9a65a;
  --green: #6ee04a;
  --todo: #ff6b6b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--brass); }
a:hover { color: var(--green); }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* Header */
header { border-bottom: 1px solid var(--line); }
header .wrap { display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; }
header img { width: 56px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--green); }
.brand .name { font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; }
header nav { margin-left: auto; display: flex; gap: 18px; font-size: .95rem; }
header nav a { text-decoration: none; color: var(--muted); }
header nav a:hover { color: var(--green); }

/* Banner */
/* Plaque and apparatus span about 25-77% of the image height, so the banner stays at 3:1 to fit both.
   It stops at the image's native 1600px; wider screens get the sides faded into the page. */
.banner { max-width: 1600px; margin: 0 auto; }
.banner img { width: 100%; aspect-ratio: 3 / 1; min-height: 180px; object-fit: cover; object-position: 50% 30%; }
@media (min-width: 1600px) {
  .banner img { mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent); }
}

/* Intro */
.intro { padding-top: 32px; padding-bottom: 4px; }
.intro h1 { font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 600; line-height: 1.3; margin: 0; }

/* Sections */
section { padding: 32px 0; }
h2 { font-size: 1.4rem; color: var(--brass); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 20px; }

.status { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; border: 1px solid; white-space: nowrap; }
.status.released { color: var(--green); border-color: var(--green); }
.status.progress { color: var(--brass); border-color: var(--brass); }

/* Home page: one linked entry per build */
.entry { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; color: var(--text); text-decoration: none; }
.entry:hover { border-color: var(--green); color: var(--text); }
.entry img, .entry .no-photo { border-radius: 6px; aspect-ratio: 5 / 4; width: 100%; object-fit: cover; background: #fff; }
.entry .no-photo { display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); }
.entry .no-photo img { width: 50%; aspect-ratio: auto; background: none; opacity: .35; }
.entry h3 { margin: 0; font-size: 1.4rem; }
.entry p { margin: 6px 0 10px; }
.entry .more { color: var(--brass); font-weight: 700; font-size: .95rem; }
.entry:hover .more { color: var(--green); }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }

/* Project pages */
.project { padding-top: 24px; padding-bottom: 40px; }
.back { display: inline-block; margin-bottom: 14px; font-size: .95rem; text-decoration: none; }
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; margin-bottom: 10px; }
.project-head h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.2; }
.project h2 { font-size: 1.1rem; margin: 36px 0 14px; }
.lede { margin: 0 0 22px; font-size: 1.05rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 0 0 6px; }
.gallery img { border-radius: 6px; aspect-ratio: 5 / 4; object-fit: cover; background: #fff; }
.caption { font-size: .85rem; color: var(--muted); margin: 0; }

.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 24px; padding: 0; margin: 0; list-style: none; font-size: .95rem; }
.specs li { border-left: 2px solid var(--brass); padding-left: 10px; }
.specs b { color: var(--muted); font-weight: 600; }

.notes { margin: 0; padding-left: 18px; }
.notes li { margin-bottom: 8px; }

.files p { margin: 0 0 14px; }
.button { display: inline-block; background: var(--brass); color: #15130f; font-weight: 700; text-decoration: none; padding: 9px 18px; border-radius: 6px; }
.button:hover { background: var(--green); color: #15130f; }
.button.secondary { background: none; color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); margin: 6px 0 0 8px; }
.button.secondary:hover { color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }

/* Links */
.links { display: flex; flex-wrap: wrap; gap: 12px; }
.links a { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 12px 18px; text-decoration: none; color: var(--text); }
.links a:hover { border-color: var(--green); }
.links small { display: block; color: var(--muted); }

/* Placeholder marker: anything with this class still needs real info before going live */
.todo { outline: 2px dashed var(--todo) !important; color: var(--todo) !important; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 18px 0 40px; margin-top: auto; }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
footer .brand { gap: 10px; }
footer .brand img { width: 36px; }
footer .brand .name { font-size: 1rem; }
footer nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .95rem; }
footer nav a { text-decoration: none; color: var(--muted); }
footer nav a:hover { color: var(--green); }
footer .copy { flex-basis: 100%; margin: 0; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  header nav { display: none; }
  footer nav { margin-left: 0; flex-basis: 100%; }
  .entry { grid-template-columns: 110px 1fr; gap: 14px; padding: 12px; align-items: start; }
  .entry h3 { font-size: 1.15rem; }
  .entry p { font-size: .95rem; }
}

/* Articles: long-form design notes */
.article p, .article .notes { max-width: 72ch; }
.article figure { margin: 22px 0; }
.article figure img { border-radius: 6px; background: #fff; }
.article .caption { margin-top: 6px; }
.project pre { max-width: 72ch; background: #0d0c0a; color: #e8e2d6; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: .8rem; line-height: 1.45; margin: 0 0 16px; }
.article-link { margin: -10px 0 22px; }

/* Parts tables */
.project h3 { font-size: 1rem; margin: 26px 0 10px; }
.table-scroll { overflow-x: auto; margin: 0 0 8px; }
.bom { width: 100%; border-collapse: collapse; font-size: .9rem; }
.bom th, .bom td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bom th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.bom .num { text-align: right; white-space: nowrap; }
.bom small { display: block; color: var(--muted); }
.bom tfoot td { font-weight: 700; border-bottom: 0; }

/* Build steps */
.steps { margin: 0; padding-left: 22px; max-width: 72ch; }
.steps > li { margin-bottom: 10px; padding-left: 4px; }
.steps ul { margin: 8px 0 0; padding-left: 18px; }
.steps ul li { margin-bottom: 6px; }

/* FEA progression and color ideas */
.fea, .colors { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 22px 0 6px; }
.fea figure, .colors figure { margin: 0; }
.fea img, .colors img { width: 100%; border-radius: 6px; background: #fff; }
.fea .caption, .colors .caption { margin-top: 6px; }
.colors { grid-template-columns: 1fr; gap: 22px; }
.colors .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.colors.singles { grid-template-columns: 1fr 1fr; }

/* Pedal setup */
.pedal .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 8px; }
.pedal .panel > p:first-child { margin-top: 0; }
.pedal button.button { border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.pedal button.button.secondary { margin: 0; }
.pedal button.button:disabled { opacity: .4; cursor: default; }
.pedal button.button:disabled:hover { background: var(--brass); }
.pedal button.button.secondary:disabled:hover { background: none; color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.notice { border-left: 3px solid var(--brass); background: var(--panel); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: .95rem; }
.panel .notice { background: var(--bg); margin: 0 0 12px; }
.connect-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 18px; }
.conn { font-size: .9rem; color: var(--muted); }
.conn::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--line); vertical-align: 1px; }
.conn.on::before { background: var(--green); }
.conn.wait::before { background: var(--brass); }
.readouts { display: flex; flex-wrap: wrap; gap: 8px 36px; margin-bottom: 12px; }
.readouts .label { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.readouts .value { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.readouts .value.small { font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.chart-wrap { position: relative; }
#chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
#chart .grid { stroke: var(--line); stroke-width: 1; }
#chart .axis-text { fill: var(--muted); font-size: 12px; }
#chart .band { fill: var(--bg); }
#chart .band-text { fill: var(--muted); font-size: 12px; }
#chart .curve { fill: none; stroke: var(--brass); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
#chart .curve.saved { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; }
#chart .guide { stroke: var(--green); stroke-width: 1; stroke-dasharray: 2 3; }
#chart .dot { fill: var(--green); stroke: var(--panel); stroke-width: 2; }
#chart .hover-line { stroke: var(--muted); stroke-width: 1; }
#chart .hover-dot { fill: var(--panel); stroke: var(--text); stroke-width: 2; }
#chart.off .curve, #chart.off .band-text { opacity: .35; }
.tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; font-size: .85rem; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; }
.legend { font-size: .85rem; color: var(--muted); margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .key { display: inline-block; width: 22px; height: 0; border-top: 2.5px solid var(--brass); }
.legend .key.saved { border-top: 2px dashed var(--muted); }
.legend .key.dot { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--green); }
.demo-pedal { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.demo-pedal label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.pedal input[type=range] { width: 100%; accent-color: var(--brass); }
.dz { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: 2px 12px; margin-bottom: 14px; }
.dz label { font-weight: 700; }
.dz output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.dz .caption { grid-column: 2 / 4; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 6px; }
.msg { font-size: .9rem; color: var(--muted); }
.msg.ok { color: var(--green); }
.msg.err { color: var(--todo); }
.cal-bar { position: relative; height: 26px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; margin: 16px 0 6px; overflow: hidden; }
.cal-bar .seen { position: absolute; top: 0; bottom: 0; background: var(--brass); opacity: .45; }
.cal-bar .now { position: absolute; top: -1px; bottom: -1px; width: 3px; margin-left: -1px; background: var(--green); }
.console { margin-top: 36px; }
.console summary { cursor: pointer; color: var(--brass); font-weight: 700; }
.console summary:hover { color: var(--green); }
.console .caption { margin: 8px 0; display: block; }
.console pre { background: #0d0c0a; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; height: 220px; overflow: auto; font-size: .8rem; line-height: 1.45; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.console pre .out { color: var(--brass); }
.console pre .sys { color: var(--muted); font-style: italic; }
.send { display: flex; gap: 8px; }
.send input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: .9rem ui-monospace, Consolas, monospace; }
code { font-size: .9em; background: var(--panel); padding: 1px 5px; border-radius: 4px; }

/* Lightbox: click an image to see it full size (lightbox.js) */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
body:has(.lightbox[open]) { overflow: hidden; }
.lightbox:focus { outline: none; }
.lightbox { border: 0; padding: 0; margin: 0; background: none; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; color: var(--text); }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.lightbox::backdrop { background: rgba(10, 9, 7, .97); }
.lightbox img { max-width: min(94vw, 1600px); max-height: calc(100vh - 110px); width: auto; height: auto; object-fit: contain; border-radius: 6px; background: #fff; cursor: zoom-out; }
.lightbox .caption { max-width: 72ch; padding: 0 64px; text-align: center; }
.lb-btn { position: fixed; display: grid; place-items: center; width: 44px; height: 44px; padding: 0 0 4px; border: 1px solid var(--line); border-radius: 50%; background: rgba(21, 19, 15, .8); color: var(--text); font: 30px/1 system-ui, sans-serif; cursor: pointer; }
.lb-btn:hover, .lb-btn:focus-visible { border-color: var(--green); color: var(--green); outline: none; }
.lb-close { top: 14px; right: 14px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
@media (max-width: 560px) {
  .lightbox .caption { padding: 0 16px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; }
}

/* On-this-page links */
.toc { border-left: 2px solid var(--brass); padding: 2px 0 2px 14px; margin: 18px 0 8px; font-size: .95rem; }
.toc p { display: grid; grid-template-columns: 5.5em 1fr; gap: 0 8px; margin: 0 0 4px; }
.toc b { color: var(--muted); font-weight: 600; }
.toc span { display: flex; flex-wrap: wrap; gap: 2px 16px; }
@media (max-width: 560px) { .toc p { grid-template-columns: 1fr; } }

/* Printing: black on white, no site chrome, link addresses spelled out */
@media print {
  :root { --bg: #fff; --panel: #fff; --line: #bbb; --text: #000; --muted: #444; --brass: #000; --green: #000; }
  body { font-size: 11pt; line-height: 1.45; display: block; min-height: 0; }
  header, footer, .back, .button, .toc, .article-link, .connect-bar, .demo-pedal, .console, dialog { display: none !important; }
  a { color: #000; text-decoration: none; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #444; word-break: break-all; }
  .bom a[href^="http"]::after { content: none; }
  .wrap { max-width: none; padding: 0; }
  .project { padding: 0; }
  .table-scroll { overflow: visible; }
  h2, h3 { break-after: avoid; }
  tr, figure, img, .steps > li, .notes > li { break-inside: avoid; }
  .gallery img, .fea img, .colors img, .article figure img { max-height: 9cm; width: auto; }
  .zoomable { outline: none !important; }
}

/* Build guide pictures: render and exploded drawing side by side, inside the step they go with */
.project { container-type: inline-size; }
.steps > li > .step-fig { width: min(914px, calc(100vw - 66px)); margin: 12px 0 18px; }
/* cqw is the page column without the scrollbar, which 100vw includes; 26px is the list indent */
@supports (width: 1cqw) { .steps > li > .step-fig { width: calc(100cqw - 26px); } }
.step-fig .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.step-fig img { width: 100%; border-radius: 6px; }
.step-fig .drawing { background: #fff; }
.step-fig .caption { margin-top: 6px; max-width: 72ch; }
@media (max-width: 560px) { .step-fig .pair { grid-template-columns: 1fr; } }
/* Lemnos wiring diagram: a tall white SVG, full column width up to its own size */
.wiring-fig { margin: 12px 0 18px; }
.wiring-fig img { width: 100%; max-width: 760px; border-radius: 6px; background: #fff; }
@page { size: letter; margin: 16mm 15mm; }
.print-only { display: none; }
@media print {
  .steps > li > .step-fig { width: auto; margin: 6pt 0 4pt; }
  .step-fig .pair { display: block; }
  .step-fig img:not(.drawing) { display: none; }
  /* photos have no drawing to stand in for them, so they print, two to a row */
  .article .wiring-fig img { width: auto; max-width: 100%; max-height: 23cm; border-radius: 0; }
  .step-fig .pair:has(.photo) { display: flex; flex-wrap: wrap; gap: 3mm; }
  .step-fig img.photo { display: block; width: min(7.5cm, calc(50% - 1.5mm)); border-radius: 0; }
  .step-fig .drawing { width: 11.5cm; max-height: none; margin: 0; border-radius: 0; }
  p, li { orphans: 3; widows: 3; }
  .screen-only { display: none; }
  .print-only { display: block; }
}
