/* Single-page guide, modelled on the Zeptocore guide's layout and type:
   monochrome, monospace headings, hairline rules, a sticky contents rail. */
:root {
  --bg: #ffffff;
  --surface: #f7f7f4;
  --text: #050505;
  --muted: #777771;
  --line: #d7d7d2;
  --line-soft: #eeeeea;
  --accent: var(--text);
  --font-body: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "Roboto Mono", "JetBrains Mono", "Courier New", monospace;
  --page-x: clamp(18px, 5vw, 72px);
  --page-y: clamp(24px, 5vw, 56px);
  --text-xs: 0.72rem;
  --text-sm: 0.84rem;
  --tracking: 0.04em;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { max-width: 100%; height: auto; }

.guide-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--page-y) var(--page-x) calc(var(--page-y) * 2);
}

/* Header: kicker, title, byline, links */
.guide-header { max-width: 1080px; margin-bottom: clamp(36px, 6vw, 72px); }
.guide-kicker, .guide-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking);
  text-transform: uppercase;
}
.guide-kicker span:not(:last-child)::after { content: "/"; margin-left: 8px; }
.guide-kicker a { text-decoration: none; }
.guide-kicker a:hover { color: var(--text); }
.guide-byline span:not(:last-child)::after { content: "·"; margin-left: 8px; }
.guide-header h1 {
  max-width: 16ch;
  margin: 18px 0 20px;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 4.6rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.055em;
}
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.guide-links a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.guide-links span { margin-left: 6px; }

/* Two columns: contents rail and content */
.guide-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.guide-rail { min-width: 0; }
.guide-toc { position: sticky; top: 24px; }
.guide-toc summary {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking);
  text-transform: uppercase;
  cursor: pointer;
}
.guide-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}
.guide-toc li { font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.45; }
.guide-toc a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 12px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.guide-toc a:hover,
.guide-toc a:focus-visible,
.guide-toc a[aria-current="location"] { color: var(--text); }
.guide-toc a[aria-current="location"] { border-left-color: var(--accent); }

/* Content */
.guide-main { min-width: 0; max-width: 980px; }
.guide-main > p:first-child { max-width: 72ch; margin-top: 0; font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.8; }
.guide-main [id] { scroll-margin-top: 24px; }
.guide-section {
  margin-top: clamp(54px, 8vw, 92px);
  padding-top: clamp(30px, 4vw, 46px);
  border-top: 1px solid var(--line);
}
.guide-main h2, .guide-main h3 {
  font-family: var(--font-mono);
  font-weight: 500;
  line-height: 1.15;
}
.guide-main h2 {
  margin: 0 0 24px;
  font-size: clamp(1.55rem, 3vw, 2.55rem);
  letter-spacing: -0.035em;
}
.guide-main h3 {
  margin: 36px 0 12px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.guide-main p, .guide-main li { font-size: 0.98rem; line-height: 1.75; }
.guide-main p, .guide-main ul, .guide-main ol, .guide-main pre { margin-block: 16px; }
.guide-main a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.guide-main a:hover { color: var(--accent); }
.guide-main img {
  display: block;
  width: auto;
  max-width: min(100%, 760px);
  max-height: 640px;
  object-fit: contain;
  margin: 24px auto 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}
/* the simulator pictures share a width, so the device shows at one scale
   however tall each one's legend is */
.guide-main p > img[src*="images/zeptomech_"]:not([src*="_effects"]) {
  width: 350px;
  max-height: none;
}
/* the ports picture is wider (its labels sit either side of the device):
   764 px at the others' 350 / 497 scale */
.guide-main p > img[src*="images/zeptomech_"][src*="_ports"] {
  width: 538px;
}
/* the caption line the guide puts after each image */
.guide-main p:has(> img) + p {
  margin-top: 0;
  text-align: center;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.5;
}

/* Diagrams side by side, each with its caption */
.diagram-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 20px;
  margin: 24px 0;
}
.diagram-grid figure { margin: 0; }
.diagram-grid img {
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0 0 8px;
}
.diagram-grid figcaption {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* Key combinations and code */
.guide-main code {
  padding: 0.14em 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.86em;
  white-space: nowrap;
}
.guide-main pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.guide-main pre code { padding: 0; border: 0; background: none; white-space: pre; }

/* Tables */
.table-wrap {
  max-width: 100%;
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
}
.table-wrap:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.guide-main table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.guide-main th, .guide-main td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.guide-main thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking);
  text-transform: uppercase;
}
.guide-main tbody td:first-child { min-width: 140px; font-weight: 600; }
.guide-main tbody tr:last-child > * { border-bottom: 0; }
.guide-main td code { white-space: normal; }
/* effect icons, the height of a key-number box */
.guide-main img.fx-icon {
  display: inline-block;
  width: 1.45em;
  height: 1.45em;
  object-fit: contain;
  margin: 0 0.5em 0 0;
  border: 0;
  background: none;
  vertical-align: -0.35em;
}
.guide-main td:has(> .fx-icon) { white-space: nowrap; }

/* Troubleshooting questions read like the guide's FAQ rows */
#troubleshooting h3 {
  margin: 0;
  padding: 18px 4px 10px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.5;
}
#troubleshooting h3 + p { margin-top: 0; padding: 0 4px; max-width: 76ch; }

.guide-footer {
  margin-top: clamp(64px, 9vw, 120px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Narrow screens: the rail becomes a collapsible list above the content */
@media (max-width: 900px) {
  .guide-layout { grid-template-columns: 1fr; gap: 32px; }
  .guide-toc { position: static; padding: 14px 16px; border: 1px solid var(--line); }
  .guide-toc summary { margin-bottom: 0; }
  .guide-toc[open] summary { margin-bottom: 12px; }
}
@media (max-width: 560px) {
  .guide-header h1 { font-size: clamp(2rem, 10vw, 3.5rem); }
  .diagram-grid { grid-template-columns: 1fr; }
}
