/* Keyne Digital Assets — redesign. Mobile-first, one layout. */
:root {
  --bg: #07090d;
  --bg-elev: #10141c;
  --bg-soft: #1a2233;
  --text: #edf1f6;
  --muted: #9aa6b5;
  --faint: #6d7a8a;
  --line: rgba(126, 200, 255, 0.28);
  --line-strong: rgba(126, 200, 255, 0.55);
  --cyan: #7ec8ff;
  --lime: #effe8a;
  --lime-ink: #14160a;
  --danger: #ff9a9a;
  --border: rgba(237, 241, 246, 0.12);
  --header-h: 64px;
  --gutter: 20px;
  --measure: 40rem;
  --wrap: 72rem;
  --font-heading: "Syne", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}
svg { display: block; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--lime); }
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 0.5rem 0.8rem;
  z-index: 100;
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 0.5rem; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

/* ----- Header / nav ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: rgba(7, 9, 13, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.brand-lockup,
.footer-lockup {
  display: block;
  height: 28px;
  width: auto;
  flex: none;
}
.footer-brand {
  display: inline-block;
  margin: 0 0 0.7rem;
  text-decoration: none;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 0;
}
.nav-toggle-bars {
  width: 18px;
  height: 12px;
  position: relative;
  display: block;
}
.nav-toggle-bars span,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.2s var(--ease), opacity 0.2s;
}
.nav-toggle-bars span { top: 5px; }
.nav-toggle-bars::before { top: 0; }
.nav-toggle-bars::after { bottom: 0; }
body.nav-open .nav-toggle-bars span { opacity: 0; }
body.nav-open .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
body.nav-open .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
}
body.nav-open .nav-backdrop { display: block !important; }

.site-nav {
  display: none;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--lime); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--lime); }

/* Mobile panel — fills the remaining viewport so page content cannot peek through */
@media (max-width: 879px) {
  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100svh - var(--header-h));
    background: var(--bg-elev);
    border-bottom: 0;
    z-index: 36;
    padding: 0.5rem 0 1.5rem;
    overflow: auto;
  }
  body.nav-open .site-nav { display: block; }
  .site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .site-nav li a {
    display: block;
    padding: 0.9rem var(--gutter);
    border-bottom: 1px solid var(--border);
  }
}

@media (min-width: 880px) {
  .nav-toggle, .nav-backdrop { display: none !important; }
  .site-nav {
    display: block;
    position: static;
    background: none;
    border: 0;
    padding: 0;
  }
  .site-nav ul {
    display: flex;
    gap: 1.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
  }
  .site-nav a {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0;
  }
}


/* Language switcher — always visible in the header; repeated in the mobile menu */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lang-switch a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.15rem;
}
.lang-switch a:hover,
.lang-switch a[aria-current="true"] {
  color: var(--lime);
}
.lang-switch--header {
  margin-left: auto;
}
.lang-switch--menu {
  display: none;
}
@media (max-width: 879px) {
  .lang-switch--header {
    margin-right: 0.35rem;
  }
  .lang-switch--menu {
    display: flex;
    padding: 1rem var(--gutter) 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }
}
@media (min-width: 880px) {
  .header-inner { justify-content: flex-start; }
  .site-nav { margin-left: auto; order: 2; }
  .lang-switch--header {
    margin-left: 1.25rem;
    order: 3;
  }
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.8rem 1.15rem;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.25;
}
.btn-solid {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
}
.btn-solid:hover { filter: brightness(1.05); color: var(--lime-ink); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--lime);
  color: var(--lime);
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ----- Hero ----- */
.hero {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}
.hero-visual {
  background: #02040a;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 18% center;
}
.hero-copy {
  padding: 2rem var(--gutter) 2.5rem;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 0.85rem;
}
.hero-copy h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2rem, 8vw, 3.6rem);
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  padding-bottom: 0.12em;
  overflow: visible;
}
.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 32rem;
  margin: 0 0 1.5rem;
}

@media (min-width: 880px) {
  :root { --gutter: 32px; --header-h: 72px; }
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
    min-height: calc(100svh - var(--header-h));
    align-items: stretch;
  }
  .hero-visual {
    aspect-ratio: auto;
    min-height: 100%;
  }
  .hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3rem 3rem 2rem;
    background:
      linear-gradient(90deg, rgba(7,9,13,0) 0%, var(--bg) 18%),
      var(--bg);
    margin-left: -4rem;
    position: relative;
    z-index: 1;
  }
}

@media (min-width: 1280px) {
  :root { --gutter: 48px; }
  .hero-copy { padding-right: 4rem; margin-left: -6rem; }
  .hero-copy h1 { font-size: clamp(3rem, 5vw, 4.25rem); }
}

/* ----- Sections ----- */
.section {
  padding: 3.25rem 0;
  border-bottom: 1px solid var(--border);
}
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 0.6rem;
}
.section h2, .page-title {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin: 0 0 1rem;
  padding-bottom: 0.12em;
  overflow: visible;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}
.section .deck, .page-deck {
  color: var(--muted);
  max-width: 40rem;
  margin: 0 0 1.75rem;
  font-size: 1.12rem;
}

.page-hero {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
.page-hero .page-title { margin-bottom: 0.6rem; }

/* Cards / grids */
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .card-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 1.35rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
a.card:hover {
  border-color: var(--line-strong);
  color: inherit;
}
.card h3 {
  font-family: var(--font-heading);
  font-weight: 650;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  padding-bottom: 0.15em;
  overflow: visible;
  color: var(--text);
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.card .more {
  margin-top: auto;
  padding-top: 0.8rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--cyan);
}

.flag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime-ink);
  background: var(--lime);
  padding: 0.18rem 0.45rem;
  margin-bottom: 0.35rem;
  width: max-content;
}
.flag-quiet {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--line);
}

.split {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 880px) {
  .split { grid-template-columns: 1fr 1fr; align-items: start; gap: 3rem; }
}

.prose {
  max-width: var(--measure);
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2rem 0 0.8rem;
}
.prose h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-top: 0; }
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose li { color: var(--text); }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1rem; }
.prose figure {
  margin: 1.4rem 0;
}
.prose figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  margin-top: 0.5rem;
}
.prose img, .prose video {
  width: 100%;
  height: auto;
  background: #000;
}
.essay-layout .prose img,
.essay-layout .prose video {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.values dt {
  font-family: var(--font-heading);
  font-weight: 650;
  margin: 1.1rem 0 0.25rem;
}
.values dd {
  margin: 0;
  color: var(--muted);
}

/* Forms */
form { display: grid; gap: 0.85rem; max-width: 32rem; }
label {
  display: grid;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
}
input, textarea {
  font: inherit;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.7rem 0.75rem;
  width: 100%;
  border-radius: 0;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 0;
  border-color: var(--cyan);
}
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}
.form-error { color: var(--danger); font-size: 0.92rem; margin: 0; min-height: 1.2em; }
.form-success {
  display: none;
  color: var(--lime);
  font-family: var(--font-heading);
  font-weight: 600;
}
.form-success.is-visible { display: block; }
.contact-lines {
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.contact-lines a { color: var(--text); }

/* Footer */
.site-footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-grid {
  display: grid;
  gap: 1.75rem;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.site-footer h2 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 0.7rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 0.4rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--lime); }
.social {
  display: flex;
  gap: 1rem;
  margin: 0.8rem 0 0;
}
.legal {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--faint);
}

/* Utilities */
.note {
  border-left: 2px solid var(--lime);
  padding: 0.2rem 0 0.2rem 1rem;
  color: var(--muted);
  margin: 1rem 0 0;
}
.crumbs {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  margin: 0 0 1rem;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--lime); }

.essay-layout {
  padding: 2rem 0 4rem;
}
.essay-layout .prose { margin-inline: auto; }

body.nav-open { overflow: hidden; }

/* 404 */
.not-found { padding: 5rem 0 6rem; }


/* Hacker Bible */
.kb-callout , .hb-callout {
  border: 1px solid var(--border);
  border-left: 2px solid var(--lime);
  background: var(--bg-elev);
  padding: 1.15rem 1.25rem 1.25rem;
  margin: 1.75rem 0;
}
.kb-callout .flag , .hb-callout .flag { margin-bottom: 0.55rem; }
.kb-callout p:last-child , .hb-callout p:last-child { margin-bottom: 0; }
.kb-toc , .hb-toc {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 800px) {
  .kb-toc , .hb-toc { grid-template-columns: 1fr 1fr; }
}
.kb-toc h2 , .hb-toc h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
.kb-toc ul , .hb-toc ul { list-style: none; margin: 0; padding: 0; }
.kb-toc li , .hb-toc li { margin: 0 0 0.35rem; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.4rem;
  font-size: 0.95rem;
}
.prose th, .prose td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.6rem 0.45rem 0;
}
.prose th { font-family: var(--font-heading); font-weight: 650; color: var(--cyan); }
.prose blockquote {
  margin: 1rem 0 1.3rem;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
}
.prose pre, .prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.prose pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  max-width: 100%;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }
.kb-missing-shot , .hb-missing-shot {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  margin: 0.4rem 0 0.8rem;
}
.kb-chapter-nav , .hb-chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 2.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.4rem;
}
.essay-layout .wrap, .prose {
  min-width: 0;
  max-width: 100%;
}
.prose pre {
  overflow-x: auto;
  max-width: 100%;
}
.prose .table-wrap table { margin: 0; }
.prose code, .prose td, .prose th {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Keep long code and tables inside the phone column without widening the page */
.prose pre,
.prose .table-wrap,
.essay-layout .prose {
  max-width: calc(100vw - 2 * var(--gutter));
}
.prose pre {
  overflow-x: auto;
  white-space: pre;
}
.prose pre code {
  display: block;
  width: max-content;
  max-width: none;
  overflow-wrap: normal;
  word-break: normal;
  white-space: pre;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose p, .prose li, .prose a {
  overflow-wrap: anywhere;
  word-break: break-word;
}
html, body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
/* layout-system: one container, one rhythm, one measure (2026-11-13) */
:root {
  --wrap: 75rem;
  --gutter: clamp(20px, 5vw, 64px);
  --measure: 68ch;
  --space-section: clamp(56px, 8vw, 112px);
  --space-hero-top: clamp(48px, 6vw, 96px);
  --space-hero-bottom: clamp(36px, 4.5vw, 64px);
  --space-block: clamp(40px, 5vw, 72px);
}
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.section { padding-block: var(--space-section); }
.page-hero { padding-block: var(--space-hero-top) var(--space-hero-bottom); }
.not-found { padding-block: var(--space-section); }
.essay-layout { padding-block: var(--space-hero-top) var(--space-section); }
.site-footer { padding-block: var(--space-block) clamp(32px, 4vw, 48px); }

/* Measure: lead, body and prose share the same left edge and max width */
.page-deck, .section .deck,
.wrap > p, .wrap > ul, .wrap > ol, .wrap > blockquote,
.split > div > p, .split > div > ul { max-width: var(--measure); }
.wrap.prose, .essay-layout .wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); max-width: none; margin-inline: auto; }
.prose, .essay-layout .prose { max-width: var(--measure); margin-inline: 0; }
.wrap.prose { max-width: none; }
.wrap.prose > *, .essay-layout .prose > * { max-width: var(--measure); }
.prose > .table-wrap, .prose > pre, .prose > .kb-diagram, .prose > figure,
.wrap.prose > .table-wrap, .wrap.prose > pre, .wrap.prose > .kb-diagram, .wrap.prose > figure { max-width: 100%; }
.essay-layout .prose { max-width: var(--measure); }

/* Headings and blocks that follow a grid get real section spacing */
.card-grid + *, .split + *, .kb-toc + * { margin-top: var(--space-block); }
.wrap > h2:not(:first-child), .prose > h2:not(:first-child) { margin-top: var(--space-block); }
.wrap > .section-kicker + h2 { margin-top: 0; }
.page-hero .section-kicker, .page-hero .crumbs { margin-bottom: 0.75rem; }
.page-deck { margin-bottom: 0; }
.section .deck { margin-bottom: clamp(28px, 3vw, 40px); }

/* Equal-height cards */
.card-grid { gap: clamp(16px, 2vw, 24px); align-items: stretch; grid-template-columns: 1fr; }
.card-grid > .card { height: 100%; }
.card p { flex: 0 0 auto; }
@media (min-width: 640px) {
  .card-grid.cols-2, .card-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.cols-3 { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .card-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.split { gap: clamp(32px, 5vw, 64px); }

/* CTA spacing */
.wrap > p > .btn:only-child, .prose > p > .btn:only-child { margin-top: 0.5rem; }
p:has(> .btn:only-child) { margin-top: clamp(24px, 3vw, 36px); }

/* Long code/tables stay inside the container, not the viewport */
.prose pre, .prose .table-wrap { max-width: 100%; }
/* /layout-system */
/* page-toc: "On this page" side index for long pages (2026-11-13) */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.doc-grid .prose h2[id], .doc-grid .prose h3[id] { scroll-margin-top: calc(var(--header-h) + 1.25rem); }
.doc-main { min-width: 0; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: 0.86rem;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.toc-list .toc-sub a { padding-left: 1.75rem; font-size: 0.8rem; }
.toc-list a:hover, .toc-list a:focus-visible { color: var(--text); }
.toc-list a.is-active { color: var(--cyan); border-left-color: var(--cyan); }
.toc-title, .toc-inline > summary {
  margin: 0 0 0.6rem;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc-inline {
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}
.toc-inline > summary { margin: 0; cursor: pointer; }
.toc-inline[open] > summary { margin-bottom: 0.75rem; }
.toc-inline .toc-list { max-height: 60vh; overflow-y: auto; border-left: 1px solid var(--line); }
.toc-side { display: none; }
.back-to-top { max-width: var(--measure); margin: 2.5rem 0 0; font-family: var(--font-heading); font-size: 0.9rem; }
.back-to-top a { color: var(--muted); text-decoration: none; }
.back-to-top a:hover { color: var(--text); }
@media (min-width: 1100px) {
  .doc-grid {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) 240px;
    justify-content: space-between;
    column-gap: clamp(40px, 5vw, 80px);
    align-items: start;
  }
  .toc-inline { display: none; }
  .toc-side {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    max-height: calc(100vh - var(--header-h) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-left: 0.25rem;
    border-left: 1px solid var(--line);
  }
  .toc-side .toc-title { padding-left: 0.85rem; }
  .toc-side .toc-list a { margin-left: -1px; }
}.prose .anchor-alias { display:block; position:relative; top:calc(-1 * (var(--header-h) + 1.25rem)); visibility:hidden; height:0; }
/* scrollbars: thin brand-palette bars (2026-11-13) */
:root {
  color-scheme: dark;
  --scrollbar-size: 8px;
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(237, 241, 246, 0.22);
  --scrollbar-thumb-hover: var(--cyan);
}
html,
.toc-side,
.toc-inline .toc-list,
.prose pre,
.table-wrap,
.kb-diagram-scroll,
.prose .math-display {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
html:hover,
.toc-side:hover,
.toc-inline .toc-list:hover,
.prose pre:hover,
.table-wrap:hover,
.kb-diagram-scroll:hover,
.prose .math-display:hover {
  scrollbar-color: var(--scrollbar-thumb-hover) var(--scrollbar-track);
}
html::-webkit-scrollbar,
.toc-side::-webkit-scrollbar,
.toc-inline .toc-list::-webkit-scrollbar,
.prose pre::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.kb-diagram-scroll::-webkit-scrollbar,
.prose .math-display::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}
html::-webkit-scrollbar-track,
.toc-side::-webkit-scrollbar-track,
.toc-inline .toc-list::-webkit-scrollbar-track,
.prose pre::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.kb-diagram-scroll::-webkit-scrollbar-track,
.prose .math-display::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
html::-webkit-scrollbar-thumb,
.toc-side::-webkit-scrollbar-thumb,
.toc-inline .toc-list::-webkit-scrollbar-thumb,
.prose pre::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.kb-diagram-scroll::-webkit-scrollbar-thumb,
.prose .math-display::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover,
.toc-side::-webkit-scrollbar-thumb:hover,
.toc-inline .toc-list::-webkit-scrollbar-thumb:hover,
.prose pre::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.kb-diagram-scroll::-webkit-scrollbar-thumb:hover,
.prose .math-display::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
html::-webkit-scrollbar-corner,
.toc-side::-webkit-scrollbar-corner,
.toc-inline .toc-list::-webkit-scrollbar-corner,
.prose pre::-webkit-scrollbar-corner,
.table-wrap::-webkit-scrollbar-corner,
.kb-diagram-scroll::-webkit-scrollbar-corner,
.prose .math-display::-webkit-scrollbar-corner {
  background: transparent;
}
/* /scrollbars */

/* math: build-time KaTeX (HTML+MathML), dark theme, long equations scroll */
.prose .math-display {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  margin: 1rem 0 1.25rem;
  padding: 0.35rem 0.25rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.prose .math-display .katex-display { margin: 0; text-align: left; }
.prose .math-display .katex-display > .katex { text-align: left; }
.prose .katex { color: var(--text); font-size: 1.08em; }
.prose .math-inline .katex { font-size: 1.02em; white-space: nowrap; }
.prose .katex .mord.text, .prose .katex .text { color: var(--muted); }

/* wide tables: real column widths, scroll horizontally instead of squeezing */
.prose .table-wrap table { min-width: 100%; }
.prose .table-wrap td, .prose .table-wrap th {
  min-width: 8.5rem;
  overflow-wrap: break-word;
  word-break: normal;
  vertical-align: top;
}
.prose .table-wrap td:first-child, .prose .table-wrap th:first-child { min-width: 2.5rem; }
/* typography-layout-fix: 2026-11-13 */
/* Headings: descenders (g, p, ç, y) must not clip */
h1, h2, h3, h4, h5, h6,
.page-title, .section h2, .hero-copy h1, .card h3,
.site-footer h2, .toc-title, .btn, .brand {
  line-height: 1.25;
  overflow: visible;
}
.hero-copy h1, .page-title, .section h2, .card h3, .prose h1, .prose h2, .prose h3, .prose h4 {
  line-height: 1.25;
  padding-bottom: 0.12em;
  overflow: visible;
}

/* Marketing lead: sit closer to the title, not the 68ch article measure (~450px) */
.page-hero .page-deck, .hero-copy .lede, .lede {
  max-width: min(46rem, 100%);
}

/* Card grids: fill the wrap, equal-height cards, 260px min tracks */
.card-grid,
.card-grid.cols-2,
.card-grid.cols-3,
.card-grid.cols-4 {
  width: 100%;
  max-width: 100%;
  display: grid;
  gap: clamp(16px, 2vw, 24px);
  align-items: stretch;
  grid-auto-rows: 1fr;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .card-grid,
  .card-grid.cols-2,
  .card-grid.cols-3,
  .card-grid.cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}
.card-grid > .card,
.card-grid > a.card {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* KB tables: break out of the 68ch prose measure to the full doc column */
@media (min-width: 1100px) {
  .doc-grid {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}
.doc-main .prose,
.doc-grid .prose,
.essay-layout .doc-main .prose {
  max-width: none;
  width: 100%;
}
.doc-main .prose > *:not(.table-wrap):not(pre):not(figure):not(.kb-diagram):not(.table-cards),
.doc-grid .prose > *:not(.table-wrap):not(pre):not(figure):not(.kb-diagram):not(.table-cards) {
  max-width: var(--measure);
}
.doc-main .prose > .table-wrap,
.doc-main .prose > pre,
.doc-main .prose > figure,
.doc-main .prose > .kb-diagram,
.doc-main .prose > .table-cards,
.doc-grid .prose > .table-wrap,
.doc-grid .prose > pre,
.doc-grid .prose > figure,
.doc-grid .prose > .kb-diagram,
.doc-grid .prose > .table-cards {
  max-width: 100%;
  width: 100%;
}

/* Compact tables: no mid-word breaks; horizontal scroll with a fade hint.
   Index / # columns shrink to content; other columns keep a readable min width. */
.prose .table-wrap {
  position: relative;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.prose .table-wrap table { min-width: 100%; }
.prose code { overflow-wrap: anywhere; word-break: break-word; }
.prose .table-wrap td,
.prose .table-wrap th {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
  min-width: 16ch;
  vertical-align: top;
}
.prose .table-wrap th:first-child,
.prose .table-wrap td:first-child,
.prose .table-wrap .col-index {
  width: 1%;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  padding-right: 0.85rem;
}
/* fade / scroll hint when the table is wider than the wrap */
.prose .table-wrap::after {
  content: "";
  pointer-events: none;
  position: sticky;
  display: block;
  float: right;
  margin-top: -100%;
  height: 100%;
  width: 2.25rem;
  background: linear-gradient(to right, transparent, var(--bg, #07090d));
}

/* Prose-heavy tables rendered as labelled cards */
.table-cards {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  grid-template-columns: 1fr;
  margin: 1rem 0 1.4rem;
}
@media (min-width: 1100px) {
  .table-cards.cards-short { grid-template-columns: 1fr 1fr; }
}
.table-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem 1.15rem;
  min-width: 0;
}
.table-card-head {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  margin: 0 0 0.85rem;
}
.table-card-index {
  font-family: var(--font-heading);
  font-weight: 650;
  color: var(--cyan);
  flex: 0 0 auto;
}
.table-card-title,
.table-card h4 {
  font-family: var(--font-heading);
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.25;
  padding-bottom: 0.08em;
  overflow: visible;
  margin: 0;
  color: var(--text);
}
.table-card dl { margin: 0; display: grid; gap: 0.75rem; }
.table-card dt,
.table-card-label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2rem;
  line-height: 1.25;
  overflow: visible;
  padding-bottom: 0.08em;
}
.table-card dd,
.table-card-value,
.table-card-body {
  margin: 0;
  max-width: none;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Compact tables at ≤640px: stacked label/value cards */
@media (max-width: 640px) {
  .prose .table-wrap table,
  .prose .table-wrap thead,
  .prose .table-wrap tbody,
  .prose .table-wrap th,
  .prose .table-wrap td,
  .prose .table-wrap tr { display: block; width: 100%; min-width: 0 !important; }
  .prose .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .prose .table-wrap tr {
    margin: 0 0 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    background: var(--bg-elev);
  }
  .prose .table-wrap td {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
  }
  .prose .table-wrap td:last-child { border-bottom: 0; }
  .prose .table-wrap th:first-child,
  .prose .table-wrap td:first-child,
  .prose .table-wrap .col-index {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none;
    white-space: normal;
    padding-right: 0;
  }
  .prose .table-wrap td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-heading);
    font-weight: 650;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cyan);
    line-height: 1.25;
    padding-bottom: 0.08em;
    margin-bottom: 0.15rem;
  }
  .prose .table-wrap::after { display: none; }
}
/* kb-diagram: build-time SVG diagrams (scripts/diagrams.py) */
.kb-diagram{margin:1.75rem 0;padding:0;max-width:100%}
.kb-diagram svg{width:100%;height:auto;max-width:100%;display:block}
.kb-diagram-narrow{display:none}
.kb-diagram figcaption{margin-top:.6rem;font-family:Sora,system-ui,sans-serif;font-size:.86rem;color:var(--muted,#9aa6b5)}
.kb-diagram-scroll{overflow-x:auto;border-radius:14px;background:#07090d;-webkit-overflow-scrolling:touch}
.kb-diagram-scroll svg{max-width:none}
@media (max-width:640px){.kb-diagram-wide{display:none}.kb-diagram-narrow{display:block}}
/* /kb-diagram */
