/* NoiseWorks user manuals: shared print style for WeasyPrint (A4, light pages, NoiseWorks accents).
   Each product adds its own style.css on top (accent colour, product-specific blocks).
   The running header text ("<Product> User Manual") is injected by manual_builder.py. */

:root {
  --ink: #1a1a1a;          /* NoiseWorks shade7, used as text on paper */
  --ink-soft: #4a4a4a;
  --muted: #8a8a8a;
  --rule: #e2e2e2;
  --paper-tint: #f6f6f3;
  --yellow: #f5f04a;       /* NoiseWorks UI yellow */
  --yellow-deep: #c9c11a;  /* yellow that still reads on white */
  --accent: var(--yellow);           /* rules, pins, step numbers; products may override */
  --accent-deep: var(--yellow-deep); /* accent for thin lines and links on white */
  --dark: #1a1a1a;
  --blue: #66d1ff;
  --red: #ff3131;
}

/* ---------- Pages ---------- */

@page {
  size: A4;
  margin: 22mm 20mm 22mm 20mm;
  @top-left {
    content: "User Manual";
    font: 500 7.5pt Inter, sans-serif;
    letter-spacing: 0.06em;
    color: var(--muted);
    vertical-align: bottom;
    padding-bottom: 4mm;
  }
  @top-right {
    content: string(chapter);
    font: 500 7.5pt Inter, sans-serif;
    color: var(--muted);
    vertical-align: bottom;
    padding-bottom: 4mm;
  }
  @bottom-left {
    content: "NOISEWORKS";
    font: 600 7pt Inter, sans-serif;
    letter-spacing: 0.22em;
    color: var(--muted);
    vertical-align: top;
    padding-top: 4mm;
  }
  @bottom-right {
    content: counter(page);
    font: 600 8pt Inter, sans-serif;
    color: var(--ink);
    vertical-align: top;
    padding-top: 4mm;
  }
}

@page cover {
  margin: 0;
  @top-left { content: none; }
  @top-right { content: none; }
  @bottom-left { content: none; }
  @bottom-right { content: none; }
}

@page toc {
  @top-right { content: none; }
}

html {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 9.6pt;
  line-height: 1.55;
  color: var(--ink);
  hyphens: manual;
}

body { margin: 0; }

/* ---------- Cover ---------- */

.cover {
  page: cover;
  height: 297mm;
  position: relative;
  break-after: page;
}

.cover-panel {
  background: #191919; /* matches the logo artwork */
  height: 96mm;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2.2mm solid var(--accent);
}

.cover-logo { width: 62mm; }

.cover-text { padding: 20mm 22mm 0 22mm; }

.cover-kicker {
  margin: 0;
  font-size: 9pt;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.cover-title {
  margin: 2mm 0 0 0;
  font-size: 44pt;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--ink);
}

.cover-sub {
  margin: 3mm 0 12mm 0;
  font-size: 13pt;
  font-weight: 400;
  color: var(--ink-soft);
}

.cover-shot {
  width: 120mm;
  border-radius: 2.5mm;
  border: 0.4mm solid #000;
}

.cover-meta {
  position: absolute;
  left: 22mm;
  right: 22mm;
  bottom: 16mm;
  display: flex;
  justify-content: space-between;
  border-top: 0.3mm solid var(--rule);
  padding-top: 4mm;
  font-size: 8.5pt;
  color: var(--ink-soft);
}

/* ---------- Table of contents ---------- */

.toc-page { page: toc; break-after: page; }

.toc-title {
  font-size: 22pt;
  font-weight: 300;
  margin: 0 0 8mm 0;
  padding-bottom: 3mm;
  border-bottom: 0.6mm solid var(--accent);
  display: inline-block;
}

ol.toc { list-style: none; margin: 0; padding: 0; }

ol.toc li a {
  color: var(--ink);
  text-decoration: none;
}

ol.toc li a::after {
  content: leader(dotted) target-counter(attr(href), page);
  color: var(--muted);
}

ol.toc li.toc-h2 {
  font-weight: 600;
  font-size: 10pt;
  margin-top: 3.4mm;
}

ol.toc li.toc-h2 a::after { color: var(--ink); }

ol.toc li.toc-h3 {
  font-size: 8.8pt;
  margin: 0.5mm 0 0 6mm;
  color: var(--ink-soft);
}

ol.toc li.toc-h3 a { color: var(--ink-soft); }

/* ---------- Headings ---------- */

.content h2 {
  string-set: chapter content();
  break-before: page;
  font-size: 20pt;
  font-weight: 300;
  line-height: 1.2;
  margin: 0 0 6mm 0;
  padding-bottom: 2.5mm;
  border-bottom: 0.6mm solid var(--accent);
  display: block;
}

.content h2.keep-with-previous { break-before: auto; margin-top: 12mm; }

.content h3 {
  font-size: 12pt;
  font-weight: 600;
  margin: 7mm 0 2mm 0;
  break-after: avoid;
}

.content h4 {
  font-size: 9.6pt;
  font-weight: 700;
  margin: 5mm 0 1mm 0;
  break-after: avoid;
}

p { margin: 0 0 2.6mm 0; orphans: 3; widows: 3; }

.lead {
  font-size: 11pt;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 5mm;
}

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-deep); }

strong { font-weight: 650; }

ul, ol { margin: 0 0 3mm 0; padding-left: 5.5mm; }
li { margin: 0 0 1.2mm 0; }
li::marker { color: var(--muted); }

code, kbd {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 8.4pt;
  background: var(--paper-tint);
  border: 0.2mm solid var(--rule);
  border-radius: 1mm;
  padding: 0.2mm 1mm;
}

/* Inline UI labels: [[Balance]] style names rendered as small chips. */
.ui {
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Numbered steps ---------- */

ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 9mm;
  margin-bottom: 2.4mm;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.2mm;
  width: 5.6mm;
  height: 5.6mm;
  line-height: 5.6mm;
  border-radius: 50%;
  background: var(--dark);
  color: var(--accent);
  font-size: 8pt;
  font-weight: 700;
  text-align: center;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2mm 0 5mm 0;
  font-size: 8.8pt;
  break-inside: auto;
}

thead th {
  text-align: left;
  font-weight: 600;
  font-size: 7.8pt;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 0.5mm solid var(--ink);
  padding: 1.6mm 2.4mm 1.6mm 0;
}

tbody td {
  vertical-align: top;
  border-bottom: 0.2mm solid var(--rule);
  padding: 2mm 2.4mm 2mm 0;
}

tbody tr { break-inside: avoid; }

td:first-child { font-weight: 600; white-space: nowrap; }

/* ---------- Figures ---------- */

figure {
  margin: 4mm 0 6mm 0;
  break-inside: avoid;
}

figure img {
  display: block;
  width: 100%;
  border-radius: 2mm;
}

figure.narrow img { width: 72%; margin: 0 auto; }

figcaption {
  font-size: 8pt;
  color: var(--muted);
  margin-top: 2mm;
  text-align: center;
}

/* Annotated screenshot: numbered pins positioned in percent of the image. */
figure.annotated .shot { position: relative; }

figure.annotated .pin {
  position: absolute;
  width: 5.4mm;
  height: 5.4mm;
  margin: -2.7mm 0 0 -2.7mm;
  border-radius: 50%;
  background: var(--accent);
  color: var(--dark);
  border: 0.45mm solid var(--dark);
  font-size: 7.6pt;
  font-weight: 800;
  line-height: 4.5mm;
  padding-top: 0.35mm;
  box-sizing: border-box;
  text-align: center;
}

/* Legend for the pins */
ol.legend {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 8mm;
  font-size: 8.8pt;
}
ol.legend li {
  break-inside: avoid;
  position: relative;
  padding-left: 7.5mm;
  margin-bottom: 1.8mm;
}
ol.legend li b.n {
  position: absolute;
  left: 0;
  top: 0.1mm;
  width: 4.8mm;
  height: 4.8mm;
  line-height: 4.8mm;
  border-radius: 50%;
  background: var(--accent);
  border: 0.35mm solid var(--dark);
  font-size: 7pt;
  font-weight: 800;
  text-align: center;
}

/* ---------- Callouts (Markdown admonitions: !!! tip / note / warning) ---------- */

.admonition {
  break-inside: avoid;
  margin: 3mm 0 5mm 0;
  padding: 3mm 4mm 1.2mm 4mm;
  background: var(--paper-tint);
  border-left: 1.2mm solid var(--accent-deep);
  border-radius: 0 1.5mm 1.5mm 0;
}

.admonition .admonition-title {
  margin: 0 0 1.2mm 0;
  font-size: 7.6pt;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.admonition.warning { border-left-color: var(--red); }
.admonition.note { border-left-color: var(--blue); }

/* ---------- Mode cards ---------- */

.modes { display: flex; gap: 4mm; margin: 3mm 0 5mm 0; break-inside: avoid; }
.mode {
  flex: 1;
  border: 0.3mm solid var(--rule);
  border-radius: 2mm;
  padding: 3.5mm 4mm 2mm 4mm;
}
.mode.default { border-color: var(--ink); border-width: 0.45mm; }
.mode .name { font-weight: 700; font-size: 10.5pt; margin: 0; }
.mode .latency { font-size: 17pt; font-weight: 300; margin: 1mm 0 1.5mm 0; }
.mode .tag {
  display: inline-block;
  font-size: 6.8pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  padding: 0.3mm 1.6mm;
  border-radius: 1mm;
  margin-left: 1.5mm;
  vertical-align: 0.5mm;
}
.mode p { font-size: 8.6pt; color: var(--ink-soft); }

/* ---------- Misc ---------- */

hr { border: 0; border-top: 0.3mm solid var(--rule); margin: 6mm 0; }

.faq h4 { margin-top: 4.5mm; }

.support-box {
  margin-top: 6mm;
  padding: 5mm 6mm;
  background: var(--dark);
  color: #f0f0f0;
  border-radius: 2mm;
  break-inside: avoid;
}
.support-box p { margin: 0 0 1.5mm 0; }
.support-box a { color: var(--accent); text-decoration: none; }
.support-box .big { font-size: 12pt; font-weight: 600; color: #fff; }

.small { font-size: 8pt; color: var(--muted); }

figure.compact img { width: 60%; margin: 0 auto; }
.content h3.new-page { break-before: page; margin-top: 0; }
