/* 3E World Library — design system v1
   Warm-ivory light / deep-graphite dark, bronze accent, editorial type.
   All fonts self-hosted (SIL OFL 1.1). No external requests. */

@font-face { font-family: "Source Serif"; src: url("../fonts/source-serif-4-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("../fonts/source-serif-4-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("../fonts/source-serif-4-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #f5f0e6;
  --paper-2: #ece5d6;
  --paper-3: #e3dac8;
  --ink: #1c1a17;
  --ink-2: #47423a;
  --muted: #645d52;
  --rule: #d6ccba;
  --rule-strong: #b9ad97;
  --accent: #74572d;
  --accent-soft: #e6d7bb;
  --accent-ink: #fbf7ef;
  --ok: #2f6b45;
  --warn: #7c500f;
  --shadow: 28, 26, 23;
  --cover-shadow: 0 1px 1px rgba(var(--shadow), .08), 0 18px 40px -12px rgba(var(--shadow), .35), 0 40px 80px -30px rgba(var(--shadow), .35);

  --serif: "Source Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1320px;
  --radius: 3px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #121316;
  --paper-2: #191b1f;
  --paper-3: #22252a;
  --ink: #ede7db;
  --ink-2: #cbc4b6;
  --muted: #a39b8c;
  --rule: #2c2f35;
  --rule-strong: #43474f;
  --accent: #cfac70;
  --accent-soft: #3a3226;
  --accent-ink: #15130f;
  --ok: #7cc597;
  --warn: #e0b064;
  --shadow: 0, 0, 0;
  --cover-shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 22px 46px -14px rgba(0, 0, 0, .8), 0 50px 90px -30px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; background: var(--ink); color: var(--paper); text-decoration: none; border-radius: var(--radius);
}
.skip:focus { top: 1rem; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- type ---------- */
.kicker {
  font: 600 .75rem/1.2 var(--sans);
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: .75rem; margin: 0 0 1.25rem;
}
.kicker::before { content: ""; width: 2rem; height: 1px; background: currentColor; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.012em; margin: 0; }
h1 { font-size: clamp(2.5rem, 5.2vw, 4.6rem); line-height: 1.02; letter-spacing: -.025em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.08; }
h3 { font-size: 1.45rem; line-height: 1.2; }
.lede { font: 400 clamp(1.15rem, 1.6vw, 1.35rem)/1.55 var(--serif); color: var(--ink-2); max-width: 40ch; margin: 1.75rem 0 0; }
.prose { max-width: var(--measure); color: var(--ink-2); }
.prose p { margin: 0 0 1em; }
.mono { font-family: var(--mono); font-size: .82em; letter-spacing: -.01em; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 2rem; height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; margin-right: auto; }
.brand:hover { color: inherit; }
.brand-emblem { display: block; flex: none; width: 36px; height: 36px; border-radius: 50%; }
.brand-emblem img { width: 100%; height: 100%; border-radius: 50%; }
.brand-emblem.large { width: 96px; height: 96px; filter: drop-shadow(0 10px 22px rgba(var(--shadow), .3)); }
.site-footer .brand { align-items: center; gap: 1.1rem; }
.brand-name { font: 400 1.18rem/1 var(--serif); letter-spacing: -.01em; white-space: nowrap; }
.brand-name { display: flex; align-items: baseline; gap: .6rem; }
.brand-name b { font-weight: 600; font-size: 1.32rem; letter-spacing: .01em; }
.brand-name small { font: 600 .66rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 1.75rem; }
.nav a { font-size: .9rem; color: var(--ink-2); text-decoration: none; position: relative; padding: .4rem 0; }
.nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--accent); transition: right .3s var(--ease); }
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="true"]::after { right: 0; }
.tools { display: flex; align-items: center; gap: .5rem; }
.tool-btn {
  display: inline-flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .75rem;
  border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; cursor: pointer;
  font-size: .82rem; color: var(--ink-2); transition: border-color .2s, color .2s, background .2s;
}
.tool-btn:hover { border-color: var(--rule-strong); color: var(--ink); background: var(--paper-2); }
.tool-btn svg { width: 16px; height: 16px; }
.kbd { font: 400 .7rem/1 var(--mono); padding: .2rem .35rem; border: 1px solid var(--rule); border-radius: 2px; color: var(--muted); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 8vw, 7rem) 0 clamp(4rem, 8vw, 7rem); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .6rem; height: 3rem; padding: 0 1.35rem;
  border-radius: var(--radius); font: 600 .92rem/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn:hover { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.ghost:hover { color: var(--ink); background: var(--paper-2); border-color: var(--ink-2); }
.btn.small { height: 2.35rem; padding: 0 .95rem; font-size: .82rem; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); max-width: 38rem; }
.hero-meta dt { font: 600 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .55rem; }
.hero-meta dd { margin: 0; font: 400 1.05rem/1.3 var(--serif); }

/* book object */
.exhibit { position: relative; display: grid; justify-items: center; }
.exhibit::before {
  content: ""; position: absolute; inset: 8% -10% 14%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 75%);
  opacity: .7; z-index: 0; pointer-events: none;
}
.book { position: relative; z-index: 1; perspective: 1600px; width: min(330px, 72vw); }
.book-body {
  position: relative; transform-style: preserve-3d;
  transform: rotateY(-18deg) rotateX(4deg);
  transition: transform .9s var(--ease);
}
.book:hover .book-body { transform: rotateY(-9deg) rotateX(2deg); }
.book-cover { position: relative; border-radius: 1px 4px 4px 1px; overflow: hidden; box-shadow: var(--cover-shadow); }
.book-cover img { width: 100%; height: auto; aspect-ratio: 779 / 1172; object-fit: cover; }
.book-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.12) 1.2%, rgba(0,0,0,.08) 3%, transparent 7%, transparent 92%, rgba(0,0,0,.06));
  pointer-events: none;
}
.book-pages {
  position: absolute; top: 1.2%; bottom: 1.2%; right: 0; width: 26px;
  transform: translateX(100%) rotateY(90deg); transform-origin: left center;
  background: repeating-linear-gradient(90deg, #f2ecdf 0 1px, #e2d9c8 1px 2px);
  box-shadow: inset 0 0 8px rgba(0,0,0,.18);
}
.seal {
  position: absolute; z-index: 3; left: -58px; bottom: 9%; width: 132px; height: 132px;
  border-radius: 50%; transform: rotate(-8deg);
  filter: drop-shadow(0 14px 22px rgba(var(--shadow), .45)) drop-shadow(0 2px 3px rgba(var(--shadow), .3));
  transition: transform .9s var(--ease);
}
.seal img { width: 100%; height: 100%; border-radius: 50%; }
.book:hover .seal { transform: rotate(-3deg) scale(1.03); }
.plate {
  position: relative; z-index: 1; margin-top: 2.75rem; width: min(380px, 86vw);
  border-top: 1px solid var(--ink); padding-top: 1rem;
}
.plate-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); font-size: .85rem; }
.plate-row span:first-child { color: var(--muted); }
.plate-row span:last-child { text-align: right; }
.fingerprint { margin-top: 1rem; }
.fingerprint code { display: block; font: 400 .72rem/1.55 var(--mono); color: var(--ink-2); word-break: break-all; letter-spacing: .02em; }
.verify { display: flex; align-items: center; gap: .9rem; margin-top: .9rem; flex-wrap: wrap; }
.verify-result { font-size: .82rem; color: var(--muted); min-height: 1.2em; }
.verify-result.ok { color: var(--ok); }
.verify-result.bad { color: var(--warn); }

/* ---------- sections ---------- */
.section { padding: clamp(4rem, 9vw, 8rem) 0; border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head .prose { margin: 0; }
.section-index { font: 400 .78rem/1 var(--mono); color: var(--muted); margin-bottom: 1.25rem; display: block; }

/* status line */
.source-line { display: inline-flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--muted); margin-top: 1.25rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-strong); flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.stale { background: var(--warn); }

/* ---------- collection ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 0; border-top: 1px solid var(--ink); }
.work { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2rem; padding: 2.25rem 2rem 2.25rem 0; border-bottom: 1px solid var(--rule); }
.shelf > .work:nth-child(odd) { border-right: 1px solid var(--rule); }
.shelf > .work:nth-child(even) { padding-left: 2rem; }
.work-cover { width: 150px; }
.work-cover img { width: 150px; height: auto; aspect-ratio: 779/1172; box-shadow: 0 12px 26px -12px rgba(var(--shadow), .45); border-radius: 1px 3px 3px 1px; }
.typeplate {
  width: 150px; aspect-ratio: 779/1172; padding: 1rem .9rem; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--paper-3); border: 1px solid var(--rule-strong); border-radius: 1px 3px 3px 1px;
  font-family: var(--serif); color: var(--ink); position: relative;
}
.typeplate::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--rule-strong); pointer-events: none; }
.typeplate .tp-title { font-size: 1.15rem; line-height: 1.1; }
.typeplate .tp-author { font: 600 .55rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.typeplate .tp-note { font: 400 .6rem/1.3 var(--sans); color: var(--muted); }
.work h3 { font-size: 1.75rem; }
.work .alt-title { font: italic 400 1rem/1.4 var(--serif); color: var(--muted); margin: .35rem 0 0; }
.work .byline { font-size: .88rem; color: var(--ink-2); margin: .9rem 0 0; }
.work .desc { font: 400 1.05rem/1.5 var(--serif); color: var(--ink-2); margin: .8rem 0 0; }
.formats { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .5rem; }
.format { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .9rem; font-size: .86rem; padding: .65rem 0; border-top: 1px solid var(--rule); }
.format b { font-weight: 600; }
.badge { font: 600 .66rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: .32rem .5rem; border: 1px solid currentColor; border-radius: 2px; }
.badge.ok { color: var(--ok); }
.badge.none { color: var(--muted); }
.badge.plan { color: var(--accent); }
.badge.live { color: var(--ok); }
.work .actions { margin-top: 1.25rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.skeleton { height: 280px; background: linear-gradient(90deg, var(--paper-2), var(--paper-3), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.6s infinite linear; border-bottom: 1px solid var(--rule); }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { padding: 1.5rem 0; color: var(--ink-2); }

/* ---------- lineage ---------- */
.lineage { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); border: 1px solid var(--rule); background: var(--paper-2); }
.lineage-canvas { position: relative; padding: 1.5rem 1rem; overflow-x: auto; border-right: 1px solid var(--rule); display: flex; align-items: center; }
.lineage-canvas svg { width: 100%; min-width: 720px; height: auto; }
.col-label { font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; fill: var(--muted); }
.edge { fill: none; stroke: var(--rule-strong); stroke-width: 1.25; transition: stroke .25s, stroke-width .25s, opacity .25s; }
.edge.is-on { stroke: var(--accent); stroke-width: 2; }
.lineage.has-focus .edge:not(.is-on) { opacity: .25; }
.node { cursor: pointer; outline: none; }
.node rect { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 1; transition: fill .2s, stroke .2s; }
.node text { fill: var(--ink); font: 400 14px/1 var(--sans); pointer-events: none; }
.node .node-type { fill: var(--muted); font: 600 9.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.node.work rect { stroke: var(--ink-2); }
.node.work text.node-label { font: 400 17px/1 var(--serif); }
.node:hover rect, .node:focus-visible rect { stroke: var(--accent); }
.node.is-active rect { fill: var(--accent); stroke: var(--accent); }
.node.is-active text { fill: var(--accent-ink); }
.lineage.has-focus .node:not(.is-near) { opacity: .45; }
.node:focus-visible rect { stroke-width: 2.5; }
.inspector { padding: 1.75rem; display: flex; flex-direction: column; gap: 1rem; min-height: 360px; }
.inspector h3 { font-size: 1.5rem; }
.inspector .type { font: 600 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.inspector ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.inspector li { border-top: 1px solid var(--rule); padding-top: .8rem; font-size: .9rem; color: var(--ink-2); }
.inspector li strong { display: block; font: 600 .7rem/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin-bottom: .3rem; }
.inspector .src { font: 400 .72rem/1.4 var(--mono); color: var(--muted); display: block; margin-top: .35rem; }
.inspector-empty { color: var(--muted); font: italic 400 1.05rem/1.5 var(--serif); }

/* ---------- disciplines ---------- */
.disciplines { columns: 3 15rem; column-gap: 3rem; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); padding-top: 1rem; }
.disciplines li { break-inside: avoid; display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); font: 400 1.12rem/1.3 var(--serif); }
.disciplines li span:last-child { font: 400 .72rem/1.8 var(--mono); color: var(--muted); white-space: nowrap; }
.disciplines li.now span:first-child { color: var(--accent); }

/* ---------- registry ---------- */
.registry { width: 100%; border-collapse: collapse; font-size: .92rem; }
.registry caption { text-align: left; color: var(--muted); font-size: .82rem; padding-bottom: 1rem; }
.registry th, .registry td { text-align: left; padding: 1rem 1rem 1rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.registry thead th { font: 600 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); }
.registry tbody th { font: 400 1.15rem/1.3 var(--serif); font-weight: 400; width: 28%; }
.registry td:nth-child(3) { white-space: nowrap; }
.registry .rel { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.timeline li { padding: 1.25rem 1rem 1.5rem 0; border-top: 1px solid var(--ink); position: relative; }
.timeline li::before { content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink-2); }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .r { font: 400 .78rem/1 var(--mono); color: var(--muted); display: block; margin-bottom: .55rem; }
.timeline li.now .r { color: var(--accent); }
.timeline .t { font: 400 1rem/1.35 var(--serif); }

/* ---------- principles ---------- */
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.principle { padding: 2rem 2rem 2.5rem 0; border-bottom: 1px solid var(--rule); }
.principle:not(:nth-child(3n)) { border-right: 1px solid var(--rule); }
.principle:not(:nth-child(3n+1)) { padding-left: 2rem; }
.principle .n { font: 400 .78rem/1 var(--mono); color: var(--accent); }
.principle h3 { margin: 1.25rem 0 .75rem; font-size: 1.7rem; }
.principle p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--ink); padding: 4rem 0 3rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 5fr) repeat(3, minmax(0, 2fr)); gap: 2rem; }
.footer-grid h4 { font: 600 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .9rem; }
.footer-grid a { text-decoration: none; color: var(--ink-2); }
.footer-grid a:hover { color: var(--accent); }
.motto { font: italic 400 1.4rem/1.35 var(--serif); margin: 1rem 0 0; max-width: 24ch; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: .8rem; color: var(--muted); }

/* ---------- command palette ---------- */
.palette { border: 0; padding: 0; background: transparent; width: min(640px, 92vw); margin: 12vh auto auto; color: var(--ink); }
.palette::backdrop { background: rgba(var(--shadow), .45); backdrop-filter: blur(3px); }
.palette-box { background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(var(--shadow), .55); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; padding: 1.15rem 1.25rem; font: 400 1.15rem/1 var(--serif); color: var(--ink); outline: none; }
.palette input::placeholder { color: var(--muted); }
.palette ul { list-style: none; margin: 0; padding: .4rem; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem .85rem; border-radius: 4px; cursor: pointer; font-size: .95rem; }
.palette li span:last-child { font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.palette li[aria-selected="true"] { background: var(--paper-2); box-shadow: inset 2px 0 0 var(--accent); }
.palette .empty { color: var(--muted); cursor: default; }
.palette-foot { display: flex; gap: 1rem; padding: .65rem 1.25rem; border-top: 1px solid var(--rule); font-size: .72rem; color: var(--muted); }

/* ---------- legal ---------- */
.legal-head { padding: clamp(3rem, 7vw, 6rem) 0 2.5rem; }
.legal-head h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.tablist { display: flex; gap: 0; border-bottom: 1px solid var(--ink); overflow-x: auto; scrollbar-width: thin; }
.tab {
  flex: none; padding: 1rem 1.25rem; border: 0; background: transparent; cursor: pointer;
  font: 400 .92rem/1 var(--sans); color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.legal-body { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 4rem; padding: 3rem 0 4rem; }
.legal-doc { max-width: 70ch; }
.legal-doc h2 { font-size: 2.2rem; margin-bottom: .5rem; }
.legal-doc h3 { font-size: 1.3rem; margin: 2.25rem 0 .6rem; }
.legal-doc p, .legal-doc li { color: var(--ink-2); }
.legal-doc ul, .legal-doc ol { padding-left: 1.2rem; }
.legal-doc li { margin: .35rem 0; }
.legal-doc .effective { font-size: .85rem; color: var(--muted); margin: 0 0 2rem; }
.legal-aside { position: sticky; top: 6rem; align-self: start; font-size: .88rem; border-top: 1px solid var(--ink); padding-top: 1rem; }
.legal-aside dl { margin: 0; display: grid; gap: 1rem; }
.legal-aside dt { font: 600 .68rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.legal-aside dd { margin: 0; color: var(--ink-2); }
.js .tabpanel[hidden] { display: none; }
.tabpanel + .tabpanel { margin-top: 4rem; }
.js .tabpanel + .tabpanel { margin-top: 0; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .nav { display: none; }
  .timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lineage { grid-template-columns: 1fr; }
  .lineage-canvas { border-right: 0; border-bottom: 1px solid var(--rule); }
  .inspector { min-height: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .legal-body { grid-template-columns: 1fr; }
  .legal-aside { position: static; }
}
@media (max-width: 820px) {
  .hero-grid, .section-head { grid-template-columns: minmax(0, 1fr); }
  .hero-grid > *, .section-head > * { min-width: 0; }
  .plate { width: 100%; max-width: 380px; }
  .exhibit { order: -1; }
  .book { width: min(240px, 60vw); }
  .seal { width: 96px; height: 96px; left: -36px; }
  .shelf > .work:nth-child(odd) { border-right: 0; }
  .shelf > .work:nth-child(even) { padding-left: 0; }
  .principles { grid-template-columns: 1fr; }
  .principle, .principle:not(:nth-child(3n+1)) { padding-left: 0; border-right: 0 !important; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .registry thead { display: none; }
  .registry, .registry tbody, .registry tr, .registry th, .registry td { display: block; width: auto; }
  .registry tr { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
  .registry th, .registry td { border: 0; padding: .2rem 0; }
  .tool-btn .label, .tool-btn .kbd { display: none; }
}
@media (max-width: 520px) {
  .work { grid-template-columns: 1fr; padding-right: 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand-name small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .book-body, .book:hover .book-body { transform: rotateY(-12deg); }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .tools, .hero-actions, .verify, .palette, .tablist { display: none !important; }
  .js .tabpanel[hidden] { display: block !important; }
  body { background: #fff; color: #000; }
}
