/* ============================================================================
 * leanrust.com design system — Hottub pool aqua, deep thermal teal, warm sun
 * orb, typeset in Hottub Thermae v0.320 (loaded via /thermae.css).
 * ============================================================================ */

:root {
  --water: #eef6f7;
  --water-soft: #e3f0f2;
  --surface: #ffffff;
  --surface-elev: #ffffff;
  --ink: #0b343e;
  --ink-soft: #3f6068;
  --ink-muted: #5c7b82;
  --line: #cce0e3;
  --line-strong: #b0cfd4;
  --tile: #a7dce5;
  --deep: #07262d;
  --deep-panel: #041b21;
  --deep-border: #14414b;
  --deep-ink: #e2f2f4;
  --deep-soft: #8eb4bc;
  --sun-a: #f26846;
  --sun-b: #ffb84d;
  --sun-ink: #341106;
  --ok: #1f9d55;
  --ok-bright: #4ade80;
  --ok-bg: #e7f7ee;
  --err: #d9483b;
  --err-bright: #fb7185;
  --err-bg: #fdeceb;
  --focus: #f26846;

  /* Hottub Thermae 0.320 house type stack (letter-spacing strictly normal) */
  --sans: "Hottub Thermae", "Hottub Thermae Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --lede: "Hottub Thermae", "Hottub Thermae Lede Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --titles: "Hottub Thermae Titles", "Hottub Thermae", "Hottub Thermae Titles Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --headline: "Hottub Thermae Headline", "Hottub Thermae", "Hottub Thermae Headline Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wordmark: "Hottub Thermae Wordmark", "Hottub Thermae", "Hottub Thermae Titles Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Hottub Thermae Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px -2px rgba(7, 38, 45, 0.06), 0 1px 2px rgba(7, 38, 45, 0.04);
  --shadow-md: 0 14px 36px -18px rgba(7, 38, 45, 0.16), 0 2px 6px rgba(7, 38, 45, 0.05);
  --shadow-console: 0 28px 64px -26px rgba(4, 27, 33, 0.55), 0 0 0 1px rgba(167, 220, 229, 0.14);
  --gutter: clamp(18px, 3.6vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --water: #062127;
    --water-soft: #092b32;
    --surface: #0b3038;
    --surface-elev: #0f3942;
    --ink: #e8f5f7;
    --ink-soft: #a4c6cc;
    --ink-muted: #7ea3aa;
    --line: #184953;
    --line-strong: #235c68;
    --tile: #2c6d7a;
    --deep: #03151a;
    --deep-panel: #020f13;
    --deep-border: #123942;
    --deep-ink: #e2f2f4;
    --deep-soft: #86adb5;
    --ok-bg: #0e3824;
    --err-bg: #3b1718;
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 14px 36px -18px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: 95%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--water);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.03rem;
  line-height: 1.64;
  letter-spacing: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent);
  transition: color 0.14s ease, text-decoration-color 0.14s ease;
}
a:hover { text-decoration-color: var(--sun-a); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-doc { max-width: 960px; margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 15px 0;
  background: color-mix(in srgb, var(--water) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--wordmark);
  font-weight: 650;
  font-size: 1.32rem;
  letter-spacing: normal;
  text-decoration: none;
  color: var(--ink);
}
.orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 34% 28%, var(--sun-b), var(--sun-a) 72%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sun-a) 18%, transparent);
  display: inline-grid;
  place-items: center;
  color: #fff9f0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 13px;
  border-radius: 999px;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.site-nav a:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--tile) 30%, transparent);
}
.site-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.site-nav a.nav-cta {
  color: var(--sun-ink);
  background: linear-gradient(135deg, var(--sun-a), var(--sun-b));
  box-shadow: 0 4px 12px -4px rgba(242, 104, 70, 0.45);
}
.site-nav a.nav-cta:hover {
  filter: brightness(1.04) saturate(1.08);
  color: var(--sun-ink);
}

/* Hero */
.hero {
  padding: clamp(32px, 5vw, 60px) 0 clamp(44px, 6vw, 76px);
  background:
    radial-gradient(1100px 500px at 10% 0%, color-mix(in srgb, var(--tile) 30%, transparent), transparent 65%),
    radial-gradient(700px 420px at 90% 10%, color-mix(in srgb, var(--sun-b) 10%, transparent), transparent 65%);
}
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(28px, 4.5vw, 52px);
  align-items: start;
}
.hero-copy { padding-top: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--sun-b), var(--sun-a) 72%);
  flex: none;
}

.hero h1 {
  margin: 0 0 18px;
  font-family: var(--headline);
  font-size: clamp(2.45rem, 4.2vw, 3.6rem);
  line-height: 1.08;
  font-weight: 550;
  letter-spacing: normal;
  text-wrap: balance;
  max-width: 15ch;
}
.hero .lede {
  font-family: var(--lede);
  margin: 0 0 26px;
  max-width: 49ch;
  font-size: 1.1rem;
  line-height: 1.58;
  color: var(--ink-soft);
}
.hero .lede strong { color: var(--ink); font-weight: 600; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.14s ease, border-color 0.14s ease, filter 0.14s ease;
}
.button:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.button.primary {
  border-color: transparent;
  color: var(--sun-ink);
  background: linear-gradient(135deg, var(--sun-a), var(--sun-b));
  box-shadow: 0 10px 24px -12px rgba(242, 104, 70, 0.7);
}
.button.primary:hover {
  filter: saturate(1.08) brightness(1.03);
  border-color: transparent;
}
.button.small {
  padding: 7px 14px;
  font-size: 0.84rem;
}

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
}
.kpi-val {
  display: block;
  font-family: var(--titles);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi-lbl {
  display: block;
  margin-top: 3px;
  font-size: 0.84rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

/* Live WASM Prover Console */
.console {
  background: var(--deep);
  color: var(--deep-ink);
  border-radius: var(--radius-lg);
  border: 1px solid var(--deep-border);
  overflow: hidden;
  box-shadow: var(--shadow-console);
}
.console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  background: color-mix(in srgb, #ffffff 4%, var(--deep));
  border-bottom: 1px solid var(--deep-border);
  flex-wrap: wrap;
}
.console-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok-bright);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.16);
  flex: none;
}
.console-topbar h2 {
  margin: 0;
  font-family: var(--titles);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--deep-ink);
  letter-spacing: normal;
}
.console-status {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--deep-soft);
  font-variant-numeric: tabular-nums slashed-zero;
}
.console-body {
  padding: 18px 20px 20px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.console .preset-btn {
  padding: 6px 11px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid color-mix(in srgb, var(--tile) 35%, transparent);
  background: rgba(255, 255, 255, 0.05);
  color: var(--deep-ink);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.console .preset-btn:hover {
  border-color: var(--sun-b);
  color: var(--sun-b);
  background: rgba(255, 184, 77, 0.08);
}
.console .preset-btn.attack {
  border-color: rgba(251, 113, 133, 0.42);
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.09);
}
.console .preset-btn.attack:hover {
  border-color: var(--sun-a);
  color: #ffffff;
}
.console .preset-btn.active {
  background: linear-gradient(135deg, var(--sun-a), var(--sun-b));
  color: var(--sun-ink);
  border-color: transparent;
}

.console-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tab-group {
  display: inline-flex;
  background: var(--deep-panel);
  border: 1px solid var(--deep-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.tab-btn {
  border: 0;
  background: transparent;
  color: var(--deep-soft);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.tab-btn:hover { color: var(--deep-ink); }
.tab-btn.active {
  background: color-mix(in srgb, var(--tile) 22%, var(--deep));
  color: #ffffff;
}

.console-summary {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--deep-soft);
}
.console pre {
  margin: 0 0 11px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--deep-panel);
  border: 1px solid color-mix(in srgb, var(--deep-border) 80%, transparent);
  font-size: 0.79rem;
  line-height: 1.5;
  overflow: auto;
  max-height: 310px;
}
.console-meta-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--deep-soft);
  padding-top: 4px;
}
.console-meta-bar a { color: var(--sun-b); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.status-ok { background: #14532d; color: #86efac; }
.status-err { background: #7c2d12; color: #fdba74; }
.status-info { background: #1e3a5f; color: #93c5fd; }

.proof-pills {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.console .proof-pills li {
  font-family: var(--mono);
  font-size: 0.77rem;
  line-height: 1.45;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: rgba(167, 220, 229, 0.08);
  border-left: 3px solid var(--ok-bright);
  color: var(--deep-ink);
  overflow-wrap: anywhere;
}
.console .proof-pills li.denied {
  border-left-color: var(--sun-a);
  background: rgba(242, 104, 70, 0.13);
}
.panel .proof-pills li {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--water);
  border: 1px solid var(--line);
  border-left: 3.5px solid var(--ok);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.panel .proof-pills li.denied {
  border-left-color: var(--err);
  background: var(--err-bg);
}

/* Sections */
.section {
  padding: clamp(48px, 6.5vw, 84px) 0;
  border-top: 1px solid var(--line);
}
.section.alt {
  background: color-mix(in srgb, var(--surface) 55%, var(--water));
}
.section-head {
  margin-bottom: 34px;
  max-width: 74ch;
}
.section-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sun-a);
  margin-bottom: 8px;
}
.section h2 {
  margin: 0 0 12px;
  font-family: var(--titles);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: normal;
  text-wrap: balance;
}
.section p.intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.07rem;
  line-height: 1.6;
}

/* Two Theorems + Product Lattice Grid */
.theorem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 0.95fr);
  gap: 18px;
  align-items: stretch;
}
.theorem-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.theorem-card.ni { border-top-color: var(--sun-a); }
.theorem-card h3 {
  margin: 0;
  font-family: var(--titles);
  font-size: 1.24rem;
  font-weight: 600;
}
.theorem-card p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.theorem-card pre {
  margin-top: auto;
  font-size: 0.78rem;
  padding: 12px 14px;
}

.lattice-card {
  background: var(--deep);
  color: var(--deep-ink);
  border: 1px solid var(--deep-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.lattice-card h3 {
  margin: 0;
  font-family: var(--titles);
  font-size: 1.05rem;
  color: var(--deep-ink);
}
.lattice-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--deep-soft);
}
.lattice-svg {
  width: 100%;
  height: auto;
  max-height: 220px;
  display: block;
}

/* Feature Rows */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  padding: 34px 0;
}
.feature + .feature { border-top: 1px solid var(--line); }
.feature h3 {
  margin: 0 0 12px;
  font-family: var(--titles);
  font-size: 1.36rem;
  line-height: 1.24;
  font-weight: 600;
}
.feature p { margin: 0 0 13px; max-width: 56ch; color: var(--ink-soft); }
.feature p strong { color: var(--ink); font-weight: 600; }
.feature p:last-child { margin-bottom: 0; }

.code-card {
  background: var(--deep);
  border: 1px solid var(--deep-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code-card-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  background: color-mix(in srgb, #ffffff 4%, var(--deep));
  border-bottom: 1px solid var(--deep-border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--deep-soft);
  gap: 10px;
}
.code-card pre {
  border-radius: 0;
  background: transparent;
  padding: 16px 18px;
}

pre, code {
  font-family: var(--mono);
  font-variant-numeric: slashed-zero;
}
code { font-size: 0.88em; }
pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--deep);
  color: var(--deep-ink);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.56;
}
:not(pre) > code {
  background: color-mix(in srgb, var(--tile) 34%, var(--surface));
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

/* Live HottubDB AWS Ledger Banner & Cards */
.ledger-band {
  background: var(--deep);
  color: var(--deep-ink);
  border: 1px solid var(--deep-border);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3.5vw, 34px);
  box-shadow: var(--shadow-console);
}
.ledger-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.ledger-head h3 {
  margin: 4px 0 6px;
  font-family: var(--titles);
  font-size: 1.4rem;
  color: #ffffff;
}
.ledger-head p { margin: 0; color: var(--deep-soft); max-width: 62ch; font-size: 0.96rem; }
.chain-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--deep-panel);
  border: 1px solid var(--deep-border);
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-bottom: 18px;
  align-items: center;
  justify-content: space-between;
}
.chain-hash {
  color: var(--ok-bright);
  overflow-wrap: anywhere;
}
.cert-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.cert-card {
  background: color-mix(in srgb, #ffffff 4%, var(--deep));
  border: 1px solid var(--deep-border);
  border-top: 3px solid var(--sun-b);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cert-card.active { border-color: var(--sun-b); }
.cert-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cert-card h4 {
  margin: 0;
  font-family: var(--titles);
  font-size: 1.04rem;
  color: #ffffff;
}
.cert-card p { margin: 0; font-size: 0.88rem; color: var(--deep-soft); line-height: 1.5; }
.cert-fp {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--tile);
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--deep-border);
}

/* Honest Boundaries Grid */
.boundary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.boundary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.boundary-card.tcb { border-top: 3px solid var(--ok); }
.boundary-card.outside { border-top: 3px solid var(--sun-a); }
.boundary-card h3 {
  margin: 0 0 12px;
  font-family: var(--titles);
  font-size: 1.2rem;
}
.clean-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
}
.clean-list strong { color: var(--ink); }

/* Tables */
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-wrap { overflow-x: auto; }
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
thead th {
  background: color-mix(in srgb, var(--water) 70%, var(--surface));
  font-family: var(--titles);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
}
tbody tr:hover td {
  background: color-mix(in srgb, var(--water) 45%, transparent);
}
.pill-sec {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.pill-secret { background: rgba(242, 104, 70, 0.14); color: var(--sun-a); border-color: rgba(242, 104, 70, 0.4); }
.pill-public { background: var(--water); color: var(--ink-soft); }
.pill-trusted { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-tainted { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }

/* Playground & Ledger Pages */
.play-section { padding: clamp(28px, 4vw, 44px) 0 72px; }
.play-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.play-header h1 {
  margin: 0 0 8px;
  font-family: var(--headline);
  font-size: clamp(1.95rem, 3.6vw, 2.75rem);
  line-height: 1.1;
  font-weight: 550;
}
.play-header p.intro {
  margin: 0;
  max-width: 66ch;
  color: var(--ink-soft);
}
.wasm-pill {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.play-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 22px;
}
.play-presets .preset-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.13s ease;
}
.play-presets .preset-btn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.play-presets .preset-btn.attack {
  border-color: color-mix(in srgb, var(--err) 45%, var(--line));
  background: var(--err-bg);
  color: color-mix(in srgb, var(--err) 85%, var(--ink));
}
.play-presets .preset-btn.active {
  background: linear-gradient(135deg, var(--sun-a), var(--sun-b));
  color: var(--sun-ink);
  border-color: transparent;
  box-shadow: 0 6px 16px -8px rgba(242, 104, 70, 0.7);
}

.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0;
  font-family: var(--titles);
  font-size: 1.08rem;
  font-weight: 600;
}
.meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}
textarea {
  width: 100%;
  min-height: 380px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--deep);
  color: var(--deep-ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.54;
  resize: vertical;
  tab-size: 4;
}
textarea:focus { outline: none; border-color: var(--sun-a); }
input[type="text"] {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--water);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84rem;
}
.play-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.commit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.commit-row input[type="text"] { flex: 1 1 160px; }

.travel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--water);
  border: 1px solid var(--line);
}
.travel-bar input[type="range"] { flex: 1; accent-color: var(--sun-a); }

.tamper-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--err-bg);
  border: 1px solid color-mix(in srgb, var(--err) 40%, var(--line));
  color: var(--ink);
}

/* Doc Pages */
.doc { padding: clamp(32px, 5vw, 56px) 0 76px; }
.doc-hero { margin-bottom: 36px; }
.doc-hero h1 {
  margin: 0 0 14px;
  font-family: var(--headline);
  font-size: clamp(2rem, 3.8vw, 3rem);
  line-height: 1.1;
  font-weight: 550;
}
.doc-hero p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  max-width: 68ch;
}
.doc-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.doc-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.doc-kpi span {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.doc-kpi strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.doc-section { margin-top: 40px; }
.doc-section h2 {
  margin: 0 0 12px;
  font-family: var(--titles);
  font-size: 1.48rem;
  font-weight: 600;
}
.doc-section p { color: var(--ink-soft); }
.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sun-a);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.callout h3 { margin: 0 0 8px; font-family: var(--titles); font-size: 1.1rem; }
.callout p { margin: 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 42px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.site-footer p {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 1020px) {
  .hero .wrap,
  .theorem-grid,
  .feature,
  .play-grid,
  .cert-cards,
  .boundary-grid {
    grid-template-columns: 1fr;
  }
  .doc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .kpi-strip, .doc-kpis { grid-template-columns: 1fr; }
}
