:root {
  --bg: #fbfaf8; --panel: #ffffff; --side: #f3f0eb; --text: #23201c; --muted: #6d665d;
  --line: #e2ddd5; --accent: #9a5a1e; --accent-soft: #f6eadb; --link: #8a4d14;
  --ph-bg: #fff7e8; --ph-line: #d9a35c; --ph-text: #7a4b12; --code: #f1ede6;
  --ok: #2f7d4a; --warn: #a3471f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a18; --panel: #232220; --side: #201f1d; --text: #ece7df; --muted: #a49c90;
    --line: #3a3733; --accent: #e0a45f; --accent-soft: #3a2c1c; --link: #eab06c;
    --ph-bg: #2c2418; --ph-line: #a77a3e; --ph-text: #f0c98f; --code: #2c2a27;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a18; --panel: #232220; --side: #201f1d; --text: #ece7df; --muted: #a49c90;
  --line: #3a3733; --accent: #e0a45f; --accent-soft: #3a2c1c; --link: #eab06c;
  --ph-bg: #2c2418; --ph-line: #a77a3e; --ph-text: #f0c98f; --code: #2c2a27;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
a { color: var(--link); }
code, kbd { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; background: var(--code); padding: .05em .35em; border-radius: 4px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand-sub { font-weight: 400; color: var(--muted); }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 17px; }
.brand-mark.big { width: 72px; height: 72px; font-size: 40px; border-radius: 16px; }
.search { margin-left: auto; width: 240px; max-width: 40vw; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.top-link { font-size: 14px; white-space: nowrap; }
.menu { display: none; border: 0; background: none; color: var(--text); font-size: 22px; cursor: pointer; }

/* side nav */
.side { position: fixed; top: 56px; bottom: 0; left: 0; width: 270px; overflow-y: auto; padding: 16px 12px 40px; background: var(--side); border-right: 1px solid var(--line); }
.nav-group { margin-bottom: 14px; }
.nav-head { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 8px 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14.5px; }
.side a:hover { background: var(--accent-soft); }
.side a.on { background: var(--accent); color: #fff; }
.nav-ico { width: 20px; height: 20px; flex: none; }
.side li.hide, .nav-group.hide { display: none; }

/* content */
.content { margin-left: 270px; max-width: 980px; padding: 28px 48px 80px; }
.content.wide { max-width: none; margin-left: 0; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); }
h1 { display: flex; align-items: center; gap: 12px; font-size: 32px; line-height: 1.2; margin: 6px 0 8px; }
h2 { font-size: 22px; margin: 36px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
h3 { font-size: 18px; margin: 26px 0 6px; }
.h1-ico { width: 40px; height: 40px; }
.lead { font-size: 18px; color: var(--muted); margin-top: 4px; }
.where { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.small { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }

.ctx { margin: 18px 0; padding: 14px 18px; border-left: 4px solid var(--accent); background: var(--panel); border-radius: 0 8px 8px 0; }
.ctx > b:first-child { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 4px; }
.ctx ul { margin: 0; padding-left: 20px; }
.tip, .note { margin: 16px 0; padding: 10px 16px; border-radius: 8px; background: var(--accent-soft); }
.tip::before { content: "Tip  "; font-weight: 700; color: var(--accent); }
.note::before { content: "Note  "; font-weight: 700; color: var(--warn); }
ol.steps { counter-reset: s; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: s; position: relative; padding-left: 40px; margin: 10px 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td:first-child { font-weight: 600; }
.shots td:first-child { font-weight: 400; }

/* screenshot placeholders */
.shot { margin: 22px 0; }
.frame { position: relative; width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: var(--panel); }
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px; text-align: center;
  background: repeating-linear-gradient(-45deg, var(--ph-bg), var(--ph-bg) 14px, transparent 14px, transparent 28px), var(--ph-bg);
  border: 2px dashed var(--ph-line); border-radius: 8px; color: var(--ph-text); overflow: hidden; }
.ph-tag { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ph-file { font-family: Consolas, monospace; font-weight: 700; font-size: 15px; word-break: break-all; }
.ph-size { font-size: 22px; font-weight: 800; }
.ph-ctx { font-size: 13px; max-width: 640px; line-height: 1.4; }
.shot figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* pager, cards */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: grid; grid-template-columns: 36px 1fr; gap: 2px 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--accent); }
.card-ico { grid-row: span 2; width: 36px; height: 36px; }
.card-t { font-weight: 700; }
.card-s { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.card:not(:has(img)) { grid-template-columns: 1fr; }

/* printable page */
.print-page .content { margin: 0 auto; max-width: 900px; }
.cover { text-align: center; padding: 60px 0 40px; }
.cover h1 { justify-content: center; font-size: 44px; }
.cover button { font: inherit; padding: 8px 18px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.toc ul { columns: 2; padding-left: 18px; }
.toc li { break-inside: avoid; }
.toc > ul > li { margin-bottom: 8px; }
h1.part { margin-top: 56px; font-size: 28px; color: var(--accent); border-bottom: 2px solid var(--accent); }
.topic h2 { display: flex; align-items: center; gap: 10px; border: 0; font-size: 24px; }
.shotlist td.f { font-family: Consolas, monospace; font-size: 13px; white-space: nowrap; }
.shotlist td.f .muted { font-size: 12px; }
.shotlist td.sz { white-space: nowrap; font-weight: 700; }
.shotlist td.n { color: var(--muted); }
.shotlist tr.done td { color: var(--ok); }
.shotlist table { font-size: 14px; }

@media (max-width: 860px) {
  .menu { display: block; }
  .side { transform: translateX(-100%); transition: transform .2s; z-index: 9; width: 280px; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .content { margin-left: 0; padding: 20px 16px 60px; }
  .top { padding: 0 12px; gap: 10px; }
  .top-link, .brand-sub { display: none; }
  .search { max-width: none; width: auto; flex: 1; }
  h1 { font-size: 26px; }
  .toc ul { columns: 1; }
  .shotlist table, .shotlist thead, .shotlist tbody, .shotlist tr, .shotlist td { display: block; }
  .shotlist thead { display: none; }
  .shotlist tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .shotlist td { border: 0; padding: 2px 0; }
}
@media print {
  :root { --bg: #fff; --panel: #fff; --text: #000; }
  .top, .side, .pager, .noprint, .crumb { display: none !important; }
  .content { margin: 0; padding: 0; max-width: none; }
  body { font-size: 11pt; }
  .topic { break-before: page; }
  h1.part { break-before: page; break-after: avoid; }
  h1.part + .topic { break-before: avoid; }
  .shot, table, .ctx { break-inside: avoid; }
  .cover { break-after: page; padding-top: 30vh; }
  .toc { break-after: page; }
  a { color: inherit; text-decoration: none; }
}
.todo { background: var(--ph-bg); color: var(--ph-text); border: 1px dashed var(--ph-line); padding: 0 .35em; border-radius: 4px; font-size: .92em; }

/* Millworker's logo (Docs\Brand): the mark beside the name, the stacked logo on the printable cover */
.brand-logo { display: block; width: 30px; height: 30px; flex: none; }
.brand-logo.big { width: 300px; height: auto; margin: 0 auto 8px; }
