/* LiberAstra site — an orchestration booklet.
   Paper, ink, hairline rules, square pages. Dark paper is a peer, not a skin. */

:root {
  --desk: #ddd6c7;
  --desk-deep: #cec5b3;
  --page: #f8f4e9;
  --page-2: #f1ebdd;
  --bar: #efe9dc;
  --ink: #24262a;
  --muted: #545852;
  --faint: #63655f;
  --rule: #d7cdba;
  --rule-strong: #b9ae99;
  --accent: #5b3fd6;
  --accent-soft: rgba(91, 63, 214, 0.08);
  --seal: #a6362f;
  --success: #2f6b46;
  --success-bright: #4ade80;
  --warning: #8a5a16;
  --danger: #a6362f;
  --cover: #22262e;
  --cover-2: #181b21;
  --cover-text: #f2ede1;
  --cover-rule: rgba(242, 237, 225, 0.24);
  --shadow-book: 0 30px 80px rgba(55, 45, 30, 0.28);
  --shadow-soft: 0 14px 36px rgba(55, 45, 30, 0.12);
  --serif: Georgia, "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Hiragino Sans GB", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --top-h: 54px;
  --bottom-h: 62px;
  --band-h: 28px;
  color-scheme: light;
}

[data-theme="dark"] {
  --desk: #0b0a0d;
  --desk-deep: #121116;
  --page: #17161a;
  --page-2: #201e24;
  --bar: #1c1a1f;
  --ink: #f2ede2;
  --muted: #b3ada1;
  --faint: #928b7e;
  --rule: #302c35;
  --rule-strong: #4b4552;
  --accent: #b9a6ff;
  --accent-soft: rgba(185, 166, 255, 0.12);
  --seal: #e08a7d;
  --success: #7fd39a;
  --warning: #e0b15c;
  --danger: #f08a7f;
  --cover: #0f0e12;
  --cover-2: #0a090d;
  --cover-text: #f2ede2;
  --cover-rule: rgba(242, 237, 226, 0.2);
  --shadow-book: 0 34px 90px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
}
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--desk);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 46% at 76% 0%, color-mix(in oklab, var(--accent) 6%, transparent), transparent 68%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px);
  opacity: 0.9;
}
::selection { background: color-mix(in oklab, var(--accent) 24%, transparent); color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--rule-strong); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
code, pre { font-family: var(--mono); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:where(a, button, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 100;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  background: var(--page);
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
.skip:focus { transform: translateY(0); }

/* Language visibility */
[data-lang="zh"] .en { display: none !important; }
[data-lang="en"] .zh { display: none !important; }

/* ------------------------------------------------------------------ */
/* The book frame                                                      */
/* ------------------------------------------------------------------ */

.book-frame {
  width: min(1400px, calc(100% - 36px));
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  background: var(--page);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-book);
}
html.book-early,
html.book-early body,
body.is-book {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
html.book-early .book-frame,
body.is-book .book-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  box-shadow: none;
  transform: none;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Book band (the cloth edge above the top bar)                        */
/* ------------------------------------------------------------------ */

.book-band {
  position: relative;
  z-index: 2;
  flex: 0 0 var(--band-h);
  height: var(--band-h);
  overflow: hidden;
  pointer-events: none;
  background-color: var(--band-tint, var(--page-2));
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 78%);
  border-bottom: 1px solid var(--rule);
  transition: background-color 220ms ease;
}
.book-band[data-band="purpose"] { --band-tint: #efe6d2; }
.book-band[data-band="desk"] { --band-tint: #ece7db; }
.book-band[data-band="image"] { --band-tint: #f0e2d8; }
.book-band[data-band="video"] { --band-tint: #e8e5dc; }
.book-band[data-band="speech"] { --band-tint: #e5ece4; }
.book-band[data-band="canvas"] { --band-tint: #eae4ef; }
.book-band[data-band="library"] { --band-tint: #efe4d8; }
.book-band[data-band="works"] { --band-tint: #f0e5cf; }
.book-band[data-band="settings"] { --band-tint: #e7e8e3; }
.book-band[data-band="access"] { --band-tint: #e3e8e3; }
.book-band[data-band="start"] { --band-tint: #f2ddd3; }
[data-theme="dark"] .book-band {
  --band-tint: var(--page-2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 78%);
}
body.motion-paused .book-band { transition: none; }
.band-art {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--faint);
}
.band-art * {
  stroke: var(--faint);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.band-art path,
.band-art circle,
.band-art use { fill: none; }
.band-art rect:not([fill]):not([class]) { fill: none; }
.band-art #band-star4 { fill: var(--faint); stroke: none; }
.band-art .solid { fill: var(--faint); stroke: none; }
.band-art .accent { stroke: var(--seal); }
.band-art .accent-fill { fill: var(--seal); stroke: none; }
.band-motif {
  opacity: 0;
  transition: opacity 220ms ease;
}
.book-band[data-band="purpose"] [data-band-motif="purpose"],
.book-band[data-band="desk"] [data-band-motif="desk"],
.book-band[data-band="image"] [data-band-motif="image"],
.book-band[data-band="video"] [data-band-motif="video"],
.book-band[data-band="speech"] [data-band-motif="speech"],
.book-band[data-band="canvas"] [data-band-motif="canvas"],
.book-band[data-band="library"] [data-band-motif="library"],
.book-band[data-band="works"] [data-band-motif="works"],
.book-band[data-band="settings"] [data-band-motif="settings"],
.book-band[data-band="access"] [data-band-motif="access"],
.book-band[data-band="start"] [data-band-motif="start"] {
  opacity: 1;
}
body.motion-paused .band-motif { transition: none; }

/* ------------------------------------------------------------------ */
/* Top bar                                                             */
/* ------------------------------------------------------------------ */

.book-top {
  position: relative;
  z-index: 50;
  height: var(--top-h);
  flex: 0 0 var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: var(--bar);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: transparent;
}
.brand-mark svg { width: 11px; height: 11px; fill: var(--accent); }
.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-tag {
  padding: 2px 6px;
  border: 1px solid var(--rule-strong);
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  white-space: nowrap;
}
.top-tools { display: flex; align-items: center; gap: 18px; }
.top-link {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.top-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.top-lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.top-lang [data-lang-label] { padding-bottom: 2px; border-bottom: 1px solid transparent; }
.top-lang[data-current="zh"] [data-lang-label="zh"],
.top-lang[data-current="en"] [data-lang-label="en"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.top-lang:hover [data-lang-label] { color: var(--ink); }
.lang-sep { opacity: 0.5; }
.top-theme {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}
.top-theme:hover { color: var(--ink); border-color: var(--rule); background: var(--page-2); }
.top-theme svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Contents */
.contents { position: relative; }
.contents summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.contents summary::-webkit-details-marker { display: none; }
.contents summary:hover, .contents[open] summary { color: var(--ink); }
.summary-lines { display: inline-grid; gap: 2px; width: 12px; }
.summary-lines i { display: block; height: 1px; background: currentColor; transition: transform 160ms ease; }
.contents[open] .summary-lines i:first-child { transform: translateY(3px) rotate(42deg); }
.contents[open] .summary-lines i:nth-child(2) { opacity: 0; }
.contents[open] .summary-lines i:last-child { transform: translateY(-3px) rotate(-42deg); }
.contents-panel {
  position: absolute;
  top: calc(100% + 13px);
  right: 0;
  width: min(440px, 92vw);
  max-height: calc(100dvh - var(--top-h) - 30px);
  overflow-y: auto;
  padding: 5px;
  background: var(--page);
  border: 1px solid var(--rule);
  box-shadow: 0 22px 54px rgba(55, 45, 30, 0.18);
  z-index: 60;
}
[data-theme="dark"] .contents-panel { box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5); }
.contents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px 8px;
  border-bottom: 1px solid var(--rule);
}
.contents-head .kicker { margin: 0; font-size: 8px; }
.contents-count { color: var(--faint); font-size: 9px; letter-spacing: 0.1em; }
.contents-panel a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 14px;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background-color 150ms ease;
}
.contents-panel a:last-child { border-bottom: 0; }
.contents-panel a:hover { background: var(--page-2); }
.contents-panel a.is-current { background: var(--page-2); }
.contents-panel a.is-current .c-idx, .contents-panel a.is-current strong { color: var(--seal); }
.c-idx { font-family: var(--serif); font-size: 11px; color: var(--faint); }
.c-copy { min-width: 0; display: grid; gap: 0; }
.c-copy strong { font-size: 12px; font-weight: 500; color: var(--ink); }
.c-copy em { font-style: normal; font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-arrow { color: var(--faint); font-size: 11px; opacity: 0; transition: opacity 150ms ease, transform 150ms ease; transform: translate(-2px, 2px); }
.contents-panel a:hover .c-arrow, .contents-panel a.is-current .c-arrow { opacity: 1; transform: none; }
.contents-links {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 11px 6px;
  border-top: 1px solid var(--rule);
}
.contents-panel .contents-links a {
  display: inline-flex;
  gap: 4px;
  padding: 0 0 2px;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}
.contents-panel .contents-links a:last-child { border-bottom: 1px solid var(--rule); }
.contents-panel .contents-links a:hover { color: var(--seal); border-bottom-color: var(--seal); background: transparent; }

/* ------------------------------------------------------------------ */
/* Stage + leaf                                                        */
/* ------------------------------------------------------------------ */

.book-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--page);
  perspective: 2100px;
  perspective-origin: 50% 48%;
}
html.book-early .book-stage { visibility: hidden; }
body.is-book .book-stage { visibility: visible; }

.leaf {
  position: relative;
  padding: clamp(48px, 7vw, 86px) 0;
  border-top: 1px solid var(--rule);
  background: transparent;
  scroll-margin-top: calc(var(--top-h) + 12px);
}
.leaf-purpose { border-top: 0; }
.leaf:focus { outline: none; }
.leaf-inner {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0;
}
body.is-book .leaf {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  padding: 0;
  background:
    radial-gradient(110% 70% at 100% 0%, color-mix(in oklab, var(--accent) 4%, transparent), transparent 58%),
    var(--page);
  box-shadow: inset 18px 0 30px -28px rgba(50, 40, 20, 0.42);
}
body.is-book .leaf[hidden] { display: none !important; }
body.is-book .leaf-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 1240px;
  padding: clamp(18px, 2.6vh, 30px) clamp(24px, 4vw, 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Typography */
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  color: var(--seal);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.kicker::before { content: ""; width: 22px; height: 1px; background: color-mix(in oklab, var(--seal) 55%, transparent); }
.display {
  font-family: var(--serif);
  font-size: clamp(44px, 5.2vw, 76px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 22px;
  text-wrap: balance;
}
.display-2 {
  font-family: var(--serif);
  font-size: clamp(34px, 3.3vw, 52px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 13px;
  text-wrap: balance;
}
.lede {
  max-width: 52ch;
  color: var(--muted);
  font-size: clamp(13px, 1.04vw, 15px);
  line-height: 1.8;
  text-wrap: pretty;
}
.mono { font-family: var(--mono); }

/* Text links and buttons */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.link-arrow:hover { color: var(--seal); border-bottom-color: var(--seal); }
.btn-ink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--page);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.btn-ink:hover { background: var(--seal); border-color: var(--seal); color: var(--page); }
.btn-ink:active { transform: translateY(1px); }

/* Purpose */
.purpose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(26px, 4.4vw, 64px);
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
}
.purpose-copy { max-width: 580px; }
.principles {
  list-style: none;
  padding: 0;
  margin: 23px 0 0;
  border-top: 1px solid var(--rule);
}
.principles li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.p-num { padding-top: 2px; font-family: var(--serif); font-size: 11px; color: var(--seal); }
.p-copy { display: grid; gap: 1px; }
.p-copy strong { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.p-copy em { font-style: normal; font-size: 11px; line-height: 1.55; color: var(--muted); }
.purpose-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 22px; }

/* Cover */
.purpose-demo {
  position: relative;
  height: clamp(350px, 58vh, 580px);
  min-width: 0;
  perspective: 1700px;
}
.cover-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 0;
}
html.js .purpose-demo .cover-scene {
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 0s linear 300ms;
}
html.js .purpose-demo.is-open .cover-scene {
  opacity: 1;
  visibility: visible;
  transition: opacity 380ms ease 90ms, visibility 0s;
}
.cover-preview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--page-2);
  box-shadow: var(--shadow-soft);
}
.cover-preview img { display: block; width: 100%; height: auto; flex: 1 1 auto; min-height: 0; object-fit: cover; object-position: center; background: var(--page-2); }
.cover-preview figcaption {
  padding: 7px 10px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 9.5px;
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 26px;
  padding: 0 9px;
  border-bottom: 1px solid var(--rule);
  background: var(--page-2);
}
.browser-bar i { width: 5px; height: 5px; border-radius: 50%; background: var(--rule-strong); }
.browser-bar span {
  margin-left: 6px;
  min-width: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cover-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.cover-status { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.cover-status i { width: 4px; height: 4px; border-radius: 50%; background: var(--success); animation: pulse-dot 2.8s ease-in-out infinite; }
.cover-replay { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--faint); font-size: 9px; }
.cover-replay:hover { color: var(--seal); }
.book-cover {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #393b43;
  overflow: hidden;
  background:
    radial-gradient(110% 80% at 88% 12%, rgba(123, 94, 255, 0.18), transparent 55%),
    radial-gradient(90% 70% at 12% 100%, rgba(166, 54, 47, 0.16), transparent 60%),
    var(--cover);
  color: var(--cover-text);
  text-align: left;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 18px 22px 56px rgba(20, 16, 10, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 1020ms cubic-bezier(0.6, 0.02, 0.24, 1), box-shadow 1020ms ease, opacity 280ms ease;
}
.book-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(150deg, #000 0%, transparent 64%);
  -webkit-mask-image: linear-gradient(150deg, #000 0%, transparent 64%);
}
.book-cover::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 8px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, rgba(0, 0, 0, 0.18) 1px 2px);
  opacity: 0.5;
}
.book-cover:not(.is-open):hover { transform: rotateY(-4deg) translateZ(8px); }
.book-cover.is-open { transform: rotateY(-106deg) translateZ(0); opacity: 0; pointer-events: none; }
.book-cover.is-hidden { display: none; }
html:not(.js) .book-cover,
html:not(.js) .cover-replay { display: none; }
.cover-seal {
  position: absolute;
  top: 26px; left: 26px;
  width: 30px; height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--seal);
  color: var(--cover-text);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}
.cover-word {
  position: absolute;
  left: 28px;
  top: 36%;
  font-family: var(--serif);
  font-size: clamp(40px, 4.3vw, 62px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
}
.cover-rule { position: absolute; left: 30px; top: calc(36% + clamp(54px, 5.2vw, 78px)); width: 52%; height: 1px; background: var(--cover-rule); }
.cover-sub {
  position: absolute;
  left: 30px;
  top: calc(36% + clamp(70px, 6.4vw, 96px));
  color: rgba(242, 237, 225, 0.58);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.16em;
}
.cover-imprint { position: absolute; top: 26px; right: 24px; color: rgba(242, 237, 225, 0.46); font-size: 8px; letter-spacing: 0.14em; }
.cover-cue {
  position: absolute;
  left: 28px; bottom: 26px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(242, 237, 225, 0.9);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.cue-rule { width: 26px; height: 1px; background: var(--cover-rule); }
.book-cover:hover .cover-cue span:last-child { transform: translateX(3px); }

/* Feature pages */
.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
}
.feature-copy { max-width: 550px; }
.row-list { margin-top: 19px; border-top: 1px solid var(--rule); }
.row {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: start;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background-color 160ms ease;
}
.row:hover { background: color-mix(in oklab, var(--page-2) 70%, transparent); }
.row.is-active { background: var(--page-2); }
.row-num { padding-top: 2px; font-family: var(--serif); font-size: 11px; color: var(--faint); }
.row.is-active .row-num { color: var(--seal); }
.row-copy { display: grid; gap: 1px; min-width: 0; }
.row-copy strong { font-size: 12.5px; font-weight: 500; }
.row-copy em { font-style: normal; font-size: 10.5px; line-height: 1.55; color: var(--muted); }
.row-arrow { padding-top: 1px; color: var(--faint); font-size: 14px; transition: color 160ms ease, transform 200ms ease; }
.row.is-active .row-arrow { color: var(--seal); transform: rotate(45deg); }

.demo { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; margin: 0; }
.demo-frame {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--page-2);
  box-shadow: var(--shadow-soft);
}
.demo-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border-bottom: 1px solid var(--rule);
  background: var(--page-2);
}
.demo-bar i { width: 5px; height: 5px; border-radius: 50%; background: var(--rule-strong); }
.demo-bar span {
  margin-left: 6px;
  min-width: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-bar .demo-tag {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid color-mix(in oklab, var(--seal) 38%, var(--rule));
  color: var(--seal);
  font-family: var(--sans);
  font-size: 7.5px;
  letter-spacing: 0.12em;
}
.demo-frame img { display: block; width: 100%; height: clamp(240px, 34vh, 340px); object-fit: cover; object-position: top center; background: #0d0c10; transition: opacity 180ms ease; }
.demo-frame img.is-fading { opacity: 0.2; }
.demo figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
}
.demo-count { color: var(--faint); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.04em; }
.demo-zoom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  margin-top: 9px;
  padding: 0 9px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.demo-zoom:hover { color: var(--ink); border-color: var(--ink); }

/* Access */
.access-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
}
.access-copy { max-width: 470px; }
.access-tabs { margin-top: 19px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; }
.access-tab {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-areas: "num name" "num desc";
  gap: 1px 6px;
  padding: 9px 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  color: var(--muted);
  transition: background-color 160ms ease;
}
.access-tab:hover { background: color-mix(in oklab, var(--page-2) 70%, transparent); }
.access-tab.is-active { background: var(--page-2); color: var(--ink); }
.a-num { grid-area: num; padding-top: 2px; font-family: var(--serif); font-size: 10px; color: var(--faint); }
.access-tab.is-active .a-num { color: var(--seal); }
.access-tab strong { grid-area: name; font-size: 11.5px; font-weight: 500; letter-spacing: 0.06em; }
.access-tab em { grid-area: desc; font-style: normal; font-size: 10px; color: var(--faint); }
.access-panels { height: auto; max-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.access-panel { display: flex; flex-direction: column; gap: 9px; height: auto; min-height: 0; }
.access-panel[hidden] { display: none !important; }
.access-panel.is-active { animation: panel-in 360ms cubic-bezier(0.22, 0.7, 0.2, 1) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head h3 { font-family: var(--serif); font-size: clamp(22px, 2.1vw, 30px); font-weight: 400; line-height: 1.15; letter-spacing: -0.02em; margin: 4px 0 6px; }
.panel-head p { max-width: 58ch; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.panel-tag { color: var(--seal); font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.16em; }
.browser-frame {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--page-2);
}
.browser-frame img { display: block; width: 100%; height: clamp(210px, 31vh, 310px); object-fit: cover; object-position: top center; background: #0d0c10; }
.code-card {
  flex: 0 1 auto;
  min-height: clamp(180px, 26vh, 270px);
  max-height: clamp(210px, 31vh, 310px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--page-2);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px 6px 11px;
  border-bottom: 1px solid var(--rule);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.code-card pre { flex: 1 1 auto; min-height: 0; margin: 0; padding: 12px; overflow: auto; font-size: 10.5px; line-height: 1.7; tab-size: 2; }
.copy-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  background: var(--page);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}
.copy-btn:hover { color: var(--ink); border-color: var(--ink); }
.copy-btn.is-copied { color: var(--success); border-color: color-mix(in oklab, var(--success) 40%, var(--rule)); }
.panel-doc { margin-top: 1px; align-self: flex-start; }

/* Start */
.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.98fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
}
.start-copy { max-width: 520px; }
.start-steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 9px; }
.start-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: start; }
.s-num { padding-top: 2px; font-family: var(--serif); font-size: 10px; color: var(--seal); }
.start-steps strong { display: block; font-size: 11.5px; font-weight: 500; }
.start-steps em { display: block; font-style: normal; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.start-side { min-width: 0; }
.terminal-card { overflow: hidden; border: 1px solid var(--cover); background: var(--cover); color: var(--cover-text); box-shadow: var(--shadow-soft); }
.terminal-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); color: rgba(242, 237, 226, 0.55); font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; }
.terminal-dots { display: inline-flex; gap: 3px; }
.terminal-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.terminal-status { margin-left: auto; color: var(--success-bright); font-size: 7.5px; letter-spacing: 0.14em; }
.terminal-body { padding: 15px 13px 13px; }
.terminal-line { display: flex; align-items: baseline; gap: 8px; }
.terminal-line .prompt { color: #b9a6ff; font-family: var(--mono); }
.terminal-line code { color: var(--cover-text); font-size: 12px; word-break: break-word; }
.terminal-note { margin-top: 7px; color: rgba(242, 237, 226, 0.62); font-size: 9.5px; }
.terminal-copy { margin: 0 13px 13px; width: calc(100% - 26px); height: 28px; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: rgba(242, 237, 226, 0.78); }
.terminal-copy:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.09); }
.start-links { display: grid; gap: 6px; margin-top: 9px; }
.start-link {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 12px;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--rule);
  background: var(--page-2);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}
.start-link:hover { border-color: var(--ink); transform: translateX(2px); }
.s-icon { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--rule-strong); color: var(--seal); font-size: 10px; }
.start-link strong { display: block; font-size: 10.5px; font-weight: 500; }
.start-link em { display: block; font-style: normal; color: var(--faint); font-size: 9px; }
.s-arrow { color: var(--faint); font-size: 10px; }
.start-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); color: var(--faint); font-size: 9.5px; line-height: 1.55; max-width: 56ch; }

/* Page foot */
.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: clamp(16px, 2.4vh, 24px);
  padding-top: 9px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}
@media (min-width: 861px) and (max-height: 680px) {
  .purpose-grid {
    flex: 0 0 auto;
  }
}
@media (min-height: 681px) {
  .leaf-purpose .page-foot {
    position: relative;
    z-index: 6;
    background: var(--page);
  }
  .leaf-purpose .page-foot::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 18px;
    background: linear-gradient(180deg, transparent, var(--page) 92%);
    pointer-events: none;
  }
}
.foot-links { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.foot-links .link-arrow { font-size: 9.5px; }
.foot-top { padding: 0; border: 0; background: transparent; color: var(--seal); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.foot-top:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Reveal on page activation */
body.is-book .leaf.is-active .purpose-copy,
body.is-book .leaf.is-active .purpose-demo,
body.is-book .leaf.is-active .feature-copy,
body.is-book .leaf.is-active .demo,
body.is-book .leaf.is-active .access-copy,
body.is-book .leaf.is-active .access-panels,
body.is-book .leaf.is-active .start-copy,
body.is-book .leaf.is-active .start-side,
body.is-book .leaf.is-active .page-foot {
  animation: leaf-rise 520ms cubic-bezier(0.22, 0.7, 0.2, 1) both;
}
body.is-book .leaf.is-active .purpose-demo,
body.is-book .leaf.is-active .demo,
body.is-book .leaf.is-active .access-panels,
body.is-book .leaf.is-active .start-side { animation-delay: 55ms; }
body.is-book .leaf.is-active .page-foot { animation-delay: 100ms; }
@keyframes leaf-rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ */
/* Bottom controls + motion toggle                                     */
/* ------------------------------------------------------------------ */

.book-controls {
  display: none;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  flex: 0 0 var(--bottom-h);
  height: var(--bottom-h);
  padding: 0 26px;
  background: var(--bar);
  border-top: 1px solid var(--rule);
}
.reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  justify-self: start;
}
.reader-next { justify-self: end; }
.reader-btn:hover:not(:disabled) { color: var(--ink); }
.reader-btn:disabled { opacity: 0.28; cursor: default; }
.reader-arrow { font-size: 14px; line-height: 1; }
body.is-book .book-controls { display: grid; }
.page-picker { display: flex; align-items: center; gap: 9px; }
.page-picker-label { color: var(--faint); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.page-menu-wrap { position: relative; }
.page-select {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  min-width: 220px;
  max-width: 44vw;
  padding: 0 3px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
}
.page-select:hover { border-bottom-color: var(--rule-strong); }
.page-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-select-chevron {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.65;
  transition: transform 160ms ease;
}
.page-select[aria-expanded="true"] .page-select-chevron { transform: rotate(225deg) translate(-2px, -2px); }
.page-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: max-content;
  min-width: 100%;
  max-width: min(92vw, 420px);
  max-height: min(48vh, 360px);
  overflow-y: auto;
  padding: 4px;
  background: var(--page);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-soft);
  z-index: 70;
}
.page-menu[hidden] { display: none; }
.page-option {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.page-option:last-child { border-bottom: 0; }
.page-option:hover, .page-option:focus-visible { background: var(--page-2); }
.page-option.is-current { background: var(--page-2); }
.page-option.is-current .page-option-index, .page-option.is-current .page-option-title { color: var(--seal); }
.page-option-index { font-family: var(--serif); font-size: 11px; color: var(--faint); }
.page-option-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.contents-motion {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  border-top: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.contents-motion:hover { background: var(--page-2); color: var(--ink); }
.cm-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid var(--rule);
}
.cm-icon svg { width: 9px; height: 9px; fill: currentColor; }
.cm-icon .motion-play { display: none; }
.contents-motion[aria-pressed="true"] .motion-pause { display: none; }
.contents-motion[aria-pressed="true"] .motion-play { display: block; }
.cm-copy { display: grid; gap: 0; }
.cm-copy strong { font-size: 10px; font-weight: 500; color: var(--ink); }
.cm-copy em { font-style: normal; font-size: 9px; color: var(--faint); }

/* ------------------------------------------------------------------ */
/* Page turn                                                           */
/* ------------------------------------------------------------------ */

.turn-sheet {
  z-index: 40 !important;
  pointer-events: none !important;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, filter;
  animation: turn-forward 880ms cubic-bezier(0.55, 0.06, 0.32, 1) forwards;
}
.turn-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(92deg, rgba(20, 16, 10, 0.42) 0%, rgba(20, 16, 10, 0.07) 24%, transparent 46%, rgba(255, 255, 255, 0.1) 82%, transparent 100%);
  opacity: 0;
  animation: turn-shade 880ms ease-in-out forwards;
}
.turn-sheet::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 18px;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18));
  opacity: 0.7;
}
.turn-sheet.is-back { transform-origin: right center; animation-name: turn-back; }
.turn-sheet.is-back::before { animation-name: turn-shade-back; }
.turn-sheet.is-back::after { right: auto; left: 0; background: linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent); }
.leaf-enter-next { animation: leaf-enter-next 420ms cubic-bezier(0.22, 0.7, 0.24, 1) both; }
.leaf-enter-prev { animation: leaf-enter-prev 420ms cubic-bezier(0.22, 0.7, 0.24, 1) both; }
@keyframes turn-forward {
  0% { transform: rotateY(0deg) translateZ(0); filter: brightness(1); }
  22% { transform: rotateY(-13deg) translateZ(20px); filter: brightness(0.98); }
  100% { transform: rotateY(-102deg) translateZ(0); filter: brightness(0.78); }
}
@keyframes turn-back {
  0% { transform: rotateY(0deg) translateZ(0); filter: brightness(1); }
  22% { transform: rotateY(13deg) translateZ(20px); filter: brightness(0.98); }
  100% { transform: rotateY(102deg) translateZ(0); filter: brightness(0.78); }
}
@keyframes turn-shade { 0% { opacity: 0; } 30% { opacity: 0.55; } 100% { opacity: 0.9; } }
@keyframes turn-shade-back { 0% { opacity: 0; } 30% { opacity: 0.55; } 100% { opacity: 0.9; } }
@keyframes leaf-enter-next { from { opacity: 0.5; transform: translateX(1.2%) scale(0.997); } to { opacity: 1; transform: none; } }
@keyframes leaf-enter-prev { from { opacity: 0.5; transform: translateX(-1.2%) scale(0.997); } to { opacity: 1; transform: none; } }

/* Three connected panels: a mountain fold and a valley fold. */
.fold-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: visible;
  transform-style: preserve-3d;
}
.fold-panel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}
.fold-panel > .fold-panel { left: 100%; }
.fold-slice {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--page);
  backface-visibility: hidden;
  box-shadow: 0 0 0 1px var(--rule);
}
.fold-slice > .leaf { box-shadow: none !important; }
.fold-light, .fold-crease {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
}
.fold-light { mix-blend-mode: multiply; }
.fold-edge {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}
.fold-edge-left { background: linear-gradient(90deg, rgba(63, 53, 42, 0.55), transparent 18%); }
.fold-edge-right { background: linear-gradient(270deg, rgba(63, 53, 42, 0.55), transparent 18%); }
[data-theme="dark"] .fold-edge-left { background: linear-gradient(90deg, rgba(0, 0, 0, 0.62), transparent 18%); }
[data-theme="dark"] .fold-edge-right { background: linear-gradient(270deg, rgba(0, 0, 0, 0.62), transparent 18%); }
.fold-mountain > .fold-crease {
  background: linear-gradient(90deg, #fffbeaeb 0, #fffbea80 1px, #3c322b24 3px, transparent 11px);
}
.fold-valley > .fold-crease {
  background: linear-gradient(90deg, #201d19a6 0, #28221c70 2px, #30291f35 12px, #352e2214 35px, transparent 22%);
}
.fold-ground {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  fill: #3f352a;
  will-change: opacity, filter;
}
[data-theme="dark"] .fold-ground { fill: #000; }

/* ------------------------------------------------------------------ */
/* Lightbox                                                            */
/* ------------------------------------------------------------------ */

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.lightbox::backdrop { background: rgba(18, 15, 10, 0.82); backdrop-filter: blur(7px); }
.lightbox-inner { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 30px clamp(14px, 3vw, 44px); }
.lightbox figure { display: flex; flex-direction: column; align-items: center; gap: 9px; margin: 0; max-width: 92vw; }
.lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 1500px);
  max-height: 80vh;
  border: 1px solid var(--rule-strong);
  background: var(--page);
  box-shadow: 0 26px 74px rgba(0, 0, 0, 0.42);
}
.lightbox figcaption { color: rgba(248, 244, 233, 0.72); font-size: 10.5px; }
.lightbox-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}
.lightbox-close:hover { color: var(--ink); }
.lightbox-nav {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--muted);
  font-size: 15px;
}
.lightbox-nav:hover { color: var(--seal); border-color: var(--seal); }
.lightbox[open] { animation: dialog-in 180ms ease-out; }
@keyframes dialog-in { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ */
/* Motion                                                              */
/* ------------------------------------------------------------------ */

@keyframes pulse-dot { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
body.motion-paused .cover-status i { animation: none; }
body.motion-paused .book-cover { transition-duration: 1ms; }
body.motion-paused .book-cover:not(.is-open):hover { transform: none; }
body.motion-paused .leaf.is-active > .leaf-inner > * { animation: none !important; opacity: 1 !important; transform: none !important; }
body.motion-paused .access-panel.is-active,
body.motion-paused .lightbox[open] { animation: none; }
body.motion-paused .leaf-enter-next, body.motion-paused .leaf-enter-prev { animation: none; }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .top-tools { gap: 12px; }
  .purpose-grid, .feature-grid, .access-grid, .start-grid { gap: 30px; }
}

@media (max-width: 860px) {
  :root { --band-h: 18px; }
  body.is-book .leaf-inner { padding: 12px 14px; overflow-y: auto; }
  .contents-panel { position: fixed; top: calc(var(--band-h) + var(--top-h)); left: 10px; right: 10px; width: auto; max-height: calc(100dvh - var(--band-h) - var(--top-h) - 10px); }
  .purpose-grid, .feature-grid, .access-grid, .start-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; flex: 0 0 auto; min-height: auto; }
  .access-grid, .start-grid { align-content: start; align-items: start; }
  .purpose-copy, .feature-copy, .access-copy, .start-copy { max-width: none; }

  .kicker { margin-bottom: 9px; }
  .display { font-size: clamp(34px, 9vw, 46px); margin-bottom: 12px; }
  .display-2 { font-size: clamp(26px, 6.8vw, 36px); margin-bottom: 8px; }
  .lede { font-size: 11.5px; line-height: 1.6; }
  .principles { margin-top: 9px; }
  .principles li { grid-template-columns: 22px 1fr; gap: 6px; padding: 5px 0; }
  .p-copy strong { font-size: 11.5px; }
  .p-copy em { font-size: 10px; line-height: 1.4; }
  .purpose-actions { gap: 10px; margin-top: 11px; }
  .btn-ink { height: 32px; padding: 0 10px; gap: 7px; font-size: 8.5px; }
  .purpose-demo { height: clamp(180px, 40vh, 240px); }
  .cover-seal { top: 14px; left: 14px; width: 22px; height: 40px; font-size: 8px; }
  .cover-word { left: 15px; top: 32%; font-size: clamp(28px, 8.5vw, 40px); }
  .cover-rule { left: 16px; top: calc(32% + 40px); width: 50%; }
  .cover-sub { left: 16px; top: calc(32% + 52px); font-size: 7.5px; }
  .cover-imprint { top: 15px; right: 14px; font-size: 7px; }
  .cover-cue { left: 15px; bottom: 14px; gap: 6px; font-size: 8px; }
  .cover-meta { margin-top: 4px; }
  .cover-status, .cover-replay { font-size: 7.5px; }

  .feature-grid { align-items: start; gap: 8px; }
  .row-list { margin-top: 7px; }
  .row { grid-template-columns: 21px minmax(0, 1fr) 14px; gap: 5px; padding: 5px 3px; }
  .row-copy strong { font-size: 11.5px; }
  .row-copy em { font-size: 9.5px; line-height: 1.35; }
  .row-arrow { font-size: 12px; }
  .demo { width: 100%; }
  .demo-bar { height: 22px; }
  .demo-bar span { font-size: 7.5px; }
  .demo-frame img { height: clamp(128px, 34vw, 220px); }
  .demo figcaption { padding-top: 4px; font-size: 8.5px; }
  .demo-count { font-size: 7.5px; }
  .demo-zoom { height: 22px; margin-top: 4px; padding: 0 7px; font-size: 8px; }

  .access-grid { gap: 7px; }
  .access-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 7px; }
  .access-tab { padding: 5px 6px; grid-template-columns: 18px 1fr; }
  .access-tab strong { font-size: 10.5px; }
  .access-tab em { font-size: 8.5px; }
  .access-panels { height: auto; max-height: none; justify-content: flex-start; }
  .access-panel { height: auto; gap: 5px; }
  .panel-head h3 { font-size: 19px; margin: 1px 0 3px; }
  .panel-head p { font-size: 10px; line-height: 1.5; }
  .browser-frame img { height: clamp(120px, 32vw, 150px); }
  .code-card { min-height: 120px; max-height: 150px; }
  .code-card pre { padding: 7px; font-size: 8.5px; line-height: 1.5; }
  .code-head { padding: 4px 7px; }
  .panel-doc { font-size: 8px; }

  .start-grid { gap: 8px; }
  .start-steps { gap: 4px; margin-top: 8px; }
  .start-steps strong { font-size: 10.5px; }
  .start-steps em { font-size: 9px; line-height: 1.35; }
  .terminal-head { padding: 5px 8px; }
  .terminal-body { padding: 8px 9px; }
  .terminal-line code { font-size: 10px; }
  .terminal-note { margin-top: 4px; font-size: 8px; }
  .terminal-copy { margin: 0 9px 9px; width: calc(100% - 18px); height: 22px; font-size: 8px; }
  .start-links { gap: 3px; margin-top: 4px; }
  .start-link { padding: 4px 6px; grid-template-columns: 22px 1fr 10px; gap: 6px; }
  .s-icon { width: 20px; height: 20px; font-size: 8px; }
  .start-link strong { font-size: 9.5px; }
  .start-link em { font-size: 8px; }
  .start-note { margin-top: 4px; padding-top: 4px; font-size: 8px; }

  .page-foot { margin-top: 7px; padding-top: 5px; gap: 6px; font-size: 8.5px; }
  .foot-links .link-arrow, .foot-top { font-size: 8.5px; }
}

@media (max-width: 700px) {
  .top-link { display: none; }
  .book-controls { padding: 0 10px; gap: 4px; }
  .reader-btn { padding: 6px 7px; }
  .reader-btn .zh, .reader-btn .en { display: none; }
  .page-picker-label { display: none; }
  .page-select { min-width: 0; max-width: 64vw; font-size: 12px; }
}

@media (max-width: 620px) {
  .book-top { padding: 0 12px; gap: 8px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 17px; }
  .brand-tag { display: none; }
  .top-tools { gap: 10px; }
  .contents summary { font-size: 9px; gap: 6px; }
  .top-lang { font-size: 9px; }
  .lightbox-nav { position: absolute; bottom: 14px; }
  .lightbox-prev { left: 14px; }
  .lightbox-next { right: 14px; }
  .lightbox-inner { padding-bottom: 64px; }
  .lightbox img { max-height: 66vh; }
}

@media (max-width: 380px) {
  .book-top { padding: 0 10px; }
  .top-tools { gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Large displays: keep the book page from collapsing into a narrow column. */
@media (min-width: 2200px) {
  :root {
    --top-h: 62px;
    --bottom-h: 72px;
    --band-h: 32px;
  }
  body.is-book .leaf-inner {
    max-width: min(2000px, 86vw);
    padding: clamp(28px, 2.8vh, 44px) clamp(40px, 3.2vw, 72px);
  }
  .purpose-grid { gap: clamp(44px, 3.6vw, 88px); }
  .feature-grid { gap: clamp(40px, 3.4vw, 80px); }
  .display { font-size: clamp(76px, 4.6vw, 110px); }
  .display-2 { font-size: clamp(52px, 3vw, 70px); }
  .lede { font-size: clamp(15px, 0.85vw, 18px); max-width: 58ch; }
  .purpose-copy { max-width: 760px; }
  .feature-copy { max-width: 700px; }
  .access-copy { max-width: 560px; }
  .start-copy { max-width: 620px; }
  .purpose-demo { height: clamp(560px, 58vh, 820px); }
  .demo-frame img { height: clamp(320px, 34vh, 480px); }
  .cover-word { left: 34px; font-size: clamp(64px, 3.6vw, 100px); }
  .cover-seal { top: 32px; left: 32px; width: 36px; height: 64px; font-size: 12px; }
  .cover-rule { left: 36px; }
  .cover-sub { left: 36px; font-size: 11px; }
  .cover-imprint { top: 32px; right: 30px; font-size: 9.5px; }
  .cover-cue { left: 34px; bottom: 32px; font-size: 10.5px; }
  .cover-preview figcaption { font-size: 11px; }
  .row-copy strong { font-size: 14px; }
  .row-copy em { font-size: 12px; }
  .page-foot { margin-top: clamp(20px, 2.6vh, 32px); padding-top: 11px; font-size: 10.5px; }
  .foot-links .link-arrow { font-size: 10.5px; }
  .brand-name { font-size: 22px; }
  .top-link, .top-lang { font-size: 11px; }
  .contents summary { font-size: 11px; }
  .contents-panel { width: min(520px, 92vw); }
  .reader-btn { font-size: 13px; }
  .page-picker-label { font-size: 10px; }
  .page-select { min-width: 260px; font-size: 15px; }
  .book-top { padding: 0 30px; }
  .book-controls { padding: 0 32px; }
}

@media (min-width: 3000px) {
  :root {
    --top-h: 72px;
    --bottom-h: 82px;
    --band-h: 38px;
  }
  body.is-book .leaf-inner {
    max-width: min(2800px, 80vw);
    padding: clamp(34px, 2.8vh, 56px) clamp(56px, 3.2vw, 96px);
  }
  .display { font-size: clamp(100px, 4vw, 140px); }
  .display-2 { font-size: clamp(64px, 2.6vw, 88px); }
  .lede { font-size: clamp(17px, 0.65vw, 21px); }
  .purpose-copy { max-width: 860px; }
  .feature-copy { max-width: 800px; }
  .access-copy { max-width: 620px; }
  .start-copy { max-width: 720px; }
  .purpose-demo { height: clamp(700px, 58vh, 980px); }
  .demo-frame img { height: clamp(380px, 32vh, 620px); }
  .cover-word { font-size: clamp(90px, 3.4vw, 130px); }
  .cover-seal { width: 42px; height: 76px; font-size: 14px; }
  .cover-sub { font-size: 12px; }
  .cover-cue { font-size: 12px; }
  .row-copy strong { font-size: 16px; }
  .row-copy em { font-size: 14px; }
  .page-foot, .foot-links .link-arrow { font-size: 12px; }
  .brand-name { font-size: 26px; }
  .top-link, .top-lang { font-size: 13px; }
  .contents summary { font-size: 13px; }
  .reader-btn { font-size: 15px; }
  .page-select { min-width: 300px; font-size: 17px; }
  .book-top { padding: 0 38px; }
  .book-controls { padding: 0 40px; }
}

@media (min-width: 2200px) {
  .cover-rule { top: calc(36% + 104px); }
  .cover-sub { top: calc(36% + 128px); }
}
@media (min-width: 3000px) {
  .cover-rule { top: calc(36% + 148px); }
  .cover-sub { top: calc(36% + 176px); }
}
