/* cookieowl site: a nocturnal storybook about privacy.
   Monsoon (monsooncss@0.2.0) provides the theme, utilities and components,
   themed with --seed amber. assets/art/palette.css (generated) holds the
   storybook palette as --k-* variables: dawn in light mode, night in dark
   mode, mixed by Monsoon's --mode so .dark sections follow too. This file
   adds the concept: cream paper with grain, a storybook serif, chapters with
   hand drawn rules, the hero town, the demo street and its logbook, the
   lantern workshop, the scroll checklist and VS Code style code frames. */

:root {
  --seed: #f2b134;
  --amber: #f2b134;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Nunito Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --wrap: 76rem;
  --top: 4rem;
  --wob: 20px 26px 18px 28px / 26px 18px 28px 20px;
  --wob-sm: 12px 16px 11px 17px / 16px 11px 17px 12px;
  --ed-bg: #ffffff;
  --ed-bar: #f3f3f3;
  --ed-border: #e1e3e8;
  --ed-text: #1f2328;
  --ed-muted: #6e7781;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ed-bg: #1e1e1e; --ed-bar: #252526; --ed-border: #33363d; --ed-text: #d4d4d4; --ed-muted: #9da5b4; }
}
:root[data-theme="dark"], .dark { --ed-bg: #1e1e1e; --ed-bar: #252526; --ed-border: #33363d; --ed-text: #d4d4d4; --ed-muted: #9da5b4; }

/* Paper in daylight, ink blue at night. Same selector list as Monsoon, so
   the tokens follow the nearest themed ancestor. */
:root, .theme, .dark, .light, [data-theme] {
  --mx: calc(var(--mode) * 100%);
  --background: color-mix(in oklab, #0b1030 var(--mx), #fbf6ec);
  --foreground: color-mix(in oklab, #f1ead8 var(--mx), #1b2547);
  --surface: color-mix(in oklab, #121a42 var(--mx), #fffdf7);
  --surface-2: color-mix(in oklab, #0f1639 var(--mx), #f5ecda);
  --surface-3: color-mix(in oklab, #1a2352 var(--mx), #efe2c8);
  --muted: color-mix(in oklab, #1a2250 var(--mx), #f1e7d3);
  --muted-foreground: color-mix(in oklab, #aeb5d2 var(--mx), #59618a);
  --border: color-mix(in oklab, #2a3470 var(--mx), #e2d3b4);
  --line: var(--k-line);
  --ink-amber: color-mix(in oklab, #f2b134 var(--mx), #95590a);
  --lift: 4px 5px 0 color-mix(in oklab, #000 calc(18% + 20% * var(--mode)), transparent);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .33 0 0 0 0 .18 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .9 0 0 0 0 .8 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
}
:root[data-theme="dark"], .dark { --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .9 0 0 0 0 .8 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

html { scroll-padding-top: calc(var(--top) + 1rem); }
body { background: var(--grain), var(--background); color: var(--foreground); font-family: var(--font-sans); overflow-x: clip; }
h1, h2, h3, .brand-name { font-family: var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; text-wrap: balance; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.ki { width: 1.5rem; height: 1.5rem; flex: none; color: var(--line); vertical-align: middle; }
.ki-sm { width: 1.1rem; height: 1.1rem; }
.ki-btn { width: 1.25rem; height: 1.25rem; color: currentColor; }
.ki-lg { width: 2rem; height: 2rem; }
.ki-xl { width: 3rem; height: 3rem; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 768px) { .wrap { padding-inline: 1.5rem; } }
code, kbd, pre { font-family: var(--font-mono); }
a { color: inherit; }
:not(pre) > code { font-size: .86em; padding: .1em .35em; border-radius: 6px; background: var(--muted); border: 1px solid var(--border); overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:root { --show-light: block; --show-dark: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --show-light: none; --show-dark: block; } }
:root[data-theme="dark"] { --show-light: none; --show-dark: block; }
.only-light { display: var(--show-light) !important; }
.only-dark { display: var(--show-dark) !important; }
.pic { display: block; }
.pic img { display: block; width: 100%; height: auto; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: 8px; background: var(--amber); color: #141a2e; font-weight: 700; }
.skip-link:focus { top: .6rem; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.65; color: var(--muted-foreground); text-wrap: pretty; }
.btn { font-family: var(--font-sans); font-weight: 800; }
.btn-primary { color: #1b2547; box-shadow: 0 3px 0 #b97a14; }
.btn-primary:hover { box-shadow: 0 2px 0 #b97a14; transform: translateY(1px); }
.btn-outline { border-width: 2px; border-color: var(--line); color: var(--foreground); }
.btn-outline:hover { background: color-mix(in oklab, var(--amber) 22%, transparent); border-color: var(--line); color: var(--foreground); }
.btn .ki-btn { margin-inline-end: .1rem; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in oklab, var(--background) 86%, transparent); backdrop-filter: saturate(1.3) blur(12px); border-bottom: 2px solid color-mix(in oklab, var(--line) 14%, transparent); }
.topbar-in { display: flex; align-items: center; gap: 1rem; height: var(--top); }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; flex: none; }
.brand img { transition: transform .3s; }
.brand:hover img { transform: rotate(-8deg); }
.brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.brand-name b { color: var(--ink-amber); font-style: italic; font-weight: 800; }
.topnav { display: flex; gap: .15rem; margin-inline-start: .8rem; }
.top-link { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 999px; text-decoration: none; font-size: .93rem; font-weight: 700; color: var(--muted-foreground); }
.top-link .ki-nav { width: 1.25rem; height: 1.25rem; color: var(--line); }
.top-link { white-space: nowrap; }
@media (max-width: 1180px) { .top-link .ki-nav, .search-label { display: none; } .top-link { padding-inline: .6rem; } }
.top-link:hover { color: var(--foreground); background: color-mix(in oklab, var(--amber) 16%, transparent); }
.top-link[aria-current="page"] { color: var(--foreground); background: color-mix(in oklab, var(--amber) 24%, transparent); }
.top-right { display: flex; align-items: center; gap: .35rem; margin-inline-start: auto; }
.search-btn { display: inline-flex; align-items: center; gap: .5rem; height: 2.4rem; padding: 0 .45rem 0 .8rem; border: 2px solid color-mix(in oklab, var(--line) 25%, transparent); border-radius: 999px; background: var(--surface); color: var(--muted-foreground); font: inherit; font-size: .88rem; cursor: pointer; }
.search-btn:hover { border-color: var(--amber); color: var(--foreground); }
.icon-btn { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px; color: var(--foreground); background: none; border: 0; cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: color-mix(in oklab, var(--amber) 18%, transparent); }
.icon-btn .ic { width: 1.25rem; height: 1.25rem; }
.theme-btn .ic { display: none; }
.theme-btn[data-voodoo-theme-mode="system"] .ti-system, .theme-btn[data-voodoo-theme-mode="light"] .ti-light, .theme-btn[data-voodoo-theme-mode="dark"] .ti-dark, .theme-btn:not([data-voodoo-theme-mode]) .ti-system { display: block; }
.nav-btn { display: none; }
@media (max-width: 960px) {
  .nav-btn { display: inline-grid; }
  .topnav { display: none; position: absolute; inset-inline: 0; top: var(--top); flex-direction: column; margin: 0; padding: .5rem 1rem 1rem; background: var(--background); border-bottom: 2px solid color-mix(in oklab, var(--line) 18%, transparent); box-shadow: 0 20px 30px -20px rgb(0 0 0 / .3); }
  .topnav.is-open { display: flex; }
  .top-link { padding: .75rem .6rem; font-size: 1rem; border-radius: 12px; }
  .search-label, .search-btn .kbd { display: none; }
  .search-btn { width: 2.4rem; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--foreground); }
}
.search-dlg .command-palette { width: min(40rem, calc(100vw - 2rem)); border: 2px solid var(--line); border-radius: var(--wob); background: var(--grain), var(--surface); }
.command-palette-search { display: flex; align-items: center; gap: .6rem; }
.command-palette-item { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.command-palette-item[aria-selected="true"] { background: color-mix(in oklab, var(--amber) 18%, transparent); }
.hit-kind { flex: none; width: 4.8rem; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-amber); }
.hit-text { display: grid; min-width: 0; }
.hit-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-sub { font-size: .8rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-palette-footer { display: flex; gap: 1rem; }
.command-palette-empty { font-family: var(--font-hand); font-size: 1.3rem; }

/* ---------- Hero: the town at night (dawn in light mode) ----------
   The scene is four layers sharing one height (--art-h) and one ground line:
   the far hills and the near ground span the whole width, the moon and the
   town (Hoot, the gate, the bugs) sit at the bottom right, sized from the
   viewport width and height so they never reach under the text. */
.town { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--k-sky1) 0%, var(--k-sky2) 62%, var(--k-sky3) 100%); color: color-mix(in oklab, #f6efdc var(--mx), #1b2547); }
.town-stage { --hero-h: clamp(600px, calc(100vh - var(--top)), 900px); --art-w: min(58vw, calc(var(--hero-h) * 1.3158)); --art-h: calc(var(--art-w) * .76); position: relative; display: flex; align-items: center; min-height: var(--hero-h); padding: 2.2rem 0 calc(var(--art-h) * .15); }
@supports (height: 100svh) { .town-stage { --hero-h: clamp(600px, calc(100svh - var(--top)), 900px); } }
.hero-stars { position: absolute; inset: 0 0 40% 50%; pointer-events: none; opacity: calc(.15 + .75 * var(--mode));
  background-image: radial-gradient(1.4px 1.4px at 30px 40px, var(--k-star) 60%, transparent 70%), radial-gradient(1px 1px at 140px 90px, var(--k-star) 60%, transparent 70%), radial-gradient(1.6px 1.6px at 230px 26px, var(--k-star) 60%, transparent 70%), radial-gradient(1px 1px at 300px 150px, var(--k-star) 60%, transparent 70%);
  background-size: 340px 200px; }
.town-scene { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: var(--art-h); pointer-events: none; }
.layer-box { position: absolute; inset: 0; }
.layer-box .layer { display: block; width: 100%; height: 100%; overflow: hidden; }
.art-box { left: auto; width: var(--art-w); }
.hero-in { position: relative; z-index: 2; width: 100%; }
.hero-text { max-width: 34rem; }
.tale { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 1rem; font-family: var(--font-hand); font-size: 1.4rem; line-height: 1.1; }
.tale .badge { font-family: var(--font-sans); background: var(--amber); color: #1b2547; border-color: transparent; font-weight: 800; }
.town h1 { font-weight: 800; font-size: clamp(2.2rem, 3.7vw, 3.6rem); line-height: 1.03; letter-spacing: -.02em; margin: 0 0 1rem; }
.town h1 em { font-style: italic; color: color-mix(in oklab, var(--amber) var(--mx), #b56d06); position: relative; white-space: nowrap; }
.town h1 em::after { content: ""; position: absolute; left: -.05em; right: -.1em; bottom: -.08em; height: .22em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8c18-6 34 2 50-2s30-5 46 0' fill='none' stroke='%23f2b134' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.town .lead { color: inherit; opacity: .88; font-size: 1.08rem; margin: 0 0 1.3rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.2rem; }
.town .btn-outline { background: color-mix(in oklab, var(--background) 55%, transparent); }
.town .frame { margin: 0; }
.hero-band { position: relative; z-index: 2; margin-top: -1px; padding: 0 0 1.4rem; background: var(--k-hill3); }
.hero-tags { display: flex; flex-wrap: wrap; gap: .8rem; list-style: none; margin-block: 0; padding-block: 0; }
.hero-tags li { display: grid; padding: .45rem .8rem .5rem 1.4rem; position: relative; border: 2px solid #1b2547; border-radius: 6px 12px 12px 6px; background: #fffaf0; color: #1b2547; box-shadow: 3px 3px 0 rgb(0 0 0 / .25); transform: rotate(-2deg); }
.hero-tags li:nth-child(2n) { transform: rotate(1.5deg); }
.hero-tags li::before { content: ""; position: absolute; left: .45rem; top: 50%; width: .45rem; height: .45rem; margin-top: -.22rem; border-radius: 50%; border: 2px solid #1b2547; }
.hero-tags b { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.1; }
.hero-tags span { font-size: .74rem; font-weight: 700; color: #4b5478; }
@media (min-width: 1100px) and (max-height: 820px) {
  .town-stage { padding-top: 1.4rem; }
  .town h1 { font-size: clamp(2.2rem, min(3.7vw, 7.4vh), 3.6rem); margin-bottom: .7rem; }
  .tale { font-size: 1.25rem; margin-bottom: .6rem; }
  .town .lead { font-size: 1rem; line-height: 1.55; margin-bottom: 1rem; }
  .hero-cta { margin-bottom: .9rem; }
  .hero-cta .btn-lg { min-height: 2.9rem; height: 2.9rem; }
}
@media (min-width: 1200px) and (max-height: 700px) { .hero-text { max-width: 38rem; } .town-stage { padding-bottom: calc(var(--art-h) * .1); } }
@media (min-width: 1300px) and (max-height: 700px) { .hero-text { max-width: 40rem; } }
@media (min-width: 1700px) and (max-height: 760px) { .hero-text { max-width: 44rem; } }
@media (max-width: 1099px) {
  .town-stage { --art-w: min(130vw, 780px); flex-direction: column; align-items: stretch; min-height: 0; padding: 2.2rem 0 0; }
  .town-scene { position: relative; order: 2; margin-top: .5rem; }
  .hero-text { max-width: 40rem; }
}
@media (max-width: 880px) {
  .hero-stars { display: none; }
  .town h1 { font-size: clamp(2.1rem, 9vw, 2.6rem); }
  .hero-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-tags li { padding: .35rem .7rem .4rem 1.3rem; }
}

/* ---------- Chapters ---------- */
.chapter { position: relative; padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-tight { padding-block: 2.5rem 4rem; }
.ch-head { max-width: 48rem; margin-bottom: 2.2rem; }
.ch-no { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin: 0 0 .7rem; font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 1.1rem; color: var(--ink-amber); }
.ch-kicker { font-family: var(--font-hand); font-style: normal; font-weight: 600; font-size: 1.35rem; color: var(--muted-foreground); }
.ch-kicker::before { content: "~"; margin-inline-end: .5rem; color: var(--border); }
.ch-head h2 { font-size: clamp(1.9rem, 3.8vw, 2.8rem); line-height: 1.08; letter-spacing: -.015em; margin: 0 0 .8rem; font-weight: 800; }
.ch-head p { color: var(--muted-foreground); font-size: 1.07rem; line-height: 1.68; margin: 0; }
.ch-head .rule { justify-content: flex-start; margin-top: 1.2rem; }
.rule { display: flex; justify-content: center; margin: 2.2rem 0; color: color-mix(in oklab, var(--line) 45%, transparent); }
.squiggle { width: min(16rem, 70%); height: auto; }

/* ---------- Code frames (VS Code style) ---------- */
.frame { margin: 1.3rem 0; border: 2px solid color-mix(in oklab, var(--line) 22%, var(--ed-border)); border-radius: 14px; overflow: hidden; background: var(--ed-bg); min-width: 0; box-shadow: var(--lift); }
.frame-bar { display: flex; align-items: stretch; min-height: 2.35rem; background: var(--ed-bar); border-bottom: 1px solid var(--ed-border); font-size: .8rem; }
.dots { display: inline-flex; align-items: center; gap: .35rem; padding: 0 .8rem; }
.dots i { width: .62rem; height: .62rem; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.frame-tab { display: inline-flex; align-items: center; gap: .45rem; padding: 0 .9rem; background: var(--ed-bg); color: var(--ed-text); border-inline: 1px solid var(--ed-border); margin-bottom: -1px; box-shadow: inset 0 2px 0 var(--amber); min-width: 0; font-family: var(--font-sans); }
.frame-tab > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-ic { flex: none; }
.frame-copy { align-self: center; display: inline-flex; align-items: center; gap: .35rem; margin: 0 .5rem 0 auto; padding: .3rem .55rem; border: 1px solid var(--ed-border); border-radius: 6px; background: var(--ed-bg); color: var(--ed-muted); font: 600 .75rem/1 var(--font-sans); cursor: pointer; flex: none; }
.frame-copy:hover { color: var(--ed-text); border-color: var(--amber); }
.frame-copy .ic { width: .9rem; height: .9rem; }
.frame pre { margin: 0; padding: .9rem 1.1rem 1rem; overflow-x: auto; font: 13px/1.65 var(--font-mono); font-variant-ligatures: none; tab-size: 2; background: var(--ed-bg); color: var(--ed-text); }
.frame pre:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.frame code { display: block; min-width: max-content; font: inherit; padding: 0; border: 0; background: none; }
.shiki span { color: var(--shiki-light); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shiki span { color: var(--shiki-dark); } }
:root[data-theme="dark"] .shiki span, .dark .shiki span { color: var(--shiki-dark); }
.light .shiki span { color: var(--shiki-light); }
.frame .line.ok { display: inline-block; min-width: 100%; background: rgb(46 160 67 / .14); box-shadow: inset 3px 0 #2ea043; }
.frame-terminal pre .line::before { content: "$ "; color: #2ea043; font-weight: 700; user-select: none; }
.frame-compact { margin: .9rem 0 0; }
.frame-compact pre { font-size: 12px; }
@media (max-width: 640px) { .frame pre { font-size: 12px; } .frame-copy span { display: none; } }

/* ---------- Chapter I: the demo street ---------- */
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1.25rem; align-items: stretch; }
@media (max-width: 1100px) { .demo-grid { grid-template-columns: minmax(0, 1fr); } }
.street { position: relative; display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; padding: 1rem 1rem 1.2rem; border: 2px solid var(--line); border-radius: var(--wob); overflow: hidden; background: linear-gradient(180deg, transparent 15rem, var(--k-road) 15rem); box-shadow: var(--lift); min-width: 0; }
.street-bg { position: absolute; inset: 0 0 auto; height: 15rem; }
.street-bg svg { display: block; width: 100%; height: 100%; }
.street::after { content: ""; position: absolute; inset: auto 0 0; height: 1.2rem; background: radial-gradient(circle at 10px 10px, var(--k-stone) 5px, transparent 6px) 0 0 / 22px 14px; opacity: .6; pointer-events: none; }
.gatehouse, .shop { position: relative; z-index: 1; min-width: 0; }
.gatehouse { display: flex; flex-direction: column; gap: .4rem; }
.queue { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 0 .2rem; min-height: 8.4rem; }
.queue:not(:has(.is-here))::after { content: "Nobody waiting. Hoot let them in."; grid-column: 1 / -1; align-self: end; font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.1; color: var(--k-line); }
.gate-art { position: relative; aspect-ratio: 220 / 280; }
.gate-art svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .6s; }
.gate-art svg + svg { opacity: 0; }
.gate-art.is-open svg:first-child { opacity: 0; }
.gate-art.is-open svg + svg { opacity: 1; }
.lamps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.lamp { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .45rem; padding: .35rem .5rem; border-radius: 10px; border: 2px solid color-mix(in oklab, var(--line) 30%, transparent); background: color-mix(in oklab, var(--surface) 88%, transparent); font-size: .82rem; font-weight: 800; transition: background .4s, box-shadow .4s, border-color .4s; }
.lamp .ki { width: 1.2rem; height: 1.2rem; opacity: .55; transition: opacity .4s; }
.lamp small { font-family: var(--font-hand); font-size: 1rem; font-weight: 600; color: var(--muted-foreground); }
.lamp.is-lit { background: color-mix(in oklab, var(--amber) 30%, var(--surface)); border-color: var(--amber); box-shadow: 0 0 18px -2px color-mix(in oklab, var(--amber) 70%, transparent); }
.lamp.is-lit .ki { opacity: 1; }
.lamp.is-lit small { color: var(--foreground); }
.dbug { display: none; width: 100%; }
.dbug svg { display: block; width: 100%; height: auto; overflow: visible; }
.dbug.is-here { display: block; }
.queue .dbug.is-here { animation: bob 3.2s ease-in-out infinite; }
.queue .dbug:nth-child(2n).is-here { animation-delay: -1.4s; }
.queue .dbug:nth-child(3n).is-here { animation-delay: -2.2s; }
.inside .dbug.is-here { animation: flyin .9s cubic-bezier(.2, .8, .3, 1.2) both; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@keyframes flyin { from { transform: translate(-140px, -40px) rotate(-20deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.shop { display: flex; flex-direction: column; padding-top: 4.2rem; }
.awning { position: relative; height: 2.6rem; margin: 0 -.4rem; border: 2px solid var(--line); border-radius: 8px 8px 0 0; background: repeating-linear-gradient(90deg, var(--amber) 0 1.6rem, #fffaf0 1.6rem 3.2rem); display: grid; place-items: center; }
.awning::after { content: ""; position: absolute; left: -2px; right: -2px; top: 100%; height: .8rem; background: radial-gradient(circle at 50% 0, var(--amber) .78rem, transparent .82rem) 0 0 / 1.6rem .8rem repeat-x; }
.awning span { padding: .15rem .8rem; border-radius: 999px; border: 2px solid #1b2547; background: #fffaf0; color: #1b2547; font-family: var(--font-display); font-weight: 800; font-size: .95rem; }
.inside { position: absolute; top: .2rem; right: .5rem; left: 2rem; display: flex; justify-content: flex-end; gap: .1rem; height: 4rem; }
.inside .dbug { width: 3.8rem; flex: none; }
.browser { position: relative; margin-top: .9rem; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #0e1534; display: flex; flex-direction: column; min-width: 0; flex: 1; }
.browser-bar { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; background: #f1e8d6; border-bottom: 2px solid #1b2547; }
.browser-url { flex: 1; display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: 999px; background: #fffaf0; color: #4b5478; font: .76rem/1.2 var(--font-mono); overflow: hidden; white-space: nowrap; }
.browser-url .ic { width: .85rem; height: .85rem; color: #2e8b57; }
.demo-site { position: relative; overflow: hidden; min-height: 34rem; flex: 1; background: #fffaf2; color: #2b2118; font-family: var(--font-sans); }
.ds-top { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; border-bottom: 1px solid #efe2cc; }
.ds-top b { font-family: var(--font-display); font-size: 1.05rem; }
.ds-top nav { display: flex; gap: 1rem; margin-inline-start: auto; font-size: .82rem; color: #7a6a58; }
@media (max-width: 480px) { .ds-top nav { display: none; } }
.ds-logo { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6b4a2a, #2b1b10); }
.ds-hero { padding: 1.4rem 1.1rem .9rem; }
.ds-kicker { margin: 0; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #a0663a; font-weight: 800; }
.ds-title { margin: .35rem 0; font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 800; line-height: 1.15; }
.ds-text { margin: 0; color: #6b5c4c; font-size: .9rem; max-width: 30rem; }
.ds-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: .5rem 1.1rem 1rem; }
.ds-card { display: grid; gap: .2rem; padding: .9rem; border-radius: 12px; background: #fff; border: 1px solid #efe2cc; }
.ds-card small { color: #8a7a68; }
.ds-bean { width: 2.2rem; height: 1.5rem; border-radius: 50%; background: radial-gradient(ellipse at 40% 40%, #8a5a33, #3d2414); margin-bottom: .3rem; }
.ds-bean-2 { background: radial-gradient(ellipse at 40% 40%, #b07a40, #5a3518); }
.ds-video { grid-column: 1 / -1; }
.ds-video iframe { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.ds-video .cko-embed { width: 100% !important; }
.ds-foot { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1.1rem 1.2rem; font-size: .8rem; color: #8a7a68; }
.ds-foot a { color: #a0663a; }
.ds-chat { position: absolute; right: 1rem; bottom: 5.2rem; padding: .55rem .8rem; border-radius: 14px 14px 4px 14px; background: #2b2118; color: #fffaf2; font-size: .8rem; font-weight: 600; box-shadow: 0 8px 20px -8px rgb(0 0 0 / .5); }
.demo-site .cko-box { max-width: calc(100% - 32px); }
@media (max-width: 640px) {
  .street { grid-template-columns: minmax(0, 1fr); padding: .8rem; }
  .gatehouse { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); grid-template-areas: "gate queue" "lamps lamps"; gap: .6rem .8rem; }
  .gate-art { grid-area: gate; align-self: start; }
  .queue { grid-area: queue; grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 4.5rem; }
  .lamps { grid-area: lamps; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lamp small { display: none; }
  .shop { padding-top: 3.4rem; }
  .street { background: linear-gradient(180deg, transparent 21rem, var(--k-road) 21rem); }
  .street-bg { height: 21rem; }
  .inside { left: 0; }
  .inside .dbug { width: 3.2rem; }
}

/* The night watch logbook */
.logbook { position: relative; display: flex; flex-direction: column; min-width: 0; border: 2px solid var(--line); border-radius: 6px 18px 18px 6px; color: var(--foreground); overflow: hidden; box-shadow: var(--lift);
  background: linear-gradient(90deg, transparent 2.6rem, color-mix(in oklab, #d9534f 45%, transparent) 2.6rem, color-mix(in oklab, #d9534f 45%, transparent) calc(2.6rem + 2px), transparent calc(2.6rem + 2px)), repeating-linear-gradient(180deg, transparent 0 calc(2.1rem - 1px), color-mix(in oklab, var(--line) 12%, transparent) calc(2.1rem - 1px) 2.1rem), var(--grain), var(--surface); }
.logbook::before { content: ""; position: absolute; left: .7rem; top: 0; bottom: 0; width: 1rem; background: radial-gradient(circle, var(--background) .32rem, color-mix(in oklab, var(--line) 50%, transparent) .34rem, transparent .42rem) 0 .6rem / 1rem 2.1rem repeat-y; }
.log-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; padding: .9rem 1rem .5rem 3.2rem; }
.log-head h3 { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.25rem; font-weight: 800; }
.log-status { font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.1; color: var(--ink-amber); text-align: end; }
.log-tabs { display: flex; gap: .3rem; padding: 0 .8rem 0 3.2rem; overflow-x: auto; }
.log-tabs button { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .7rem .55rem; border: 2px solid color-mix(in oklab, var(--line) 30%, transparent); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--muted-foreground); font: 800 .8rem/1.2 var(--font-sans); cursor: pointer; white-space: nowrap; }
.log-tabs button[aria-selected="true"] { background: var(--amber); color: #1b2547; border-color: var(--line); }
.log-tabs button[aria-selected="true"] .ki { color: #1b2547; }
.log-page { flex: 1; overflow: auto; max-height: 33rem; min-height: 14rem; border-top: 2px solid var(--line); }
.log-list { list-style: none; margin: 0; padding: .3rem 0; }
.log-row { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: center; min-height: 2.1rem; padding: .35rem 1rem .35rem 3.2rem; font-size: .82rem; animation: ink .5s ease-out both; }
@keyframes ink { from { opacity: 0; transform: translateX(6px); } }
.log-what { display: grid; min-width: 0; }
.log-what b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-what small { font: .7rem/1.35 var(--font-mono); color: var(--muted-foreground); overflow-wrap: anywhere; }
.stamp { justify-self: start; padding: .15rem .4rem; border: 2px solid currentColor; border-radius: 5px; font: 800 .68rem/1.1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; transform: rotate(-5deg); color: var(--muted-foreground); background: color-mix(in oklab, currentColor 8%, transparent); }
.log-row.is-held .stamp { color: color-mix(in oklab, #ff7a6b var(--mx), #b8322a); }
.log-row.is-ran .stamp { color: color-mix(in oklab, #6fe09a var(--mx), #23824a); transform: rotate(3deg); }
.log-row.is-sent .stamp { color: color-mix(in oklab, #8fb4ff var(--mx), #2f5fc4); }
.log-row.is-note .stamp { color: color-mix(in oklab, #d3a6ff var(--mx), #7c3aed); }
.log-row.is-cmd .stamp { color: var(--foreground); text-transform: none; letter-spacing: 0; font-family: var(--font-mono); font-size: .64rem; }
.log-row.is-cookie .stamp { color: var(--ink-amber); }
.log-cat { font: .68rem/1 var(--font-mono); color: var(--muted-foreground); }
.log-empty { padding: .6rem 1rem .6rem 3.2rem; margin: 0; font-family: var(--font-hand); font-size: 1.25rem; line-height: 1.3; color: var(--muted-foreground); }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.1rem; }
.demo-pick { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 700; }
.demo-pick .select { width: auto; }

/* ---------- Chapter II: three panels and the usual suspects ---------- */
.panels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
@media (max-width: 980px) { .panels { grid-template-columns: minmax(0, 1fr); } }
.panel { min-width: 0; padding: 1rem 1rem 1.3rem; border: 2px solid var(--line); border-radius: var(--wob); background: var(--surface); box-shadow: var(--lift); }
.panel:nth-child(2) { transform: rotate(.4deg); }
.panel:nth-child(3) { transform: rotate(-.4deg); }
.panel-pic { border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.panel-time { margin: .9rem 0 0; font-family: var(--font-hand); font-size: 1.5rem; line-height: 1; color: var(--ink-amber); }
.panel h3 { margin: .2rem 0 .45rem; font-size: 1.3rem; font-weight: 800; }
.panel p { margin: 0; color: var(--muted-foreground); line-height: 1.6; font-size: .95rem; }
.suspects { margin-top: 3rem; }
.suspects-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1.5rem; align-items: end; margin-bottom: 1.3rem; }
@media (max-width: 800px) { .suspects-head { grid-template-columns: minmax(0, 1fr); gap: .5rem; } }
.suspects-head h3 { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1.7rem; font-weight: 800; }
.suspects-head p { margin: 0; color: var(--muted-foreground); line-height: 1.6; }
.posters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.2rem, 1fr)); gap: 1rem; }
.poster { display: grid; justify-items: center; gap: .35rem; padding: .7rem .6rem 1rem; border: 2px solid var(--line); border-radius: 4px; background: color-mix(in oklab, #3a2c18 var(--mx), #fff3d6); text-align: center; box-shadow: var(--lift); transform: rotate(-1.5deg); }
.poster:nth-child(2n) { transform: rotate(1.2deg); }
.poster:nth-child(3n) { transform: rotate(-.4deg); }
.poster-top { width: 100%; padding-bottom: .3rem; border-bottom: 2px dashed color-mix(in oklab, var(--line) 40%, transparent); font-family: var(--font-display); font-weight: 800; font-size: .95rem; letter-spacing: .22em; text-transform: uppercase; }
.poster .ki-xl { margin-top: .3rem; }
.poster b { font-family: var(--font-display); font-size: 1rem; line-height: 1.15; }
.poster-cat { padding: .05rem .5rem; border: 2px solid currentColor; border-radius: 4px; font: 800 .66rem/1.3 var(--font-sans); text-transform: uppercase; letter-spacing: .1em; transform: rotate(-4deg); color: color-mix(in oklab, #ff8a7a var(--mx), #b8322a); }
.poster-cat.cat-analytics { color: color-mix(in oklab, #8fb4ff var(--mx), #2f5fc4); }

/* ---------- Chapter III: the lantern workshop ---------- */
.workshop-sec { background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--surface-2) 80%, transparent) 20%, color-mix(in oklab, var(--surface-2) 80%, transparent) 80%, transparent); }
.cfg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.6rem; align-items: start; }
@media (max-width: 980px) { .cfg { grid-template-columns: minmax(0, 1fr); } }
.cfg-form { display: grid; gap: 1.1rem; }
.tray { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: 0; padding: 1.4rem 1.1rem 1.1rem; border: 2px solid var(--line); border-radius: var(--wob-sm); background: var(--surface); min-width: 0; box-shadow: var(--lift); }
.tray legend { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .7rem; border: 2px solid var(--line); border-radius: 999px; background: var(--amber); color: #1b2547; font-family: var(--font-display); font-weight: 800; font-size: .98rem; }
.tray legend .ki { width: 1.2rem; height: 1.2rem; color: #1b2547; --k-tint: #fffaf0; }
.tray .field { display: grid; gap: .35rem; min-width: 0; }
.tray .label { font-weight: 700; }
.cfg-wide { grid-column: 1 / -1; }
.cfg-checks { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
@media (max-width: 520px) { .tray, .cfg-checks { grid-template-columns: minmax(0, 1fr); } }
.cfg-checks .label { display: flex; align-items: center; gap: .5rem; font-size: .93rem; }
.cfg-color { display: flex; align-items: center; gap: .6rem; }
.cfg-color input[type="color"] { width: 2.6rem; height: 2.4rem; padding: .15rem; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.cfg-out { position: sticky; top: calc(var(--top) + 1rem); min-width: 0; }
.bench { --lamp: #f2b134; display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); align-items: end; gap: 1rem; margin-bottom: 1rem; padding: .6rem 1.2rem 0; border: 2px solid var(--line); border-bottom-width: 10px; border-radius: var(--wob-sm); background: radial-gradient(14rem 10rem at 5.5rem 55%, color-mix(in oklab, var(--lamp) 26%, transparent), transparent), var(--surface); box-shadow: var(--lift); }
.lantern { display: block; width: 100%; height: auto; overflow: visible; }
.lantern .gem circle { fill: var(--k-winOff); transition: fill .3s, filter .3s; }
.lantern .gem-necessary circle { fill: #f2b134; }
.bench.on-preferences .gem-preferences circle { fill: #6fbf73; filter: drop-shadow(0 0 4px #6fbf73); }
.bench.on-analytics .gem-analytics circle { fill: #6f8fe8; filter: drop-shadow(0 0 4px #6f8fe8); }
.bench.on-marketing .gem-marketing circle { fill: #e8705a; filter: drop-shadow(0 0 4px #e8705a); }
.bench-note { padding-bottom: 1rem; }
.hand { margin: 0 0 .6rem; font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.15; }
.gem-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .8rem; font-weight: 700; color: var(--muted-foreground); }
.gem-key li { display: inline-flex; align-items: center; gap: .35rem; opacity: .5; transition: opacity .3s; }
.gem-key li::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--line); background: var(--k-winOff); }
.gem-key .gk-necessary, .bench.on-preferences .gk-preferences, .bench.on-analytics .gk-analytics, .bench.on-marketing .gk-marketing { opacity: 1; color: var(--foreground); }
.gk-necessary::before { background: #f2b134 !important; }
.bench.on-preferences .gk-preferences::before { background: #6fbf73; }
.bench.on-analytics .gk-analytics::before { background: #6f8fe8; }
.bench.on-marketing .gk-marketing::before { background: #e8705a; }
@media (max-width: 460px) { .bench { grid-template-columns: 7.5rem minmax(0, 1fr); padding-inline: .8rem; } .hand { font-size: 1.25rem; } }
.cfg-frame { margin: .9rem 0; }
.cfg-frame pre { min-height: 11rem; }
.cfg-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.cfg-note { color: var(--muted-foreground); font-size: .9rem; line-height: 1.6; }

/* ---------- Chapter IV: the promises, as an open book ---------- */
.spread { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 2px solid var(--line); border-radius: 8px 8px 20px 20px; background: var(--grain), var(--surface); box-shadow: var(--lift), 0 0 0 6px color-mix(in oklab, var(--k-roof) 85%, transparent), 4px 11px 0 6px color-mix(in oklab, #000 20%, transparent); }
.spread::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3.5rem; margin-left: -1.75rem; background: linear-gradient(90deg, transparent, color-mix(in oklab, #000 calc(9% + 20% * var(--mode)), transparent) 48%, color-mix(in oklab, #000 calc(14% + 20% * var(--mode)), transparent) 50%, color-mix(in oklab, #000 calc(9% + 20% * var(--mode)), transparent) 52%, transparent); pointer-events: none; }
.page { list-style: none; margin: 0; padding: 1.8rem 2.6rem 2rem 2rem; display: grid; gap: 1.2rem; counter-reset: promise; }
.page-r { padding: 1.8rem 2rem 2rem 2.6rem; counter-reset: promise 6; }
.promise { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: start; counter-increment: promise; }
.promise-ic { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border: 2px dashed color-mix(in oklab, var(--line) 45%, transparent); border-radius: 50%; background: color-mix(in oklab, var(--amber) 12%, transparent); }
.promise h3 { margin: .1rem 0 .25rem; font-size: 1.12rem; font-weight: 800; }
.promise h3::before { content: counter(promise, upper-roman) ". "; color: var(--ink-amber); font-style: italic; }
.promise p { margin: 0; color: var(--muted-foreground); line-height: 1.6; font-size: .94rem; }
@media (max-width: 820px) { .spread { grid-template-columns: minmax(0, 1fr); } .spread::before { display: none; } .page, .page-r { padding: 1.4rem 1.2rem; } .page-l { padding-bottom: 0; } }

/* ---------- Chapters V and VI: frameworks and the record ---------- */
.fw-tabs .tab { font-family: var(--font-display); font-weight: 700; }
.fw-tabs .tab-content { min-width: 0; }
.fw-tabs .frame { margin: 0; }
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 900px) { .rec-grid { grid-template-columns: minmax(0, 1fr); } }
.rec-pic { max-width: 18rem; margin: -1rem auto -.5rem; }
.ledger { overflow-x: auto; border: 2px solid var(--line); border-radius: var(--wob-sm); background: var(--surface); box-shadow: var(--lift); }
.ledger .table { margin: 0; }
.ledger thead th { font-family: var(--font-display); font-size: .95rem; font-weight: 800; background: color-mix(in oklab, var(--amber) 22%, transparent); border-bottom: 2px solid var(--line); }
.ledger th[scope="row"] { white-space: nowrap; }

/* ---------- Chapter VII: the shelf ---------- */
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
@media (max-width: 960px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .shelf { grid-template-columns: minmax(0, 1fr); } }
.book { display: flex; flex-direction: column; min-width: 0; border: 2px solid var(--line); border-radius: 6px 16px 16px 6px; overflow: hidden; background: var(--surface); text-decoration: none; color: inherit; box-shadow: inset 7px 0 0 color-mix(in oklab, var(--k-roof) 80%, transparent), var(--lift); transition: transform .25s, box-shadow .25s; }
.book:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: inset 7px 0 0 var(--amber), 6px 9px 0 color-mix(in oklab, #000 calc(18% + 20% * var(--mode)), transparent); }
.book-pic { background: color-mix(in oklab, var(--amber) 8%, var(--surface-2)); border-bottom: 2px solid color-mix(in oklab, var(--line) 20%, transparent); padding-left: 7px; }
.book-body { display: grid; gap: .35rem; padding: 1rem 1.1rem 1.2rem 1.4rem; }
.book-body small { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--font-display); font-style: italic; font-weight: 700; color: var(--ink-amber); font-size: .9rem; }
.book-title { margin: 0; font-family: var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; font-size: 1.18rem; font-weight: 800; line-height: 1.22; }
.book-body > span { color: var(--muted-foreground); font-size: .9rem; line-height: 1.55; }
.book-body em { font-family: var(--font-hand); font-style: normal; font-size: 1.15rem; color: var(--muted-foreground); }
.faq-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .faq-grid { grid-template-columns: minmax(0, 1fr); } .faq-pic { display: none; } }
.faq-pic { max-width: 20rem; }
.accordion .collapse { border: 2px solid color-mix(in oklab, var(--line) 30%, transparent); border-radius: var(--wob-sm); background: var(--surface); margin-bottom: .6rem; }
.accordion .collapse[open] { border-color: var(--line); box-shadow: var(--lift); }
.collapse-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.collapse-content p { margin: 0; line-height: 1.68; color: var(--muted-foreground); }

/* ---------- Footer: the rooftops at night ---------- */
.site-foot { position: relative; margin-top: 3rem; color: #eee6d2; background: transparent; }
.foot-roofs { display: block; width: 100%; height: clamp(60px, 8vw, 110px); margin-bottom: -1px; }
.foot-night { padding: 1.5rem 0 2rem; background: var(--grain), linear-gradient(180deg, var(--k-hill3), #070a1e); }
.the-end { margin: 0 0 2.4rem; text-align: center; font-family: var(--font-hand); font-size: 1.6rem; color: #c9c3ae; }
.the-end span { display: block; font-family: var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; font-style: italic; font-weight: 800; font-size: clamp(2rem, 4vw, 2.8rem); color: var(--amber); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2rem; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: minmax(0, 1fr); } }
.foot-about p { color: #b5b9d3; line-height: 1.6; font-size: .93rem; max-width: 26rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.foot-links a { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; color: #eee6d2; }
.foot-links .ki { width: 1.2rem; height: 1.2rem; color: #eee6d2; }
.foot-links a:hover, .site-foot ul a:hover { color: var(--amber); }
.foot-title { margin: 0 0 .8rem; font-family: var(--font-hand); font-size: 1.5rem; font-weight: 600; color: var(--amber); }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .92rem; }
.site-foot ul a { color: #eee6d2; text-decoration: none; }
.foot-more li { display: grid; }
.foot-more small { color: #9ba1c4; font-size: .78rem; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.4rem; border-top: 2px dashed rgb(255 255 255 / .12); color: #b5b9d3; font-size: .87rem; }
.foot-bottom p { margin: 0; display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.foot-bottom a { color: #fff; }
.foot-ic { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 6px; }
.foot-ic:hover { background: rgb(255 255 255 / .08); }

/* ---------- Guides: one storybook chapter each ---------- */
.read-progress { position: fixed; inset: 0 0 auto; height: 4px; z-index: 60; background: var(--amber); transform-origin: 0 50%; transform: scaleX(0); }
@supports (animation-timeline: scroll()) { .read-progress { animation: grow linear both; animation-timeline: scroll(root); } }
@keyframes grow { to { transform: scaleX(1); } }
.g-head { position: relative; padding: 2rem 0 1rem; }
.g-head-in { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 2rem; align-items: center; }
@media (max-width: 860px) { .g-head-in { grid-template-columns: minmax(0, 1fr); gap: 0; } .g-spot { order: -1; max-width: 15rem; } }
.g-spot .spot { display: block; width: 100%; height: auto; }
.crumbs { margin-bottom: 1.2rem; font-size: .87rem; font-weight: 700; }
.crumbs a { color: var(--muted-foreground); }
.g-head h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 1rem; font-weight: 800; }
.g-head .lead { margin: 0 0 1.1rem; max-width: 44rem; }
.g-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0; color: var(--muted-foreground); font-size: .87rem; }
.g-meta span:last-child { font-family: var(--font-hand); font-size: 1.2rem; line-height: 1; color: var(--ink-amber); }
.g-layout { display: grid; grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 3rem; padding-block: 1.5rem 3rem; }
@media (max-width: 1040px) { .g-layout { grid-template-columns: minmax(0, 1fr); } .g-aside { display: none; } }
.g-article { min-width: 0; max-width: 46rem; font-size: 1.06rem; line-height: 1.78; }
.g-article-wide { max-width: none; }
.g-article p, .g-article li { color: color-mix(in oklab, var(--foreground) 86%, var(--muted-foreground)); }
.g-article p, .g-article ul { margin: 0 0 1.05rem; }
.g-article > .g-sec:first-child > p:first-of-type::first-letter { float: left; margin: .1em .12em 0 0; font-family: var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; font-weight: 800; font-size: 3.6em; line-height: .8; color: var(--ink-amber); }
.g-article ul:not([class]) { padding-inline-start: 1.25rem; display: grid; gap: .45rem; list-style: disc; }
.g-article li::marker { color: var(--amber); }
.g-article a:not(.btn):not(.book) { color: var(--ink-amber); font-weight: 700; text-underline-offset: 3px; }
.g-article .rule { margin: 2.4rem 0; }
.g-sec { margin-bottom: 1rem; }
.g-sec h2 { position: relative; font-size: clamp(1.5rem, 2.7vw, 1.95rem); line-height: 1.18; margin: 0 0 1rem; padding-bottom: .4rem; scroll-margin-top: calc(var(--top) + 1rem); font-weight: 800; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10'%3E%3Cpath d='M2 6c14-5 26 3 40-1s26-4 40 0 24 2 36-2' fill='none' stroke='%23f2b134' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") left bottom / 7.5rem .6rem no-repeat; }
.anchor { position: absolute; left: -1.4rem; top: 0; opacity: 0; text-decoration: none; color: var(--muted-foreground); }
.g-sec h2:hover .anchor { opacity: 1; }
.hoot-note { margin: 1.6rem 0; padding: 1rem 1.2rem 1rem; border: 2px solid var(--line); border-radius: var(--wob-sm); background: color-mix(in oklab, var(--amber) 14%, var(--surface)); box-shadow: var(--lift); transform: rotate(-.4deg); }
.hoot-note p { margin: 0; }
.hoot-note-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem !important; font-family: var(--font-hand); font-size: 1.5rem; font-weight: 600; line-height: 1; color: var(--foreground) !important; }
.g-aside { position: sticky; top: calc(var(--top) + 1.5rem); align-self: start; max-height: calc(100vh - var(--top) - 3rem); overflow: auto; }
.g-toc { position: relative; padding: 1.1rem 1.1rem 1.1rem; border: 2px solid var(--line); border-radius: var(--wob-sm); background: var(--surface); }
.g-toc::before { content: ""; position: absolute; right: 1.1rem; top: -2px; width: 1.1rem; height: 2.2rem; background: var(--amber); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.g-toc-title { display: flex; align-items: center; gap: .45rem; margin: 0 0 .6rem; font-family: var(--font-hand); font-size: 1.4rem; line-height: 1; }
.g-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; border-inline-start: 2px dotted color-mix(in oklab, var(--line) 30%, transparent); }
.g-toc a { display: block; padding: .3rem .7rem; font-size: .88rem; color: var(--muted-foreground); text-decoration: none; border-inline-start: 2px solid transparent; margin-inline-start: -2px; }
.g-toc a:hover { color: var(--foreground); border-color: var(--amber); }
.g-side-card { margin-top: 1rem; padding: 1rem; border: 2px dashed color-mix(in oklab, var(--line) 40%, transparent); border-radius: var(--wob-sm); font-size: .88rem; }
.g-side-card p { margin: .3rem 0 .6rem; color: var(--muted-foreground); }
.g-side-card p:first-of-type { color: var(--foreground); font-family: var(--font-display); font-size: 1.05rem; }
.g-cta { display: grid; grid-template-columns: 12rem minmax(0, 1fr); align-items: center; gap: 1.4rem; margin: 2.4rem 0; padding: 1.1rem; border: 2px solid #e9dfc6; border-radius: var(--wob); background: var(--grain), linear-gradient(160deg, #131b48, #070b22); color: #f1ead8; box-shadow: var(--lift); }
.g-cta-pic { display: block; width: 100%; height: auto; border-radius: 12px; }
.g-cta h2 { margin: 0 0 .3rem; font-size: 1.5rem; font-weight: 800; }
.g-cta p { margin: 0 0 .8rem; color: #c9cbe0 !important; font-size: .95rem; }
@media (max-width: 600px) { .g-cta { grid-template-columns: minmax(0, 1fr); } .g-cta-pic { max-width: 14rem; } }
.cta-cmd { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.cta-cmd code { font-size: .78rem !important; background: #0a0f28 !important; border-color: #2a3470 !important; color: #e3e8f7; padding: .45rem .6rem !important; overflow-wrap: anywhere; }
.related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.related .book-body > span { display: none; }
.related .book-title { font-size: 1rem; }
@media (max-width: 720px) { .related { grid-template-columns: minmax(0, 1fr); } }

/* The checklist: an illustrated scroll */
.scroll { margin: 1.6rem 0; }
.scroll-roll { position: relative; z-index: 1; height: 1.6rem; margin-inline: .6rem; border: 2px solid var(--line); border-radius: 999px; background: linear-gradient(180deg, color-mix(in oklab, var(--k-wall2) 70%, #fff), var(--k-wall2) 45%, color-mix(in oklab, var(--k-wall2) 75%, #000)); box-shadow: var(--lift); }
.scroll-roll::before, .scroll-roll::after { content: ""; position: absolute; top: 50%; width: 1rem; height: 2.2rem; margin-top: -1.1rem; border: 2px solid var(--line); border-radius: 6px; background: var(--k-roof); }
.scroll-roll::before { left: -.7rem; }
.scroll-roll::after { right: -.7rem; }
.scroll-paper { display: grid; gap: 1.6rem; margin: -.4rem 1.3rem; padding: 1.8rem 1.4rem 1.6rem; border-inline: 2px solid var(--line); background: var(--grain), linear-gradient(90deg, color-mix(in oklab, #000 6%, transparent), transparent 1.2rem, transparent calc(100% - 1.2rem), color-mix(in oklab, #000 6%, transparent)), color-mix(in oklab, #1d2554 var(--mx), #fff6e2); }
.ck-meter { position: sticky; top: calc(var(--top) + .5rem); z-index: 5; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: .7rem 1rem; border: 2px solid var(--line); border-radius: var(--wob-sm); background: color-mix(in oklab, var(--surface) 94%, transparent); backdrop-filter: blur(8px); font-size: .9rem; }
.ck-meter .progress { width: 100%; }
.ck-saved { display: block; color: var(--muted-foreground); font-size: .75rem; }
.ck-group h3 { display: flex; align-items: center; gap: .6rem; margin: 0 0 .7rem; font-size: 1.35rem; font-weight: 800; }
.ck-seal { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 2px solid var(--line); border-radius: 50%; background: var(--amber); color: #1b2547; font-size: .9rem; font-style: italic; box-shadow: 0 0 0 3px color-mix(in oklab, var(--amber) 35%, transparent); }
.ck-list { list-style: none; padding: 0 !important; margin: 0 !important; display: grid !important; gap: .2rem; }
.ck-item { padding: .8rem .4rem .9rem; border-bottom: 2px dashed color-mix(in oklab, var(--line) 20%, transparent); }
.ck-check { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: .8rem; align-items: start; cursor: pointer; }
.ck-check .checkbox { margin-top: .35rem; flex: none; border-width: 2px; }
.ck-ic { display: grid; place-items: center; }
.ck-check > span:last-child { display: grid; gap: .15rem; }
.ck-check b { font-family: var(--font-display); font-size: 1.08rem; transition: color .3s; }
.ck-item.is-done .ck-check b { text-decoration: line-through; text-decoration-color: var(--amber); text-decoration-thickness: 3px; }
.ck-text { color: var(--muted-foreground); font-size: .95rem; line-height: 1.6; }
.ck-how { display: flex; gap: .5rem; margin: .5rem 0 0 4.8rem !important; padding: .45rem .7rem; border-radius: 10px; background: color-mix(in oklab, var(--amber) 12%, transparent); font-size: .88rem; line-height: 1.55; }
.ck-how .ki { margin-top: .15rem; }
@media (max-width: 600px) { .ck-meter { grid-template-columns: auto minmax(0, 1fr) auto; } .ck-meter > .ki { display: none; } .ck-meter .progress { grid-column: 1 / -1; grid-row: 2; } .ck-how { margin-inline-start: 0 !important; } .ck-ic { display: none; } .ck-check { grid-template-columns: auto minmax(0, 1fr); } .scroll-paper { padding-inline: .9rem; margin-inline: 1rem; } }

/* ---------- API ---------- */
.api-table { min-width: 42rem; }
.api-table code { overflow-wrap: normal; word-break: normal; }
.api-table th[scope="row"] code { white-space: nowrap; }
.api-table td { line-height: 1.55; font-size: .92rem; }
.api-table td code { white-space: normal; }
.api-list { display: grid; gap: .5rem; }

/* ---------- 404 ---------- */
.nf { min-height: 70vh; display: grid; align-items: center; }
.nf-in { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; gap: 2rem; padding-block: 3rem; }
@media (max-width: 760px) { .nf-in { grid-template-columns: minmax(0, 1fr); } .nf-art { max-width: 18rem; } }
.nf-art .spot { display: block; width: 100%; height: auto; }
.nf h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; margin: 0 0 .8rem; font-weight: 800; }
.nf .lead { margin: 0 0 1.4rem; }

/* ---------- Gentle motion (never when reduced motion is asked) ---------- */
.tw { animation: twinkle 4s ease-in-out infinite alternate; }
.tw-1 { animation-delay: -1.3s; animation-duration: 5s; }
.tw-2 { animation-delay: -2.6s; animation-duration: 3.4s; }
@keyframes twinkle { from { opacity: .25; } }
.flicker { animation: flicker 3.5s ease-in-out infinite; }
@keyframes flicker { 30% { opacity: .82; } 55% { opacity: 1; } 70% { opacity: .9; } }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame 1.6s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(.92, 1.08) skewX(-3deg); } }
.bug-bob { animation: bob 3.4s ease-in-out infinite; }
.b2 .bug-bob { animation-delay: -1.1s; animation-duration: 3.9s; }
.b3 .bug-bob { animation-delay: -2.2s; animation-duration: 3s; }
.bug-w { transform-box: fill-box; animation: flap .5s ease-in-out infinite alternate; }
.bug-wl { transform-origin: 100% 40%; }
.bug-wr { transform-origin: 0 40%; }
@keyframes flap { to { transform: scaleX(.78); } }
.drift { animation: drift 40s linear infinite alternate; }
.drift-2 { animation-duration: 55s; }
@keyframes drift { to { transform: translateX(60px); } }
.ff { animation: firefly 6s ease-in-out infinite; }
.ff-1 { animation-delay: -2s; } .ff-2 { animation-delay: -4s; } .ff-3 { animation-delay: -1s; } .ff-4 { animation-delay: -3s; }
@keyframes firefly { 0%, 100% { transform: translate(0, 0); opacity: .2; } 30% { opacity: 1; } 50% { transform: translate(18px, -14px); opacity: .9; } 80% { transform: translate(-10px, -24px); opacity: .3; } }
.fireflies { opacity: calc(.15 + .85 * var(--mode)); }
.win-blink { animation: win 7s steps(1) infinite; }
@keyframes win { 40% { opacity: .25; } 60% { opacity: 1; } }
.gate-glow { animation: flicker 5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .px { will-change: auto; transform: none !important; }
}
