/* A product's manual (products/<slug>/manual/): a contents rail on the left, the manual in a
   readable column on the right, in the site's frame and the product's own two colours.
   The print rules at the end turn the same page into the PDF (light paper, a cover and a
   contents page, no site chrome): tools/manual_pdf.sh. */

.manual-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; align-items: start; padding-top: 40px; padding-bottom: 72px; }

/* contents rail */
.toc-rail { position: sticky; top: 96px; display: grid; gap: 14px; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-rail .label, .doc-head .label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--p-accent); }
.toc-rail ol { list-style: none; display: grid; gap: 2px; }
.toc-rail li a { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 7px 10px; border-radius: 6px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.3; }
.toc-rail li a span { font-family: var(--font-mono); font-size: 0.78rem; color: var(--p-accent); padding-top: 1px; }
.toc-rail li a:hover, .toc-rail li a[aria-current="true"] { background: var(--bg-panel); color: var(--text-heading); }
.toc-rail .pdf { justify-self: start; font-size: 0.88rem; color: var(--text-heading); border-bottom: 1px solid var(--border-highlight); }
.toc-rail .pdf:hover { border-color: var(--p-accent); }

/* manual body */
.doc { min-width: 0; max-width: 820px; }
.doc-head { display: grid; gap: 16px; margin-bottom: 8px; }
.doc-head h1 { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--text-heading); }
.doc-head .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); }
.doc section { padding-top: 56px; scroll-margin-top: 80px; }
.doc section + section { border-top: 1px solid var(--border-subtle); margin-top: 56px; }
.doc h2 { display: flex; gap: 16px; align-items: baseline; font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; color: var(--text-heading); margin-bottom: 20px; text-wrap: balance; }
.doc h2 .num { font-family: var(--font-mono); font-size: 0.6em; color: var(--p-accent); }
.doc h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-heading); margin: 36px 0 12px; scroll-margin-top: 80px; }
.doc p { max-width: 68ch; margin-bottom: 14px; }
.doc p.lede { color: var(--text-heading); font-size: 1.1rem; }
.doc strong { color: var(--text-heading); font-weight: 600; }
.doc a { color: var(--text-heading); text-decoration: underline; text-decoration-color: var(--border-highlight); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--p-accent); }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 1.3em; display: grid; gap: 8px; max-width: 68ch; }
.doc code { overflow-wrap: anywhere; }

/* numbered steps */
.doc ol.steps { list-style: none; padding: 0; counter-reset: step; gap: 12px; }
.doc ol.steps li { counter-increment: step; position: relative; padding-left: 42px; min-height: 26px; }
.doc ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--p-accent);
  background: color-mix(in srgb, var(--p-accent) 12%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--p-accent) 35%, transparent); }

/* a key on the panel, and text as a screen shows it */
.doc kbd { display: inline-block; padding: 3px 8px 4px; border-radius: 4px; white-space: nowrap; vertical-align: 0.08em;
  background: linear-gradient(#4a4d55, #31343a 50%, #272a2f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 0 #08090a;
  font-family: var(--font-sans); font-size: 0.7rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-heading); }
.doc .dot { font-family: var(--font-mono); font-size: 0.85em; color: #e4e8ff; padding: 1px 6px 2px; border-radius: 3px; white-space: nowrap;
  background: color-mix(in srgb, var(--p-accent) 55%, #10143a); }

/* tables */
.tbl { overflow-x: auto; margin: 4px 0 20px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.doc th { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--border-highlight); font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.doc td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.doc td:first-child { color: var(--text-heading); font-weight: 600; }
.doc td:first-child:has(kbd) { white-space: nowrap; }

/* figures */
.doc figure { margin: 28px 0 32px; }
.doc figure img { display: block; max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 60px -24px rgba(0, 0, 0, 0.9); }
.doc figcaption { margin-top: 12px; font-size: 0.88rem; color: var(--text-secondary); max-width: 68ch; }
.doc figcaption b { color: var(--text-heading); font-weight: 600; }

/* panel map: numbered markers over the screenshot */
.callouts { position: relative; }
.callouts .pin { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #ff3b2f; color: #fff; font-family: var(--font-sans); font-size: 14px; font-weight: 700; line-height: 1; text-decoration: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 59, 47, 0.7); }
.doc .legend-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 24px; max-width: none; }
.legend-list li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: baseline; font-size: 0.93rem; }
.legend-list li b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #ff3b2f; color: #fff; font-size: 12px; font-weight: 700; }

/* the library diagram: drawn on the product's own dark panel */
.flow { margin: 28px 0 32px; padding: 20px; border-radius: 10px; background: #1a1b1f; box-shadow: 0 0 0 1px var(--gloss-edge); }
.flow svg { width: 100%; height: auto; display: block; }

/* notes */
.note { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin: 24px 0; padding: 16px 18px; border-radius: 10px;
  background: color-mix(in srgb, var(--p-accent) 10%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--p-accent) 35%, transparent); }
.note p { margin: 0; color: var(--text-heading); }
.note .led { width: 8px; height: 8px; margin-top: 9px; border-radius: 50%; background: var(--p-accent); box-shadow: 0 0 8px 1px color-mix(in srgb, var(--p-accent) 70%, transparent); }
.note.warn { background: rgba(255, 59, 47, 0.08); box-shadow: 0 0 0 1px rgba(255, 59, 47, 0.35); }
.note.warn .led { background: #ff3b2f; box-shadow: 0 0 8px 1px rgba(255, 59, 47, 0.7); }

/* four facts in a strip */
.spec-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin: 24px 0 8px; border-radius: 12px; background: linear-gradient(180deg, #20232a, #17191d); box-shadow: 0 0 0 1px var(--gloss-edge); }
.spec-strip > div { padding: 22px 22px 20px; display: grid; gap: 8px; align-content: start; }
.spec-strip > div + div { border-left: 1px solid var(--border-subtle); }
.spec-strip .n { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.spec-strip .n small { font-size: 0.45em; color: var(--text-secondary); }
.spec-strip p { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }

.doc .to-top { display: inline-block; margin-top: 24px; font-size: 0.85rem; color: var(--text-secondary); text-decoration: none; }
.doc .to-top:hover { color: var(--text-heading); }

.print-only { display: none; }

@media (max-width: 960px) {
  .manual-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .toc-rail { position: static; max-height: none; padding: 16px; border-radius: 12px; background: var(--bg-surface); box-shadow: 0 0 0 1px var(--gloss-edge); }
  .toc-rail ol { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-strip > div:nth-child(3) { border-left: 0; }
  .spec-strip > div:nth-child(n+3) { border-top: 1px solid var(--border-subtle); }
}
@media (max-width: 560px) { .callouts .pin { width: 22px; height: 22px; font-size: 12px; } }
@media (max-width: 460px) { .spec-strip { grid-template-columns: 1fr; } .spec-strip > div + div { border-left: 0; border-top: 1px solid var(--border-subtle); } }

/* ---------- print: the PDF ---------- */
@page {
  size: A4; margin: 18mm 17mm 20mm;
  @bottom-left { content: "User Manual"; font: 500 8pt Inter, sans-serif; color: #8a8e9c; }
  @bottom-right { content: counter(page); font: 600 8pt Inter, sans-serif; color: #8a8e9c; }
}
@page :first { margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #33353d; font-size: 10pt; line-height: 1.5; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .offer-bar, .doc-crumbs, .toc-rail, .cookie-banner, .to-top { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .manual-grid { display: block; padding: 0; }
  .doc { max-width: none; }
  .doc-head { display: none; }
  .doc p, .doc ul, .doc ol, .doc td, .doc figcaption, .legend-list li { color: #33353d; max-width: none; }
  .doc p.lede, .doc strong, .doc td:first-child, .doc a, .doc h2, .doc h3, .doc figcaption b { color: #1b1c20; }
  .doc h2 { font-size: 20pt; border-bottom: 2px solid #1b1c20; padding-bottom: 8px; }
  .doc h3 { font-size: 12.5pt; break-after: avoid; }
  .doc section { break-before: page; padding-top: 0; border: 0 !important; margin-top: 0 !important; }
  .doc th { color: #5d6170; border-bottom-color: #1b1c20; }
  .doc td { border-bottom-color: #d9dbe3; }
  .doc tr, .doc figure, .flow, .note, .spec-strip { break-inside: avoid; }
  .doc code { background: #f2f3f7; border-color: #d9dbe3; color: #1b1c20; }
  .doc kbd { background: #f4f4f7; box-shadow: none; border: 1px solid #b9bcc8; border-bottom-width: 2px; color: #1b1c20; }
  .doc figure { width: 80%; margin: 14px auto 18px; }
  .doc figure img { box-shadow: 0 0 0 1px #2a2a2e; border-radius: 4px; }
  .note { background: #eef1ff; box-shadow: 0 0 0 1px #c5cdf5; }
  .note p { color: #1b1c20; }
  .note.warn { background: #fff3f1; box-shadow: 0 0 0 1px #f2c4bf; }
  .spec-strip { background: #17191d !important; }
  .doc .spec-strip p { color: #b8bcc8; }
  .doc .spec-strip .n { color: #fff; }

  /* cover and contents pages, print only */
  .cover { height: 297mm; width: 210mm; margin: 0; padding: 30mm 22mm 0; position: relative; break-after: page; color: #ebe7dc;
    background: linear-gradient(160deg, #1d1d21, #0e0e10 70%); }
  .cover .bar { position: absolute; left: 0; right: 0; top: 0; height: 4mm; background: var(--p-accent); }
  .cover img.logo { width: 150mm; }
  .cover .kicker { margin-top: 16mm; font: 600 10pt/1 var(--font-mono); letter-spacing: 0.2em; text-transform: uppercase; color: #9aa3c7; }
  .cover .title { margin-top: 4mm; font: 700 36pt/1.1 var(--font-display); color: #fff; }
  .cover p { margin-top: 5mm; color: #c9c6bc; font-size: 12pt; max-width: 125mm; }
  .cover img.shot { position: absolute; left: 22mm; bottom: 34mm; width: calc(100% - 44mm); border-radius: 2mm; }
  .cover .foot { position: absolute; left: 22mm; right: 22mm; bottom: 14mm; display: flex; justify-content: space-between; font-size: 8.5pt; color: #8d8a82; border-top: 1px solid #2e2e33; padding-top: 4mm; }
  .print-toc { break-after: page; }
  .print-toc h2 { font: 700 20pt/1.2 var(--font-display); color: #1b1c20; border-bottom: 2px solid #1b1c20; padding-bottom: 8px; margin-bottom: 8mm; }
  .print-toc ol { list-style: none; padding: 0; margin: 0; }
  .print-toc li { display: grid; grid-template-columns: 12mm 1fr; padding: 3mm 0; border-bottom: 1px solid #d9dbe3; font: 600 12pt/1.3 var(--font-sans); color: #1b1c20; }
  .print-toc li span { color: var(--p-accent); font-weight: 700; }
}
