/* Roxabi Factory — shared styles (Forge skin overlay on roxabi-site base).
   Base structure and class vocabulary = roxabi-site styles.css (kept intact so body classes work).
   Forge overlay = token values (tokens.css), Outfit headings, hero v17 module.
   Vanilla CSS, no preprocessor. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 64px;
}
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
#main:focus { outline: none; }

/* Skip link */
.skip-link {
  position: absolute; left: var(--s-sm); top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-on);
  font-weight: 600; font-size: .9rem; padding: 8px 14px; border-radius: var(--r-md);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s-sm); }

/* ── Layout ───────────────────────────────────────────────── */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s-lg); }
.prose { max-width: var(--maxw-prose); }
section { padding-block: var(--s-2xl); }
.section-label {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase; color: var(--accent);
  margin-bottom: var(--s-md);
}

/* ── Typography — Forge font roles ───────────────────────── */
/* Outfit for all headings and nav wordmark */
h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.1; letter-spacing: -.03em; font-weight: 800;
}
h1 { font-size: clamp(2.25rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.04em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
p { color: var(--text-muted); }
.lead { font-size: 1.125rem; color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }
code, .mono { font-family: var(--font-mono); }
.prose code { font-size: .86em; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .08em .36em; color: var(--text); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.prose pre code { font-size: 1em; background: none; border: none; padding: 0; border-radius: 0; color: inherit; -webkit-box-decoration-break: slice; box-decoration-break: slice; }
.codeblock pre code { color: var(--code-text); }
.formula-box pre code { color: var(--accent); font-size: .9em; }

/* ── Nav ──────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { position: relative; display: flex; align-items: center; gap: var(--s-lg); height: 60px; padding-inline: var(--s-lg); }
.nav-inner > *, .nav-actions > * { display: flex; align-items: center; }
/* Wordmark: Outfit 800, forge orange */
.brand {
  gap: var(--s-sm); font-family: var(--font-head); font-weight: 800;
  letter-spacing: -.02em; font-size: 1.05rem; line-height: 1;
  color: var(--accent-hover);
}
:root[data-theme="light"] .brand { color: var(--accent); }
.brand svg, .brand img { width: 26px; height: 26px; }
.nav-links { gap: var(--s-lg); margin-left: var(--s-md); }
.nav-links a { display: inline-flex; align-items: center; line-height: 1; color: var(--text-muted); font-size: .925rem; font-weight: 500; transition: color var(--dur) var(--ease); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: var(--s-xs); margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: var(--r-md); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: all var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border-hi); }
.icon-btn svg { width: 18px; height: 18px; }
.lang-toggle {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600; letter-spacing: .05em;
  width: auto; padding-inline: var(--s-sm); gap: 2px; line-height: 1;
}
.lang-toggle .on { color: var(--accent); }
.lang-toggle .sep { color: var(--text-dim); }

/* Mobile menu toggle (CSS-only, zero-JS) */
.nav-toggle-cb { display: none; }
.nav-toggle { display: none; }
.nav-toggle .i-close { display: none; }
.nav-toggle-cb:focus-visible ~ .nav-toggle { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle-cb:checked ~ .nav-toggle .i-menu { display: none; }
.nav-toggle-cb:checked ~ .nav-toggle .i-close { display: block; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-sm);
  font-weight: 600; font-size: .95rem; padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--glow-accent); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-hi); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn .star-count { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }

/* ── Badge / eyebrow ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-sm);
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .02em;
  color: var(--text-muted); padding: 5px 12px; border: 1px solid var(--border-hi);
  border-radius: var(--r-full); background: var(--surface);
}
.badge .dot { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ── Hero — Forge v17 module ──────────────────────────────── */
/* Full-viewport, 2-col grid desktop / 1-col mobile.
   ember-forge Canvas2D shader (vendor/ember-forge.js) auto-inits #hero-bg
   when shader="ember-forge" in site.toml. Static CSS-only ember fallback below. */
.hero {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100dvh;
  padding-block: clamp(64px, 12vw, 140px);
  display: flex; align-items: center; justify-content: center;
}

/* Concentric ember glow — CSS-only fallback (v17 .hero::before) */
.hero::before {
  content: ''; position: absolute; z-index: 0; pointer-events: none;
  width: 600px; height: 600px; border-radius: 50%;
  top: 40%; left: 50%; transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, rgba(232,93,4,0.18) 0%, transparent 22%),
    radial-gradient(circle, rgba(232,93,4,0.08) 0%, transparent 45%),
    radial-gradient(circle, rgba(249,115,22,0.04) 0%, transparent 70%);
  animation: emberPulse 5s ease-in-out infinite;
}

/* Subtle angular forge lines (v17 .hero::after) */
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(135deg, transparent 42%, rgba(232,93,4,0.03) 42.5%, rgba(232,93,4,0.03) 43%, transparent 43.5%),
    linear-gradient(135deg, transparent 58%, rgba(232,93,4,0.025) 58.5%, rgba(232,93,4,0.025) 59%, transparent 59.5%);
}

@keyframes emberPulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
}

/* Light mode: softer ember (v17 light overrides) */
:root[data-theme="light"] .hero::before {
  background:
    radial-gradient(circle, rgba(194,65,12,0.10) 0%, transparent 22%),
    radial-gradient(circle, rgba(194,65,12,0.05) 0%, transparent 45%),
    radial-gradient(circle, rgba(194,65,12,0.025) 0%, transparent 70%);
}
:root[data-theme="light"] .hero::after {
  background:
    linear-gradient(135deg, transparent 42%, rgba(194,65,12,0.025) 42.5%, rgba(194,65,12,0.025) 43%, transparent 43.5%),
    linear-gradient(135deg, transparent 58%, rgba(194,65,12,0.02) 58.5%, rgba(194,65,12,0.02) 59%, transparent 59.5%);
}

/* Canvas shader — dark mode only */
#hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .7; }
:root[data-theme="light"] #hero-bg { display: none; }

/* 2-col hero inner (v17 .hero-inner) */
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--maxw); width: 100%;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 48px; align-items: center;
  padding-inline: var(--s-lg);
}

/* Legacy .wrap inside .hero for non-2col bodies */
.hero .wrap { position: relative; z-index: 2; max-width: 1280px; }

/* LEFT: text block */
.hero-copy, .hero-text { display: flex; flex-direction: column; align-items: flex-start; }

/* Hero title — Chakra Petch 700, forge display */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 700; line-height: 1.05;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

/* Glitch-decode entrance — JS adds .decoded to [data-glitch] */
[data-glitch] { opacity: 0; }
[data-glitch].decoded {
  opacity: 1;
  animation: glitchReveal .8s steps(1) forwards;
}
@keyframes glitchReveal {
  0%  { opacity: 0;   clip-path: inset(0 100% 0 0); }
  10% { opacity: .6;  clip-path: inset(0 80% 0 0); }
  25% { opacity: .3;  clip-path: inset(0 55% 0 0); }
  40% { opacity: .8;  clip-path: inset(0 30% 0 0); }
  55% { opacity: .5;  clip-path: inset(0 15% 0 0); }
  70% { opacity: 1;   clip-path: inset(0 5% 0 0); }
  85% { opacity: .9;  clip-path: inset(0 1% 0 0); }
  100%{ opacity: 1;   clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  [data-glitch] { opacity: 1; animation: none; }
}

/* Sub+CTAs flicker in after glitch (v17 revealFlicker) */
.hero-sub-reveal, .hero-ctas-reveal {
  opacity: 0;
  animation: revealFlicker .6s step-end 2.8s forwards;
}
@keyframes revealFlicker {
  0%   { opacity: 0; }
  10%  { opacity: 0.7; }
  15%  { opacity: 0; }
  25%  { opacity: 0.9; }
  40%  { opacity: 0.8; }
  55%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-sub-reveal, .hero-ctas-reveal { opacity: 1; animation: none; }
}

/* Hero sub-label — mono, ember */
.hero-sub {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--accent-hover); letter-spacing: 0.06em;
  margin-bottom: 32px;
}
:root[data-theme="light"] .hero-sub { color: var(--accent); }

/* Legacy .hero .lead / .sub */
.hero .lead { font-size: 1.25rem; max-width: 620px; margin-inline: auto; }
.hero .sub { color: var(--accent); font-weight: 600; }

/* Hero CTAs: hero-btn system (v17) */
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-top: var(--s-lg); }
/* Legacy hero-cta */
.hero-cta { display: flex; gap: var(--s-md); justify-content: center; flex-wrap: wrap; margin-top: var(--s-xl); }
.hero-copy .hero-cta { justify-content: flex-start; }

.hero-btn {
  display: inline-flex; align-items: center; padding: 12px 28px; border-radius: var(--r-md);
  font-family: var(--font-sans); font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: all var(--dur) var(--ease); border: 1px solid transparent;
}
.hero-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.hero-btn.primary:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
  box-shadow: 0 0 24px rgba(232,93,4,0.3); transform: translateY(-1px);
}
.hero-btn.secondary { background: transparent; color: var(--text-muted); border-color: var(--border); }
.hero-btn.secondary:hover { color: var(--text); border-color: var(--border-hi); background: rgba(232,93,4,0.06); }
:root[data-theme="light"] .hero-btn.primary { background: var(--accent); color: #fff; }
:root[data-theme="light"] .hero-btn.primary:hover { box-shadow: 0 0 24px rgba(194,65,12,0.25); }
:root[data-theme="light"] .hero-btn.secondary { color: var(--text); border-color: rgba(0,0,0,0.15); background: #fff; }
:root[data-theme="light"] .hero-btn.secondary:hover { background: rgba(194,65,12,0.06); }

/* RIGHT: hero mark — ember drop-shadow */
.hero-mark-wrap { display: flex; align-items: center; justify-content: center; }
.hero-mark {
  width: 240px; height: 240px;
  filter: drop-shadow(0 0 24px rgba(232,93,4,0.45)) drop-shadow(0 0 64px rgba(232,93,4,0.18));
}
:root[data-theme="light"] .hero-mark {
  filter: drop-shadow(0 0 18px rgba(194,65,12,0.3)) drop-shadow(0 0 48px rgba(194,65,12,0.1))
          brightness(1.3) saturate(1.15);
}

/* Legacy .rox-dia for bodies not using .hero-inner */
.hero .rox-dia { width: 100%; max-width: 880px; height: auto; display: block; margin: var(--s-xl) auto 0; }

/* iso hub SVG (roxabi-site compat) */
#iso .grid-line { stroke: var(--border); stroke-width: 1; }
#iso .link { stroke: var(--border); stroke-opacity: .55; stroke-width: 1.2; fill: none; stroke-linecap: round; }
#iso .mlabel { font-family: var(--font-mono); font-size: 9.5px; fill: var(--text-muted); letter-spacing: .02em; }
#iso .clabel { font-family: var(--font-mono); font-size: 9px; fill: var(--accent); letter-spacing: .04em; }

/* Forge strip — bottom of hero (v17) */
.hero-strip {
  display: flex; align-items: center; gap: var(--s-md); flex-wrap: wrap;
  margin-top: var(--s-xl); font-family: var(--font-mono); font-size: .72rem;
  color: var(--text-dim); letter-spacing: .06em;
}
.pulse-dot {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); flex-shrink: 0;
  animation: pulseDot 2.2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: .7; box-shadow: 0 0 0 0 rgba(232,93,4,0.5); }
  50%       { opacity: 1; box-shadow: 0 0 0 4px rgba(232,93,4,0); }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }

/* Scroll cue — anchored near the first-screen fold, NOT the hero's bottom:
   the hero is min-height:100dvh and vertically centres its content, so a
   bottom-anchored cue can sit below the fold. Fixed offset up from the fold
   keeps it on the first screen regardless of hero height (roxabi-site arrangement). */
.hero-scroll {
  position: absolute; left: 50%; bottom: auto; transform: translateX(-50%); z-index: 3;
  top: calc(100vh - 185px); top: calc(100dvh - 185px);
  display: inline-flex; flex-direction: column; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-muted); transition: color var(--dur) var(--ease);
  text-decoration: none;
}
.hero-scroll:hover { color: var(--accent); }
.hero-scroll svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hero-scroll-arrow { display: block; line-height: 0; }
.hero-scroll-arrow svg { width: 20px; height: 20px; display: block; }
/* Bob the arrow only — the wrapper keeps its translateX(-50%) centring. */
@media (prefers-reduced-motion: no-preference) {
  .hero-scroll-arrow { animation: scrollHint 1.8s ease-in-out infinite; }
}
@keyframes scrollHint {
  0%, 100% { transform: translateY(0);   opacity: .7; }
  50%      { transform: translateY(5px); opacity: 1; }
}
@media (max-width: 860px) { .hero-scroll { display: none; } }

/* Desktop: 2-col hero — copy left, forge mark right (mirrors roxabi-site). */
@media (min-width: 860px) {
  .hero .wrap {
    display: grid; grid-template-columns: .9fr 1.1fr;
    align-items: center; gap: 48px;
  }
  .hero-copy { min-width: 0; align-items: flex-start; }
  .hero .lead { margin-inline: 0; max-width: 46ch; }
  .hero-copy .hero-cta { justify-content: flex-start; }
  .hero-mark { width: 300px; height: 300px; }
}

/* Mobile / tablet: 1-col centred hero (below the desktop grid breakpoint). */
@media (max-width: 860px) {
  .hero { padding-block: clamp(48px, 10vw, 80px); }
  .hero .wrap { gap: 32px; text-align: center; }
  .hero-copy, .hero-text { align-items: center; }
  .hero-mark { width: 160px; height: 160px; }
  .hero-title { letter-spacing: 0.01em; }
  .hero-sub { margin-bottom: 24px; }
  .hero-ctas { justify-content: center; flex-direction: column; align-items: center; }
  .hero-btn { width: 100%; max-width: 280px; justify-content: center; }
  .hero::before { width: 350px; height: 350px; }
  .hero .lead { margin-inline: 0; }
  .hero-copy .hero-cta { justify-content: center; }
}

/* ── Code block (always dark terminal) ────────────────────── */
.code {
  background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border);
  border-radius: var(--r-lg); font-family: var(--font-mono); font-size: .875rem; line-height: 1.6;
  text-align: left; overflow: hidden; box-shadow: var(--shadow-md);
}
.code-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.code-head .d { width: 11px; height: 11px; border-radius: var(--r-full); background: var(--border-hi); }
.code-head .name { margin-left: var(--s-sm); font-size: .75rem; color: var(--code-muted); }
.code pre { padding: var(--s-lg); overflow-x: auto; margin: 0; }
.code .k { color: var(--code-keyword); }
.code .s { color: var(--code-string); }
.code .c { color: var(--code-muted); }
.hero .code { max-width: 640px; margin: var(--s-xl) auto 0; }

/* ── Grid / cards ─────────────────────────────────────────── */
.grid { display: grid; gap: var(--s-lg); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-pillars { grid-template-columns: 1fr; }
@media (min-width: 680px) { .grid-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-lg); transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: rgba(232,93,4,0.35); }
.card h3 { margin-bottom: var(--s-sm); }
.card p { font-size: .95rem; }
.card .icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: var(--s-md); }
/* Pillar header: the number/icon sits inline beside the heading; the body
   paragraph wraps to its own full-width row below (flex-wrap + basis:100%). */
.card.pillar { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: var(--s-sm); }
.pillar .num { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; margin: 0; flex: 0 0 auto; }
.card.pillar h3 { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.card.pillar > p:not(.num) { flex-basis: 100%; margin: 0; }
.pillar:hover { transform: translateY(-2px); }

/* Project cards */
a.proj-card { display: block; }
a.proj-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.proj-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-md); }
.proj-card .tag { font-family: var(--font-mono); font-size: .7rem; color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px 10px; }
.proj-card .tag.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.proj-card .arrow { color: var(--accent); transition: transform var(--dur) var(--ease); }
a.proj-card:hover .arrow { transform: translateX(3px); }
.proj-card.roadmap { display: flex; flex-direction: column; }
.roadmap-list { list-style: none; padding: 0; margin: var(--s-sm) 0 0; }
.roadmap-list li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-md); padding: 10px 0; border-top: 1px solid var(--border); }
.roadmap-list li:first-child { border-top: 0; }
.roadmap-list .mono { color: var(--text); font-weight: 500; font-size: .95rem; }
.roadmap-list .mono-note { font-family: var(--font-mono); font-size: .78rem; color: var(--text-dim); }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-md); }
.stat { text-align: center; padding: var(--s-lg); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); }
.stat .n { font-size: 1.75rem; font-weight: 900; color: var(--accent); font-family: var(--font-mono); }
.stat .l { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Final CTA band ───────────────────────────────────────── */
.cta-band { text-align: center; position: relative; overflow: hidden; border-top: 1px solid var(--border); }
.cta-band::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(232,93,4,0.10), transparent 70%); pointer-events: none; }
.cta-band .wrap { position: relative; }
.cta-band h2 { margin-bottom: var(--s-md); }
.cta-band .hero-cta { margin-top: var(--s-xl); }

/* ── Footer ───────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding-block: var(--s-2xl) 0; color: var(--text-muted); }
.footer-top { display: flex; flex-wrap: wrap; gap: var(--s-xl); justify-content: space-between; }
.footer-links { display: flex; gap: var(--s-xl); flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: var(--s-sm); }
.footer-col .h { color: var(--text); font-weight: 600; font-size: .85rem; margin-bottom: 2px; }
.footer-col a { color: var(--text-muted); font-size: .9rem; transition: color var(--dur) var(--ease); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; margin-top: 0; padding: 16px var(--s-lg) 8px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--s-md); justify-content: space-between; font-size: .85rem; background: var(--bg); }
.footer .mono-note { font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); }

/* ── Constitution / article layout ────────────────────────── */
.doc-hero { border-bottom: 1px solid var(--border); text-align: center; padding-block: var(--s-2xl); }
.doc-hero .meta { font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); margin-top: var(--s-md); }
.constitution { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-2xl); align-items: start; }
.const-body { min-width: 0; }
.const-body pre.code, pre.code { overflow-x: auto; max-width: 100%; }
.toc { position: sticky; top: 80px; font-size: .85rem; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--border); padding-left: var(--s-md); }
.toc a { color: var(--text-muted); padding: 2px 0; border-left: 2px solid transparent; margin-left: calc(-1 * var(--s-md) - 2px); padding-left: var(--s-md); transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
.toc .t { color: var(--text); font-weight: 600; margin-top: var(--s-md); font-size: .8rem; }
.titre { margin-top: var(--s-2xl); }
.titre > .label { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); }
.titre > h2 { margin-top: var(--s-xs); margin-bottom: var(--s-lg); }
.article { padding: var(--s-lg) 0; border-top: 1px solid var(--border); }
.article h3 { margin-bottom: var(--s-sm); }
.article h3 .a-num { color: var(--accent); font-family: var(--font-mono); font-size: .85rem; margin-right: var(--s-sm); }
.article p + p { margin-top: var(--s-md); }
.preamble { font-size: 1.05rem; }
.preamble p { color: var(--text); }
.laws { list-style: none; counter-reset: law; padding: 0; display: grid; gap: var(--s-md); }
.laws li { counter-increment: law; padding-left: 2.5rem; position: relative; color: var(--text-muted); }
.laws li::before { content: counter(law, upper-roman); position: absolute; left: 0; top: 0; font-family: var(--font-mono); color: var(--accent); font-size: .85rem; font-weight: 600; }

/* ── Project detail ───────────────────────────────────────── */
.proj-hero { border-bottom: 1px solid var(--border); padding-block: var(--s-2xl); }
.proj-hero .kicker { display: flex; align-items: center; gap: var(--s-md); margin-bottom: var(--s-md); }
.proj-hero .units { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-md); margin-top: var(--s-xl); }
.meta-grid .m { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-md); background: var(--panel); }
.meta-grid .m .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); font-family: var(--font-mono); }
.meta-grid .m .v { color: var(--text); font-weight: 600; margin-top: 4px; }
.feature-list { list-style: none; padding: 0; display: grid; gap: var(--s-md); }
.feature-list li { padding-left: 1.75rem; position: relative; color: var(--text-muted); }
/* Diamond bullet marker — forge brand */
.feature-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; transform: rotate(45deg); }

/* ── Reveal animation ─────────────────────────────────────── */
[data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .hero::before { animation: none; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 820px) {
  .nav-toggle-cb { display: block; position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
  .nav-toggle { display: inline-grid; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: var(--s-lg);
    flex-direction: column; align-items: stretch; gap: 2px;
    margin: var(--s-sm) 0 0; padding: var(--s-sm); min-width: 190px;
    background: var(--surface); border: 1px solid var(--border-hi);
    border-radius: var(--r-md); box-shadow: var(--shadow-md);
  }
  .nav-toggle-cb:checked ~ .nav-links { display: flex; }
  .nav-links a { padding: 8px 10px; border-radius: var(--r-sm); }
  .nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--panel); color: var(--text); }
  .constitution { grid-template-columns: 1fr; }
  .toc { display: none; }
}

@media (max-width: 600px) {
  .footer-bottom { position: static; }
  body { padding-bottom: 0; }
}
.portfolio-note { font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); margin-top: var(--s-lg); }

/* ── Documentation collection ────────────────────────────── */
.doc-cards { align-items: stretch; }
a.doc-card { display: flex; flex-direction: column; gap: var(--s-sm); }
a.doc-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.tag { display: inline-block; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; line-height: 1.7; }
a.tag:hover { color: var(--accent); border-color: var(--accent); }
.doc-card-tags, .doc-hero-tags, .doc-nav-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-hero-tags { justify-content: center; margin-top: var(--s-md); }
.doc-card h3 { margin-bottom: 0; }
.doc-card > p { font-size: .95rem; }
.doc-card .portfolio-note { margin-top: auto; padding-top: var(--s-sm); color: var(--accent); }
.doc-card .arrow { display: inline-block; transition: transform var(--dur) var(--ease); }
a.doc-card:hover .arrow { transform: translateX(3px); }

.doc-figure { margin: var(--s-xl) 0; padding: var(--s-lg); background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); }
.doc-figure svg { width: 100%; height: auto; }
.doc-figure figcaption { margin-top: var(--s-md); font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); text-align: center; }

.callout { margin: var(--s-lg) 0; padding: var(--s-md) var(--s-lg); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--r-md) var(--r-md) 0; }
.callout p { color: var(--text); margin: 0; }
.callout p + p { margin-top: var(--s-sm); }

/* ── Doc components extended ─────────────────────────────── */
.codeblock { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin: var(--s-lg) 0; box-shadow: var(--shadow-md); }
.codeblock-header { background: color-mix(in srgb, var(--code-text) 7%, var(--code-bg)); border-bottom: 1px solid var(--border); padding: 8px 14px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; color: var(--code-muted); }
.codeblock pre { margin: 0; padding: var(--s-lg); overflow-x: auto; color: var(--code-text); font-family: var(--font-mono); font-size: .85rem; line-height: 1.6; }
.codeblock .k { color: var(--code-keyword); }
.codeblock .s { color: var(--code-string); }
.codeblock .c { color: var(--code-muted); }

.tbl-wrap { overflow-x: auto; margin: var(--s-lg) 0; border: 1px solid var(--border); border-radius: var(--r-md); }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--surface); color: var(--text-dim); font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-hi); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .9rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }
.data-table td code, .data-table th code { font-family: var(--font-mono); font-size: .8rem; background: var(--surface); border: 1px solid var(--border); padding: 1px 6px; border-radius: var(--r-sm); color: var(--text); }

.steps { display: flex; flex-direction: column; margin: var(--s-lg) 0; }
.step { display: flex; gap: var(--s-md); position: relative; padding-bottom: var(--s-lg); }
.step:last-child { padding-bottom: 0; }
.step::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.step:last-child::after { display: none; }
.step-num { flex: none; width: 29px; height: 29px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--r-full); font-family: var(--font-mono); font-size: .8rem; color: var(--accent); }
.step-body { flex: 1; padding-top: 2px; }
.step-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.step-desc { font-size: .9rem; color: var(--text-muted); }

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s-md); margin: var(--s-xl) 0; }
.kpi-item { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-md); text-align: center; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.kpi-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.kpi-value { display: block; font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.kpi-label { display: block; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .05em; color: var(--text-dim); }

.timeline { position: relative; padding-left: var(--s-xl); margin: var(--s-lg) 0; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, var(--accent), var(--border)); }
.tl-item { position: relative; margin-bottom: var(--s-xl); }
.tl-item:last-child { margin-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1 * var(--s-xl) + 1px); top: 5px; width: 10px; height: 10px; border-radius: var(--r-full); background: var(--accent); border: 2px solid var(--bg); }
.tl-label { font-family: var(--font-mono); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 4px; }
.tl-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tl-body { font-size: .9rem; color: var(--text-muted); }

.compare-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-md); margin: var(--s-lg) 0; }
.compare-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-lg); }
.compare-col.positive { border-top: 3px solid var(--accent); }
.compare-col.negative { border-top: 3px solid var(--border-hi); }
.compare-head { font-family: var(--font-mono); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: var(--s-md); color: var(--text-dim); }
.compare-col.positive .compare-head { color: var(--accent); }
.compare-item { margin-bottom: var(--s-sm); font-size: .9rem; color: var(--text-muted); }
.compare-item:last-child { margin-bottom: 0; }
.compare-item strong { display: block; color: var(--text); }

.formula-box { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-md); padding: var(--s-md) var(--s-lg); margin: var(--s-lg) 0; overflow-x: auto; }
.formula-box pre { margin: 0; }
.formula-box code { font-family: var(--font-mono); font-size: .9em; line-height: 1.8; color: var(--accent); }

.caveat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-md); margin: var(--s-lg) 0; }
.caveat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-lg); }
.caveat-q { font-weight: 600; color: var(--text); margin-bottom: var(--s-sm); }
.caveat-body { font-size: .9rem; color: var(--text-muted); }
.caveat-direction { margin-top: var(--s-sm); padding-top: var(--s-sm); border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-dim); }
.caveat-direction strong { color: var(--accent); }

.trinity { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-md); margin: var(--s-lg) 0; }
.trinity-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-lg); position: relative; }
.trinity-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); border-radius: var(--r-md) var(--r-md) 0 0; opacity: .65; }
.trinity-label { font-family: var(--font-mono); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: var(--s-sm); }
.trinity-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.trinity-body { font-size: .9rem; color: var(--text-muted); }

.modcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-lg); margin-bottom: var(--s-md); }
.modcard-label { font-family: var(--font-mono); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 6px; }
.modcard-title { font-weight: 600; color: var(--accent); margin-bottom: var(--s-sm); }
.modcard-body { font-size: .9rem; color: var(--text-muted); }
.modcard-body p + p { margin-top: var(--s-sm); }

.maxim { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-lg) var(--s-xl); margin: var(--s-lg) 0; }
.maxim-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-xs) var(--s-md); margin-bottom: var(--s-sm); }
.maxim-id { font-family: var(--font-mono); font-size: .95rem; font-weight: 700; color: var(--accent); }
.maxim-name { font-weight: 600; color: var(--text); }
.maxim-domain { margin-left: auto; font-family: var(--font-mono); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.maxim-sub { font-family: var(--font-mono); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin: var(--s-md) 0 6px; }
.maxim-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.maxim-list li { font-size: .9rem; color: var(--text-muted); padding-left: 1.2rem; position: relative; }
.maxim-list li::before { content: "·"; position: absolute; left: .2rem; color: var(--accent); font-weight: 700; }
.maxim-list li.anti::before { content: "∉"; font-family: var(--font-mono); font-size: .72rem; top: .1em; }
.maxim-list .c { font-family: var(--font-mono); font-weight: 600; color: var(--text); margin-right: .2rem; }
.maxim-list .g { color: var(--text-dim); }
.maxim-list code { font-size: .82rem; }
.reflex { display: grid; gap: 6px; margin-top: var(--s-lg); }
.reflex-row { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-md); align-items: baseline; padding: 8px var(--s-md); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface); }
.reflex-row .r-tag { font-family: var(--font-mono); font-size: .62rem; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.reflex-row .r-body { font-size: .9rem; color: var(--text-muted); }
.reflex-row .r-body code { background: none; border: none; padding: 0; font-size: .85rem; }
.reflex-row.derived { border-left: 3px solid var(--accent); }
.reflex-row.derived .r-tag { color: var(--accent); }
.reflex-row.derived .r-body code { color: var(--text); }
.reflex-row.naive { border-left: 3px solid var(--border-hi); }
.reflex-row.naive .r-tag { color: var(--text-dim); }
.reflex-row.naive .r-body code { color: var(--text-dim); text-decoration: line-through; text-decoration-color: var(--text-dim); }

/* ── v17 info-boxes (.ib) ────────────────────────────────── */
.ib { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid; margin: 10px 0; font-size: .9rem; line-height: 1.5; }
.ib .ico, .ib .ib-icon { font-size: 1rem; flex-shrink: 0; }
.ib .bd, .ib .ib-body { color: var(--text-muted); }
.ib .bd strong, .ib .ib-body strong { color: var(--text); }
.ib.note  { background: rgba(6,182,212,0.07);   border-color: rgba(6,182,212,0.25); }
.ib.warn  { background: rgba(245,158,11,0.07);  border-color: rgba(245,158,11,0.25); }
.ib.tip   { background: rgba(16,185,129,0.07);  border-color: rgba(16,185,129,0.25); }
.ib.stack, .ib.new { background: rgba(232,93,4,0.07); border-color: rgba(232,93,4,0.28); }

/* ── v17 flow nodes (.flow / .fn) ────────────────────────── */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 12px 0; }
.fn { padding: 7px 13px; border-radius: 7px; font-size: .78rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; color: var(--text-muted); }
.fn.a { background: rgba(232,93,4,0.08);   border-color: rgba(232,93,4,0.30);   color: var(--accent-hover); }
.fn.t { background: rgba(6,182,212,0.08);   border-color: rgba(6,182,212,0.25);  color: #06b6d4; }
.fn.g { background: rgba(16,185,129,0.08);  border-color: rgba(16,185,129,0.25); color: #10b981; }
.fn.o { background: rgba(245,158,11,0.08);  border-color: rgba(245,158,11,0.25); color: #f59e0b; }
.fa { padding: 0 5px; color: var(--text-dim); font-size: .9rem; }

@media (max-width: 640px) { .compare-wrap, .trinity { grid-template-columns: 1fr; } .maxim { padding: var(--s-lg); } }

/* Per-document footer nav */
.doc-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-md); margin-top: var(--s-2xl); padding-top: var(--s-lg); border-top: 1px solid var(--border); }
.doc-nav .idx { font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); transition: color var(--dur) var(--ease); }
.doc-nav .idx:hover { color: var(--accent); }

/* Tag-filter bar */
.doc-filter { display: flex; flex-wrap: wrap; gap: var(--s-sm); justify-content: center; margin-bottom: var(--s-xl); }
.tag-filter { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.tag-filter:hover { color: var(--accent); border-color: var(--accent); }
.tag-filter.is-active { color: var(--accent-on); background: var(--accent); border-color: var(--accent); }
.doc-card[hidden] { display: none; }
