/* energyhub book theme. Tokens follow the main qlines.net site (static/src/css/qlines-v2.css, 2026-10 "Intelligent Energy
   Solutions" redesign): navy bands with a faint grid, blue buttons, green accent, Nunito headings, Poppins body, white cards
   on #f5f7fb, no coloured bars on the left of boxes. The --slate names are kept as aliases of the navy tones. */
@font-face { font-family: 'Poppins'; font-weight: 300; font-display: swap; src: url('../fonts/poppins-300-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('../fonts/poppins-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('../fonts/poppins-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('../fonts/poppins-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-display: swap; src: url('../fonts/nunito-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  --slate: #102a4d; --slate-deep: #0a1d38; --slate-night: #061224;
  --navy-grid: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 44px 44px, linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 44px 44px;
  --blue: #0a63d1; --blue-dark: #084fa6;
  --green: #4aca85; --green-text: #1f7a4a;
  --accent: #798eea; --accent-text: #4e62cf;
  --ink: #0f1b2d; --body: #46505f; --muted: #5b6676;
  --bg: #f5f7fb; --line: #e2e7ef; --radius: 14px;
  --shadow: 0 2px 12px rgba(48,49,51,.08); --lift: 0 10px 30px rgba(48,49,51,.14);
  --warn-bg: #fff6e6; --warn-line: #f0b84a; --bad: #b42318; --good: #1f7a4a;
  --f-head: "Nunito", Arial, sans-serif; --f-body: "Poppins", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); color: var(--body); background: #fff; line-height: 1.7; font-size: 16px; }
h1, h2, h3, h4 { font-family: var(--f-head); color: var(--ink); line-height: 1.25; margin: 0 0 .6em; }
a { color: var(--blue); } a:hover { color: var(--blue-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 3000; padding: 12px 18px; border-radius: 8px; background: #fff; color: #1f2937; font-weight: 600; box-shadow: var(--lift); }
.skip:focus { top: 12px; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 .6rem; }
.muted { color: var(--muted); }

/* ---- Header ---- */
.parent-bar { background: var(--slate-night); font-size: .78rem; }
.parent-bar a { color: #c9d1e0; text-decoration: none; display: inline-block; padding: 6px 0; }
.parent-bar a:hover { color: #fff; }
.site-head { background: var(--slate-deep); position: sticky; top: 0; z-index: 900; box-shadow: 0 2px 14px rgba(0,0,0,.18); }
.head-inner { display: flex; align-items: center; gap: 1.2rem; min-height: 64px; position: relative; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; font-family: var(--f-head); font-weight: 800; font-size: 1.35rem; letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.brand-mark { color: var(--green); display: inline-flex; }
.site-nav { display: flex; gap: .2rem; margin-left: auto; align-items: center; }
.site-nav a { color: #dfe5f0; text-decoration: none; padding: .5rem .8rem; border-radius: 8px; font-size: .92rem; font-weight: 500; white-space: nowrap; }
.site-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.site-nav a.active { color: #fff; text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 8px; }
.head-right { display: flex; align-items: center; gap: .6rem; }
.lang-toggle { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; padding: .4rem .9rem; font-size: .86rem; font-weight: 500; }
.lang-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav-toggle { display: none; }
@media (max-width: 1060px) {
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: .4rem 20px 1rem; background: var(--slate-deep); box-shadow: 0 16px 28px rgba(0,0,0,.25); max-height: calc(100dvh - 100px); overflow-y: auto; }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .85rem .4rem; border-bottom: 1px solid rgba(255,255,255,.1); border-radius: 0; white-space: normal; }
  .head-right { margin-left: auto; }
  .nav-toggle { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; font: inherit; font-size: .86rem; cursor: pointer; }
}

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 26px; border-radius: 8px; border: 2px solid transparent; font-family: var(--f-body); font-weight: 500; font-size: 1rem; text-decoration: none; cursor: pointer; transition: background-color .2s, transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(0,105,217,.35); } .btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-light { background: #fff; color: var(--slate); } .btn-light:hover { background: #eef1f6; color: var(--slate); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.85); } .btn-ghost:hover { background: rgba(255,255,255,.14); color: #fff; }
.btn-outline { background: transparent; color: var(--blue); border-color: var(--blue); } .btn-outline:hover { background: var(--blue); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---- Hero / page heads ---- */
.hero { position: relative; overflow: hidden; color: #fff; background: var(--navy-grid), linear-gradient(160deg, var(--slate-night) 0%, var(--slate-deep) 48%, var(--slate) 100%); padding: 84px 0 80px; }
.hero::before { content: ""; position: absolute; width: 620px; height: 620px; right: -140px; top: -180px; background: radial-gradient(circle, rgba(74,202,133,.24), rgba(74,202,133,0) 68%); pointer-events: none; }
.hero-grid { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero .eyebrow { color: #9be7c2; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 700; margin-bottom: 18px; }
.hero .lead { font-size: 1.12rem; font-weight: 300; color: rgba(255,255,255,.92); max-width: 560px; margin: 0 0 28px; }
.hero-facts { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: .9rem; color: rgba(255,255,255,.9); }
.hero-facts li::before { content: "✓"; color: var(--green); font-weight: 700; margin-right: 8px; }
.cover { background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 24px 60px rgba(10,16,30,.4); color: var(--ink); }
.cover small { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; font-weight: 600; }
.cover h2 { font-size: 1.6rem; margin: .4rem 0 1rem; }
.cover ol { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.cover li { display: flex; gap: .8rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .93rem; }
.cover li::before { counter-increment: p; content: counter(p); flex: 0 0 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; border-radius: 50%; background: #eef1fb; color: var(--accent-text); font-weight: 600; font-size: .78rem; }
.cover li a { color: var(--ink); text-decoration: none; font-weight: 500; } .cover li a:hover { color: var(--blue); }
.pagehead { background: var(--navy-grid), linear-gradient(160deg, var(--slate-night), var(--slate-deep) 55%, var(--slate)); color: #fff; padding: 56px 0 48px; }
.pagehead h1 { color: #fff; font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 700; margin: 0 0 .5rem; }
.pagehead .eyebrow { color: #9be7c2; }
.pagehead .sub { font-size: 1.08rem; font-weight: 300; max-width: 720px; color: rgba(255,255,255,.92); margin: 0; }
.crumbs { font-size: .85rem; margin-bottom: 1rem; color: rgba(255,255,255,.75); }
.crumbs a { color: #d6defa; text-decoration: none; } .crumbs a:hover { color: #fff; text-decoration: underline; } .crumbs span { margin: 0 .45rem; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: 1.2rem 0 0; font-size: .85rem; color: rgba(255,255,255,.8); }
.meta a { color: #fff; }

/* ---- Sections ---- */
.band { padding: 72px 0; } .band-alt { background: var(--bg); }
.head-c { text-align: center; max-width: 720px; margin: 0 auto 40px; }
.head-c h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 700; }
.head-c p { font-size: 1.05rem; font-weight: 300; margin: 0; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.part-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.part-card .no { font-family: var(--f-head); font-weight: 800; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); }
.part-card h3 { font-size: 1.3rem; margin: .3rem 0 .5rem; } .part-card h3 a { color: var(--ink); text-decoration: none; } .part-card h3 a:hover { color: var(--blue); }
.part-card p { font-size: .93rem; margin: 0 0 1rem; }
.part-card ol { margin: 0 0 1rem; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.part-card ol li { border-bottom: 1px solid var(--line); }
.part-card ol a { display: flex; gap: .7rem; padding: .5rem 0; font-size: .9rem; color: var(--body); text-decoration: none; }
.part-card ol a:hover { color: var(--blue); }
.part-card ol b { flex: 0 0 1.7rem; color: var(--accent-text); font-weight: 600; }
.part-card .more { margin-top: auto; font-weight: 500; font-size: .9rem; text-decoration: none; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.steps3 > div { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border-top: 4px solid var(--green); }
.steps3 h3 { font-size: 1.1rem; } .steps3 p { margin: 0; font-size: .93rem; }
.slate { background: var(--slate); color: rgba(255,255,255,.92); } .slate h2, .slate h3 { color: #fff; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; } .cols3 p { font-weight: 300; margin: 0; }

.prose { font-size: var(--fs, 1rem); line-height: 1.8; }
.prose h2 { font-size: 1.65rem; font-weight: 700; margin: 2.4rem 0 .8rem; padding-top: .4rem; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.2rem; font-weight: 700; margin: 1.8rem 0 .5rem; scroll-margin-top: 90px; }
.prose p { margin: 0 0 1.1rem; } .prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.2rem; } .prose li { margin: .35rem 0; }
.prose li::marker { color: var(--accent-text); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code { background: #eef1f6; padding: .1em .4em; border-radius: 4px; font-size: .9em; }
.prose pre { background: var(--slate-night); color: #e8ecf5; padding: 16px 18px; border-radius: 10px; overflow-x: auto; font-size: .88rem; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2rem 0; }
.prose .tablewrap, .prose table { display: block; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.3rem 0 1.6rem; font-size: .92rem; border: 1px solid var(--line); border-radius: 10px; }
.prose th { background: var(--slate-deep); color: #fff; text-align: left; padding: 10px 12px; font-weight: 500; white-space: nowrap; }
.prose td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; min-width: 7rem; }
.prose tr:nth-child(even) td { background: var(--bg); }
.prose blockquote { margin: 1.5rem 0; padding: 14px 18px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* boxes: <div class="box learn" markdown="1"> */
.prose .box { margin: 1.6rem 0; padding: 18px 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); }
.prose .box > :last-child { margin-bottom: 0; } .prose .box > :first-child { margin-top: 0; }
.prose .box .bt { font-family: var(--f-head); font-weight: 800; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 .5rem; color: var(--accent-text); }
.prose .box ul { margin-bottom: 0; }
.prose .learn { background: #eef1fb; border-color: #d5dcf7; }
.prose .key { background: #eafaf1; border-color: #bfe8d0; } .prose .key .bt { color: var(--green-text); }
.prose .warn { background: var(--warn-bg); border-color: #f3d79a; } .prose .warn .bt { color: #9a5b00; }
.prose .example { background: #fff; border: 1px dashed #b9c2d6; } .prose .example .bt { color: var(--slate); }
.prose .ask { background: #fff; border-color: #cfd6e6; } .prose .ask .bt { color: var(--blue); }

.prose li.task { list-style: none; position: relative; margin-left: -1.4rem; padding-left: 2rem; }
.prose li.task::before { content: ""; position: absolute; left: 0; top: .42em; width: 1.05rem; height: 1.05rem; border: 2px solid var(--accent); border-radius: 4px; background: #fff; }
/* good / ok / red spec tables */
.prose td.g, .prose td.o, .prose td.r { font-size: .86rem; }

/* ---- Footer ---- */
.site-foot { background: var(--slate-night); color: #c9d1e0; padding: 44px 0 30px; font-size: .9rem; }
.foot-inner { display: grid; grid-template-columns: 1.2fr 1.8fr; gap: 32px; }
.foot-inner .brand-name { font-family: var(--f-head); font-weight: 800; color: #fff; font-size: 1.2rem; }
.foot-inner p { margin: .5rem 0 0; font-weight: 300; }
.foot-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; align-content: start; }
.foot-nav a { color: #c9d1e0; text-decoration: none; } .foot-nav a:hover { color: #fff; text-decoration: underline; }
.foot-legal { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; font-size: .82rem; color: #98a3b8; }

@media (max-width: 860px) {
  .hero-grid, .steps3, .cols3, .toc-part, .foot-inner { grid-template-columns: 1fr; }
  .hero { padding: 56px 0; } .band { padding: 52px 0; } .cover { display: none; }
  .pn { grid-template-columns: 1fr; } .toc-part { gap: 14px; }
}

/* ---- One-page book layout ---- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 1200; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .1s linear; }
.book { display: grid; grid-template-columns: 320px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; align-items: start; }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100dvh - 64px); overflow-y: auto; padding: 28px 18px 40px 20px; border-right: 1px solid var(--line); background: #fff; overscroll-behavior: contain; font-size: .88rem; }
.sb-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sb-title { margin: 0; font-family: var(--f-head); font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.fs button { font: inherit; font-size: .8rem; font-weight: 600; min-width: 38px; min-height: 34px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; cursor: pointer; }
.fs button:hover { border-color: var(--blue); color: var(--blue); }
.sb-part { margin-bottom: 18px; }
.sb-ph { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; font-family: var(--f-head); font-weight: 800; color: var(--ink); text-decoration: none; text-transform: uppercase; letter-spacing: .05em; font-size: .76rem; }
.sb-ph span { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 6px; background: var(--slate-deep); color: #fff; font-size: .72rem; letter-spacing: 0; }
.sb-part ol { list-style: none; margin: .2rem 0 0; padding: 0; }
.sb-part ol a { display: flex; gap: .6rem; padding: .42rem .55rem; border-radius: 8px; color: var(--body); text-decoration: none; line-height: 1.35; }
.sb-part ol a b { flex: 0 0 1.4rem; color: var(--muted); font-weight: 500; }
.sb-part ol a:hover { background: var(--bg); color: var(--blue); }
.sb-part ol a.on { background: #eef4ff; color: var(--blue-dark); font-weight: 600; }
.sb-part ol a.on b { color: var(--blue); }
.content { padding: 0 clamp(20px, 5vw, 64px) 40px; min-width: 0; }
.part-head { margin: 72px 0 8px; padding: 34px 32px; border-radius: 16px; color: #fff; background: var(--navy-grid), linear-gradient(155deg, var(--slate-deep), var(--slate)); position: relative; overflow: hidden; }
.part-head:first-child { margin-top: 48px; }
.part-head::after { content: ""; position: absolute; width: 320px; height: 320px; right: -80px; top: -120px; background: radial-gradient(circle, rgba(74,202,133,.22), transparent 70%); }
.part-head .eyebrow { color: #9be7c2; } .part-head h2 { color: #fff; font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin: 0 0 .4rem; position: relative; }
.part-head p:last-child { margin: 0; max-width: 560px; font-weight: 300; color: rgba(255,255,255,.92); position: relative; }
.chapter { max-width: 720px; margin: 0 auto; padding: 56px 0 28px; border-bottom: 1px solid var(--line); }
.ch-no { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--accent-text); margin: 0 0 .5rem; }
.ch-no span { color: var(--muted); font-weight: 500; }
.ch-title { font-size: clamp(1.8rem, 3.6vw, 2.5rem); font-weight: 800; letter-spacing: -.01em; margin: 0 0 .6rem; }
.ch-sum { font-size: 1.15rem; font-weight: 300; color: var(--muted); margin: 0 0 1.6rem; line-height: 1.6; }
.chapter .prose h2 { font-size: 1.5rem; }
.ch-foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 2.4rem; }
.ch-foot .next { display: block; padding: 14px 20px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-family: var(--f-head); font-weight: 800; background: #fff; box-shadow: var(--shadow); }
.ch-foot .next span { display: block; font-family: var(--f-body); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ch-foot .next:hover { box-shadow: var(--lift); color: var(--blue); }
.ch-foot .totop { font-size: .86rem; color: var(--muted); text-decoration: none; }
.the-end { text-align: center; padding: 72px 0 24px; max-width: 760px; margin: 0 auto; }
.next-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin: 28px 0 22px; text-align: left; }
.step-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.step-card h3 { margin: 0 0 8px; font-size: 1.05rem; } .step-card p { font-size: .94rem; margin: 0 0 14px; }
.btn-ghost-dark { background: transparent; color: var(--blue); border-color: var(--blue); } .btn-ghost-dark:hover { background: rgba(0,105,217,.08); color: var(--blue-dark); }
.step-card .step-note { font-size: .86rem; color: var(--muted); margin: 0; }
.hero-help { margin: 14px 0 0; font-size: .95rem; opacity: .95; } .hero-help a { color: #fff; text-decoration: underline; }
.fab, .scrim { display: none; }
.hero { padding: 64px 0 60px; }
.site-head { position: sticky; top: 0; } .head-right { margin-left: auto; }
.nav-toggle { display: none; }
body.lock { overflow: hidden; }
@media (max-width: 960px) {
  .book { display: block; }
  .sidebar { position: fixed; z-index: 1100; left: 0; top: 0; bottom: 0; height: auto; width: min(340px, 88vw); transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; padding-top: 22px; }
  .sidebar.open { transform: none; box-shadow: var(--lift); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 1050; background: rgba(20,28,40,.5); } .scrim[hidden] { display: none; }
  .nav-toggle { display: inline-flex; }
  .fab { display: inline-flex; position: fixed; z-index: 1000; left: 14px; bottom: 14px; max-width: calc(100vw - 28px); padding: 12px 18px; border: 0; border-radius: 99px; background: var(--slate-deep); color: #fff; font: 500 .88rem var(--f-body); box-shadow: var(--lift); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .part-head { padding: 26px 22px; margin-top: 52px; }
}

/* ---- Figures (inline SVG from tools/make_figures.py) ---- */
:root { --fg-blue-l: #e8f1fd; --fg-green-l: #e7f7ee; --fg-amber-l: #fff3df; --fg-hot: rgba(240,169,58,.16); }
.prose figure.fig { margin: 2rem 0; padding: 14px 14px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.fig-svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig figcaption { margin: 10px 4px 2px; font-size: .84rem; line-height: 1.5; color: var(--muted); }
.fig-svg text { fill: var(--body); font-family: var(--f-body); font-size: 13px; }
.fig-svg .tb { fill: var(--ink); font-weight: 600; }
.fig-svg .ts { font-size: 11.5px; fill: var(--muted); }
.fig-svg .tw { fill: #fff; font-weight: 600; }
.fig-svg .sm { font-size: 11.5px; }
.fig-svg .bx { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.fig-svg .bl { fill: var(--fg-blue-l); stroke: #0069d9; stroke-width: 1.5; }
.fig-svg .bg { fill: var(--fg-green-l); stroke: #2f9e62; stroke-width: 1.5; }
.fig-svg .ba { fill: var(--fg-amber-l); stroke: #d98a1c; stroke-width: 1.5; }
.fig-svg .bs { fill: var(--slate); }
.fig-svg .hot { fill: var(--fg-hot); }
.fig-svg .fb { fill: #0069d9; } .fig-svg .fg { fill: #2f9e62; } .fig-svg .fa { fill: #e29a2d; } .fig-svg .fs { fill: #4d586b; }
.fig-svg .fp { fill: #6b7fdb; } .fig-svg .fr { fill: #d6453b; }
.fig-svg .rad-h { fill: #d6453b; } .fig-svg .rad-m { fill: #e0764f; } .fig-svg .rad-l { fill: #e9a27c; } .fig-svg .rad-c { fill: #6fa2d6; }
.fig-svg .ln, .fig-svg .lb, .fig-svg .lg, .fig-svg .lr, .fig-svg .la, .fig-svg .grid { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig-svg .ln { stroke: var(--muted); stroke-width: 1.6; }
.fig-svg .lb { stroke: #0069d9; stroke-width: 2.6; } .fig-svg .lg { stroke: #2f9e62; stroke-width: 2.6; }
.fig-svg .lr { stroke: #d6453b; stroke-width: 2.6; } .fig-svg .la { stroke: var(--muted); stroke-width: 2.2; }
.fig-svg .grid { stroke: var(--line); stroke-width: 1; }
.fig-svg .ds { stroke-dasharray: 6 5; }
.fig-svg .mk-m { fill: var(--muted); } .fig-svg .mk-b { fill: #0069d9; } .fig-svg .mk-g { fill: #2f9e62; } .fig-svg .mk-r { fill: #d6453b; }
@media (prefers-color-scheme: dark) {
  :root { --fg-blue-l: #1b2c4a; --fg-green-l: #17301f; --fg-amber-l: #3a2f17; --fg-hot: rgba(240,169,58,.14); }
  .prose figure.fig { background: #1a2230; }
  .fig-svg .bs { fill: #4d586b; }
}
@media (max-width: 700px) { .prose figure.fig { overflow-x: auto; -webkit-overflow-scrolling: touch; } .fig-svg { min-width: 600px; } .fig figcaption { position: sticky; left: 0; } }
@media print { .prose figure.fig { break-inside: avoid; box-shadow: none; } }
.part-icon { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); width: 84px; height: 84px; opacity: .22; color: #fff; z-index: 0; }
@media (max-width: 700px) { .part-icon { width: 56px; height: 56px; right: 14px; } }

/* dark mode */
@media (prefers-color-scheme: dark) {
  :root { --ink: #eef1f7; --body: #c4cad6; --muted: #98a3b8; --bg: #1c2431; --line: #323d50; --warn-bg: #3a2f17; }
  body, .sidebar, .ch-foot .next, .fs button { background: #151b26; }
  body { color: var(--body); }
  .prose code { background: #263043; } .prose tr:nth-child(even) td { background: #1b2331; }
  .prose .learn { background: #1f2742; border-color: #38437a; } .prose .key { background: #15301f; border-color: #26573a; } .prose .key .bt { color: #6fe0a0; }
  .prose .warn { background: #3a2f17; border-color: #6b5320; } .prose .warn .bt { color: #f3c16a; }
  .prose .example, .prose .ask { background: #151b26; }
  .sb-part ol a.on { background: #1f2c47; color: #9cc4ff; } a { color: #7db3ff; } .btn-primary { color: #fff; } .step-card { background: #243044; } .btn-ghost-dark { color: #9cc4ff; border-color: #9cc4ff; }
  .cover { background: #1c2431; } .prose th { background: #2b3750; }
  .sb-ph span { background: #4d586b; }
}

@media print {
  .site-head, .parent-bar, .site-foot, .sidebar, .fab, .progress, .hero, .ch-foot, .skip, .scrim { display: none !important; } .book { display: block; } .chapter { page-break-before: always; } .part-head { background: none; color: #000; } .part-head h2, .part-head p { color: #000 !important; }
  .pagehead { background: none; color: #000; padding: 0 0 12px; } .pagehead h1, .pagehead .sub, .crumbs, .meta { color: #000; }
  .chapter-layout { display: block; padding: 0; } .prose { font-size: 11pt; } .prose .box { break-inside: avoid; }
  .prose th { background: #ddd; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.foot-legal a { color: #c9d1e0; } .foot-legal a:hover { color: #fff; }
