/* Potato Literature — brand guidelines document styles.
   Every visual value reads from tokens.css. No hex lives here. */

/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper-warm);
}

img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
button { font: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--brand-start);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-3) var(--sp-5);
  font-family: var(--font-mono);
}
.skip:focus { left: 0; }

::selection { background: var(--brand-end); color: var(--ink); }

/* ---------- Shell & sidebar ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-w);
  background: var(--room);
  background-image: var(--gradient-room);
  color: var(--room-fg);
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  z-index: 50;
  overflow-y: auto;
}

.sidebar-mark {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  font-family: var(--font-display);
  font-size: var(--text-body-sm);
  letter-spacing: 0.04em;
  line-height: 1.15;
}
.sidebar-mark img { border-radius: var(--r-sm); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  gap: var(--sp-2);
  align-items: baseline;
  color: var(--room-fg);
  text-decoration: none;
  font-size: var(--text-body-sm);
  padding: 5px var(--sp-2);
  border-left: 3px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.nav a .n {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--book-lore);
  min-width: 2ch;
}
.nav a:hover { color: var(--brand-end); }
.nav a.active {
  background: rgba(225,100,22,0.10);
  color: var(--brand-end);
}

.sidebar-actions { margin-top: auto; padding-top: var(--sp-5); }

.burger {
  display: none;
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 60;
}

main { flex: 1; margin-left: var(--nav-w); min-width: 0; }

/* ---------- Sections ---------- */
.sec {
  padding: var(--section-pad) clamp(var(--sp-5), 5vw, var(--sp-8));
  background: var(--paper);
  border-bottom: var(--border);
}
.sec--warm { background: var(--paper-warm); }
.sec--room {
  background: var(--room);
  background-image: var(--gradient-room);
  color: var(--room-fg);
}
.sec-inner { max-width: var(--max-w); margin: 0 auto; }
.sec-inner--wide { max-width: var(--max-w-wide); }

.sec-head { margin-bottom: var(--sp-7); max-width: var(--max-w-narrow); }

.kicker {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  color: var(--brand-start);
  margin-bottom: var(--sp-3);
}
.sec--room .kicker { color: var(--brand-end); }

.sec-head h2 {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.sec-head .sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-body-lg);
  color: var(--ink-70);
  margin-top: var(--sp-3);
  max-width: 60ch;
}
.sec--room .sub { color: var(--room-fg); }

.lede {
  font-family: var(--font-prose);
  font-size: var(--text-body-lg);
  max-width: 65ch;
  line-height: 1.65;
}
p, dd, li { max-width: 65ch; }

h3 {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  line-height: 1.2;
}
h4 { font-family: var(--font-body); font-weight: 800; font-size: var(--text-h4); }

.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-7);
  align-items: start;
}

.mono-note {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--muted);
}

/* ---------- Definition lists ---------- */
.deflist { display: flex; flex-direction: column; gap: var(--sp-4); }
.deflist dt {
  font-weight: 800;
  font-size: var(--text-body);
  letter-spacing: 0.01em;
}
.deflist dd { color: var(--ink-70); font-size: var(--text-body-sm); line-height: 1.6; }
.sec--room .deflist dd { color: var(--room-fg); }

.numbered {
  list-style: none;
  counter-reset: n;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.numbered li {
  counter-increment: n;
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-bottom: var(--hairline);
}
.numbered li::before {
  content: counter(n, decimal-leading-zero);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-start);
  font-size: var(--text-caption);
  padding-top: 3px;
}

/* ---------- Tables ---------- */
.ttable { width: 100%; border-collapse: collapse; font-size: var(--text-body-sm); }
.ttable th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 2px solid var(--ink);
}
.ttable td { padding: var(--sp-3); border-bottom: 1px solid var(--ink-25); vertical-align: top; }
.ttable .pass { color: var(--book-void); font-weight: 700; }
.ttable .fail { color: var(--brand-start); font-weight: 700; }
.ttable code, .vocab code { font-family: var(--font-mono); font-size: 0.92em; }

/* ---------- Do / Don't ---------- */
.dd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}
.dd-col { border: var(--border); border-radius: var(--r-md); background: var(--paper); }
.dd-col header {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: var(--border);
}
.dd-col--do header { background: var(--brand-end); }
.dd-col--dont header { background: var(--ink); color: var(--paper); }
.dd-col ul { margin: 0; padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.dd-col li { font-size: var(--text-body-sm); }

/* ---------- Buttons & cards ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-body-sm);
  color: var(--ink);
  background: var(--paper);
  border: var(--border);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-5);
  box-shadow: var(--sh-btn);
  transition: transform var(--dur-fast) var(--ease-bounce), box-shadow var(--dur-fast) var(--ease-bounce);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-btn-hover); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn--primary { background: var(--gradient-brand); }
.btn--dark { background: var(--ink); color: var(--paper); }

.card {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-card);
  padding: var(--sp-5);
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal) var(--ease-out);
}
.card:hover { transform: translate(-4px, -4px); box-shadow: var(--sh-card-hover); }

/* ---------- PROPOSED / placeholder machinery ---------- */
.proposed-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  border: 2px solid var(--brand-start);
  color: var(--brand-start);
  border-radius: var(--r-sm);
  padding: 2px var(--sp-2);
  vertical-align: middle;
}

.placeholder {
  border: 2px dashed var(--brand-start);
  border-radius: var(--r-md);
  background: var(--ink-08);
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--text-body-sm);
  color: var(--ink);
}
.placeholder strong {
  display: block;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--brand-start);
  margin-bottom: var(--sp-2);
}

/* Iconography — the inherited Literature utility set (section 05) */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
}
.icon-cell {
  border: 1px solid var(--ink-25);
  border-radius: var(--r-sm);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--paper);
}
.icon-cell svg { width: 24px; height: 24px; stroke: var(--ink); }
.icon-label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  color: var(--ink-70);
  text-align: center;
  margin-top: var(--sp-1);
}

/* The site's own art-slot pattern, rebuilt from tokens (see section 06) */
.art-slot {
  border: 1.5px dashed var(--ink-25);
  border-radius: var(--r-md);
  background: repeating-linear-gradient(45deg, var(--ink-08) 0 14px, transparent 14px 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--ink-35);
  min-height: 180px;
  text-align: center;
  padding: var(--sp-4);
}

/* Invitation zone — interview scaffolding, resolved before final lock */
.invite {
  border: 1px dashed var(--ink-35);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 1.6;
}
.js .invite { opacity: 0; transition: opacity var(--dur-slow) var(--ease-smooth) 2s; }
.js .invite.vis { opacity: 1; }

/* ---------- Scroll reveal — js-gated, fails visible ---------- */
.rv { /* visible by default; JS opts in below */ }
.js .rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.js .rv.vis { opacity: 1; transform: none; }
.js .rv-d1.vis { transition-delay: 0.08s; }
.js .rv-d2.vis { transition-delay: 0.16s; }
.js .rv-d3.vis { transition-delay: 0.24s; }

/* ---------- Cover ---------- */
.cover { display: flex; align-items: center; min-height: 100vh; }
.cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: center;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  width: 100%;
}
.cover-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--book-lore);
  margin-bottom: var(--sp-4);
}
.cover-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--room-fg);
}
.cover-title .accent {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cover-tag {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-h3);
  margin-top: var(--sp-4);
  color: var(--room-fg);
  max-width: 34ch;
}
.cover-meta {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--book-lore);
  margin-top: var(--sp-4);
}
.toc {
  margin-top: var(--sp-6);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px var(--sp-6);
  max-width: 640px;
}
.toc a {
  color: var(--room-fg);
  text-decoration: none;
  font-size: var(--text-body-sm);
  padding: 4px 0;
  border-bottom: 1px dashed var(--room-grain);
  display: flex;
  gap: var(--sp-2);
}
.toc a:hover { color: var(--brand-end); }
.toc .n { font-family: var(--font-mono); color: var(--book-lore); font-size: var(--text-caption); }

/* The library — book spines built from accent tokens */
.spines { display: flex; align-items: flex-end; gap: var(--sp-3); justify-content: center; }
.spine {
  width: 64px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  border: var(--border-w) solid var(--room-grain);
  box-shadow: var(--sh-page);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--sp-4);
  transition: transform var(--dur-normal) var(--ease-out);
}
.spine:hover { transform: translateY(-8px); }
.spine span {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: var(--text-caption);
  letter-spacing: 0.08em;
  color: var(--room);
}
.spine--haikus { height: 200px; background: var(--gradient-brand); }
.spine--scary { height: 230px; background: var(--brand-mid); }
.spine--tree { height: 260px; background: var(--brand-end); }
.spine--hole { height: 240px; background: var(--book-hole); }
.spine--void { height: 250px; background: var(--book-void); }
.spine--aether { height: 270px; background: var(--book-aether); }
.spine--void span, .spine--aether span { color: var(--room-fg); }

/* ---------- 01 · principle demos ---------- */
.demo-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}
.demo {
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.demo figcaption {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 1.5;
}
.demo-stage {
  height: 120px;
  border-radius: var(--r-sm);
  background: var(--paper-warm);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
}

/* Demo: the shack persists; everything else resets */
.reset-item {
  width: 26px; height: 26px;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--paper);
  animation: item-reset 5s var(--ease-smooth) infinite;
}
.reset-item:nth-child(2) { animation-delay: 0.3s; }
.reset-item:nth-child(3) { animation-delay: 0.6s; }
.reset-shack {
  width: 40px; height: 34px;
  border: var(--border);
  background: var(--book-lore);
  border-radius: var(--r-sm);
  position: relative;
}
.reset-shack::before {
  content: "";
  position: absolute;
  left: -5px; right: -5px; top: -14px;
  height: 12px;
  background: var(--ink);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
@keyframes item-reset {
  0%, 55% { opacity: 1; transform: none; }
  70%, 78% { opacity: 0; transform: translateY(14px); }
  92%, 100% { opacity: 1; transform: none; }
}

/* Demo: the potato is the prism */
.prism-beam { position: absolute; left: 0; top: 50%; width: 42%; height: 3px; background: var(--ink); }
.prism {
  width: 34px; height: 34px;
  background: var(--gradient-brand);
  border: var(--border-w) solid var(--ink);
  border-radius: 42% 58% 55% 45% / 50% 44% 56% 50%; /* a potato, roughly */
  z-index: 1;
}
.prism-out { position: absolute; right: 0; width: 42%; display: flex; flex-direction: column; gap: 6px; }
.prism-out i { height: 3px; transform-origin: left center; animation: split var(--dur-slow) var(--ease-out) both; }
.prism-out i:nth-child(1) { background: var(--book-hole); rotate: -8deg; }
.prism-out i:nth-child(2) { background: var(--book-void); }
.prism-out i:nth-child(3) { background: var(--book-aether); rotate: 8deg; }
@keyframes split { from { scale: 0 1; } to { scale: 1 1; } }

/* Demo: two layers, never confused (hover/focus flips public → canon) */
.layers { perspective: 600px; width: 150px; height: 96px; background: none; border: 0; padding: 0; }
.layers-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--dur-turn) var(--ease-out);
}
.layers:hover .layers-inner, .layers:focus-visible .layers-inner { transform: rotateY(180deg); }
.layers-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: var(--sp-2);
  text-align: center;
}
.layers-face--front { background: var(--gradient-brand); color: var(--ink); }
.layers-face--back { background: var(--room); color: var(--room-fg); transform: rotateY(180deg); }

/* ---------- 02 · logo ---------- */
.logo-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
.logo-tile {
  border: var(--border);
  border-radius: var(--r-md);
  min-height: 150px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.logo-tile img { width: 72px; height: 72px; }
.logo-tile figcaption {
  position: absolute; bottom: var(--sp-2); left: var(--sp-3);
  font-family: var(--font-mono); font-size: var(--text-label);
  letter-spacing: var(--track-label); text-transform: uppercase; color: var(--muted);
}
.logo-tile--paper { background: var(--paper); }
.logo-tile--warm { background: var(--paper-warm); }
.logo-tile--room { background: var(--room); }
.logo-tile--room figcaption { color: var(--room-fg); }
.logo-tile--gradient { background: var(--gradient-brand); }
.logo-tile--gradient figcaption { color: var(--ink); }

.clearspace {
  display: inline-grid;
  grid-template-columns: 32px 96px 32px;
  grid-template-rows: 32px 96px 32px;
  border: 1px dashed var(--ink-35);
}
.clearspace > img { grid-area: 2 / 2; width: 96px; height: 96px; }
.clearspace i {
  border: 1px dashed var(--ink-25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-style: normal;
  font-size: var(--text-label); color: var(--ink-35);
}

.minsize-row { display: flex; align-items: flex-end; gap: var(--sp-6); }
.minsize-row img { height: auto; }

/* ---------- 03 · color ---------- */
.swatch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.swatch { border: var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--paper); }
.swatch-chip { height: 96px; }
.swatch dl { padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 2px; }
.swatch dt { font-weight: 800; font-size: var(--text-body-sm); }
.swatch dd { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--muted); }

.chip--brand-start { background: var(--brand-start); }
.chip--brand-mid { background: var(--brand-mid); }
.chip--brand-end { background: var(--brand-end); }
.chip--ink { background: var(--ink); }
.chip--paper { background: var(--paper); border-bottom: 1px solid var(--ink-25); }
.chip--paper-warm { background: var(--paper-warm); border-bottom: 1px solid var(--ink-25); }
.chip--room { background: var(--room); }
.chip--room-fg { background: var(--room-fg); }
.chip--hole { background: var(--book-hole); }
.chip--void { background: var(--book-void); }
.chip--aether { background: var(--book-aether); }
.chip--lore { background: var(--book-lore); }
.chip--gradient { background: var(--gradient-brand); }

/* ---------- 04 · typography ---------- */
.spec-hero { font-family: var(--font-display); font-size: var(--text-h1); line-height: 1; }
.spec-verse {
  font-family: var(--font-serif);
  font-size: var(--text-body-lg);
  line-height: 1.65;
  border-left: 3px solid var(--brand-start);
  padding-left: var(--sp-5);
  max-width: 58ch;
}
.spec-verse em { font-style: italic; }
.spec-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--brand-start);
}
.type-row td:first-child { white-space: nowrap; }

/* ---------- 05 · ornament ---------- */
.canto-seal { display: flex; align-items: center; gap: var(--sp-4); max-width: 420px; }
.canto-seal i { flex: 1; height: 1px; background: var(--ink-25); }
.canto-seal span {
  font-family: var(--font-display);
  font-size: var(--text-body);
  color: var(--brand-start);
  letter-spacing: 0.4em;
}

/* ---------- 07 · characters ---------- */
.roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-6); }
.roster > div { border-bottom: var(--hairline); padding-bottom: var(--sp-3); }
.roster dt { font-weight: 800; font-size: var(--text-body-sm); }
.roster dd { font-size: var(--text-caption); color: var(--ink-70); font-family: var(--font-serif); font-style: italic; }

/* ---------- 08 · components & device frame ---------- */
.comp-row { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; }

.tabchip {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-body-sm);
  border: var(--border);
  border-radius: var(--r-pill);
  padding: var(--sp-1) var(--sp-4);
  background: var(--paper);
  box-shadow: var(--sh-badge);
}
.tabchip--active { background: var(--gradient-tab-active); }

.mini-page {
  width: 150px;
  aspect-ratio: 8.5 / 11;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: var(--sh-page);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mini-page i { display: block; height: 3px; background: var(--ink-25); }
.mini-page i:first-child { height: 8px; width: 70%; background: var(--ink); }

.device {
  width: 270px;
  border: var(--border);
  border-radius: var(--r-lg);
  background: var(--room);
  background-image: var(--gradient-room);
  box-shadow: var(--sh-card);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  align-items: center;
}
.device .comp-row { justify-content: center; }
.device .tabchip { font-size: var(--text-caption); padding: 2px var(--sp-3); box-shadow: none; }
.device-title {
  font-family: var(--font-display);
  color: var(--room-fg);
  font-size: var(--text-caption);
  letter-spacing: 0.06em;
}

/* ---------- 09 · shadows & radii ---------- */
.shadow-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-6); }
.shadow-demo {
  height: 90px;
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}
.shadow-demo--badge { box-shadow: var(--sh-badge); }
.shadow-demo--btn { box-shadow: var(--sh-btn); }
.shadow-demo--card { box-shadow: var(--sh-card); }
.shadow-demo--page { box-shadow: var(--sh-page); border: none; }

.radius-row { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.radius-demo {
  width: 90px; height: 90px;
  border: var(--border);
  background: var(--paper-warm);
  display: flex; align-items: flex-end; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-label);
  padding-bottom: var(--sp-2);
}
.radius-demo--sm { border-radius: var(--r-sm); }
.radius-demo--md { border-radius: var(--r-md); }
.radius-demo--lg { border-radius: var(--r-lg); }
.radius-demo--pill { border-radius: var(--r-pill); }

/* ---------- 10 · motion ---------- */
.turn-stage {
  perspective: 1200px;
  width: 210px;
  aspect-ratio: 8.5 / 11;
  position: relative;
}
.turn-base, .turn-leaf {
  position: absolute; inset: 0;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: var(--sh-page);
  padding: 18px;
}
.turn-base i, .turn-leaf i { display: block; height: 3px; background: var(--ink-25); margin-bottom: 8px; }
.turn-base i:first-child { height: 9px; width: 65%; background: var(--book-void); }
.turn-leaf { transform-origin: left center; }
.turn-leaf i:first-child { height: 9px; width: 65%; background: var(--ink); }
.play .turn-leaf { animation: page-turn var(--dur-turn) var(--ease-out) forwards; }
@keyframes page-turn {
  to { transform: rotateY(-140deg); opacity: 0.2; }
}

.ease-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.ease-lane {
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: var(--sp-4);
  overflow: hidden;
}
.ease-lane .dot {
  width: 22px; height: 22px;
  border-radius: var(--r-pill);
  background: var(--gradient-brand);
  border: 2px solid var(--ink);
}
.ease-lane--smooth .dot { animation: lane 2.4s var(--ease-smooth) infinite alternate; }
.ease-lane--bounce .dot { animation: lane 2.4s var(--ease-bounce) infinite alternate; }
.ease-lane--out .dot { animation: lane 2.4s var(--ease-out) infinite alternate; }
@keyframes lane { from { transform: translateX(0); } to { transform: translateX(calc(100% + 140px)); } }
.ease-lane figcaption { margin-top: var(--sp-3); font-family: var(--font-mono); font-size: var(--text-caption); color: var(--muted); }

/* ---------- 11 · layout ---------- */
.page-diagram {
  width: min(100%, 300px);
  aspect-ratio: 8.5 / 11;
  background: var(--paper);
  box-shadow: var(--sh-page);
  position: relative;
}
.page-diagram .marginbox {
  position: absolute;
  inset: 4.55% 5.88%; /* 0.5in margins: 5.88% of 8.5in, 4.55% of 11in */
  border: 1px dashed var(--brand-start);
}
.page-diagram figcaption {
  position: absolute; bottom: var(--sp-2); left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono); font-size: var(--text-label);
  letter-spacing: var(--track-label); color: var(--muted); text-transform: uppercase;
}
.container-diagram { display: flex; flex-direction: column; gap: var(--sp-3); }
.container-diagram div {
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--paper);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}
.container-diagram .w-narrow { width: 57%; }
.container-diagram .w-default { width: 86%; }
.container-diagram .w-wide { width: 100%; }

.space-ruler { display: flex; align-items: flex-end; gap: var(--sp-3); }
.space-ruler div {
  background: var(--brand-mid);
  border: 2px solid var(--ink);
  width: var(--sp-5);
}
.space-ruler span { font-family: var(--font-mono); font-size: var(--text-label); display: block; margin-top: var(--sp-1); }

/* ---------- 12 · voice ---------- */
.voice-sample {
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  line-height: 1.5;
  font-style: italic;
  max-width: 46ch;
}
.vocab { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }

/* ---------- 13 · AI policy ---------- */
.stance {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  line-height: 1.1;
  max-width: 22ch;
}

/* ---------- 14 · ecosystem ---------- */
.arch { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; }
.arch-node {
  border: var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: var(--sp-2) var(--sp-4);
  font-weight: 700;
  font-size: var(--text-body-sm);
}
.arch-node--root { background: var(--gradient-brand); }
.arch-kids { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding-left: var(--sp-7); }
.arch-kids .arch-node { box-shadow: var(--sh-badge); }
.accent-dot {
  display: inline-block; width: 12px; height: 12px;
  border-radius: var(--r-pill); border: 2px solid var(--ink);
  margin-right: var(--sp-2); vertical-align: baseline;
}
.accent-dot--hole { background: var(--book-hole); }
.accent-dot--void { background: var(--book-void); }
.accent-dot--aether { background: var(--book-aether); }
.accent-dot--lore { background: var(--book-lore); }
.accent-dot--brand { background: var(--gradient-brand); }

/* ---------- Alternate toggles ---------- */
.alt-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--paper);
  padding: var(--sp-1) var(--sp-4);
}
.alt-toggle[aria-pressed="true"] { background: var(--brand-end); }
.sidebar .alt-toggle { border-color: var(--room-fg); color: var(--room-fg); background: none; width: 100%; margin-bottom: var(--sp-2); justify-content: center; }
.sidebar .alt-toggle[aria-pressed="true"] { background: var(--brand-start); color: var(--ink); border-color: var(--brand-start); }
.sidebar .btn { width: 100%; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js .rv, .js .invite { opacity: 1; transform: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .burger { display: inline-block; }
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-normal) var(--ease-out); }
  .sidebar.open { transform: none; }
  main { margin-left: 0; }
  .duo, .dd-grid, .swatch-grid, .demo-strip, .roster, .shadow-row,
  .ease-row, .logo-row, .vocab, .cover-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { grid-template-columns: minmax(0, 1fr); }
  .spines { justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .burger, .skip, .invite, .alt-toggle { display: none !important; }
  main { margin-left: 0; }
  .sec { border-bottom: none; break-before: page; padding: var(--sp-6); }
  .sec:first-of-type { break-before: auto; }
  .rv, .invite { opacity: 1 !important; transform: none !important; }
  .sec--room, .sidebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: var(--paper); }
}
