:root {
  --bg: #f4f3ee; --surface: #ffffff; --surface-2: #ecebe4; --ink: #1b1f23; --muted: #5b636b; --line: #d8d6cc;
  --accent: #0a6c55; --accent-soft: #dcefe8; --accent-ink: #ffffff; --warn: #b4410e; --warn-soft: #fbe7dc;
  --kaizen: #f3c637; --paper: #fbfbf8; --grid: #e4e2da;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.06);
  --radius: 10px; --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417; --surface: #1a1d21; --surface-2: #23272c; --ink: #e7e5df; --muted: #9aa2ab; --line: #31363c;
    --accent: #43c49a; --accent-soft: #15352b; --accent-ink: #06140f; --warn: #f08a54; --warn-soft: #3a2216;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121417; --surface: #1a1d21; --surface-2: #23272c; --ink: #e7e5df; --muted: #9aa2ab; --line: #31363c;
  --accent: #43c49a; --accent-soft: #15352b; --accent-ink: #06140f; --warn: #f08a54; --warn-soft: #3a2216;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
button, input, select, textarea { font: inherit; color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--warn); }

/* ---------- site header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.wordmark { display: block; width: min(360px, 80%); height: auto; margin: 0 0 18px; }
.brand-icon { width: 30px; height: 30px; display: block; flex: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.site-header nav { margin-left: auto; display: flex; gap: 6px; }

/* ---------- guide ---------- */
.hero { max-width: 1120px; margin: 0 auto; padding: 56px 24px 28px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); margin: 0 0 14px; }
.hero p { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { padding: 10px 18px; font-size: 15px; }
.hero-figure { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.hero-figure svg { width: 100%; height: auto; display: block; }
.eyebrow { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

.layout { max-width: 1120px; margin: 0 auto; padding: 8px 24px 80px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; }
.toc { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; font-size: 14px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li a { display: block; padding: 5px 10px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.toc li a:hover, .toc li a.active { color: var(--ink); border-left-color: var(--accent); }
article { max-width: 760px; }
article section { padding-top: 12px; margin-bottom: 44px; scroll-margin-top: 70px; }
article h2 { font-size: 26px; margin: 0 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
article h3 { font-size: 18px; margin: 26px 0 8px; }
article p, article li { color: var(--ink); }
.lede { color: var(--muted); font-size: 16.5px; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 8px; margin: 18px 0; }
.callout.warn { border-left-color: var(--warn); }
.callout strong:first-child { display: block; margin-bottom: 2px; }
.formula { font-family: var(--mono); font-size: 14px; background: var(--surface-2); padding: 10px 14px; border-radius: 8px; margin: 10px 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; background: var(--surface); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 2px 0 14px 46px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font: 700 14px/30px var(--mono); text-align: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 14px 0; }
.sym { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.sym .art { background: #fff; border-radius: 8px; height: 76px; display: grid; place-items: center; border: 1px solid var(--line); }
.sym h4 { margin: 0 0 2px; font-size: 14.5px; }
.sym p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.link-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.link-row .art { background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.link-row h4 { margin: 0; font-size: 14px; } .link-row p { margin: 0; font-size: 13px; color: var(--muted); }
.calc { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.calc label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.calc input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.calc .out { grid-column: 1 / -1; font-family: var(--mono); font-size: 15px; padding-top: 6px; border-top: 1px dashed var(--line); }
.calc .out b { color: var(--accent); font-size: 18px; }
dl.glossary { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; }
dl.glossary dt { font-weight: 600; } dl.glossary dd { margin: 0; color: var(--muted); }
.howto { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.howto .card .k { font: 600 12px var(--mono); color: var(--accent); }
kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
footer.site { border-top: 1px solid var(--line); padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 32px 16px 12px; }
  .layout { grid-template-columns: 1fr; padding: 0 16px 60px; gap: 0; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--surface); margin-bottom: 12px; }
  .toc ol { columns: 2; }
  .site-header { padding: 10px 16px; }
  dl.glossary { grid-template-columns: 1fr; } dl.glossary dd { margin-bottom: 8px; }
  .link-row { grid-template-columns: 1fr; }
}

/* light and dark versions of the logo */
.dark-only { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .light-only { display: none !important; }
  :root:not([data-theme="light"]) .dark-only { display: block !important; }
}
:root[data-theme="dark"] .light-only { display: none !important; }
:root[data-theme="dark"] .dark-only { display: block !important; }
