/* ════════════════════════════════════════════════════════════════════════
   KuberEva — kubereva.ai
   Palette: instrumentation on blue-slate. Amber signals, teal resolves,
   clay faults. Clay is reserved for genuine failure states only.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --ink:      #0C1218;
  --raised:   #131B23;
  --raised-2: #18222C;
  --line:     #23303B;
  --line-2:   #2E3F4D;
  --bone:     #E6EAED;
  --mute:     #8798A5;
  --mute-2:   #6B7C89;
  --signal:   #E8A33D;
  --trace:    #4FB3A8;
  --fault:    #C4553F;

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

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --max:    1240px;
  --measure: 68ch;
  --r:      3px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-variation-settings: 'wdth' 110;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.06;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }

.mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 1.4rem;
}

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

.skip {
  position: absolute; left: -9999px; top: 0.5rem;
  background: var(--signal); color: var(--ink);
  padding: 0.6rem 1rem; font-weight: 600; z-index: 60;
}
.skip:focus { left: 0.5rem; }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  background: var(--signal);
  color: #0C1218;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.95rem 1.5rem;
  border: 1px solid var(--signal);
  border-radius: var(--r);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.btn:hover { background: #F0B457; border-color: #F0B457; transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--bone); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--raised-2); border-color: var(--mute); }

.btn-sm { padding: 0.6rem 1.05rem; font-size: 0.85rem; }

/* ── Top bar ──────────────────────────────────────────────────────────── */

.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.85rem var(--gutter);
  background: rgba(12, 18, 24, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none;
  font-family: var(--display);
  font-variation-settings: 'wdth' 118;
  font-weight: 700; font-size: 1.06rem;
  margin-right: auto;
}
.mark { width: 28px; height: 24px; color: var(--signal); flex: none; }

.bar-nav { display: flex; gap: 1.35rem; }
.bar-nav a {
  font-size: 0.9rem; color: var(--mute);
  text-decoration: none; white-space: nowrap;
  transition: color 0.16s ease;
}
.bar-nav a:hover { color: var(--bone); }
.bar-nav a[aria-current="page"] { color: var(--bone); }

.nav-toggle {
  display: none;
  background: transparent; border: 1px solid var(--line-2);
  border-radius: var(--r); color: var(--bone);
  padding: 0.5rem 0.75rem; cursor: pointer;
  font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.14em; text-transform: uppercase;
}

@media (max-width: 940px) {
  .nav-toggle { display: block; order: 3; }
  .bar .btn-sm { display: none; }
  .bar-nav {
    order: 4; flex-basis: 100%;
    flex-direction: column; gap: 0;
    display: none;
    border-top: 1px solid var(--line);
    margin-top: 0.85rem; padding-top: 0.35rem;
  }
  .bar-nav.open { display: flex; }
  .bar-nav a { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
  .bar { flex-wrap: wrap; }
}

/* ── Generic band ─────────────────────────────────────────────────────── */

.band { padding: clamp(3.25rem, 6.5vw, 5.5rem) var(--gutter); border-top: 1px solid var(--line); }
.band-alt { background: var(--raised); }
.band > * { max-width: var(--max); margin-inline: auto; }

.band-head { margin-bottom: clamp(2rem, 3.75vw, 3rem); }
.band-head h2 { font-size: clamp(1.75rem, 3.2vw, 2.6rem); margin-bottom: 0.85rem; }
.band-head p { color: var(--mute); max-width: 60ch; }

/* ── Page header (interior pages) ─────────────────────────────────────── */

.page-head {
  padding: clamp(2.75rem, 5.5vw, 4.5rem) var(--gutter) clamp(2.25rem, 4vw, 3.25rem);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 88% 0%, rgba(79, 179, 168, 0.07), transparent 60%),
    var(--ink);
}
.page-head-in { max-width: var(--max); margin-inline: auto; }
.page-head h1 { font-size: clamp(2.15rem, 4.4vw, 3.5rem); margin-bottom: 1.1rem; }
.page-head .lede { color: var(--mute); font-size: clamp(1rem, 1.4vw, 1.15rem); max-width: 62ch; }

.crumb { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em;
         text-transform: uppercase; color: var(--mute-2); margin-bottom: 1.1rem; }
.crumb a { color: var(--mute); text-decoration: none; }
.crumb a:hover { color: var(--signal); }
.crumb span { color: var(--line-2); margin: 0 0.5rem; }

/* ── Hero (home) ──────────────────────────────────────────────────────── */

.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(2.75rem, 6vw, 5rem) var(--gutter) clamp(3.5rem, 7vw, 5.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 4.5vw, 4rem);
  align-items: center;
}
.hero h1 { font-size: clamp(2.35rem, 4.4vw, 3.9rem); font-variation-settings: 'wdth' 106; margin-bottom: 1.6rem; }
.hero h1 em { font-style: normal; color: var(--signal); }
.lede { font-size: clamp(1.02rem, 1.5vw, 1.18rem); color: var(--mute); max-width: 48ch; margin-bottom: 2.1rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── Signature: path trace ────────────────────────────────────────────── */

.trace-fig { margin: 0; position: relative; }
.trace-fig::before {
  /* Vertical bleed only — horizontal bleed would push the document past the viewport. */
  content: ''; position: absolute; inset: -12% 0;
  background: radial-gradient(ellipse at 62% 50%, rgba(79, 179, 168, 0.10), transparent 65%);
  pointer-events: none;
}
.trace-frame { position: relative; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem; }
.trace-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  color: var(--mute); padding-bottom: 0.85rem; margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.trace-legend { display: flex; align-items: center; gap: 0.45rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--trace); }
.dot-fault { background: var(--fault); margin-left: 0.65rem; }

.trace { display: block; width: 100%; height: auto; }
.edge { stroke: var(--trace); stroke-width: 1.6; opacity: 0.55; stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); }
.edge-f { stroke: var(--fault); opacity: 0.75; }
.node { fill: var(--ink); stroke: var(--trace); stroke-width: 1.6; opacity: 0; }
.node-entry { fill: var(--signal); stroke: var(--signal); }
.term circle { fill: var(--ink); stroke: var(--trace); stroke-width: 1.6; }
.term path { fill: none; stroke: var(--trace); stroke-width: 1.8; stroke-linecap: round; }
.term { opacity: 0; }
.term-fault circle { stroke: var(--fault); }
.term-fault path { stroke: var(--fault); }
.probe { fill: var(--signal); opacity: 0; }

.trace.lit .edge { transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1); stroke-dashoffset: 0; }
.trace.lit .node, .trace.lit .term { transition: opacity 0.5s ease; opacity: 1; }
.trace.lit .term-fault { animation: fault-pulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes fault-pulse { 0%, 62%, 100% { opacity: 1; } 74% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .trace .edge { stroke-dashoffset: 0; }
  .trace .node, .trace .term { opacity: 1; }
  .trace.lit .edge, .trace.lit .node, .trace.lit .term { transition: none; }
  .trace.lit .term-fault { animation: none; }
  .probe { display: none; }
}

figcaption {
  color: var(--mute); font-size: 0.86rem; line-height: 1.55;
  padding: 0.9rem 0.3rem 0.2rem; border-top: 1px solid var(--line); margin-top: 0.5rem;
}

@media (max-width: 880px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .trace-fig { order: 2; }
}

/* ── Card grids ───────────────────────────────────────────────────────── */

/* Explicit column counts, never auto-fit. Every .cards grid holds exactly four
   items, and auto-fit produced 3 columns between ~1020–1270px — leaving a
   fourth card alone beside an empty lit panel that read as a broken layout. */
.cards {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
@media (max-width: 1080px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--ink); padding: clamp(1.5rem, 2.4vw, 2.1rem); transition: background 0.2s ease; }
.band-alt .card { background: var(--raised); }
.card:hover { background: var(--raised-2); }
/* ── Category glyphs ──────────────────────────────────────────────────── */

.ico {
  width: 42px; height: 42px; display: block; margin-bottom: 1.15rem;
  color: var(--signal); overflow: visible;
}
.ico .a { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico .b { stroke: var(--trace); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico .dot { fill: currentColor; }
.ico .dot-t { fill: var(--trace); }

.card, .lcard { transition: background .2s ease, border-color .18s ease, transform .18s ease; }
.card .ico, .lcard .ico { transition: color .25s ease, transform .35s cubic-bezier(.2,.7,.3,1); }
.card:hover .ico, .lcard:hover .ico { color: #F5C070; transform: translateY(-2px) scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .card:hover .ico, .lcard:hover .ico { transform: none; }
}

.tag { color: var(--signal); margin-bottom: 1.1rem; }
.card h3 { font-size: 1.18rem; margin-bottom: 0.75rem; }
.card p { color: var(--mute); font-size: 0.95rem; }

/* Linked cards (docs index, use cases) */
.link-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 1.1rem; }
.lcard {
  display: block; text-decoration: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.5rem 1.6rem;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.band-alt .lcard { background: var(--ink); }
.lcard:hover { border-color: var(--line-2); background: var(--raised-2); transform: translateY(-2px); }
.lcard h3 { font-size: 1.1rem; margin-bottom: 0.55rem; }
.lcard p { color: var(--mute); font-size: 0.93rem; margin: 0; }
.lcard .tag { margin-bottom: 0.85rem; font-size: 0.68rem; }
.lcard-more { display: inline-block; margin-top: 1rem; color: var(--signal); font-size: 0.88rem; font-weight: 600; }

/* ── Steps ────────────────────────────────────────────────────────────── */

.steps { list-style: none; margin: 0; padding: 0;
         display: grid; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); }
.step { position: relative; padding-top: 2.4rem; border-top: 1px solid var(--line); }
.step::before { content: ''; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.step-n { position: absolute; top: 1.1rem; left: 0; color: var(--mute); font-size: 0.7rem; }
.step h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.step p { color: var(--mute); font-size: 0.95rem; }

/* ── Facts / definition rows ──────────────────────────────────────────── */

.facts { margin: 0; border-top: 1px solid var(--line); }
.facts > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1.25rem;
  padding: 0.95rem 0; border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--mute); flex: none; }
.facts dd { margin: 0; font-family: var(--display); font-variation-settings: 'wdth' 108;
            font-weight: 600; font-size: 1.02rem; text-align: right; }

.link-out {
  display: inline-block; margin-top: 1.4rem; color: var(--signal);
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-bottom: 1px solid rgba(232, 163, 61, 0.35); padding-bottom: 2px;
}
.link-out:hover { border-bottom-color: var(--signal); }

/* ── Two-column split ─────────────────────────────────────────────────── */

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2.25rem, 5vw, 4.5rem); align-items: start; }
.split h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); margin-bottom: 1.3rem; }
.split-copy p { color: var(--mute); max-width: 58ch; }
@media (max-width: 820px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ── Prose (articles) ─────────────────────────────────────────────────── */

/* The column is full width; only the *text* is held to a reading measure, so
   figures and tables can use the whole column instead of being crushed into 68ch. */
.prose { max-width: none; min-width: 0; font-size: 1.06rem; }
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3,
.prose > blockquote, .prose > .callout, .prose > .sources, .prose > .doc-foot {
  max-width: var(--measure);
}
.prose > .fig, .prose > .tbl-wrap { max-width: none; }
.prose > * + * { margin-top: 1.15rem; }
.prose h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.prose h3 { font-size: 1.16rem; margin-top: 2rem; }
.prose p { color: #C9D2D8; margin-bottom: 0; }
.prose strong { color: var(--bone); font-weight: 600; }
.prose a { color: var(--signal); text-decoration: none; border-bottom: 1px solid rgba(232,163,61,0.3); }
.prose a:hover { border-bottom-color: var(--signal); }
.prose ul, .prose ol { color: #C9D2D8; padding-left: 1.3rem; margin-bottom: 0; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--signal); }
.prose code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--raised-2); border: 1px solid var(--line);
  border-radius: 2px; padding: 0.1em 0.35em; color: var(--trace);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.prose blockquote {
  margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.35rem;
  border-left: 2px solid var(--signal); color: var(--mute); font-style: normal;
}

/* Callouts */
.callout {
  background: var(--raised); border: 1px solid var(--line);
  border-left: 3px solid var(--signal); border-radius: var(--r);
  padding: 1.15rem 1.35rem; margin: 1.75rem 0; font-size: 0.98rem; color: #C9D2D8;
}
.callout .mono { display: block; color: var(--signal); margin-bottom: 0.55rem; }
.callout-warn { border-left-color: var(--fault); }
.callout-warn .mono { color: var(--fault); }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 1.75rem 0; border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  background: var(--raised-2); color: var(--mute);
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody td { color: #C9D2D8; }
tbody td:first-child { color: var(--bone); font-weight: 500; }
td .mono { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: none; color: var(--trace); }

/* Sources block */
.sources { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.sources h2 { font-size: 1.05rem; border: 0; padding: 0; margin: 0 0 1rem; }
.sources ol { padding-left: 1.2rem; font-size: 0.9rem; color: var(--mute); }
.sources li { margin-bottom: 0.6rem; }
.sources a { color: var(--mute); text-decoration: none; border-bottom: 1px solid var(--line-2); word-break: break-word; }
.sources a:hover { color: var(--signal); border-bottom-color: var(--signal); }

/* ── Doc layout: sidebar + article ────────────────────────────────────── */

.doc-layout {
  max-width: var(--max); margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) clamp(3.5rem, 7vw, 5.5rem);
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.doc-nav { position: sticky; top: 5.25rem; font-size: 0.9rem; }
.doc-nav h2 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
              text-transform: uppercase; color: var(--mute-2); font-weight: 500;
              margin: 1.75rem 0 0.75rem; letter-spacing: 0.16em; }
.doc-nav h2:first-child { margin-top: 0; }
.doc-nav ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.doc-nav li a {
  display: block; padding: 0.4rem 0 0.4rem 0.9rem; margin-left: -1px;
  color: var(--mute); text-decoration: none; border-left: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.doc-nav li a:hover { color: var(--bone); }
.doc-nav li a[aria-current="page"] { color: var(--signal); border-left-color: var(--signal); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-nav { position: static; border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem; background: var(--raised); }
}

.doc-foot {
  margin-top: 3.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
}
.doc-foot p { color: var(--mute); font-size: 0.92rem; max-width: 46ch; margin: 0; }

/* ── Platform scorecards ──────────────────────────────────────────────── */

.plat {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raised); margin-bottom: 1.25rem; overflow: hidden;
}
.band-alt .plat { background: var(--ink); }
.plat-head {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: baseline;
  padding: 1.35rem 1.6rem; border-bottom: 1px solid var(--line);
}
.plat-head h3 { font-size: 1.3rem; margin-right: auto; }
.plat-body { padding: 1.5rem 1.6rem; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1.5rem 2.5rem; }
@media (max-width: 720px) { .plat-body { grid-template-columns: minmax(0, 1fr); } }
.plat-body h4 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
                text-transform: uppercase; font-weight: 500; color: var(--mute-2); margin-bottom: 0.7rem; }
.plat-body ul { list-style: none; margin: 0; padding: 0; color: #C9D2D8; font-size: 0.94rem; }
.plat-body li { padding-left: 1.15rem; position: relative; margin-bottom: 0.45rem; }
.plat-body li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--trace); }
.plat-watch li::before { background: var(--signal); }
.plat-note { grid-column: 1 / -1; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--mute); font-size: 0.94rem; }
.plat-note strong { color: var(--bone); }

.pill {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.3rem 0.6rem; border: 1px solid var(--line-2); border-radius: 2px; color: var(--mute); white-space: nowrap;
}
.pill-lead { border-color: rgba(79,179,168,0.5); color: var(--trace); }

/* ── Use-case blocks ──────────────────────────────────────────────────── */

.ucase { border-top: 1px solid var(--line); padding: clamp(2rem, 4vw, 3rem) 0; }
.ucase:last-child { border-bottom: 1px solid var(--line); }
.ucase-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(1.75rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 860px) { .ucase-grid { grid-template-columns: minmax(0, 1fr); } }
.ucase h2 { font-size: clamp(1.35rem, 2.2vw, 1.7rem); margin-bottom: 0.9rem; }
.ucase-side p { color: var(--mute); font-size: 0.95rem; }
.ucase h3 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
            font-weight: 500; color: var(--signal); margin: 1.5rem 0 0.6rem; }
.ucase h3:first-child { margin-top: 0; }
.ucase-main p, .ucase-main li { color: #C9D2D8; font-size: 0.98rem; }
.ucase-main ul { padding-left: 1.2rem; margin: 0; }
.ucase-main li { margin-bottom: 0.45rem; }
.ucase-main li::marker { color: var(--trace); }

/* ── Contact ──────────────────────────────────────────────────────────── */

.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.25rem, 5vw, 4.5rem); align-items: start; }
.contact h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); margin-bottom: 1.1rem; }
.contact-copy > p { color: var(--mute); max-width: 48ch; }

.direct { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.direct li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.direct span { color: var(--mute); flex: none; min-width: 5.5rem; }
.direct a { color: var(--bone); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; word-break: break-word; }
.direct a:hover { color: var(--signal); border-bottom-color: var(--signal); }

.form { background: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1.4rem, 2.6vw, 2rem); }
.band:not(.band-alt) .form { background: var(--raised); }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em;
               text-transform: uppercase; color: var(--mute); margin-bottom: 0.45rem; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--raised-2); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--bone); font-family: var(--body); font-size: 0.98rem; padding: 0.7rem 0.8rem;
  transition: border-color 0.16s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--signal); }
.field textarea { resize: vertical; min-height: 6.5rem; }
.form .btn { width: 100%; text-align: center; }
.form-status { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--trace); min-height: 1.35rem; }
.form-status[data-state="error"] { color: var(--signal); }

@media (max-width: 820px) { .contact { grid-template-columns: minmax(0, 1fr); } }

/* ── CTA strip ────────────────────────────────────────────────────────── */

.cta-strip {
  border-top: 1px solid var(--line); background: var(--raised);
  padding: clamp(2.75rem, 5vw, 4rem) var(--gutter);
}
.cta-in {
  max-width: var(--max); margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: center; justify-content: space-between;
}
.cta-in h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); max-width: 22ch; }
.cta-in p { color: var(--mute); max-width: 44ch; margin: 0.75rem 0 0; }

/* ════════════════════════════════════════════════════════════════════════
   DIAGRAM SYSTEM
   Every figure is authored SVG. Nothing is a stock image, nothing is
   licensable by a competitor. Motion is keyed to `.in`, which script.js
   adds when the figure scrolls into view — so a diagram animates once,
   when you actually look at it.
   ════════════════════════════════════════════════════════════════════════ */

/* Scroll reveal — the base contract for every animated element. */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .75s ease, transform .75s cubic-bezier(.2,.7,.3,1); }
[data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ── Figure frame ─────────────────────────────────────────────────────── */

.fig {
  margin: 2.25rem 0;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.band-alt .fig, .prose .fig { background: var(--raised); }
.fig-wide { margin-inline: 0; }

.fig-head {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline;
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  color: var(--mute-2);
}
.fig-head strong {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 500; color: var(--signal);
}
.fig-head span {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; margin-left: auto; white-space: nowrap;
}
.fig-body { padding: 1.35rem 1.15rem; }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig figcaption {
  padding: 1rem 1.15rem; border-top: 1px solid var(--line);
  color: var(--mute); font-size: .88rem; line-height: 1.55;
}
.fig figcaption b { color: var(--bone); font-weight: 600; }

/* Shared SVG text styles */
.d-label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
           text-transform: uppercase; fill: var(--mute-2); }
.d-label-lit { fill: var(--signal); }
.d-val { font-family: var(--display); font-size: 15px; font-weight: 600; fill: var(--bone); }
.d-note { font-family: var(--body); font-size: 12px; fill: var(--mute); }
.d-tiny { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; fill: var(--mute-2); }

/* Generic stroke draw-on: set --len via JS or a known dasharray */
.d-draw { stroke-dasharray: var(--len, 600); stroke-dashoffset: var(--len, 600); }
.in .d-draw { transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1); stroke-dashoffset: 0; }
.in .d-draw.d-d1 { transition-delay: .15s; }
.in .d-draw.d-d2 { transition-delay: .3s; }
.in .d-draw.d-d3 { transition-delay: .45s; }
.in .d-draw.d-d4 { transition-delay: .6s; }

/* Generic fade-in for SVG children, staggered */
.d-fade { opacity: 0; }
.in .d-fade { transition: opacity .6s ease; opacity: 1; }
.in .d-fade.d-d1 { transition-delay: .2s; }
.in .d-fade.d-d2 { transition-delay: .35s; }
.in .d-fade.d-d3 { transition-delay: .5s; }
.in .d-fade.d-d4 { transition-delay: .65s; }
.in .d-fade.d-d5 { transition-delay: .8s; }
.in .d-fade.d-d6 { transition-delay: .95s; }

@media (prefers-reduced-motion: reduce) {
  .d-draw { stroke-dashoffset: 0; }
  .d-fade { opacity: 1; }
  .in .d-draw, .in .d-fade { transition: none; }
}

/* ── Signature: copper → glass ────────────────────────────────────────── */

.cg {
  position: relative;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 82% 50%, rgba(79,179,168,.13), transparent 62%),
    radial-gradient(ellipse at 12% 50%, rgba(196,85,63,.09), transparent 58%),
    var(--ink);
  padding: clamp(3rem, 6vw, 5rem) var(--gutter) clamp(2.5rem, 5vw, 4rem);
  overflow: hidden;
}
.cg-in { max-width: var(--max); margin-inline: auto; }
.cg-head { max-width: 60ch; margin-bottom: clamp(1.75rem, 3vw, 2.5rem); }
.cg-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); margin-bottom: .9rem; }
.cg-head p { color: var(--mute); }

.cg-strand { stroke-linecap: round; fill: none; }

/* Copper: warm, irregular, dying. */
.cu { stroke: #B07C46; stroke-width: 2.4; opacity: .95; }
.in .cu { animation: cu-fail 7s ease-in-out forwards; }
.in .cu-1 { animation-delay: 1.1s } .in .cu-2 { animation-delay: 1.9s }
.in .cu-3 { animation-delay: 1.5s } .in .cu-4 { animation-delay: 2.6s }
.in .cu-5 { animation-delay: 2.2s } .in .cu-6 { animation-delay: 3.1s }
.in .cu-7 { animation-delay: 2.9s }
@keyframes cu-fail {
  0%   { stroke: #B07C46; opacity: .95; }
  55%  { stroke: #B07C46; opacity: .95; }
  70%  { stroke: var(--fault); opacity: 1; }
  /* De-energized, not deleted — the copper must stay legible or the left
     half reads as empty space instead of infrastructure that still exists. */
  100% { stroke: #6B4B2E; opacity: .9; }
}

.cu-break { opacity: 0; }
.in .cu-break { animation: br 7s ease-in-out forwards; }
.in .cu-break.cu-1 { animation-delay: 1.1s } .in .cu-break.cu-2 { animation-delay: 1.9s }
.in .cu-break.cu-3 { animation-delay: 1.5s } .in .cu-break.cu-4 { animation-delay: 2.6s }
.in .cu-break.cu-5 { animation-delay: 2.2s } .in .cu-break.cu-6 { animation-delay: 3.1s }
.in .cu-break.cu-7 { animation-delay: 2.9s }
@keyframes br { 0%,55% { opacity: 0 } 72% { opacity: 1 } 100% { opacity: .75 } }

/* Glass: precise, straight, alight. */
.fb { stroke: #24403F; stroke-width: 1.6; }
.in .fb { animation: fb-ignite 2.2s ease forwards; animation-delay: 2.6s; }
@keyframes fb-ignite { to { stroke: var(--trace); } }

.fb-glow { stroke: var(--trace); stroke-width: 5; opacity: 0; filter: blur(3px); }
.in .fb-glow { animation: fb-glow 2.4s ease forwards; animation-delay: 2.9s; }
@keyframes fb-glow { to { opacity: .22 } }

/* Light pulses travelling down the glass */
.fb-pulse { fill: none; stroke: #BFF3EC; stroke-width: 2.4; stroke-linecap: round;
            stroke-dasharray: 26 620; stroke-dashoffset: 646; opacity: 0; }
.in .fb-pulse { animation: pulse 2.6s linear infinite; opacity: 1; }
.in .fb-pulse.p1 { animation-delay: 3.4s } .in .fb-pulse.p2 { animation-delay: 3.9s }
.in .fb-pulse.p3 { animation-delay: 4.3s } .in .fb-pulse.p4 { animation-delay: 3.6s }
.in .fb-pulse.p5 { animation-delay: 4.6s } .in .fb-pulse.p6 { animation-delay: 4.1s }
.in .fb-pulse.p7 { animation-delay: 4.9s }
@keyframes pulse { to { stroke-dashoffset: 0 } }

.cg-seam { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 5; }
.cg-era { font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
          text-transform: uppercase; }
.cg-era-cu { fill: #9A6B3F; }
.cg-era-fb { fill: var(--trace); }

@media (prefers-reduced-motion: reduce) {
  .in .cu, .in .cu-break, .in .fb, .in .fb-glow, .in .fb-pulse { animation: none; }
  .cu { stroke: #6B4B2E; opacity: .9; }
  .cu-break { opacity: .75; }
  .fb { stroke: var(--trace); }
  .fb-glow { opacity: .22; }
  .fb-pulse { opacity: 0; }
}

/* ── DS1 frame ────────────────────────────────────────────────────────── */

.ds1-slot { fill: var(--raised-2); stroke: var(--line-2); stroke-width: 1; opacity: 0; }
.in .ds1-slot { transition: opacity .3s ease; transition-delay: calc(var(--i, 0) * 34ms); opacity: 1; }
.ds1-num { font-family: var(--mono); font-size: 9.5px; fill: var(--mute-2); opacity: 0; }
.in .ds1-num { transition: opacity .3s ease; transition-delay: calc(var(--i, 0) * 34ms); opacity: 1; }

.ds1-f { fill: rgba(232,163,61,.18); stroke: var(--signal); stroke-width: 1.4; }
.in .ds1-f { animation: ds1-fpulse 2.6s ease-in-out infinite; animation-delay: 1.1s; }
@keyframes ds1-fpulse { 0%,100% { fill: rgba(232,163,61,.18) } 50% { fill: rgba(232,163,61,.45) } }

.ds1-bit { fill: var(--raised-2); stroke: var(--line-2); stroke-width: 1; }
.ds1-robbed { fill: rgba(196,85,63,.28); stroke: var(--fault); }
.in .ds1-robbed { animation: ds1-rpulse 2.8s ease-in-out infinite; animation-delay: 1.7s; }
@keyframes ds1-rpulse { 0%,100% { fill: rgba(196,85,63,.28) } 50% { fill: rgba(196,85,63,.62) } }

.ds1-rule { stroke: var(--line-2); stroke-width: 1; fill: none; }
.ds1-funnel { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.ds1-sum { font-family: var(--display); font-weight: 700; font-size: 19px; fill: var(--signal); }

@media (prefers-reduced-motion: reduce) {
  .ds1-slot, .ds1-num { opacity: 1; }
  .in .ds1-f, .in .ds1-robbed { animation: none; }
}

/* ── Diagram primitives: boxes, nodes, flows ──────────────────────────── */

.d-box      { fill: var(--raised-2); stroke: var(--line-2); stroke-width: 1.2; }
.d-box-sig  { fill: rgba(232,163,61,.10); stroke: var(--signal); stroke-width: 1.3; }
.d-box-ok   { fill: rgba(79,179,168,.10); stroke: var(--trace);  stroke-width: 1.3; }
.d-box-bad  { fill: rgba(196,85,63,.12);  stroke: var(--fault);  stroke-width: 1.3; }
.d-box-cu   { fill: rgba(176,124,70,.12); stroke: #B07C46;       stroke-width: 1.3; }

.d-flow     { stroke: var(--line-2); stroke-width: 1.5; fill: none; stroke-linecap: round; }
.d-flow-ok  { stroke: var(--trace); }
.d-flow-sig { stroke: var(--signal); }
.d-flow-bad { stroke: var(--fault); }
.d-flow-dash{ stroke-dasharray: 4 4; }

.d-head     { fill: var(--line-2); }
.d-head-ok  { fill: var(--trace); }
.d-head-sig { fill: var(--signal); }
.d-head-bad { fill: var(--fault); }

.d-node     { fill: var(--ink); stroke: var(--trace); stroke-width: 1.8; }
.d-node-sig { stroke: var(--signal); }
.d-node-bad { stroke: var(--fault); }

.d-title    { font-family: var(--display); font-weight: 600; font-size: 13px; fill: var(--bone); }
.d-lane     { fill: rgba(255,255,255,.018); stroke: var(--line); stroke-width: 1; }

/* Travelling packet along a flow */
.d-pkt { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round;
         stroke-dasharray: 14 400; stroke-dashoffset: 414; opacity: 0; }
.in .d-pkt { animation: d-pkt 2.8s linear infinite; opacity: 1; }
.in .d-pkt.d-d1 { animation-delay: .6s } .in .d-pkt.d-d2 { animation-delay: 1.2s }
.in .d-pkt.d-d3 { animation-delay: 1.8s } .in .d-pkt.d-d4 { animation-delay: 2.4s }
@keyframes d-pkt { to { stroke-dashoffset: 0 } }

@media (prefers-reduced-motion: reduce) { .in .d-pkt { animation: none; opacity: 0; } }

/* ── Bars (funnels, gaps, scales) ─────────────────────────────────────── */

.bar-grow { transform: scaleX(0); transform-origin: left center; transform-box: fill-box; }
.in .bar-grow { transition: transform 1.05s cubic-bezier(.2,.7,.3,1); transform: scaleX(1); }
.in .bar-grow.d-d1 { transition-delay: .15s }
.in .bar-grow.d-d2 { transition-delay: .5s }
.in .bar-grow.d-d3 { transition-delay: .85s }
.in .bar-grow.d-d4 { transition-delay: 1.2s }

.bar-track { fill: var(--raised-2); stroke: var(--line-2); stroke-width: 1; }
.bar-ok    { fill: var(--trace); }
.bar-warn  { fill: var(--signal); }
.bar-gap   { fill: var(--fault); opacity: .82; }
.bar-cap   { font-family: var(--display); font-weight: 700; font-size: 17px; }

/* Diagonal hatch for "counted but not helped" */
.hatch-gap { fill: url(#hatchClay); stroke: var(--fault); stroke-width: 1; }

@media (prefers-reduced-motion: reduce) {
  .bar-grow { transform: none; }
  .in .bar-grow { transition: none; }
}

/* ── Era timeline ─────────────────────────────────────────────────────── */

.era-line { stroke: var(--line-2); stroke-width: 1.5; }
.era-dot  { fill: var(--ink); stroke: var(--signal); stroke-width: 2.5; }
.era-dot-live { fill: var(--signal); }
.era-band { rx: 3; }
.era-cu { fill: rgba(176,124,70,.22); stroke: #B07C46; stroke-width: 1; }
.era-td { fill: rgba(232,163,61,.14); stroke: var(--signal); stroke-width: 1; }
.era-ip { fill: rgba(79,179,168,.14); stroke: var(--trace); stroke-width: 1; }
.era-ai { fill: rgba(79,179,168,.26); stroke: var(--trace); stroke-width: 1.4; }
.era-title { font-family: var(--display); font-weight: 600; font-size: 14px; fill: var(--bone); }

/* ── Stat row ─────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px,100%), 1fr));
         gap: 1px; background: var(--line); border: 1px solid var(--line);
         border-radius: var(--r); overflow: hidden; }
.stat { background: var(--ink); padding: 1.5rem 1.4rem; }
.band-alt .stat { background: var(--raised); }
.stat-n { font-family: var(--display); font-variation-settings: 'wdth' 108;
          font-weight: 700; font-size: clamp(1.9rem, 3.4vw, 2.6rem);
          line-height: 1; letter-spacing: -.02em; color: var(--signal); display: block; }
.stat-n.teal { color: var(--trace); }
.stat-n.clay { color: var(--fault); }
.stat-k { display: block; margin-top: .7rem; color: var(--bone); font-weight: 600; font-size: .95rem; }
.stat-s { display: block; margin-top: .35rem; color: var(--mute); font-size: .88rem; line-height: 1.5; }

/* ── Footer ───────────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--line); padding: clamp(2.5rem, 4vw, 3.5rem) var(--gutter) 2rem; }
.foot-in { max-width: var(--max); margin-inline: auto; display: grid;
           grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2rem; }
@media (max-width: 780px) { .foot-in { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.foot-brand p { color: var(--mute); font-size: 0.92rem; max-width: 30ch; margin-top: 0.9rem; }
.foot h3 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
           font-weight: 500; color: var(--mute-2); margin-bottom: 0.9rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.5rem; }
.foot li a { color: var(--mute); text-decoration: none; font-size: 0.92rem; }
.foot li a:hover { color: var(--bone); }
.foot-base {
  max-width: var(--max); margin: 2.5rem auto 0; padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; justify-content: space-between; color: var(--mute-2);
}
.foot-base p { margin: 0; }
