/* User manual page. Builds on site.css: same chassis, legends and LCD. A contents rail on the left,
   the manual in a readable column on the right. The print rules at the end turn the same page into
   the PDF (light paper, cover page, no site chrome): see Tools/make_manual_pdf.sh. */

.manual { padding-block: 56px 32px; }
.manual-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; align-items: start; }
@media (max-width: 960px) { .manual-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

/* contents rail */
.toc-rail { position: sticky; top: 84px; display: grid; gap: 14px; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc-rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc-rail li a { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 7px 10px; border-radius: 4px; text-decoration: none; color: var(--legend-dim); font-size: .93rem; line-height: 1.3; }
.toc-rail li a span { font-weight: 800; color: var(--lcd-hi); font-variant-numeric: tabular-nums; }
.toc-rail li a:hover, .toc-rail li a[aria-current="true"] { background: var(--chassis-2); color: var(--legend); }
.toc-rail .pdf { font-size: .9rem; color: var(--legend); text-decoration: none; border-bottom: 1px solid var(--edge); justify-self: start; }
.toc-rail .pdf:hover { border-color: var(--legend-dim); }
@media (max-width: 960px) {
  .toc-rail { position: static; max-height: none; border: 1px solid var(--edge); border-radius: 6px; padding: 16px; background: var(--chassis-2); }
  .toc-rail ol { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* manual body */
.doc { min-width: 0; max-width: 820px; }
.doc-head { display: grid; gap: 16px; margin-bottom: 48px; }
.doc-head h1 { font-size: clamp(2.4rem, 5.4vw, 4rem); }
.doc-head .meta { font-size: .92rem; color: var(--legend-dim); }
.doc section { padding-top: 56px; scroll-margin-top: 72px; }
.doc section + section { border-top: 1px solid var(--edge); margin-top: 56px; }
.doc h2 { display: flex; gap: 16px; align-items: baseline; font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin-bottom: 20px; }
.doc h2 .num { color: var(--lcd-hi); font-variant-numeric: tabular-nums; }
.doc h3 { margin: 36px 0 12px; scroll-margin-top: 72px; }
.doc p { max-width: 68ch; color: var(--legend-dim); margin-bottom: 14px; }
.doc p.lede { color: var(--legend); font-size: 1.15rem; }
.doc strong { color: var(--legend); font-weight: 650; }
.doc a { color: var(--legend); text-decoration-color: var(--edge); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--legend-dim); }
.doc ul, .doc ol { color: var(--legend-dim); margin: 0 0 16px; padding-left: 1.3em; display: grid; gap: 8px; max-width: 68ch; }
.doc code { font: 500 .88em/1 ui-monospace, Menlo, Consolas, monospace; background: var(--chassis-2); border: 1px solid var(--edge); border-radius: 3px; padding: 2px 5px; color: var(--legend); 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; background: var(--chassis-2); border: 1px solid var(--edge); color: var(--legend); font: 800 13px/1 var(--body); }

/* keycaps and LCD text in running copy */
kbd {
  display: inline-block; padding: 3px 8px 4px; border-radius: 4px; white-space: nowrap;
  background: linear-gradient(#55575d, #36383d 50%, #2b2d32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 2px 0 #08090a;
  font: 800 .72rem/1.2 var(--body); font-stretch: 112%; letter-spacing: .08em; text-transform: uppercase; color: var(--legend);
  vertical-align: .08em;
}
.dot { font: 400 1.15em/1 var(--dot); color: var(--lcd-ink); background: var(--lcd); padding: 1px 6px 2px; border-radius: 2px; white-space: nowrap; text-shadow: 0 0 5px rgba(220,228,255,.4); }

/* tables */
.tbl { overflow-x: auto; margin: 4px 0 20px; }
.doc table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.doc th { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--legend-dim); font: 700 11px/1.4 var(--body); font-stretch: 112%; letter-spacing: .12em; text-transform: uppercase; color: var(--legend-dim); }
.doc td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--edge); vertical-align: top; color: var(--legend-dim); }
.doc td:first-child { color: var(--legend); font-weight: 600; }
.doc td:first-child:has(kbd) { white-space: nowrap; }

/* figures */
.doc figure { margin: 28px 0 32px; }
.doc figure img { border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--edge), 0 30px 60px -24px rgba(0,0,0,.9); }
.doc figcaption { font-size: .9rem; color: var(--legend-dim); max-width: 68ch; }
.doc figcaption b { color: var(--legend); font-weight: 650; }

/* 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: var(--led); color: #fff; font: 800 14px/1 var(--body);
  box-shadow: 0 0 0 3px rgba(0,0,0,.55), 0 0 14px rgba(255,59,47,.7); text-decoration: none;
}
@media (max-width: 560px) { .callouts .pin { width: 22px; height: 22px; font-size: 12px; } }
.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; color: var(--legend-dim); font-size: .95rem; }
.legend-list li b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--led); color: #fff; font-size: 12px; font-weight: 800; }
.legend-list a { color: var(--legend); }

/* library flow diagram */
.flow { margin: 28px 0 32px; padding: 20px; border: 1px solid var(--edge); border-radius: 6px; background: var(--chassis-2); }
.flow svg { width: 100%; height: auto; display: block; }

/* callout boxes */
.note { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; margin: 24px 0; padding: 16px 18px; border-radius: 6px; background: rgba(51,72,216,.12); border: 1px solid rgba(90,109,255,.35); }
.note p { margin: 0; color: var(--legend); }
.note .led { margin-top: 8px; }
.note.warn { background: rgba(255,59,47,.08); border-color: rgba(255,59,47,.35); }

/* fact strip reuses the home page look */
.doc .spec-strip { margin: 24px 0 8px; }

.to-top { display: inline-block; margin-top: 24px; font-size: .88rem; color: var(--legend-dim); text-decoration: none; }
.to-top:hover { color: var(--legend); }

.print-only { display: none; }

/* ---------- print: the PDF ---------- */
@page {
  size: A4; margin: 18mm 17mm 20mm;
  @bottom-left { content: "WS-30 Player User Manual"; font: 500 8pt Archivo, sans-serif; color: #8a8e9c; }
  @bottom-right { content: counter(page); font: 700 8pt Archivo, 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: #1b1c20; font-size: 10pt; line-height: 1.5; }
  body { background-image: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .top, footer, .toc-rail, .cookie, .to-top, .no-print { display: none !important; }
  .print-only { display: block; }
  .wrap { max-width: none; padding: 0; }
  .manual { padding: 0; }
  .manual-grid { display: block; }
  .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, .legend-list a { color: #1b1c20; }
  .doc h2 { font-size: 20pt; border-bottom: 2px solid #1b1c20; padding-bottom: 8px; }
  .doc h2 .num { color: var(--lcd); }
  .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; }
  kbd { background: #f4f4f7; box-shadow: none; border: 1px solid #b9bcc8; border-bottom-width: 2px; color: #1b1c20; }
  .doc ol.steps li::before { background: #1b1c20; color: #fff; border: 0; }
  .doc figure { width: 80%; margin: 14px auto 18px; }
  .doc figure img { box-shadow: 0 0 0 1px #2a2a2e; }
  .flow { background: #141417; }
  .note { background: #eef1ff; border-color: #c5cdf5; }
  .note p { color: #1b1c20; }
  .note.warn { background: #fff3f1; border-color: #f2c4bf; }
  .spec-strip { background: #141417 !important; }
  .spec-strip p { color: #b8b5ab; }
  .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; border-radius: 0;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px), linear-gradient(160deg, #1d1d21, #0e0e10 70%);
    color: var(--legend);
  }
  .cover .bar { position: absolute; left: 0; right: 0; top: 0; height: 4mm; background: #c8312b; }
  .cover img.logo { width: 150mm; }
  .cover .kicker { margin-top: 16mm; font: 700 10pt/1 var(--body); letter-spacing: .22em; text-transform: uppercase; color: #9aa3c7; }
  .cover h1 { margin-top: 4mm; font-size: 36pt; color: #fff; }
  .cover p { margin-top: 5mm; color: #c9c6bc; font-size: 12pt; max-width: 125mm; }
  .cover img.shot { position: absolute; left: 22mm; right: 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-size: 20pt; 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: 650 12pt/1.3 var(--body); color: #1b1c20; }
  .print-toc li span { color: var(--lcd); font-weight: 900; }
}
