:root {
  --ink: #272727;
  --muted: #5c5c5c;
  --line: #e4e4e4;
  --line-strong: #272727;
  --bg: #ffffff;
  --hover: #f6f6f6;
  --header: 64px;
  --nav: 248px;
  --toc: 196px;
  --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

body {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr) var(--toc);
  grid-template-rows: var(--header) minmax(0, 1fr);
  height: 100%;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.site-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.menu-button {
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
}

.site-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.01em;
}

.site-name span {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav {
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 8px 0 28px;
}

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

.site-nav a {
  display: block;
  padding: 6px 16px 6px 16px;
  margin-left: 0;
  border-left: 2px solid transparent;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}

.site-nav a:hover { background: var(--hover); }

.site-nav a.is-current {
  border-left-color: var(--ink);
  font-weight: 600;
}

.nav-foot {
  margin: 28px 18px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.site-main {
  overflow: auto;
  min-width: 0;
}

.site-toc {
  overflow: auto;
  border-left: 1px solid var(--line);
  padding: 28px 16px 40px;
}

.site-toc p {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-toc a {
  display: block;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  padding: 5px 0;
}

.site-toc a:hover { color: var(--ink); }

.js [data-page] { display: none; }
.js [data-page].is-active { display: block; }

article {
  max-width: 760px;
  padding: 40px 48px 80px;
}

h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.5;
}

h2 {
  margin: 40px 0 10px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  scroll-margin-top: 16px;
}

h3 {
  margin: 22px 0 6px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

p { margin: 0 0 12px; }

ul, ol { margin: 0 0 14px; padding-left: 1.2em; }
li { margin: 0 0 6px; }
li > ul, li > ol { margin-top: 6px; }

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

figure {
  margin: 20px 0 8px;
  padding: 0;
}

figcaption {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.bands { margin: 8px 0 4px; }

.band {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px 16px;
  padding: 16px 0;
  border-top: 1px solid var(--ink);
}

.band-name {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nodes a {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.3;
  background: var(--bg);
}

.nodes a:hover { background: var(--hover); }

.nodes a small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.table-wrap { overflow-x: auto; margin: 8px 0 16px; }
#composer-edit-examples { margin-top: 36px; }
.table-wrap table { margin: 0; }

.criteria th:nth-child(1),
.criteria td:nth-child(1) {
  width: 4.75rem;
  white-space: nowrap;
}

.criteria th:nth-child(2),
.criteria td:nth-child(2) {
  width: 6.5rem;
  white-space: nowrap;
}

.criteria th:nth-child(3),
.criteria td:nth-child(3) {
  width: 8.75rem;
  white-space: nowrap;
}

.checks th:nth-child(2),
.checks td:nth-child(2),
.checks th:nth-child(3),
.checks td:nth-child(3) {
  width: 6.5rem;
  white-space: nowrap;
}

tr.is-required td { background: #e7f0e8; }
tr.is-optional td { background: #f4efe6; }

.row-key {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.poc-mark {
  display: inline-block;
  padding: 1px 8px;
  color: var(--ink);
  font-weight: 600;
}

.poc-mark.is-required { background: #e7f0e8; }
.poc-mark.is-optional { background: #f4efe6; }

.editors td:first-child {
  width: 11.5rem;
  font-weight: 600;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: 14px;
  line-height: 1.45;
}

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding: 6px 12px 8px 0;
  vertical-align: bottom;
}

td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 10px 0;
  vertical-align: top;
}

.steps {
  list-style: none;
  margin: 8px 0 16px;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  counter-increment: step;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 3px;
}

.steps { counter-reset: step; }

.steps h3 { margin: 0 0 6px; }

.steps p { margin: 0 0 6px; font-size: 15px; }

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

.process {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
  border-left: 1px solid var(--ink);
}

.process li {
  position: relative;
  margin: 0;
  padding: 0 0 16px 18px;
}

.process li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--bg);
  border: 1px solid var(--ink);
}

.process strong { font-weight: 600; }

.process .who {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.diagram-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--bg);
  width: calc(100vw - var(--nav) - var(--toc) - 72px);
  max-width: 1040px;
}

.diagram-scroll svg {
  display: block;
  height: auto;
}

.diagram-scroll .system-map { width: 100%; min-width: 760px; }
.diagram-scroll .composer-graph { width: 100%; min-width: 640px; }
.diagram-scroll .editor-graph { width: 100%; min-width: 520px; }

.map-box, .graph-node { cursor: pointer; }
.map-box rect, .graph-node > rect.node-face {
  fill: var(--bg);
  stroke: #c8c8c8;
  stroke-width: 1;
}
.map-box.is-active rect, .graph-node.is-active > rect.node-face {
  fill: var(--hover);
  stroke: var(--ink);
  stroke-width: 1.6;
}
.graph-node > rect.kind-bar {
  stroke: none;
}
.map-edge { fill: none; stroke: #b5b5b5; stroke-width: 1.2; }
.map-edge.is-hot { stroke: var(--ink); stroke-width: 1.8; }
.map-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  fill: #5c5c5c;
  stroke: #ffffff;
  stroke-width: 3px;
  paint-order: stroke fill;
  stroke-linejoin: round;
}
.map-edge.is-hot .map-label {
  fill: var(--ink);
  font-weight: 400;
}
.map-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.map-sub { font-size: 11px; fill: var(--muted); }
.map-num { font-size: 11px; fill: #a3a3a3; }
.band-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: var(--muted);
}

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.graph-node text {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink);
}

.diagram-detail {
  border: 1px solid var(--line);
  padding: 12px 14px 4px;
  min-height: 132px;
}

.diagram-detail h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.diagram-detail p { font-size: 14px; }
.diagram-detail a { text-decoration: underline; text-underline-offset: 2px; }

.legend-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.swatch {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.swatch-line {
  width: 16px;
  height: 0;
  border-top: 1.5px dashed var(--ink);
}

.kind-code { background: #8a8a8a; }
.kind-jev { background: #3d6fbf; }
.kind-luna { background: #7a4e9a; }
.kind-vision { background: #c47a2c; }
.kind-output { background: #3d7a52; }
.kind-ml { background: #4f8a8b; }
.kind-agent { background: #7a4e9a; }
.kind-gate { background: #b0413e; }

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--bg);
}

figure a:has(img) { display: block; }

figcaption strong { color: var(--ink); font-weight: 600; }

.render-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px 24px;
  margin: 12px 0 20px;
}

.render-grid figure { margin: 0; }

.render-key { font-size: 14px; }
.render-key li { margin-bottom: 4px; }

.figure-narrow { max-width: 480px; }

.platform-map {
  display: grid;
  grid-template-columns: 0.9fr 0.7fr 1.35fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.platform-group {
  border: 1px solid var(--line);
  padding: 12px 12px 4px;
}

.platform-core { border-color: var(--ink); }

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

.platform-box {
  border: 1px solid var(--ink);
  padding: 8px 10px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.platform-group p:last-child { font-size: 14px; }

.legend { list-style: none; margin: 0; padding: 0; }
.legend li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
}
.legend b { font-family: var(--mono); font-weight: 400; font-size: 12px; }

.callout {
  margin: 16px 0;
  padding: 12px 0 12px 14px;
  border-left: 2px solid var(--ink);
  font-size: 15px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
}

.nav-backdrop {
  display: none;
}

#theory { max-width: 1040px; }

#theory .theory-grid,
#theory .theory-six {
  display: grid;
  align-items: start;
  min-width: 0;
}

#theory .theory-foundations {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

#theory .theory-elements {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

#theory .theory-card {
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 20px 20px 16px;
  min-width: 0;
}

#theory .theory-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

#theory .theory-field { margin-top: 14px; }

#theory .theory-label {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

#theory .theory-value > p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

#theory .theory-value > p + p { margin-top: 10px; }

#theory .theory-value ul,
#theory .theory-value ol {
  margin: 0;
  padding-left: 1.15em;
  font-size: 15px;
  line-height: 1.45;
}

#theory .theory-value li { margin: 0 0 4px; }
#theory .theory-value li:last-child { margin-bottom: 0; }

#theory-method { scroll-margin-top: 16px; }

#theory .theory-glance {
  margin-top: 28px;
  padding: 28px 24px 24px;
  container-type: inline-size;
  container-name: theory-glance;
}

#theory .theory-glance .kicker { margin-bottom: 6px; }

#theory .theory-glance h2 { margin: 0 0 20px; }

#theory .theory-six {
  grid-template-columns: 1fr;
  gap: 20px;
}

@container theory-glance (min-width: 640px) {
  #theory .theory-six {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    gap: 20px 36px;
  }
}

#theory .theory-six h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

#theory .theory-six p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 1080px) {
  body { grid-template-columns: var(--nav) minmax(0, 1fr); }
  .site-toc { display: none; }
  .diagram-scroll { width: calc(100vw - var(--nav) - 56px); }
}

@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .menu-button { display: inline-block; }
  .site-nav {
    display: none;
    position: fixed;
    z-index: 3;
    top: var(--header);
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    background: var(--bg);
    border-right: 1px solid var(--line);
  }
  .site-nav.is-open { display: block; }
  .nav-backdrop.is-open {
    display: block;
    position: fixed;
    z-index: 2;
    inset: var(--header) 0 0 0;
    background: rgba(39, 39, 39, 0.2);
  }
  article { padding: 28px 20px 64px; }
  h1 { font-size: 36px; }
  .band, .platform-map { grid-template-columns: 1fr; }
  .diagram-scroll { width: calc(100vw - 40px); max-width: none; }
}
