/* CleftEngine: Swiss Editorial Scientific Monograph Stylesheet
   Sister to Cleft Labs (cleftlabs.com) and Weightome (weightome.com).
   Zero third-party fonts, zero external CDNs, zero cookies, 100% DSGVO-clean. */

:root {
  --paper: #f6f5f0;
  --sheet: #ffffff;
  --surface-alt: #efede6;
  --code-bg: #17181c;
  --code-fg: #ebe9e1;
  --code-muted: #989ba6;
  --ink: #141619;
  --ink-soft: #3a3f47;
  --muted: #606670;
  --rule: #dcd9d0;
  --rule-strong: #b8b3a6;
  --accent: #4c2a85;
  --accent-hover: #361d62;
  --accent-tint: #f1edf8;
  --steel: #1b4d7e;
  --steel-tint: #ebf1f7;
  --rust: #963b22;
  --rust-tint: #f9efec;
  --teal: #0f5257;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max-w: 1120px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-alt);
  padding: 1px 5px;
  color: var(--ink);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* Masthead */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: rgba(246, 245, 240, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  position: relative;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.wordmark:hover {
  text-decoration: none;
  color: var(--ink);
}

.wordmark-text {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wordmark-parent {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  border-left: 1px solid var(--rule-strong);
  padding-left: 11px;
}

.nav-toggle {
  display: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 1.5px solid transparent;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.site-nav .nav-mobile-only {
  display: none;
}

.site-nav .nav-parent-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  margin-left: 4px;
}

.site-nav .nav-parent-link:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  text-decoration: none;
}

.site-nav .nav-dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  border-bottom: 1.5px solid transparent;
  padding: 4px 0;
}

.site-nav .nav-dashboard-link:hover {
  color: var(--accent);
  border-bottom-color: var(--teal);
  text-decoration: none;
}

.nav-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 82, 87, 0.18);
  flex-shrink: 0;
}

/* Editorial Hero */
.hero {
  padding: 68px 0 56px;
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 44px;
  align-items: center;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 4.1vw, 3.2rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
  color: var(--ink);
}

.hero-lead {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--ink);
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn-secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

/* Live Dashboard & Video Showcase */
.showcase-stage {
  background: #12141a;
  border: 1px solid var(--rule-strong);
  color: #ebe9e1;
  overflow: hidden;
}

.showcase-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid #262a36;
  background: #17181c;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fa5b4;
}

.showcase-head-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #5eead4;
  border: 1px solid rgba(45, 212, 191, 0.32);
  background: rgba(15, 82, 87, 0.25);
  padding: 3px 9px;
  font-size: 10.5px;
}

.showcase-head-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 8px #2dd4bf;
}

.showcase-video-wrap {
  position: relative;
  background: #0c0e13;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
}

.showcase-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0c0e13;
}

.showcase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-top: 1px solid #262a36;
  background: #161820;
}

.showcase-bar-copy {
  max-width: 62ch;
}

.showcase-bar-copy h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.25;
  color: #f6f5f0;
  margin: 0 0 6px;
}

.showcase-bar-copy p {
  font-size: 13.5px;
  color: #b0b6c4;
  margin: 0;
  line-height: 1.55;
}

.showcase-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn-dark-outline {
  background: transparent;
  color: #ebe9e1;
  border-color: #3d4354;
}

.btn-dark-outline:hover {
  border-color: #a98be8;
  color: #ffffff;
  text-decoration: none;
}

/* Visual Gallery Plates */
.visual-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.gallery-plate {
  background: var(--sheet);
  border: 1px solid var(--rule);
  margin: 0;
  display: flex;
  flex-direction: column;
}

.gallery-plate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.gallery-plate-media {
  display: block;
  background: #0d0f15;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.gallery-plate-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #0c0e13;
  transition: transform 240ms ease;
}

a.gallery-plate-media:hover img {
  transform: scale(1.018);
}

.gallery-plate-cap {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.gallery-plate-cap strong {
  color: var(--ink);
}

/* Full-width Pipeline & Benchmark Figures */
.pipeline-frame {
  margin-top: 28px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 20px;
}

.pipeline-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.bench-figures-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.bench-figure-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 18px;
  margin: 0;
}

.bench-figure-card img {
  display: block;
  width: 100%;
  height: auto;
}

/* Technical Schematic Figure */
.schematic-frame {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 20px;
  margin: 0;
}

.schematic-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

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

.schematic-caption {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* Metrics Ledger */
.ledger {
  border-bottom: 1px solid var(--rule);
  background: var(--sheet);
}

.ledger-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ledger-cell {
  padding: 26px 24px 26px 0;
  border-right: 1px solid var(--rule);
}

.ledger-cell:not(:first-child) {
  padding-left: 24px;
}

.ledger-cell:last-child {
  border-right: none;
  padding-right: 0;
}

.ledger-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ledger-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
  color: var(--ink);
}

.ledger-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* Editorial Sections */
.section {
  padding: 68px 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 76px;
}

.section-alt {
  background: var(--sheet);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 0.35fr) minmax(0, 0.65fr);
  gap: 36px;
  margin-bottom: 40px;
  align-items: baseline;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
}

/* Numbered Mechanism Tracks */
.tracks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tracks-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.track {
  padding: 30px 28px 32px 0;
  border-right: 1px solid var(--rule);
}

.track:not(:first-child) {
  padding-left: 28px;
}

.track:last-child {
  border-right: none;
  padding-right: 0;
}

.track-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 12px;
}

.track h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 12px;
}

.track p {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.6;
}

.track-spec {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  line-height: 1.6;
}

/* Equation & Memory Strip */
.equation-strip {
  margin-top: 28px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 22px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
}

.eq-block-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.eq-formula {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  border-left: 2px solid var(--accent);
  padding: 10px 14px;
  margin: 0 0 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.eq-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

/* Benchmark & Release Panels */
.release-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 40px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 36px;
}

.release-panel + .release-panel {
  margin-top: 28px;
}

.release-panel h3 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  margin: 8px 0 14px;
}

.release-panel p {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin: 0 0 14px;
  line-height: 1.6;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-top: 8px;
}

.spec-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1.5px solid var(--rule-strong);
  padding: 8px 8px 10px 0;
  text-align: left;
  width: auto;
}

.spec-table thead th.num,
.spec-table td.num {
  text-align: right;
  padding-right: 0;
  padding-left: 10px;
}

.spec-table tbody tr {
  border-bottom: 1px solid var(--rule);
}

.spec-table tbody tr.row-highlight {
  background: var(--accent-tint);
}

.spec-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
  padding: 10px 12px 10px 6px;
}

.spec-table td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 10px 8px 10px 0;
}

.spec-table .muted-cell {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
}

.bench-footnote {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 14px;
  line-height: 1.55;
}

/* Interactive Backend Selector */
.estimator-box {
  margin-top: 20px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 18px 20px;
}

.estimator-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.estimator-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.estimator-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.control-group label strong {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 600;
}

.control-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.estimator-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}

.estimator-metric {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.backend-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.backend-badge.is-dense {
  border-color: var(--rust);
  background: var(--rust-tint);
  color: var(--rust);
}

/* Validation & Limits Lists */
.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.check-list li {
  padding: 10px 0 10px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.58;
  position: relative;
}

.check-list li:last-child {
  border-bottom: none;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 7px;
  height: 7px;
  background: var(--accent);
}

.check-list.is-limits li::before {
  background: var(--muted);
}

.check-list strong {
  color: var(--ink);
  font-weight: 600;
}

/* Code Tabs & Terminal Blocks */
.code-tabs-wrap {
  border: 1px solid var(--rule-strong);
  background: var(--code-bg);
  color: var(--code-fg);
}

.code-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #2b2d35;
  padding: 0 14px 0 0;
  background: #111216;
  flex-wrap: wrap;
}

.code-tabs {
  display: flex;
  flex-wrap: wrap;
}

.code-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-right: 1px solid #2b2d35;
  border-bottom: 2px solid transparent;
  color: var(--code-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.code-tab:hover {
  color: #ffffff;
}

.code-tab[aria-selected="true"] {
  color: #ffffff;
  background: var(--code-bg);
  border-bottom-color: #a98be8;
}

.copy-btn {
  appearance: none;
  background: transparent;
  border: 1px solid #383b46;
  color: #cfd2dc;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: border-color 140ms ease, color 140ms ease;
}

.copy-btn:hover {
  border-color: #a98be8;
  color: #ffffff;
}

.code-panel {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.62;
  color: var(--code-fg);
}

.code-panel[hidden] {
  display: none;
}

.code-panel code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.tok-c { color: #8c91a0; }
.tok-k { color: #c7a6ff; }
.tok-s { color: #a7d7b8; }
.tok-n { color: #f0c08a; }
.tok-f { color: #8ec5f0; }

.usage-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.usage-note-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 18px 20px;
}

.usage-note-card h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 8px;
}

.usage-note-card p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
}

/* Two-Column Editorial Prose */
.prose-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.35fr) minmax(0, 0.65fr);
  gap: 36px;
}

.prose-block p {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 66ch;
  line-height: 1.65;
}

.prose-block p:last-child {
  margin-bottom: 0;
}

.license-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0 22px;
}

.license-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 20px 22px;
}

.license-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.license-card h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  margin: 0 0 8px;
  color: var(--ink);
}

.license-card p {
  font-size: 13.5px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.ref-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  border-top: 1px solid var(--rule);
}

.ref-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
}

.ref-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Legal Document Pages */
.legal-main {
  padding: 56px 0 80px;
}

.legal-sheet {
  max-width: 780px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 44px 48px;
}

.legal-sheet h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  margin: 8px 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.legal-sheet h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  margin: 30px 0 10px;
  color: var(--ink);
}

.legal-sheet p,
.legal-sheet li {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.68;
}

.legal-sheet ul {
  padding-left: 20px;
  margin: 8px 0 16px;
}

.address-block {
  font-style: normal;
  background: var(--paper);
  border-left: 2px solid var(--accent);
  padding: 14px 18px;
  margin: 14px 0 20px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
}

/* Footer */
.site-footer {
  padding: 36px 0 48px;
  background: var(--paper);
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--ink-soft);
}

.footer-meta {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 920px) {
  .hero-grid,
  .section-head,
  .tracks,
  .tracks-2,
  .equation-strip,
  .release-panel,
  .prose-grid,
  .ledger-grid,
  .usage-notes,
  .license-grid,
  .estimator-controls,
  .visual-gallery,
  .bench-figures-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-grid > *,
  .release-panel > *,
  .prose-grid > *,
  .track,
  .ledger-cell {
    min-width: 0;
  }

  .hero-grid {
    gap: 28px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 24px;
  }

  .prose-grid {
    gap: 16px;
  }

  .ledger-cell,
  .track {
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 20px 0 !important;
  }

  .ledger-cell:last-child,
  .track:last-child {
    border-bottom: none;
  }

  .release-panel {
    padding: 24px 20px;
    gap: 24px;
  }

  .legal-sheet {
    padding: 26px 18px;
  }

  .wordmark-parent {
    display: none;
  }
}

@media (max-width: 860px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    height: 58px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 7px 11px;
    min-height: 36px;
    cursor: pointer;
  }

  .nav-toggle-bars {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    width: 14px;
  }

  .nav-toggle-bars span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: currentColor;
    transition: transform 160ms ease;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars span:first-child {
    transform: translateY(2.75px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars span:last-child {
    transform: translateY(-2.75px) rotate(-45deg);
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: -16px;
    right: -16px;
    background: var(--sheet);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule-strong);
    box-shadow: 0 14px 28px rgba(20, 22, 25, 0.08);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 16px 16px;
    z-index: 50;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 13px 4px;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
    color: var(--ink);
  }

  .site-nav a:hover,
  .site-nav a.active {
    border-bottom-color: var(--rule);
    color: var(--accent);
  }

  .site-nav .nav-mobile-only {
    display: block;
    font-size: 13.5px;
    color: var(--muted);
  }

  .site-nav .nav-parent-link {
    margin: 12px 0 0;
    padding: 11px 14px;
    text-align: center;
    font-size: 12.5px;
    border: 1px solid var(--accent);
  }

  .site-nav .nav-dashboard-link {
    padding: 13px 4px;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
  }

  .showcase-bar {
    padding: 16px;
    gap: 14px;
  }

  .showcase-bar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-frame,
  .bench-figure-card {
    padding: 14px;
  }

  .hero {
    padding: 36px 0 34px;
  }

  .hero h1 {
    font-size: 1.9rem;
    margin-bottom: 14px;
  }

  .hero-lead {
    font-size: 15.5px;
    margin-bottom: 22px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
    min-height: 44px;
  }

  .schematic-frame {
    padding: 14px;
  }

  .schematic-header {
    flex-direction: column;
    gap: 2px;
  }

  .section {
    padding: 40px 0;
  }

  .ledger-val {
    font-size: 22px;
  }

  .spec-table {
    font-size: 12.5px;
  }

  .spec-table th,
  .spec-table td {
    padding: 8px 6px 8px 0;
  }

  .code-panel {
    padding: 16px;
    font-size: 12px;
  }

  .ref-list li {
    grid-template-columns: 44px 1fr;
    gap: 10px;
    font-size: 13px;
  }

  .legal-main {
    padding: 28px 0 48px;
  }

  .legal-sheet h1 {
    font-size: 26px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 14px;
  }
}
