/* ═══════════════════════════════════════════════════════════════════════════
   LegalStep.ai — design system.

   A deliberate break from the LegalCollect "ledger" identity. The organising
   idea: an MCP server is a *surface of named, bounded tools*, so the page is
   built around the permission taxonomy the product actually enforces —
   reads / writes / guarded. That taxonomy colours the hero trace and
   classifies every capability. Nothing else is colour-coded, so the code
   always means the same thing.

   Loaded by every page on this site. assets/theme.js handles the light/dark
   toggle; the LegalCollect wordmark SVGs appear in the footer lockup.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  --bg:        #F4F5FA;
  --bg-deep:   #EDEFF7;
  --surface:   #FFFFFF;
  --surface-2: #FAFBFE;
  --ink:       #0D1224;
  --muted:     #545E7A;
  --faint:     #666F8A;   /* dark enough for 11px mono: 4.6:1 on porcelain */
  --line:      #E4E7F0;
  --line-2:    #D5DAE8;

  /* Accents are measured against their own tint over the card, since that is
     where the 10px badge text actually sits. All clear 4.5:1. */
  --reads:      #2450C8;  /* 6.0:1 */
  --reads-bg:   rgba(36, 80, 200, 0.085);
  --writes:     #8A5005;  /* 5.7:1 */
  --writes-bg:  rgba(138, 80, 5, 0.09);
  --guarded:    #BC2B32;  /* 5.3:1 */
  --guarded-bg: rgba(188, 43, 50, 0.075);

  --shadow-sm: 0 1px 2px rgba(13, 18, 36, 0.04);
  --shadow:    0 4px 16px -4px rgba(13, 18, 36, 0.09), 0 1px 2px rgba(13, 18, 36, 0.04);
  --shadow-lg: 0 24px 60px -20px rgba(13, 18, 36, 0.22), 0 2px 6px rgba(13, 18, 36, 0.05);

  --display: 'Archivo', 'Helvetica Neue', sans-serif;
  --body:    'IBM Plex Sans', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --gutter: clamp(20px, 5vw, 48px);
  --measure: 1180px;
  --section: clamp(64px, 7.4vw, 106px);
}

:root[data-theme="dark"] {
  --bg:        #080C1A;
  --bg-deep:   #05080F;
  --surface:   #111731;
  --surface-2: #0C1226;
  --ink:       #EEF1FA;
  --muted:     #9AA3BF;
  --faint:     #7B84A6;   /* 4.8:1 on the card surface, still a step below muted */
  --line:      #1D2544;
  --line-2:    #2A3358;

  --reads:      #79A2FF;
  --reads-bg:   rgba(121, 162, 255, 0.13);
  --writes:     #EFA845;
  --writes-bg:  rgba(239, 168, 69, 0.13);
  --guarded:    #FF7076;
  --guarded-bg: rgba(255, 112, 118, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 4px 18px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 70px -24px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

img, svg { display: block; max-width: 100%; }

::selection { background: var(--reads); color: #fff; }

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

/* ── Type system ──────────────────────────────────────────────────────────── */
.d1, .d2, .d3 {
  font-family: var(--display);
  font-variation-settings: 'wdth' 115;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin: 0;
  text-wrap: balance;
}
.d1 { font-size: clamp(33px, 4.3vw, 56px); }
.d2 { font-size: clamp(29px, 3.9vw, 46px); }
.d3 { font-size: clamp(19px, 1.5vw, 21px); font-variation-settings: 'wdth' 108; letter-spacing: -0.015em; line-height: 1.25; }

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.rule-tag {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.rule-tag::before {
  content: '';
  width: 26px;
  height: 1px;
  background: var(--line-2);
}

.lede {
  font-size: clamp(16.5px, 1.5vw, 19px);
  color: var(--muted);
  max-width: 62ch;
  margin: 20px 0 0;
}

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

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--body);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  padding: 13px 20px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.btn-solid {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
.btn-solid:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-line {
  border-color: var(--line-2);
  color: var(--ink);
  background: var(--surface);
}
.btn-line:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ── Navigation ───────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, background 0.25s;
}
.nav.scrolled { border-bottom-color: var(--line); }

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  margin-right: auto;
}
.lockup .mark { width: 26px; height: 26px; flex-shrink: 0; }
.lockup .mark rect { fill: var(--reads); }
.lockup .mark rect.q { fill: var(--ink); }
.lockup .name {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.lockup .name i { font-style: normal; color: var(--reads); }

.nav-set { display: flex; align-items: center; gap: 4px; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 450;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: color 0.18s, background 0.18s;
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.nav-link[aria-current] { color: var(--ink); font-weight: 500; }
.nav-link[aria-current]::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 1.5px;
  background: var(--reads);
  border-radius: 2px;
}
.nav-link .chev { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.4; transition: transform 0.2s; }

.nav-group { position: relative; }
.nav-group:hover .chev, .nav-group:focus-within .chev { transform: rotate(180deg); }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 268px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}
.nav-group:hover .menu, .nav-group:focus-within .menu {
  opacity: 1; visibility: visible; transform: none;
}
.menu .tag { display: block; padding: 8px 10px 6px; }
.menu a {
  display: block;
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}
.menu a:hover { color: var(--ink); background: var(--bg-deep); }

.theme-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}
.theme-btn:hover { color: var(--ink); border-color: var(--line-2); }
.theme-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.nav-cta { margin-left: 6px; padding: 10px 16px; font-size: 14px; }

.nav-burger { display: none; }

@media (max-width: 900px) {
  .nav-set {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px var(--gutter) 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .nav:not(.open) .nav-set { display: none; }
  .nav-group .menu {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 12px;
    min-width: 0;
    background: transparent;
  }
  .nav-link[aria-current]::after { display: none; }
  .nav-cta { margin: 8px 0 0; justify-content: center; }
  .theme-btn { margin: 8px 0 0; width: 100%; }
  .nav-burger {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--ink);
    cursor: pointer;
  }
  .nav-burger svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
}

/* ── Permission taxonomy (the page's one colour system) ───────────────────── */
.perm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
  white-space: nowrap;
}
.perm::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.perm-reads   { color: var(--reads);   background: var(--reads-bg); }
.perm-writes  { color: var(--writes);  background: var(--writes-bg); }
.perm-guarded { color: var(--guarded); background: var(--guarded-bg); }
.perm-base    { color: var(--muted);   background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: clamp(40px, 5vw, 72px) 0 clamp(48px, 6vw, 88px);
  overflow: hidden;
}
.hero > .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(40px, 5vw, 76px);
  align-items: center;
}
@media (max-width: 1000px) { .hero-grid { grid-template-columns: 1fr; gap: 48px; } }

.hero-crumbs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-crumbs .by { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.hero h1 { font-size: clamp(38px, 5.4vw, 68px); }
.hero h1 .said { display: block; color: var(--ink); }
.hero h1 .claim {
  display: block;
  margin-top: 0.16em;
  font-size: 0.56em;
  line-height: 1.12;
  color: color-mix(in srgb, var(--ink) 62%, var(--bg));
  font-variation-settings: 'wdth' 108;
  font-weight: 500;
  letter-spacing: -0.018em;
  max-width: 21ch;
}
.hero h1 .by-line {
  display: block;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.hero .sub { font-size: clamp(16px, 1.5vw, 17.5px); color: var(--muted); max-width: 54ch; margin: 26px 0 30px; }
.hero .sub strong { color: var(--ink); font-weight: 600; }

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 34px; }
@media (max-width: 520px) {
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-actions .btn { justify-content: center; }
  .close-actions { display: grid; grid-template-columns: 1fr; }
  .close-actions .btn { justify-content: center; }
}

.hero-points { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.hero-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.hero-points { list-style: none; margin: 0; padding: 0; }
.hero-points svg { width: 13px; height: 13px; stroke: var(--reads); fill: none; stroke-width: 2.6; flex-shrink: 0; }

/* ── Signature: the tool trace ────────────────────────────────────────────── */
.trace {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.trace-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.trace-head .who {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.trace-head .live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.trace-head .live b {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--reads);
  box-shadow: 0 0 0 3px var(--reads-bg);
}

.trace-body {
  padding: 20px;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
@media (max-width: 520px) { .trace-body { min-height: 360px; padding: 18px 15px; } }

.step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.step-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.ask { font-size: 15.5px; color: var(--ink); line-height: 1.5; }
.ask .cursor {
  display: inline-block;
  width: 7px; height: 16px;
  margin-left: 2px;
  vertical-align: -3px;
  background: var(--reads);
  border-radius: 1px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.slot { display: flex; flex-direction: column; }
.call-slot { min-height: 62px; }
.result:empty { min-height: 22px; }

.call {
  border: 1px solid var(--line);
  border-left: 3px solid var(--call-hue, var(--line-2));
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 12px 14px;
  animation: rise 0.32s ease both;
}
.call.is-reads   { --call-hue: var(--reads); }
.call.is-writes  { --call-hue: var(--writes); }
.call.is-guarded { --call-hue: var(--guarded); }
.call-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.call-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.call-top .perm { margin-left: auto; }
.call-args {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 7px;
  word-break: break-word;
}

.result {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.58;
  animation: rise 0.32s ease both;
}
.result strong { color: var(--ink); font-weight: 600; }
.result .ok { color: var(--reads); font-weight: 600; }

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.dots { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: pulse 1.15s infinite; }
.dots i:nth-child(2) { animation-delay: 0.14s; }
.dots i:nth-child(3) { animation-delay: 0.28s; }
@keyframes pulse { 0%, 65%, 100% { opacity: 0.35; transform: none; } 32% { opacity: 1; transform: translateY(-4px); } }

.trace-foot {
  margin: 0 20px 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.trace-foot .k { color: var(--muted); }

/* ── Platform strip ───────────────────────────────────────────────────────── */
.strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.strip-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding: 34px 0;
}
@media (max-width: 860px) { .strip-inner { grid-template-columns: 1fr; gap: 26px; } }
.strip p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.62; }
.strip p strong { color: var(--ink); font-weight: 600; }
.stats { display: flex; gap: clamp(20px, 4vw, 44px); flex-wrap: wrap; }
.stats dt {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.03em;
  color: var(--ink);
}
.stats dd {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  max-width: 15ch;
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
/* Homepage composed sections. Deliberately NOT .sec — that class carries the
   document-prose rules in Part 2, whose .sec p / .sec a / .sec h2 selectors are
   more specific than the component classes here and would override them. */
.block { padding: var(--section) 0; }
.block + .block { padding-top: 0; }   /* one rhythm between stacked sections */
.sec-head { max-width: 720px; }

/* Band headers: the taxonomy IS the structure of this section, so the key
   lives in the flow of the grid rather than in a separate legend. */
.band {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 30px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.tools > .band:first-child { margin-top: 6px; }
.band-n { font-family: var(--mono); font-size: 11px; color: var(--ink); font-weight: 500; }
.band-d { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* Capability grid */
.tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}
@media (max-width: 1000px) { .tools { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .tools { grid-template-columns: 1fr; } }

.tool {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  transition: border-color 0.22s, transform 0.22s, box-shadow 0.22s;
}
.tool:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.tool-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.tool-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool h3 { margin: 0 0 9px; }
.tool p { margin: 0 0 16px; font-size: 14px; color: var(--muted); line-height: 1.58; }
.tool .say {
  padding: 10px 12px;
  border-left: 2px solid var(--say-hue, var(--line-2));
  background: var(--surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.tool.is-reads   { --say-hue: var(--reads); }
.tool.is-writes  { --say-hue: var(--writes); }
.tool.is-guarded { --say-hue: var(--guarded); }
.tool .say { margin-top: auto; }

/* The foundation statement is explicitly not a tool — it spans the grid so it
   reads as the ground under the bands, not another cell in them. */
.tool-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: clamp(20px, 4vw, 48px);
}
.tool-wide .tool-body { flex: 1 1 460px; }
.tool-wide h3 { margin-bottom: 9px; }
.tool-wide p { margin-bottom: 0; }
.tool-wide .say { margin: 0; flex: 0 1 320px; }
@media (max-width: 760px) {
  .tool-wide { flex-direction: column; align-items: stretch; gap: 16px; }
  .tool-wide .say { flex: initial; }
}

/* Oversight guarantees */
.guards { list-style: none; margin: 38px 0 0; padding: 0; }
.guard {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0 18px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.guard:last-child { border-bottom: 1px solid var(--line); }
.guard .n {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  padding-top: 4px;
}
.guard h3 { margin: 0 0 7px; }
.guard p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.62; max-width: 74ch; }
@media (max-width: 560px) { .guard { grid-template-columns: 1fr; gap: 8px; } }

/* Setup sequence */
.seq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 38px; counter-reset: s; }
@media (max-width: 860px) { .seq { grid-template-columns: 1fr; } }
.seq li {
  position: relative;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 20px;
}
.seq li::before {
  counter-increment: s;
  content: '0' counter(s);
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--reads);
  margin-bottom: 14px;
}
.seq h3 { margin: 0 0 8px; }
.seq p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.58; }

/* Docs list */
.docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 34px; }
@media (max-width: 760px) { .docs { grid-template-columns: 1fr; } }
.doc {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.doc:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.doc .txt h3 { margin: 0; font-size: 15.5px; font-family: var(--display); font-variation-settings: 'wdth' 108; font-weight: 600; letter-spacing: -0.015em; }
.doc .txt { flex: 1; }
.doc .txt p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.doc .go { margin-left: auto; width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2.2; flex-shrink: 0; transition: stroke 0.2s, transform 0.2s; }
.doc:hover .go { stroke: var(--reads); transform: translateX(3px); }

/* Closing panel */
.close-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(40px, 6vw, 68px) clamp(24px, 5vw, 60px);
  text-align: center;
  box-shadow: var(--shadow);
}
.close-panel::before {
  content: '';
  position: absolute;
  inset: -60% -20% auto -20%;
  height: 460px;
  background: radial-gradient(42% 50% at 50% 50%, color-mix(in srgb, var(--reads) 12%, transparent), transparent 72%);
  pointer-events: none;
}
.close-panel > * { position: relative; }
.close-panel .panel-h { margin-top: 18px; }
.close-panel .lede { margin: 18px auto 0; text-align: center; }
.close-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.close-note { margin: 20px 0 0; font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); background: var(--surface-2); padding: clamp(48px, 6vw, 72px) 0 34px; }
.foot-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: clamp(28px, 4vw, 56px);
}
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-brand p { margin: 16px 0 20px; font-size: 13.5px; color: var(--muted); max-width: 30ch; }
.foot-parent { display: flex; align-items: center; gap: 10px; }
.foot-parent .tag { white-space: nowrap; }
.foot-parent img { height: 20px; width: auto; }
.logo-for-light { display: block; }
.logo-for-dark  { display: none; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark  { display: block; }

/* Footer column labels. These are site chrome, not document structure, so they
   are <p class="foot-h"> rather than <h2> — an <h2> here put three boilerplate
   headings into every page's outline. .foot h2 is kept as an alias in case a
   page still carries the old markup. */
.foot .foot-h,
.foot h2 { margin: 0 0 14px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink); }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.foot li a { font-size: 13.5px; color: var(--muted); text-decoration: none; transition: color 0.16s; }
.foot li a:hover { color: var(--ink); }
.foot .sub-h { margin: 18px 0 9px; }
.foot-legal {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: clamp(36px, 5vw, 56px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.55;
}
.foot-legal span:last-child { max-width: 64ch; }

/* ── Scroll reveal ────────────────────────────────────────────────────────── */
.rv { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.rv.in { opacity: 1; transform: none; }
.rv.s1 { transition-delay: 0.07s; }
.rv.s2 { transition-delay: 0.14s; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .rv { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PART 2 — the document pages (setup, user guide, doc merger, release notes,
   book a demo, legal). These pages carry their own small page-specific <style>
   blocks written against the previous "ledger" token names. Aliasing those
   names into this palette re-skins every one of them without touching their
   content markup.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* surfaces + rules */
  --paper:     var(--bg);
  --paper-2:   var(--surface);
  --rule:      var(--line);
  --rule-2:    var(--line-2);
  --rule-ink:  var(--line-2);
  /* the old palette's semantic colours, mapped onto the permission taxonomy */
  --paid:      var(--reads);
  --paid-bg:   var(--reads-bg);
  --paid-fill: var(--reads);
  --info:      var(--reads);
  --info-bg:   var(--reads-bg);
  --amber:     var(--writes);
  --amber-bg:  var(--writes-bg);
  --overdue:   var(--guarded);
  /* type + shape */
  --serif:     var(--display);
  --sans:      var(--body);
  --radius:    var(--r);
  --radius-lg: var(--r-lg);
  /* legacy brand aliases still referenced by a few blocks */
  --navy:      var(--ink);
  --green:     var(--reads);
  --accent:    var(--reads);
}

/* Old decorative layers are retired in this system. */
.ambient, .orb { display: none !important; }

/* ── Shared type helpers used by the document pages ───────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 18px;
}
.eyebrow::before { content: ''; width: 26px; height: 1px; background: var(--line-2); flex-shrink: 0; }

.mono-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.mono { font-family: var(--mono); }
/* The old identity set these italic-serif; here the display face carries it. */
.grad-text, .ital { font-family: var(--display); font-variation-settings: 'wdth' 108; font-weight: 500; color: var(--muted); }
.lead { color: var(--muted); font-size: 16px; max-width: 680px; margin-bottom: 18px; }
.intro { color: var(--muted); font-size: clamp(16px, 1.5vw, 17.5px); max-width: 660px; }
.intro strong { color: var(--ink); font-weight: 600; }

/* ── Legacy buttons map onto the new pair ─────────────────────────────────── */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--body); font-size: 14.5px; font-weight: 500;
  text-decoration: none; padding: 13px 20px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary svg { stroke: currentColor; fill: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ── Status + pill chips: same three-colour code as the tool taxonomy ─────── */
.status, .pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 3px; white-space: nowrap;
}
.status.live       { color: var(--reads);   background: var(--reads-bg); }
.status.early      { color: var(--reads);   background: var(--reads-bg); }
.status.soon       { color: var(--muted);   background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pill.g, .pill.ok  { color: var(--reads);   background: var(--reads-bg); }
.pill.t, .pill.info{ color: var(--reads);   background: var(--reads-bg); }
.pill.warn         { color: var(--writes);  background: var(--writes-bg); }
.pill.n            { color: var(--muted);   background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pillrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

/* ── Document head ────────────────────────────────────────────────────────── */
/* The nav is sticky rather than fixed-overlay in this system, so pages no
   longer need to reserve ~130px of dead space at the top. */
.doc-head { padding: clamp(40px, 5vw, 68px) 0 18px; }
.doc-head .crumb { margin-bottom: 16px; }
.doc-head .crumb a {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  color: var(--muted); text-decoration: none; letter-spacing: 0.02em;
}
.doc-head .crumb a:hover { color: var(--reads); }
.doc-head h1 {
  font-family: var(--display); font-variation-settings: 'wdth' 115;
  font-size: clamp(33px, 4.3vw, 54px); font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.03; margin: 14px 0 18px;
  text-wrap: balance;
}
.doc-head h1 .grad-text { display: block; font-size: 0.82em; }

/* ── Section body ─────────────────────────────────────────────────────────── */
.sec { padding: clamp(38px, 4.5vw, 56px) 0 6px; }
.sec h2 {
  font-family: var(--display); font-variation-settings: 'wdth' 112;
  font-size: clamp(24px, 2.9vw, 33px); font-weight: 600;
  letter-spacing: -0.022em; line-height: 1.08;
  margin: 0 0 14px; scroll-margin-top: 92px; text-wrap: balance;
}
.sec h3 {
  font-family: var(--display); font-variation-settings: 'wdth' 108;
  font-size: 18.5px; font-weight: 600; letter-spacing: -0.015em;
  margin: 30px 0 10px; scroll-margin-top: 92px;
}
.sec h4 { font-family: var(--body); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 22px 0 8px; }
.sec p { color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 74ch; margin: 0 0 14px; }
.sec p strong, .sec .lead strong, .sec li strong { color: var(--ink); font-weight: 600; }
/* Prose links only. Buttons and card-links carry their own colour, and the
   descendant selector would otherwise outrank their single-class rules. */
.sec a:not([class]), .sec a.plain-link { color: var(--reads); text-decoration: none; font-weight: 500; }
.sec a:not([class]):hover, .sec a.plain-link:hover { text-decoration: underline; }
.sec ul, .sec ol { color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 74ch; padding-left: 20px; }
.sec li { margin-bottom: 8px; }

/* Tick lists — the blue check is the "reads" blue, consistent with the code. */
.ticks { list-style: none; display: grid; gap: 12px; margin: 22px 0 10px; padding: 0; max-width: 78ch; }
.ticks li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.6; color: var(--muted); margin: 0; }
.ticks svg { width: 16px; height: 16px; stroke: var(--reads); fill: none; flex-shrink: 0; margin-top: 4px; }
.ticks strong { color: var(--ink); font-weight: 600; }

/* Numbered procedure lists — a real sequence, so the numbering is earned. */
.steps { list-style: none; counter-reset: step; display: grid; gap: 12px; margin: 22px 0 10px; padding: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 18px 22px 18px 62px; margin: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); font-size: 15px; color: var(--muted); line-height: 1.6;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 20px; top: 18px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--reads);
}
.steps li strong { color: var(--ink); font-weight: 600; }

/* Step cards (three-across "simple setup" pattern) */
.step { padding: 22px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.step .num {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--reads); margin-bottom: 14px; display: block;
}
.step h4 { font-family: var(--display); font-variation-settings: 'wdth' 108; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; }
.step p { font-size: 14px; color: var(--muted); margin: 0; }

/* Callouts */
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 20px 0; padding: 16px 18px;
  background: var(--reads-bg); border: 1px solid color-mix(in srgb, var(--reads) 22%, transparent);
  border-radius: var(--r);
}
.callout svg { width: 18px; height: 18px; stroke: var(--reads); fill: none; flex-shrink: 0; margin-top: 3px; }
.callout p { margin: 0; font-size: 14.5px; color: var(--muted); max-width: none; }
.callout p strong { color: var(--ink); }
.callout-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(24px, 3vw, 36px); margin: 26px 0;
}
.callout-box h3 { font-family: var(--display); font-variation-settings: 'wdth' 112; font-size: clamp(21px, 2.4vw, 28px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.14; margin: 10px 0 12px; }
.callout-box p { color: var(--muted); font-size: 15px; margin-bottom: 20px; }

/* Console blocks stay dark in both themes — a terminal reading as a terminal
   is signposting, not decoration. */
pre {
  background: #0A0F1F; border: 1px solid #1E2645;
  border-radius: var(--r); padding: 16px 18px;
  overflow-x: auto; margin: 18px 0; max-width: 100%;
}
pre code { font-family: var(--mono); font-size: 12.5px; color: #C3D0F0; line-height: 1.65; white-space: pre; }
code { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; color: var(--ink);
}

/* Closing CTA panel (legacy .cta-box markup) */
.cta-box {
  position: relative; overflow: hidden; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(36px, 5vw, 64px) clamp(22px, 4vw, 56px);
  box-shadow: var(--shadow);
}
.cta-box::before {
  content: ''; position: absolute; inset: -60% -20% auto -20%; height: 440px;
  background: radial-gradient(42% 50% at 50% 50%, color-mix(in srgb, var(--reads) 11%, transparent), transparent 72%);
  pointer-events: none;
}
.cta-box > * { position: relative; }
.cta-box h2 {
  font-family: var(--display); font-variation-settings: 'wdth' 115;
  font-size: clamp(25px, 3.4vw, 40px); font-weight: 600; letter-spacing: -0.025em;
  line-height: 1.05; margin: 16px 0 14px;
}
.cta-box p, .cta-box .lede { color: var(--muted); font-size: 16px; max-width: 60ch; margin: 0 auto 26px; text-align: center; }
.cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cta-note { margin-top: 20px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.cta-note a { color: var(--reads); font-weight: 500; text-decoration: none; }
@media (max-width: 520px) {
  .cta-actions { display: grid; grid-template-columns: 1fr; }
  .cta-actions .btn-primary, .cta-actions .btn-ghost { justify-content: center; }
}

/* "More like this" link grids */
.more { padding: clamp(46px, 6vw, 72px) 0 8px; }
.more h2 { font-family: var(--display); font-variation-settings: 'wdth' 112; font-size: clamp(21px, 2.5vw, 27px); font-weight: 600; letter-spacing: -0.02em; margin-bottom: 20px; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px; }
.more-grid a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 18px; text-decoration: none; color: var(--ink); font-size: 14.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.more-grid a:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }

/* Tables inside documents */
.sec table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.sec th, .sec td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sec th { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.sec td { color: var(--muted); }
.sec tbody tr:last-child td { border-bottom: none; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(22px, 3vw, 32px); box-shadow: var(--shadow);
}
.form-card label, .wl-form label {
  display: block; margin-bottom: 16px;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.form-card input, .form-card select, .form-card textarea,
.wl-form input, .wl-form select, .wl-form textarea {
  display: block; width: 100%; margin-top: 7px;
  font-family: var(--body); font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 11px 13px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-card textarea, .wl-form textarea { min-height: 108px; resize: vertical; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus,
.wl-form input:focus, .wl-form textarea:focus {
  outline: none; border-color: var(--reads);
  box-shadow: 0 0 0 3px var(--reads-bg);
}
.form-card ::placeholder, .wl-form ::placeholder { color: var(--faint); }
.form-card .btn-primary, .wl-form .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }
.form-note, .fc-sub { font-size: 13px; color: var(--faint); }
.form-note { margin-top: 14px; }

/* ── Legacy nav/footer class shims ────────────────────────────────────────── */
/* Every page now ships the new nav and footer markup; these keep any stray
   legacy class from rendering unstyled. */
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-logo, .foot-logo { display: inline-flex; align-items: center; text-decoration: none; }
.nav-logo img, .foot-logo img { height: 26px; width: auto; }
a.plain { color: var(--muted); text-decoration: none; }
a.plain.current, a.plain:hover { color: var(--ink); }
.foot-set { margin-bottom: 14px; }
.foot-sub { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 16px 0 9px; }

/* Reveal-on-scroll (legacy class names used by the document pages) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.07s; }
.reveal.d2 { transition-delay: 0.14s; }
.reveal.d3 { transition-delay: 0.21s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ── Base headings ────────────────────────────────────────────────────────── */
/* Pages set their own heading sizes in page-specific blocks but relied on a
   global rule for the face and leading, so it has to live here. Component
   rules (.d1, .sec h2, .doc-head h1 …) are more specific and still win. */
h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: balance;
}
h1 { font-size: clamp(33px, 4.3vw, 52px); letter-spacing: -0.025em; line-height: 1.03; }
h2 { font-size: clamp(24px, 2.9vw, 33px); }
h3 { font-size: 18.5px; font-variation-settings: 'wdth' 108; letter-spacing: -0.015em; }
h4, h5 { font-family: var(--body); font-size: 16px; letter-spacing: -0.01em; line-height: 1.35; }
/* The old identity used italic serif for emphasis inside headings; here the
   second clause steps back in weight and colour instead. */
h1 em, h2 em, h3 em { font-style: normal; font-weight: 500; color: var(--muted); }

/* First heading inside a card or list row shouldn't inherit the section
   heading's top margin — it would drop below its own step number. */
.steps li > :first-child,
.step > :first-child,
.tool > :first-child,
.callout-box > :first-child,
.next-box > :first-child { margin-top: 0; }
.steps li h3, .steps li h4, .step h3, .step h4 { margin-top: 0; }
