/* =============================================================================
   Adunai Brand Foundation · stylesheet
   Tokens mirror tokens.css; this file binds them to the book's layout.
   ============================================================================= */

:root {
  /* Brand */
  --gold-50:  #FAF6EC;
  --gold-100: #F2E8C9;
  --gold-200: #E5D199;
  --gold-300: #D8BA68;
  --gold-400: #CFAA52;
  --gold-500: #C89B3C;
  --gold-600: #A37E2A;
  --gold-700: #826322;
  --gold-800: #614B19;
  --gold-900: #403111;
  --gold-950: #26200A;

  --foundation-50:  #E6F0EE;
  --foundation-100: #BFD8D4;
  --foundation-200: #8FB9B2;
  --foundation-300: #5F9B91;
  --foundation-400: #3F7E73;
  --foundation-500: #0A3B36;
  --foundation-600: #08322E;
  --foundation-700: #062825;
  --foundation-800: #051E1C;
  --foundation-900: #031412;
  --foundation-950: #020A09;

  --neutral-0:    #FFFFFF;
  --neutral-50:   #FAFAF9;
  --neutral-100:  #F5F5F2;
  --neutral-200:  #E5E5E2;
  --neutral-300:  #C8C8C5;
  --neutral-400:  #8A8A87;
  --neutral-500:  #6B6B68;
  --neutral-600:  #4A4A47;
  --neutral-700:  #2D2D2A;
  --neutral-800:  #1D2423;
  --neutral-900:  #111618;
  --neutral-950:  #0A0E10;
  --neutral-1000: #000000;

  --success-500: #10B981;
  --warning-500: #F97316;
  --error-500:   #EF4444;
  --info-500:    #3B82F6;

  /* Semantic · dark mode default */
  --surface-base:    var(--neutral-900);
  --surface-raised:  var(--neutral-800);
  --surface-overlay: var(--neutral-700);
  --surface-inverse: var(--neutral-100);

  --border-subtle:  var(--neutral-700);
  --border-default: var(--neutral-600);
  --border-strong:  var(--neutral-500);
  --border-rule:    var(--neutral-800);

  --text-primary:   var(--neutral-100);
  --text-secondary: var(--neutral-300);
  --text-muted:     var(--neutral-400);
  --text-faint:     var(--neutral-500);
  --text-accent:    var(--gold-500);

  /* Type */
  --font-display: 'Manrope', system-ui, sans-serif;
  --font-ui:      'Inter', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', Menlo, Monaco, monospace;

  /* Motion */
  --duration-instant: 50ms;
  --duration-quick:   150ms;
  --duration-normal:  250ms;
  --duration-slow:    400ms;
  --duration-slower:  600ms;
  --ease-out-confident:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-confident: cubic-bezier(0.65, 0, 0.35, 1);

  /* Page metrics */
  --gutter: 32px;
  --rule: 1px solid var(--border-rule);
  --section-gap: clamp(96px, 12vw, 168px);
}

[data-theme="light"] {
  --surface-base:    var(--neutral-100);
  --surface-raised:  var(--neutral-0);
  --surface-overlay: var(--neutral-50);
  --surface-inverse: var(--neutral-900);
  --border-subtle:   var(--neutral-200);
  --border-default:  var(--neutral-300);
  --border-strong:   var(--neutral-400);
  --border-rule:     var(--neutral-200);
  --text-primary:    var(--neutral-900);
  --text-secondary:  var(--neutral-600);
  --text-muted:      var(--neutral-500);
  --text-faint:      var(--neutral-400);
  --text-accent:     var(--gold-600);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--surface-base);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-500); color: var(--neutral-900); }

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* =============================================================================
   GLOBAL HEADER
   ============================================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--surface-base) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: var(--rule);
}

.site-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.site-header .brand svg { width: 18px; height: 22px; display: block; }

.site-header .brand-name {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: 0.18em;
  font-size: 13px;
}

.site-header .doc-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.site-header .doc-meta .sep {
  color: var(--text-faint);
  margin: 0 8px;
}

.site-header .toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.toolbar-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--duration-quick) var(--ease-out-confident);
}

.toolbar-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.toolbar-btn[aria-pressed="true"] { color: var(--gold-500); border-color: var(--gold-500); }

/* =============================================================================
   PAGE
   ============================================================================= */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.chapter {
  padding: var(--section-gap) 0;
  border-bottom: var(--rule);
}

.chapter:last-of-type { border-bottom: none; }

.chapter-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 880px) {
  .chapter-grid { grid-template-columns: 1fr; gap: 16px; }
}

.chapter-marker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  position: sticky;
  top: 88px;
  padding-top: 6px;
}

.chapter-marker .marker-num {
  display: block;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--gold-500);
  margin-bottom: 8px;
}

.chapter-marker .marker-label {
  display: block;
  color: var(--text-muted);
  max-width: 70px;
  line-height: 1.5;
}

.chapter-head {
  margin-bottom: 56px;
  border-bottom: var(--rule);
  padding-bottom: 32px;
}

.chapter-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 16px;
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.chapter-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
}

.chapter-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(36px, 4.5vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 24px;
  text-wrap: balance;
}

.chapter-lede {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 64ch;
  text-wrap: pretty;
}

.chapter-body { display: grid; gap: 56px; }

/* =============================================================================
   COVER
   ============================================================================= */

.cover {
  min-height: calc(100vh - 56px);
  padding: 80px 0 120px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-bottom: var(--rule);
  position: relative;
  overflow: hidden;
}

.cover::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 900px;
  height: 900px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at center,
    color-mix(in oklab, var(--gold-500) 5%, transparent) 0%,
    transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.cover-frame {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  text-align: center;
  gap: 40px;
  position: relative;
  z-index: 1;
  padding: 40px 0;
}

.cover-mark {
  width: 156px;
  height: 188px;
}

.cover-mark svg { width: 100%; height: 100%; display: block; }

/* Cover mark settle · first-load signature moment (≤1× per session).
   Default state on cover load: hidden parts; .is-settling triggers the build. */
.cover-mark.is-settling .foundation,
.cover-mark.is-settling .trust,
.cover-mark.is-settling .growth { opacity: 0; }

.cover-mark.is-settling .foundation {
  transform: translateY(34px);
  animation: settle-foundation var(--duration-slower) var(--ease-out-confident) 200ms forwards;
}
.cover-mark.is-settling .trust {
  transform: scale(0.82);
  transform-origin: 100px 120px;
  transform-box: fill-box;
  animation: settle-trust 500ms var(--ease-out-confident) 600ms forwards;
}
.cover-mark.is-settling .growth {
  transform: translateY(-34px);
  animation: settle-growth var(--duration-slower) var(--ease-out-confident) 900ms forwards;
}

/* Sequenced cover-text reveal · anchored, never floating */
.cover-frame.is-settling .cover-wordmark,
.cover-frame.is-settling .cover-title,
.cover-frame.is-settling .cover-meta,
.cover-frame.is-settling .cover-foot {
  opacity: 0;
  transform: translateY(12px);
  animation: cover-reveal var(--duration-slow) var(--ease-out-confident) forwards;
}
.cover-frame.is-settling .cover-wordmark { animation-delay: 1500ms; }
.cover-frame.is-settling .cover-title     { animation-delay: 1700ms; }
.cover-meta.is-settling                    { animation: cover-reveal var(--duration-slow) var(--ease-out-confident) 1900ms forwards; opacity: 0; }
.cover-foot.is-settling                    { animation: cover-reveal var(--duration-slow) var(--ease-out-confident) 2100ms forwards; opacity: 0; }

@keyframes cover-reveal {
  to { opacity: 1; transform: translateY(0); }
}

.cover-wordmark {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(64px, 9vw, 112px);
  letter-spacing: 0.18em;
  line-height: 1;
  color: var(--text-primary);
}

.cover-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.cover-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  .cover-meta { grid-template-columns: repeat(2, 1fr); }
}

.cover-meta-cell {
  padding: 20px 24px;
  border-right: var(--rule);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cover-meta-cell:last-child { border-right: none; }

@media (max-width: 760px) {
  .cover-meta-cell:nth-child(2n) { border-right: none; }
  .cover-meta-cell:nth-child(-n+2) { border-bottom: var(--rule); }
}

.cover-meta-key { color: var(--text-faint); }
.cover-meta-val { color: var(--text-primary); letter-spacing: 0.1em; }

.cover-foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding-top: 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  position: relative;
  z-index: 1;
}

.cover-foot-scroll {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.cover-foot-scroll::after {
  content: '';
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, currentColor, transparent);
}

/* =============================================================================
   TABLE OF CONTENTS
   ============================================================================= */

.toc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: var(--rule);
}

.toc-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  align-items: baseline;
  gap: 24px;
  padding: 22px 8px;
  border-bottom: var(--rule);
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: padding var(--duration-quick) var(--ease-out-confident),
              background var(--duration-quick) var(--ease-out-confident);
}

.toc-row:hover {
  padding-left: 20px;
  background: color-mix(in oklab, var(--gold-500) 4%, transparent);
  text-decoration: none;
}

.toc-row:hover .toc-num { color: var(--gold-500); }

.toc-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  transition: color var(--duration-quick) var(--ease-out-confident);
}

.toc-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.toc-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: right;
}

.toc-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid currentColor;
}

.toc-status.locked { color: var(--success-500); }
.toc-status.tbd { color: var(--warning-500); }

@media (max-width: 720px) {
  .toc-row { grid-template-columns: 56px 1fr; }
  .toc-meta, .toc-status { display: none; }
}

/* =============================================================================
   COMMON BUILDING BLOCKS
   ============================================================================= */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.tag.locked { color: var(--success-500); border-color: color-mix(in oklab, var(--success-500) 50%, transparent); }
.tag.tbd { color: var(--warning-500); border-color: color-mix(in oklab, var(--warning-500) 50%, transparent); }

.rule { border-top: var(--rule); }

.subsection {
  display: grid;
  gap: 24px;
}

.subsection-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: var(--rule);
  flex-wrap: wrap;
}

.subsection-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.subsection-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 64ch;
}

.note .strong { color: var(--text-primary); }

/* =============================================================================
   §01 IDENTITY · pillar grid
   ============================================================================= */

.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: var(--rule);
  background: var(--border-rule);
  gap: 1px;
}

@media (max-width: 980px) { .pillars { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .pillars { grid-template-columns: 1fr; } }

.pillar {
  background: var(--surface-base);
  padding: 32px 28px;
  display: grid;
  gap: 20px;
}

.pillar-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.pillar-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.pillar-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.pillar-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-top: auto;
}

.identity-callout {
  border-left: 2px solid var(--gold-500);
  padding: 4px 0 4px 24px;
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 300;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  max-width: 56ch;
}

.identity-callout cite {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 12px;
  font-style: normal;
}

/* =============================================================================
   §02 TRIAD
   ============================================================================= */

.triad-frame {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.4fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 900px) { .triad-frame { grid-template-columns: 1fr; } }

.triad-mark {
  position: relative;
  aspect-ratio: 5 / 6;
  background: color-mix(in oklab, var(--surface-raised) 60%, transparent);
  border: var(--rule);
  display: grid;
  place-items: center;
  padding: 40px;
  overflow: hidden;
}

.triad-mark .construction-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
}

.triad-mark .construction-grid line {
  stroke: var(--gold-500);
  stroke-width: 0.4;
  stroke-dasharray: 2 3;
}

.triad-mark .construction-grid circle {
  fill: none;
  stroke: var(--gold-500);
  stroke-width: 0.4;
  stroke-dasharray: 2 3;
}

.triad-mark svg.mark { width: 65%; height: auto; position: relative; z-index: 1; }

.triad-mark .callout-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-500);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.triad-mark .callout-label::before {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--gold-500);
}

.triad-mark .callout-label.right::before { display: none; }
.triad-mark .callout-label.right::after {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--gold-500);
}

.callout-growth { top: 8%; left: 50%; transform: translateX(-50%); flex-direction: column; }
.callout-growth::before { width: 1px; height: 16px; }

.callout-trust { top: 50%; right: 6%; transform: translateY(-50%); }
.callout-foundation { bottom: 8%; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }
.callout-foundation::before { width: 1px; height: 16px; }

.triad-list { display: grid; gap: 0; }

.triad-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 24px;
  padding: 28px 0;
  border-bottom: var(--rule);
  align-items: baseline;
}

.triad-row:first-child { padding-top: 0; }
.triad-row:last-child { border-bottom: none; }

.triad-row .row-bullet {
  width: 14px; height: 14px;
  margin-top: 8px;
}

.triad-row .row-name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.01em;
  display: block;
  margin-bottom: 6px;
}

.triad-row .row-role {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.triad-row .row-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 52ch;
}

.triad-row .row-key {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
  text-align: right;
}

/* =============================================================================
   §03 MARK · construction, clearspace, sizes, misuse
   ============================================================================= */

.mark-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
}

@media (max-width: 900px) { .mark-grid { grid-template-columns: 1fr; } }

.specimen-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 32px;
}

.specimen-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.specimen-card-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.specimen-card-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.construction-figure {
  width: 100%;
  aspect-ratio: 5 / 6;
  display: grid;
  place-items: center;
  position: relative;
  background:
    linear-gradient(to right,
      transparent calc(50% - 0.5px),
      color-mix(in oklab, var(--gold-500) 18%, transparent) calc(50% - 0.5px),
      color-mix(in oklab, var(--gold-500) 18%, transparent) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)),
    linear-gradient(to bottom,
      transparent calc(50% - 0.5px),
      color-mix(in oklab, var(--gold-500) 18%, transparent) calc(50% - 0.5px),
      color-mix(in oklab, var(--gold-500) 18%, transparent) calc(50% + 0.5px),
      transparent calc(50% + 0.5px));
}

.construction-figure svg { width: 70%; height: auto; }

.clearspace-figure {
  width: 100%;
  aspect-ratio: 5 / 4;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 6px,
      color-mix(in oklab, var(--neutral-100) 4%, transparent) 6px 7px);
  border: 1px dashed var(--border-subtle);
}

.clearspace-inner {
  width: 64%;
  aspect-ratio: 5 / 6;
  display: grid;
  place-items: center;
  border: 1px dashed var(--gold-500);
  position: relative;
}

.clearspace-inner svg {
  width: 60%;
  height: auto;
}

.clearspace-x {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--gold-500);
}

.clearspace-x.top { top: -8px; left: 8px; transform: translateY(-100%); }
.clearspace-x.right { right: -8px; top: 8px; transform: translateX(100%); }

.scales-figure {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: end;
}

.scale-cell { text-align: center; display: grid; gap: 12px; justify-items: center; }
.scale-cell svg { display: block; }
.scale-cell .scale-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.scale-cell .scale-px {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.misuse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 720px) { .misuse-grid { grid-template-columns: repeat(2, 1fr); } }

.misuse-cell {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 20px;
  position: relative;
  display: grid;
  gap: 14px;
  aspect-ratio: 1 / 1;
  grid-template-rows: 1fr auto;
}

.misuse-cell .misuse-frame {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.misuse-cell .misuse-frame svg { width: 60%; height: auto; }

.misuse-cell::after {
  content: '✕';
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-mono);
  color: var(--error-500);
  font-size: 14px;
}

.misuse-cell .misuse-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

/* =============================================================================
   §04 COLOR · primary cards, scales, semantic, proportion
   ============================================================================= */

.primary-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 800px) { .primary-pair { grid-template-columns: 1fr; } }

.primary-block {
  border: var(--rule);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
}

.primary-block .pb-canvas {
  aspect-ratio: 16 / 10;
  position: relative;
  display: grid;
  align-items: end;
  padding: 24px;
}

.primary-block .pb-name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 32px;
  letter-spacing: -0.01em;
  color: var(--neutral-100);
  line-height: 1;
}

.primary-block.gold .pb-canvas { background: var(--gold-500); }
.primary-block.teal .pb-canvas { background: var(--foundation-500); }
.primary-block.gold .pb-name { color: var(--neutral-900); }

.primary-block .pb-foot {
  padding: 20px 24px;
  display: grid;
  gap: 12px;
  background: var(--surface-raised);
}

.primary-block .pb-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.primary-block .pb-stats span { display: block; }
.primary-block .pb-stats .stat-key { color: var(--text-faint); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 4px; }

.primary-block .pb-role {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Scales */
.scale-block { display: grid; gap: 12px; }

.scale-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.scale-head h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.scale-head .scale-canonical {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.scale-row {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}

@media (max-width: 720px) { .scale-row { grid-template-columns: repeat(6, 1fr); } }

.scale-swatch {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  transition: transform var(--duration-quick) var(--ease-out-confident);
  display: grid;
  align-content: end;
  padding: 6px;
}

.scale-swatch::before {
  content: attr(data-step);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--swatch-fg, var(--neutral-100));
  opacity: 0.6;
}

.scale-swatch:hover { transform: translateY(-3px); }

.scale-swatch[data-canonical="true"] {
  outline: 1px solid var(--gold-500);
  outline-offset: 4px;
}

.swatch-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--neutral-1000);
  color: var(--neutral-100);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 8px;
  border: 1px solid var(--gold-500);
  z-index: 100;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--duration-quick) var(--ease-out-confident);
}

.swatch-tooltip.show { opacity: 1; transform: translateY(0); }

/* Semantic */
.semantic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: var(--rule);
  gap: 1px;
  background: var(--border-rule);
}

@media (max-width: 720px) { .semantic-grid { grid-template-columns: repeat(2, 1fr); } }

.semantic-cell {
  background: var(--surface-raised);
  padding: 24px;
  display: grid;
  gap: 12px;
}

.semantic-cell .dot { width: 12px; height: 12px; }
.semantic-cell .sem-name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.semantic-cell .sem-hex {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}
.semantic-cell .sem-body {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Proportion bar */
.proportion-bar {
  display: grid;
  grid-template-columns: 1fr;
  border: var(--rule);
  background: var(--surface-raised);
}

.proportion-head {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: var(--rule);
  flex-wrap: wrap;
  gap: 16px;
}

.proportion-bars {
  display: flex;
  height: 56px;
  margin: 24px;
}

.proportion-seg {
  display: grid;
  align-content: end;
  padding: 8px 12px;
  position: relative;
}

.proportion-seg .seg-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: inherit;
}

.proportion-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: var(--rule);
}

@media (max-width: 720px) { .proportion-list { grid-template-columns: repeat(2, 1fr); } }

.proportion-item {
  padding: 20px 24px;
  border-right: var(--rule);
  display: grid;
  gap: 8px;
}

.proportion-item:last-child { border-right: none; }
@media (max-width: 720px) {
  .proportion-item:nth-child(2n) { border-right: none; }
  .proportion-item:nth-child(-n+2) { border-bottom: var(--rule); }
}

.proportion-item .pi-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gold-500);
}

.proportion-item .pi-role {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* =============================================================================
   §05 TYPOGRAPHY
   ============================================================================= */

.type-stack { display: grid; gap: 56px; }

.type-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: var(--rule);
}

.type-row:last-child { border-bottom: none; padding-bottom: 0; }

@media (max-width: 900px) { .type-row { grid-template-columns: 1fr; gap: 24px; } }

.type-meta {
  display: grid;
  gap: 14px;
  align-content: start;
  border-right: var(--rule);
  padding-right: 32px;
}

@media (max-width: 900px) { .type-meta { border-right: none; padding-right: 0; padding-bottom: 16px; border-bottom: var(--rule); } }

.type-meta .meta-role {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.type-meta .meta-name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.01em;
}

.type-meta .meta-stack {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.65;
}

.type-meta .meta-status { display: flex; gap: 8px; flex-wrap: wrap; }

.type-sample-display {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(40px, 6vw, 80px);
  letter-spacing: -0.025em;
  line-height: 1.04;
  text-wrap: balance;
  margin-bottom: 24px;
}

.type-sample-ui {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 60ch;
}

.type-sample-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--neutral-950);
  border: var(--rule);
  padding: 20px 24px;
  white-space: pre;
  overflow-x: auto;
}

[data-theme="light"] .type-sample-mono { background: var(--neutral-50); }

.type-bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 24px;
  border-top: var(--rule);
  padding-top: 24px;
}

@media (max-width: 760px) { .type-bilingual { grid-template-columns: 1fr; } }

.type-bilingual .lang-key {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 8px;
}

.type-scale {
  display: grid;
  border: var(--rule);
  background: var(--surface-raised);
}

.type-scale-row {
  display: grid;
  grid-template-columns: 80px 80px 80px 1fr;
  gap: 24px;
  padding: 14px 20px;
  align-items: baseline;
  border-bottom: var(--rule);
}

.type-scale-row:last-child { border-bottom: none; }

.type-scale-row .token {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--gold-500);
}

.type-scale-row .px,
.type-scale-row .lh {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.type-scale-row .demo {
  font-family: var(--font-display);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .type-scale-row { grid-template-columns: 60px 60px 1fr; }
  .type-scale-row .lh { display: none; }
}

/* =============================================================================
   §06 MOTION · tokens, curves, patterns
   ============================================================================= */

.motion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) { .motion-grid { grid-template-columns: 1fr; } }

.curve-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 28px;
}

.curve-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.curve-card .curve-name {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--gold-500);
}

.curve-card .curve-expr {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.curve-svg {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  background: var(--neutral-950);
  border: var(--rule);
  margin-bottom: 16px;
}

[data-theme="light"] .curve-svg { background: var(--neutral-50); }

.curve-svg .grid-line { stroke: var(--border-subtle); stroke-width: 0.5; }
.curve-svg .curve-path { stroke: var(--gold-500); stroke-width: 2; fill: none; }
.curve-svg .curve-dot { fill: var(--gold-500); r: 5; }
.curve-svg .progress-line { stroke: var(--foundation-400); stroke-width: 1; stroke-dasharray: 2 2; }

.curve-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.curve-controls .curve-use {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.curve-play-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
  background: transparent;
  border: 1px solid var(--gold-500);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--duration-quick) var(--ease-out-confident);
}

.curve-play-btn:hover { background: var(--gold-500); color: var(--neutral-900); }

.duration-track {
  border: var(--rule);
  background: var(--surface-raised);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.duration-row {
  display: grid;
  grid-template-columns: 120px 56px 1fr 80px;
  gap: 16px;
  align-items: center;
}

@media (max-width: 720px) { .duration-row { grid-template-columns: 100px 50px 1fr; } .duration-row .duration-use { display: none; } }

.duration-row .d-token {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-500);
  letter-spacing: 0.04em;
}

.duration-row .d-ms {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
}

.duration-row .d-bar {
  height: 4px;
  background: var(--gold-500);
  position: relative;
}

.duration-row .d-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold-500);
  opacity: 0;
  animation: d-pulse 2.6s var(--ease-out-confident) infinite;
}

@keyframes d-pulse {
  0% { opacity: 0; transform: translateX(-100%); }
  20%, 60% { opacity: 0.4; }
  80%, 100% { transform: translateX(100%); opacity: 0; }
}

.duration-row .duration-use {
  font-size: 12px;
  color: var(--text-muted);
}

/* Mark settle */
.mark-settle-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 28px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: center;
}

@media (max-width: 720px) { .mark-settle-card { grid-template-columns: 1fr; } }

.mark-settle-card .mark-frame {
  width: 160px;
  aspect-ratio: 5 / 6;
  margin: 0 auto;
}

.mark-settle-card .mark-frame svg { width: 100%; height: 100%; display: block; }

#animated-mark .growth,
#animated-mark .foundation,
#animated-mark .trust { opacity: 1; }

.mark-settle-card.is-replaying #animated-mark .foundation {
  animation: settle-foundation var(--duration-slower) var(--ease-out-confident) 100ms both;
}
.mark-settle-card.is-replaying #animated-mark .trust {
  animation: settle-trust 500ms var(--ease-out-confident) 500ms both;
}
.mark-settle-card.is-replaying #animated-mark .growth {
  animation: settle-growth var(--duration-slower) var(--ease-out-confident) 800ms both;
}

@keyframes settle-foundation {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes settle-trust {
  from { opacity: 0; transform: scale(0.82); transform-origin: center; }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes settle-growth {
  from { opacity: 0; transform: translateY(-28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mark-settle-info { display: grid; gap: 16px; }

.mark-settle-info ol {
  list-style: none;
  display: grid;
  gap: 8px;
  counter-reset: step;
}

.mark-settle-info li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: color-mix(in oklab, var(--gold-500) 6%, transparent);
  border-left: 2px solid var(--gold-500);
  display: grid;
  grid-template-columns: 24px 1fr 80px;
  gap: 12px;
  align-items: center;
}

.mark-settle-info li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--gold-500);
}

.mark-settle-info li .step-delay {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  text-align: right;
}

/* Live patterns */
.patterns-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) { .patterns-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .patterns-grid { grid-template-columns: 1fr; } }

.pattern-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  min-height: 200px;
}

.pattern-card-head { display: flex; justify-content: space-between; align-items: baseline; }

.pattern-card-name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.pattern-card-token {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.pattern-stage {
  display: grid;
  place-items: center;
  background: var(--neutral-950);
  border: var(--rule);
  min-height: 120px;
  padding: 16px;
  position: relative;
}

[data-theme="light"] .pattern-stage { background: var(--neutral-50); }

.pattern-card .ctrl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--duration-quick) var(--ease-out-confident);
}

.pattern-card .ctrl:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* Pattern: button */
.demo-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  background: var(--gold-500);
  color: var(--neutral-900);
  border: none;
  padding: 12px 22px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background var(--duration-quick) var(--ease-out-confident),
              box-shadow var(--duration-quick) var(--ease-out-confident),
              transform var(--duration-instant) var(--ease-out-confident);
}

.demo-btn:hover {
  background: var(--gold-300);
  box-shadow: 0 0 24px -4px color-mix(in oklab, var(--gold-500) 50%, transparent);
}

.demo-btn:active {
  background: var(--gold-600);
  transform: scale(0.98);
}

/* Pattern: success check */
.demo-check-wrap { display: grid; place-items: center; gap: 12px; }
.demo-check { width: 44px; height: 44px; }
.demo-check circle, .demo-check path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.demo-check circle { stroke: var(--success-500); stroke-width: 2; stroke-dasharray: 138; stroke-dashoffset: 138; transition: stroke-dashoffset var(--duration-slower) var(--ease-out-confident); }
.demo-check path { stroke: var(--success-500); stroke-width: 2.5; stroke-dasharray: 30; stroke-dashoffset: 30; transition: stroke-dashoffset 300ms var(--ease-out-confident) 200ms; }
.demo-check.is-on circle { stroke-dashoffset: 0; }
.demo-check.is-on path { stroke-dashoffset: 0; }

.demo-check-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--success-500);
  opacity: 0;
  transition: opacity var(--duration-quick) var(--ease-out-confident) 500ms;
}
.demo-check.is-on + .demo-check-label { opacity: 1; }

/* Pattern: dropdown */
.demo-dropdown-stage { display: grid; place-items: start center; padding-top: 20px; }
.demo-dropdown-trigger {
  font-family: var(--font-ui);
  font-size: 12px;
  background: var(--neutral-700);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  padding: 8px 16px;
  cursor: pointer;
  position: relative;
}

[data-theme="light"] .demo-dropdown-trigger { background: var(--neutral-0); }

.demo-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--neutral-800);
  border: 1px solid var(--border-default);
  opacity: 0;
  transform: scaleY(0.85);
  transform-origin: top;
  pointer-events: none;
  transition: opacity var(--duration-quick) var(--ease-out-confident),
              transform var(--duration-quick) var(--ease-out-confident);
}

[data-theme="light"] .demo-dropdown-menu { background: var(--neutral-50); }

.demo-dropdown-menu.is-open { opacity: 1; transform: scaleY(1); pointer-events: auto; }

.demo-dropdown-item {
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  text-align: left;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.demo-dropdown-item:last-child { border-bottom: none; }

/* Pattern: shake invalid */
.demo-input {
  background: transparent;
  border: 1px solid var(--border-default);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-primary);
  width: 60%;
  outline: none;
  transition: border-color var(--duration-quick) var(--ease-out-confident);
}

.demo-input.is-invalid {
  border-color: var(--error-500);
  animation: adunai-shake 240ms var(--ease-out-confident);
}

@keyframes adunai-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Pattern: spinner */
.demo-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Pattern: toast */
.demo-toast-stage { display: grid; align-items: end; min-height: 120px; }
.demo-toast {
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-left: 2px solid var(--gold-500);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-normal) var(--ease-out-confident),
              transform var(--duration-normal) var(--ease-out-confident);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  justify-self: start;
  width: 100%;
}

.demo-toast.is-visible { opacity: 1; transform: translateY(0); }

.demo-toast .toast-dot {
  width: 6px; height: 6px;
  background: var(--success-500);
  border-radius: 50%;
}

/* =============================================================================
   §07 VOICE
   ============================================================================= */

.voice-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: var(--rule);
  background: var(--border-rule);
  gap: 1px;
}

@media (max-width: 1100px) { .voice-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .voice-grid { grid-template-columns: 1fr; } }

.voice-cell {
  background: var(--surface-base);
  padding: 24px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.voice-cell .vc-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.voice-cell .vc-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}

.voice-cell .vc-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.voice-cell .vc-example {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold-500);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.dont-do {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 760px) { .dont-do { grid-template-columns: 1fr; } }

.dont-do-col {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 24px;
  display: grid;
  gap: 12px;
}

.dont-do-col .dd-head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: var(--rule);
}

.dd-head .dd-dot { width: 8px; height: 8px; }
.dont-do-col.dont .dd-head { color: var(--error-500); }
.dont-do-col.do .dd-head { color: var(--success-500); }
.dont-do-col.dont .dd-head .dd-dot { background: var(--error-500); }
.dont-do-col.do .dd-head .dd-dot { background: var(--success-500); }

.dd-line {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 17px;
  letter-spacing: -0.005em;
  color: var(--text-primary);
  line-height: 1.45;
}

.dd-line + .dd-line { border-top: 1px solid var(--border-subtle); padding-top: 12px; }

/* =============================================================================
   §08 DIAGRAMS · embedded protocol architecture
   ============================================================================= */

.diagram-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 32px;
}

.diagram-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: var(--rule);
}

.diagram-svg {
  width: 100%;
  height: auto;
  display: block;
}

.diagram-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: var(--rule);
}

@media (max-width: 760px) { .diagram-legend { grid-template-columns: repeat(2, 1fr); } }

.legend-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: center;
}

.legend-line-wrap { display: grid; place-items: center; height: 16px; }
.legend-line { width: 24px; height: 0; border-top: 2px solid var(--gold-500); position: relative; }
.legend-line.foundation { border-top-color: var(--foundation-400); }
.legend-line.gov { border-top: 1.5px dashed var(--foundation-400); }
.legend-line.optional { border-top: 1.5px dotted var(--neutral-400); }

.legend-text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =============================================================================
   §09 APPLICATION · wallet
   ============================================================================= */

.app-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 900px) { .app-grid { grid-template-columns: 1fr; } }

.wallet-card {
  background: var(--surface-raised);
  border: var(--rule);
  padding: 28px;
  display: grid;
  gap: 24px;
}

.wallet-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wallet-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.wallet-balance {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 56px;
  letter-spacing: -0.025em;
  line-height: 1;
}

.wallet-balance .small {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold-500);
  letter-spacing: 0.08em;
  margin-left: 8px;
}

.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.wallet-btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.02em;
  transition: all var(--duration-quick) var(--ease-out-confident);
}

.wallet-btn.primary { background: var(--gold-500); color: var(--neutral-900); }
.wallet-btn.primary:hover { background: var(--gold-300); box-shadow: 0 0 24px -4px color-mix(in oklab, var(--gold-500) 50%, transparent); }
.wallet-btn.secondary { background: var(--neutral-700); color: var(--text-primary); border: 1px solid var(--border-default); }
[data-theme="light"] .wallet-btn.secondary { background: var(--neutral-100); }
.wallet-btn.secondary:hover { background: var(--neutral-600); }
[data-theme="light"] .wallet-btn.secondary:hover { background: var(--neutral-200); }

.tx-list { display: grid; }

.tx {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 14px 0;
  border-bottom: var(--rule);
  align-items: center;
}

.tx:last-child { border-bottom: none; }

.tx-icon {
  width: 36px; height: 36px;
  background: var(--surface-overlay);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gold-500);
}

.tx-name {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tx-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.tx-amount {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

.tx-amount.out { color: var(--text-secondary); }
.tx-amount.in { color: var(--success-500); }

/* =============================================================================
   §10 ACCESSIBILITY
   ============================================================================= */

.a11y-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: var(--rule);
  background: var(--surface-raised);
}

.a11y-table th,
.a11y-table td {
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  border-bottom: var(--rule);
}

.a11y-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-base);
}

.a11y-table tbody tr:last-child td { border-bottom: none; }
.a11y-table td:first-child { font-family: var(--font-mono); }

.a11y-sample {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  display: inline-block;
}

.a11y-pass { color: var(--success-500); font-family: var(--font-mono); font-size: 12px; }
.a11y-partial { color: var(--warning-500); font-family: var(--font-mono); font-size: 12px; }
.a11y-ratio { font-family: var(--font-mono); color: var(--text-secondary); }

/* =============================================================================
   COLOPHON
   ============================================================================= */

.colophon {
  padding: 96px 0 80px;
  border-top: var(--rule);
  text-align: center;
  display: grid;
  gap: 32px;
  justify-items: center;
}

.colophon-mark { width: 44px; height: 52px; }
.colophon-mark svg { width: 100%; height: 100%; display: block; }

.colophon-lines {
  display: grid;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  max-width: 60ch;
}

.colophon-lines .strong { color: var(--text-secondary); }

.colophon-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
  width: 100%;
  max-width: 720px;
}

@media (max-width: 600px) { .colophon-meta-grid { grid-template-columns: 1fr; } }

.colophon-meta-cell {
  padding: 16px 20px;
  border-right: var(--rule);
  display: grid;
  gap: 4px;
  text-align: left;
}

.colophon-meta-cell:last-child { border-right: none; }
@media (max-width: 600px) {
  .colophon-meta-cell { border-right: none; border-bottom: var(--rule); }
  .colophon-meta-cell:last-child { border-bottom: none; }
}

.colophon-meta-cell .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.colophon-meta-cell .v {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

/* =============================================================================
   TWEAKS PANEL
   ============================================================================= */

.tweaks {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 280px;
  background: var(--neutral-1000);
  border: 1px solid var(--gold-500);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  z-index: 100;
  display: none;
}

.tweaks.is-open { display: block; }

[data-theme="light"] .tweaks { background: var(--neutral-0); color: var(--neutral-900); }

.tweaks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gold-500);
}

.tweaks-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.tweaks-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 4px;
}

.tweaks-close:hover { color: var(--text-primary); }

.tweaks-body { padding: 16px 14px; display: grid; gap: 18px; }

.tweak-row { display: grid; gap: 8px; }

.tweak-key {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.tweak-options { display: flex; gap: 4px; flex-wrap: wrap; }

.tweak-opt {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-quick) var(--ease-out-confident);
  text-align: center;
  min-width: 0;
}

.tweak-opt:hover { color: var(--text-primary); border-color: var(--border-strong); }
.tweak-opt[aria-pressed="true"] {
  color: var(--neutral-900);
  background: var(--gold-500);
  border-color: var(--gold-500);
}

[data-theme="light"] .tweak-opt[aria-pressed="true"] { color: var(--neutral-100); }

.tweak-action-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-500);
  background: transparent;
  border: 1px solid var(--gold-500);
  padding: 8px;
  cursor: pointer;
  width: 100%;
  transition: all var(--duration-quick) var(--ease-out-confident);
}

.tweak-action-btn:hover { background: var(--gold-500); color: var(--neutral-900); }

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

[data-reduced-motion="true"] *,
[data-reduced-motion="true"] *::before,
[data-reduced-motion="true"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* Language toggle visibility */
[data-lang="en"] [data-fr] { display: none; }
[data-lang="fr"] [data-en] { display: none; }
