
/* ============================================================
   Sections & typography
   ============================================================ */
section {
  margin-top: 88px;
  scroll-margin-top: 100px;
}
section:first-of-type { margin-top: 0; }

.section-head {
  margin-bottom: 32px;
  max-width: 64ch;
}
.section-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--orange);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  font-weight: 500;
}
h2.section {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 14px;
  text-wrap: balance;
}
.section-head .deck {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-soft);
  max-width: 60ch;
}

h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: -0.005em;
}

p { color: var(--text-soft); max-width: 64ch; font-size: 15.5px; }
p + p { margin-top: 12px; }
p strong { color: var(--text); font-weight: 600; }

a { color: var(--orange); }

code, .mono { font-family: var(--mono); font-size: 0.9em; }
code:not(pre code) {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--navy);
  font-size: 0.85em;
}

ul.bullets {
  list-style: none;
  margin-top: 10px;
}
ul.bullets li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.55;
}
ul.bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 11px;
  width: 12px; height: 1.5px;
  background: var(--orange);
}
ul.bullets li strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Cards & layout helpers
   ============================================================ */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
}
.card.tinted {
  background: var(--surface);
  border-color: var(--border);
}
.card.featured {
  border-left: 3px solid var(--orange);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 880px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.callout {
  border-left: 3px solid var(--orange);
  background: var(--orange-soft);
  padding: 18px 22px;
  margin: 22px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.callout p { color: var(--text); max-width: none; }
.callout strong { color: var(--orange); font-weight: 600; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tag.navy { background: var(--navy-soft); color: var(--navy); }
.tag.orange { background: var(--orange-soft); color: var(--orange); }
.tag.pass { background: var(--pass-soft); color: var(--pass); }
.tag.fail { background: var(--fail-soft); color: var(--fail); }

/* ============================================================
   Pipeline stages strip
   ============================================================ */
.pipeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.pipeline .stage {
  padding: 22px 18px 20px;
  border-right: 1px solid var(--border);
  position: relative;
}
.pipeline .stage:last-child { border-right: 0; }
.pipeline .stage .n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--orange);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.pipeline .stage .t {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.15;
}
.pipeline .stage .d {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}
@media (max-width: 1000px) {
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .pipeline .stage:nth-child(3) { border-right: 0; }
  .pipeline .stage:nth-child(1), .pipeline .stage:nth-child(2), .pipeline .stage:nth-child(3) {
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 600px) {
  .pipeline { grid-template-columns: 1fr 1fr; }
  .pipeline .stage { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .pipeline .stage:nth-child(2n) { border-right: 0; }
  .pipeline .stage:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ============================================================
   Bands / similarity table
   ============================================================ */
.bands {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.bands table { width: 100%; border-collapse: collapse; }
.bands th, .bands td {
  text-align: left;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.bands th {
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bands tr:last-child td { border-bottom: 0; }
.bands td:first-child {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--navy);
  font-weight: 500;
  white-space: nowrap;
  width: 130px;
}
.bands td.status {
  font-weight: 600;
  width: 140px;
}
.bands tr.green td.status { color: var(--pass); }
.bands tr.amber td.status { color: var(--orange); }
.bands tr.red td.status { color: var(--fail); }
.bands tr.green td:first-child { border-left: 3px solid var(--pass); }
.bands tr.amber td:first-child { border-left: 3px solid var(--orange); }
.bands tr.red td:first-child { border-left: 3px solid var(--fail); }

/* ============================================================
   Diagram (light theme override)
   ============================================================ */
.diagram-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}
@media (max-width: 980px) { .diagram-wrap { grid-template-columns: 1fr; } }

.diagram-canvas {
  background: var(--surface);
  padding: 28px 24px;
  min-height: 520px;
  min-width: 0;
  position: relative;
  border-right: 1px solid var(--border);
}
@media (max-width: 980px) { .diagram-canvas { border-right: 0; border-bottom: 1px solid var(--border); } }
.diagram-canvas svg { width: 100%; height: auto; display: block; }

.node { cursor: pointer; transition: filter 120ms; }
.node:hover .node-fill { stroke: var(--orange); }
.node.selected .node-fill { stroke: var(--orange); stroke-width: 2px; }
.node-fill {
  fill: var(--bg);
  stroke: var(--navy-line);
  stroke-width: 1.2;
  transition: stroke 120ms;
}
.node.diamond .node-fill { fill: var(--navy-soft); stroke: var(--navy-line); }
.node.terminal .node-fill { fill: var(--orange-soft); stroke: var(--orange-line); }
.node.pass-tone .node-fill { fill: var(--pass-soft); stroke: rgba(47, 158, 108, 0.4); }
.node.fail-tone .node-fill { fill: var(--fail-soft); stroke: rgba(217, 74, 61, 0.4); }
.node.amber-tone .node-fill { fill: var(--orange-soft); stroke: var(--orange-line); }
.node-label {
  fill: var(--navy);
  font-family: var(--sans);
  font-size: 12px;
  pointer-events: none;
  user-select: none;
  font-weight: 600;
}
.node-label-sub {
  fill: var(--text-muted);
  font-family: var(--sans);
  font-size: 10px;
  pointer-events: none;
  user-select: none;
}
.edge {
  fill: none;
  stroke: #b6bdcf;
  stroke-width: 1.3;
  marker-end: url(#arrow);
}
.edge-label {
  fill: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  pointer-events: none;
  user-select: none;
}
.lane-bg { fill: var(--navy); stroke: var(--navy-deep); }
.lane-title { fill: #fff; font-family: var(--sans); font-size: 11px; font-weight: 600; }
.lifeline { stroke: var(--navy-line); stroke-width: 1; stroke-dasharray: 3 3; }
.msg-line { stroke: var(--text-muted); stroke-width: 1.2; }
.msg-label { fill: var(--text); font-family: var(--sans); font-size: 11px; }
.frame { fill: none; stroke: var(--orange-line); stroke-width: 1; stroke-dasharray: 4 3; }
.frame-tag { fill: var(--orange); font-family: var(--mono); font-size: 9.5px; font-weight: 700; }

/* Detail panel beside diagram */
.diagram-detail {
  padding: 24px 26px;
  background: var(--surface);
  font-size: 14.5px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
}
.diagram-detail .empty { color: var(--text-muted); font-style: italic; }
.diagram-detail .role {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--orange);
  margin-bottom: 8px;
  font-weight: 600;
}
.diagram-detail h4 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.diagram-detail p { color: var(--text-soft); font-size: 14.5px; max-width: none; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-chip {
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* ============================================================
   Personas
   ============================================================ */
.persona {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.persona::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--navy);
}
.persona.commercial::before { background: var(--orange); }
.persona.adversary::before { background: var(--fail); }
.persona .p-role {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--navy);
  font-weight: 600;
}
.persona.commercial .p-role { color: var(--orange); }
.persona.adversary .p-role { color: var(--fail); }
.persona .p-name {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--navy);
  font-weight: 500;
}
.persona .p-job {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.persona .p-out {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* ============================================================
   Formula
   ============================================================ */
.formula-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 32px;
  text-align: center;
  margin: 24px 0;
}
.formula-stage .formula {
  font-family: var(--serif);
  font-style: italic;
  font-size: 52px;
  letter-spacing: -0.01em;
  color: var(--navy);
  line-height: 1.1;
  font-weight: 500;
}
.formula-stage .formula em { color: var(--orange); font-style: italic; }
.formula-stage .formula sub { font-size: 0.55em; opacity: 0.85; }
.formula-stage .key {
  margin-top: 22px;
  color: var(--text-soft);
  font-size: 14px;
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}
.formula-stage .key strong { color: var(--navy); font-weight: 700; margin-right: 4px; }

/* ============================================================
   Data model table
   ============================================================ */
.data-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.data-table th {
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child {
  font-family: var(--mono);
  color: var(--navy);
  font-weight: 500;
  white-space: nowrap;
}
.data-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--orange);
}
.data-table td:last-child { color: var(--text-soft); }

/* ============================================================
   Footer
   ============================================================ */
.doc-foot {
  margin-top: 120px;
  padding-top: 36px;
  border-top: 2px solid var(--orange);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 22px;
}
.doc-foot .left {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.doc-foot .left .sub {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
}
.doc-foot .right {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: right;
}
.doc-foot .right strong { color: var(--navy); font-weight: 600; }

/* Helpers */
.muted { color: var(--text-muted); }
.amber { color: var(--orange); }
.navy { color: var(--navy); }
.mint { color: var(--pass); }
.coral { color: var(--fail); }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 36px; }
