/* WeGo Robotics manual stylesheet — shared by every manual made from this template.
   Taken from the Unitree G1 / H2 / R1 and xArm7 Korean manuals (B5 book, Pretendard).
   Book-specific page headers (top-left / top-right text) live in parts/_head.html, not here.
   Change colours or sizes here only when the change should apply to ALL WeGo manuals. */
@font-face { font-family:"Pretendard"; font-weight:400; src:url("../fonts/Pretendard-Regular.otf"); }
@font-face { font-family:"Pretendard"; font-weight:500; src:url("../fonts/Pretendard-Medium.otf"); }
@font-face { font-family:"Pretendard"; font-weight:600; src:url("../fonts/Pretendard-SemiBold.otf"); }
@font-face { font-family:"Pretendard"; font-weight:700; src:url("../fonts/Pretendard-Bold.otf"); }
@font-face { font-family:"Pretendard"; font-weight:800; src:url("../fonts/Pretendard-ExtraBold.otf"); }
@font-face { font-family:"JetBrains Mono"; font-weight:400; src:url("../fonts/JetBrainsMono-Regular.ttf"); }

:root{
  --ink:#0b1020; --ink2:#2e3446; --ink3:#5a6178; --rule:#dcdfea; --soft:#f4f6fb;
  --blue:#1673e6; --blue-dim:#e3eefc; --navy:#0a1428;
  --green:#7fae2e; --red:#b42318; --red-dim:#fdecea; --amber:#9a5b00; --amber-dim:#fdf2dc;
}

/* ── pages ─────────────────────────────────────────────────────────────── */
@page {
  size: B5;
  margin: 21mm 17mm 19mm 17mm;
  @bottom-center { content: counter(page); font: 600 8.5pt "Pretendard"; color: #5a6178; }
}
@page cover { margin: 0; @top-left{content:none} @top-right{content:none} @bottom-center{content:none} }
@page front { @top-left{content:none} @top-right{content:none} @bottom-center{content:none} }

*{ box-sizing:border-box; }
html{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
body{ margin:0; font-family:"Pretendard",sans-serif; font-size:9.2pt; line-height:1.6;
      color:var(--ink); word-break:keep-all; overflow-wrap:break-word; }
b, strong{ font-weight:700; }
code{ font-family:"JetBrains Mono","Pretendard",monospace; font-size:8.2pt; background:var(--soft);
      border:1px solid var(--rule); border-radius:3px; padding:0 3px; word-break:break-all; }

/* ── cover ─────────────────────────────────────────────────────────────── */
.cover{ page:cover; width:176mm; height:250mm; overflow:hidden; display:flex; flex-direction:column; position:relative;
  background: radial-gradient(120mm 90mm at 80% 8%, #1d4f9a 0%, rgba(29,79,154,0) 70%),
              linear-gradient(170deg, #0d1b36 0%, #070d1c 100%);
  color:#fff; padding:16mm 18mm 12mm; }
.cover .top{ display:flex; justify-content:space-between; align-items:center; }
.cover .tag{ font-size:7.5pt; font-weight:700; letter-spacing:.34em; color:#8fb8ff; }
.cover .logo{ display:inline-block; background:#fff; border-radius:3mm; padding:2.6mm 4mm; }
.cover .logo img{ height:9mm; display:block; }
.cover .kicker{ margin-top:16mm; font-weight:600; font-size:9pt; letter-spacing:.32em; color:#8fb8ff; }
.cover h1{ margin:3mm 0 0; font-size:29pt; line-height:1.18; font-weight:800; letter-spacing:-.01em; }
.cover h1 span{ color:#5aa2ff; }
.cover .title2{ margin-top:4mm; font-size:14.5pt; font-weight:600; color:#e7edf8; }
.cover .bar{ width:24mm; height:1.2mm; background:var(--green); border-radius:1mm; margin:6mm 0 5mm; }
.cover .lead{ font-size:9.4pt; line-height:1.7; color:#c3cde0; max-width:74mm; position:relative; z-index:1; }
.cover .hero{ position:absolute; right:3mm; bottom:17mm; height:150mm; z-index:0;
  filter:drop-shadow(0 4mm 8mm rgba(0,0,0,.55)); }
.cover .glow{ position:absolute; right:-20mm; bottom:0; width:140mm; height:150mm; z-index:0;
  background:radial-gradient(closest-side, rgba(90,162,255,.30), rgba(90,162,255,0)); }
.cover .foot{ position:relative; z-index:1; margin-top:auto; padding-top:4mm; border-top:.3mm solid rgba(143,184,255,.25); display:flex; justify-content:space-between;
  font-size:8pt; color:#9aa7bf; letter-spacing:.04em; }
.cover .foot b{ color:#fff; font-weight:700; }

/* ── front matter ──────────────────────────────────────────────────────── */
.front{ page:front; break-before:page; }
.colophon{ height:205mm; display:flex; flex-direction:column; justify-content:flex-end; font-size:8.4pt; color:var(--ink2); }
.colophon h3{ font-size:10pt; margin:0 0 2mm; }
.colophon table{ border-collapse:collapse; margin-bottom:6mm; }
.colophon td{ padding:1.2mm 6mm 1.2mm 0; border-bottom:1px solid var(--rule); vertical-align:top; }
.colophon td:first-child{ color:var(--ink3); white-space:nowrap; }
.colophon .copy{ color:var(--ink3); font-size:7.6pt; }

.toc h2{ font-size:20pt; font-weight:800; margin:6mm 0 1mm; border:0; padding:0; }
.toc .sub{ color:var(--ink3); font-size:8.5pt; letter-spacing:.24em; margin-bottom:9mm; }
.toc ol{ list-style:none; margin:0; padding:0; }
.toc li{ display:flex; align-items:baseline; gap:3mm; padding:2.4mm 0; border-bottom:1px solid var(--rule); font-size:10.5pt; }
.toc li .n{ font-weight:800; color:var(--blue); width:9mm; font-variant-numeric:tabular-nums; }
.toc li .t{ font-weight:600; }
.toc li .d{ flex:1; border-bottom:1px dotted #b8bdcc; transform:translateY(-1.2mm); }
.toc li .p{ font-weight:700; color:var(--ink2); font-variant-numeric:tabular-nums; min-width:6mm; text-align:right; }
.toc li.app .n{ color:var(--green); }
.toc li small{ display:block; font-size:7.8pt; color:var(--ink3); font-weight:500; }

/* ── chapters ──────────────────────────────────────────────────────────── */
.chapter{ break-before:page; }
.opener{ margin:0 0 5mm; padding-bottom:4mm; border-bottom:.5mm solid var(--ink); position:relative; }
.opener .num{ font-size:8pt; font-weight:700; letter-spacing:.3em; color:var(--blue); }
.opener .num big{ display:block; font-size:30pt; letter-spacing:0; line-height:1; margin-top:1mm; color:var(--blue); font-weight:800; }
.opener h1{ margin:2mm 0 0; font-size:17pt; font-weight:800; line-height:1.25; }
.opener::after{ content:""; position:absolute; left:0; bottom:-.5mm; width:22mm; height:1.6mm; background:var(--blue); }
.chapter.app .opener .num, .chapter.app .opener .num big{ color:var(--green); }
.chapter.app .opener::after{ background:var(--green); }
.chapter.app .opener{ margin-bottom:4mm; padding-bottom:3mm; } .chapter.app .opener .num big{ font-size:24pt; } .chapter.app .opener h1{ font-size:15pt; margin-top:1mm; }
p.lede{ font-size:10.3pt; line-height:1.58; font-weight:600; color:var(--ink); margin:0 0 4mm; }
h2{ font-size:11.5pt; font-weight:800; margin:5mm 0 2mm; padding-left:3mm; border-left:1.2mm solid var(--blue);
    line-height:1.3; break-after:avoid; }
h3{ font-size:10pt; font-weight:700; margin:4.5mm 0 1.5mm; break-after:avoid; }
p{ margin:0 0 2.6mm; }
ul{ margin:0 0 3mm; padding-left:5mm; }
ul li{ margin-bottom:1.2mm; }
ul li::marker{ color:var(--blue); }

ol.steps{ list-style:none; counter-reset:s; margin:0 0 4mm; padding:0; }
ol.steps > li{ counter-increment:s; position:relative; padding:0 0 2.4mm 10.5mm; break-inside:avoid; }
ol.steps > li::before{ content:counter(s); position:absolute; left:0; top:.3mm; width:6.6mm; height:6.6mm; border-radius:50%;
  background:var(--blue); color:#fff; font-weight:800; font-size:8.6pt; line-height:6.6mm; text-align:center; }
ol.steps > li:not(:last-child)::after{ content:""; position:absolute; left:3.2mm; top:7.6mm; bottom:.6mm; width:.25mm; background:#c9d6ee; }
ol.steps > li > b:first-child{ display:block; font-size:10pt; margin-bottom:.4mm; }

table.t{ width:100%; border-collapse:collapse; margin:1mm 0 4mm; font-size:8.4pt; line-height:1.5; break-inside:auto; }
table.t thead th{ background:var(--navy); color:#fff; font-weight:700; text-align:left; padding:1.6mm 2.4mm; }
table.t thead th code{ background:rgba(255,255,255,.14); border-color:rgba(255,255,255,.28); color:#fff; }
table.t thead th:first-child{ border-top-left-radius:1.4mm; } table.t thead th:last-child{ border-top-right-radius:1.4mm; }
table.t td{ padding:1.5mm 2.4mm; border-bottom:1px solid var(--rule); vertical-align:top; }
table.t tbody tr:nth-child(even) td{ background:#f8f9fc; }
table.t tr{ break-inside:avoid; }
table.t td:first-child{ font-weight:700; white-space:nowrap; }
table.t.wrap1 td:first-child{ white-space:normal; width:22%; }
table.t.api td:first-child{ width:44%; }
table.t.tight{ font-size:7.9pt; line-height:1.4; } table.t.tight td{ padding:1.05mm 2.1mm; }
table.t.num td{ white-space:nowrap; }
table.t.num td:first-child{ text-align:center; width:8mm; color:var(--blue); }
table.t td.c{ text-align:center; }
.mono{ font-family:"JetBrains Mono","Pretendard",monospace; font-size:7.9pt; }
.en{ display:block; font-size:6.8pt; color:var(--ink3); font-weight:500; letter-spacing:.02em; }

.box{ border-radius:1.8mm; padding:2.6mm 3.4mm; margin:2.4mm 0 3.4mm; break-inside:avoid; border-left:1.4mm solid; }
.box .h{ font-weight:800; font-size:9pt; letter-spacing:.06em; margin-bottom:.8mm; }
.box p:last-child, .box ul:last-child{ margin-bottom:0; }
.warn{ background:var(--red-dim); border-color:var(--red); } .warn .h{ color:var(--red); }
.note{ background:var(--blue-dim); border-color:var(--blue); } .note .h{ color:var(--blue); }
.caution{ background:var(--amber-dim); border-color:var(--amber); } .caution .h{ color:var(--amber); }

.k{ display:inline-block; min-width:5.4mm; height:5.4mm; padding:0 1.3mm; border-radius:2.7mm; background:var(--ink);
    color:#fff; font-weight:800; font-size:7.6pt; line-height:5.4mm; text-align:center; vertical-align:.1mm; white-space:nowrap; }
.k.r{ background:var(--red); } .k.g{ background:#1a7f4b; } .k.b{ background:var(--blue); } .k.s{ background:#5a6178; }
.ui{ font-weight:700; color:var(--ink); background:#e9eef8; border:1px solid #cfd8ea; border-radius:1mm; padding:0 .9mm; margin:0 .3mm; white-space:nowrap; }
.src{ display:inline-block; font-size:6.6pt; font-weight:700; letter-spacing:.06em; padding:0 1.2mm; border-radius:1mm;
      border:1px solid #9fc0ef; color:var(--blue); vertical-align:.3mm; white-space:nowrap; }
.src.r{ border-color:#b8d08a; color:#4f7a12; }

pre.cmd{ font-family:"JetBrains Mono","Pretendard",monospace; font-size:7.6pt; line-height:1.5; background:var(--soft); border:1px solid var(--rule);
  border-radius:1.4mm; padding:1.8mm 2.6mm; margin:1.2mm 0 3mm; white-space:pre-wrap; overflow-wrap:anywhere; break-inside:avoid; }
pre.cmd .c{ color:#6a7390; }
figure{ margin:1mm 0 3.5mm; break-inside:avoid; }
figure img{ width:100%; display:block; border-radius:1.6mm; border:1px solid #1c2a44; }
figure.light img{ border-color:var(--rule); }
figure.f80 img{ width:80%; margin:0 auto; } figure.f60 img{ width:60%; margin:0 auto; } figure.f45 img{ width:45%; margin:0 auto; }
figure.h70 img{ max-height:70mm; width:auto; max-width:100%; margin:0 auto; }
figure.h95 img{ max-height:95mm; width:auto; max-width:100%; margin:0 auto; }
figure svg{ width:100%; display:block; }
figcaption{ font-size:7.8pt; color:var(--ink3); margin-top:1.6mm; }
figcaption b{ color:var(--ink2); }
.three{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:3mm; align-items:end; }
figure.f90 img{ width:90%; margin:0 auto; }
.two{ display:grid; grid-template-columns:1fr 1fr; gap:4mm; align-items:start; }

.qr{ display:grid; grid-template-columns:1fr 1fr; gap:3mm; }
.qr .card{ border:1px solid var(--rule); border-radius:2mm; padding:3mm 3.6mm; break-inside:avoid; }
.qr .card h3{ margin:0 0 2mm; font-size:9.6pt; color:var(--blue); }
.qr .card.full{ grid-column:1 / -1; }
.qr ol{ margin:0; padding-left:4.4mm; font-size:8pt; line-height:1.45; } .qr ol li{ margin-bottom:.5mm; }
.qr table.t{ margin:0; font-size:7.8pt; } .qr table.t td{ padding:1.1mm 2mm; }
.qr .cut{ font-size:7.6pt; color:var(--ink3); margin-top:2mm; }

/* ── numbering hooks used by build_pdf.py ──────────────────────────────── */
table.t caption{ caption-side:top; text-align:left; font-size:7.8pt; color:var(--ink3); padding:0 0 1.4mm; }
table.t caption b{ color:var(--ink2); }
/* pass-1 page marker for the contents page; absolutely positioned so it never moves the layout */
.tocmark{ position:absolute; font-size:1pt; color:#fff; }

/* Four UI symbols Pretendard lacks (⚙ ☾ ❚ ⟲), from DejaVu Sans (Bitstream Vera licence, see fonts/LICENSE-DejaVu.txt).
   Same family name + unicode-range: only these code points use it, no font stack changes. */
@font-face { font-family:"Pretendard"; font-weight:100 900; src:url("../fonts/DejaVuSans-Symbols.ttf");
             unicode-range:U+263E, U+2699, U+275A, U+27F2; }
/* Chinese characters the manuals quote (Unitree UI strings, figure labels), which Pretendard lacks: Noto Sans CJK SC,
   SIL OFL 1.1 (fonts/OFL-NotoSansCJK.txt). tools/build.py writes the subset into site/ on every build from the
   characters the parts use; the full font stays in shared/fonts/src and is never served. A character in this range
   that the subset lacks (because Pretendard has it) falls back to Pretendard. */
@font-face { font-family:"Pretendard"; font-weight:100 900; src:url("../fonts/NotoSansCJKsc-Subset.otf");
             unicode-range:U+2E80-2FFF, U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF; }
