/* ====== Tokens ====== */
:root {
  /* dark hero (from docs/decks/agent-native-delivery.html) */
  --d-bg: #0b0f17; --d-surface: #131a26; --d-border: #283449;
  --d-text: #e9eef6; --d-muted: #94a3b8; --d-dim: #64748b;
  --accent: #2dd4bf; --accent-deep: #0f766e; --amber: #f5b94a;
  /* light editorial */
  --l-bg: #faf8f4; --l-surface: #ffffff; --l-border: #e7e2d8;
  --l-text: #1a1f29; --l-muted: #4b5563; --l-dim: #6b7280;
  --maxw: 760px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--l-bg); color: var(--l-text); font-family: var(--serif); line-height: 1.7; -webkit-font-smoothing: antialiased; }

/* ====== Dark hero ====== */
.hero { background: var(--d-bg); color: var(--d-text); font-family: var(--sans); padding: 9vh 24px 11vh; }
.hero .wrap { max-width: 880px; margin: 0 auto; }
.kicker { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.hero h1 { font-size: clamp(34px, 6vw, 62px); line-height: 1.06; font-weight: 760; letter-spacing: -.02em; margin-top: 18px; }
.hero .lede { font-size: clamp(17px, 2vw, 21px); color: var(--d-muted); max-width: 720px; margin-top: 20px; line-height: 1.55; font-family: var(--sans); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.stat { background: var(--d-surface); border: 1px solid var(--d-border); border-radius: 14px; padding: 22px 20px; }
.stat .n { font-size: clamp(28px, 4vw, 46px); font-weight: 780; letter-spacing: -.02em; line-height: 1; }
.stat .n .u { font-size: .5em; color: var(--accent); font-weight: 680; }
.stat .l { margin-top: 10px; font-size: 13.5px; color: var(--d-muted); line-height: 1.4; }
.hero .src { margin-top: 22px; font-size: 13px; color: var(--d-muted); }
.hero .src a { color: var(--accent); text-decoration: none; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }

/* ====== Light article body ====== */
.article { max-width: var(--maxw); margin: 0 auto; padding: 64px 24px 40px; }
.article h2 { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 36px); line-height: 1.2; font-weight: 700; margin: 56px 0 18px; }
.article h3 { font-family: var(--sans); font-size: 19px; font-weight: 700; margin: 36px 0 12px; }
.article p { margin: 0 0 18px; font-size: 18px; }
.article ul, .article ol { margin: 0 0 18px 24px; font-size: 18px; }
.article li { margin-bottom: 8px; }
.article a { color: var(--accent-deep); text-underline-offset: 3px; }
.article strong { font-weight: 700; }
.article blockquote { border-left: 3px solid var(--accent-deep); padding-left: 18px; color: var(--l-muted); margin: 0 0 18px; }
.article code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: #efece4; padding: 2px 6px; border-radius: 5px; }
.eyebrow { font-family: var(--sans); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; display: block; margin-bottom: 8px; }

/* ====== Tables (blueprint + essay) ====== */
.tablewrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--l-border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 14.5px; background: var(--l-surface); }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--l-border); vertical-align: top; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--l-dim); background: #f4f1ea; }
tr:last-child td { border-bottom: none; }

/* ====== Pipeline diagram ====== */
.pipe { display: flex; gap: 0; margin: 28px 0 8px; flex-wrap: wrap; font-family: var(--sans); }
.stage { flex: 1; min-width: 110px; background: var(--l-surface); border: 1px solid var(--l-border); padding: 18px 12px 14px; text-align: center; position: relative; cursor: pointer; transition: .2s; font: inherit; color: inherit; appearance: none; }
.stage:first-child { border-radius: 12px 0 0 12px; }
.stage:last-child { border-radius: 0 12px 12px 0; }
.stage + .stage { border-left: none; }
.stage:hover, .stage.active { background: #eef9f7; border-color: var(--accent-deep); }
.stage .s-n { font-size: 11px; color: var(--l-dim); letter-spacing: .1em; }
.stage .s-t { font-weight: 700; margin-top: 6px; font-size: 15px; }
.stage .gate { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); font-size: 10px; background: var(--amber); color: #1a1206; padding: 2px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.stage-detail { font-family: var(--sans); background: var(--l-surface); border: 1px solid var(--l-border); border-radius: 10px; padding: 16px 18px; margin-bottom: 22px; font-size: 15.5px; color: var(--l-muted); min-height: 72px; }
.stage-detail b { color: var(--l-text); }

/* ====== CTA ====== */
.cta { background: var(--d-bg); color: var(--d-text); font-family: var(--sans); padding: 72px 24px; margin-top: 72px; }
.cta .wrap { max-width: 880px; margin: 0 auto; text-align: center; }
.cta h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 760; letter-spacing: -.015em; }
.cta p { color: var(--d-muted); margin-top: 14px; font-size: 17px; }
.cta .buttons { display: flex; gap: 14px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 13px 26px; border-radius: 10px; font-weight: 700; font-size: 15.5px; text-decoration: none; }
.btn-primary { background: var(--accent); color: #06211d; }
.btn-secondary { border: 1px solid var(--d-border); color: var(--d-text); }
.btn-secondary:hover, .btn-primary:hover { filter: brightness(1.1); }
footer { font-family: var(--sans); text-align: center; font-size: 13px; color: var(--l-dim); padding: 28px 24px 40px; background: var(--l-bg); }
footer a { color: var(--accent-deep); }
.cta + footer { background: var(--d-bg); color: var(--d-dim); }
.cta + footer a { color: var(--accent); }

/* ====== Blueprint page layout ====== */
.bp-layout { display: grid; grid-template-columns: 280px 1fr; max-width: 1240px; margin: 0 auto; gap: 40px; padding: 0 24px; }
.bp-toc { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 32px 0; font-family: var(--sans); }
.bp-toc .toc-title { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--l-dim); font-weight: 700; margin-bottom: 12px; }
.bp-toc a { display: block; font-size: 13.5px; color: var(--l-muted); text-decoration: none; padding: 5px 0; border-left: 2px solid transparent; padding-left: 10px; line-height: 1.35; }
.bp-toc a:hover { color: var(--accent-deep); border-left-color: var(--accent-deep); }
.bp-content { padding: 32px 0 80px; min-width: 0; }
.bp-content h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.15; margin-bottom: 8px; }
.bp-content h2 { font-size: clamp(24px, 3vw, 32px); margin: 52px 0 16px; scroll-margin-top: 24px; }
.bp-content h3 { font-family: var(--sans); font-size: 18px; font-weight: 700; margin: 32px 0 10px; scroll-margin-top: 24px; }
.bp-content p, .bp-content li { font-size: 16.5px; }
.bp-content ul, .bp-content ol { margin: 0 0 16px 22px; }
.bp-content p { margin-bottom: 16px; }
.bp-content a { color: var(--accent-deep); }
.bp-content blockquote { border-left: 3px solid var(--accent-deep); padding-left: 16px; color: var(--l-muted); margin-bottom: 16px; font-size: 15px; font-family: var(--sans); }
.bp-content hr { border: none; border-top: 1px solid var(--l-border); margin: 40px 0; }
.topbar { background: var(--d-bg); font-family: var(--sans); padding: 14px 24px; }
.topbar .wrap { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.topbar .brand { color: var(--d-text); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; text-decoration: none; }
.topbar .brand b { color: var(--accent); }
.topbar nav a { color: var(--d-muted); text-decoration: none; font-size: 14px; margin-left: 22px; }
.topbar nav a:hover { color: var(--accent); }
@media (max-width: 900px) { .bp-layout { grid-template-columns: 1fr; } .bp-toc { position: static; max-height: none; padding-bottom: 0; } }

/* ====== Diagrams (hand-crafted partials + ascii fallback) ====== */
.ascii-panel { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.5; background: #10151f; color: #cdd6e4; border-radius: 12px; padding: 18px 20px; overflow-x: auto; margin: 0 0 22px; }
.diagram { font-family: var(--sans); background: var(--l-surface); border: 1px solid var(--l-border); border-radius: 14px; padding: 24px 22px; margin: 0 0 26px; }
.diagram .dg-title { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--l-dim); font-weight: 700; margin-bottom: 16px; }
.diagram .mt { margin-top: 14px; }
/* vertical flow of steps */
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.fnode { background: #f6f4ee; border: 1px solid var(--l-border); border-radius: 10px; padding: 12px 16px; text-align: center; position: relative; }
.fnode .t { font-weight: 700; font-size: 14.5px; }
.fnode .d { font-size: 13px; color: var(--l-muted); margin-top: 3px; }
.fnode .agent { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--accent-deep); }
.fnode + .fnode, .lanes + .fnode, .fnode + .lanes { margin-top: 28px; }
.fnode + .fnode::before, .lanes + .fnode::before { content: ""; position: absolute; top: -22px; left: 50%; width: 2px; height: 16px; background: var(--accent-deep); }
.fnode + .fnode::after, .lanes + .fnode::after { content: ""; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--accent-deep); }
/* parallel lanes */
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.lanes + .lanes { margin-top: 28px; }
.lane { display: flex; flex-direction: column; gap: 8px; }
.lane .fnode { flex: none; }
/* badges */
.b-human, .b-out, .b-gap { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; vertical-align: 2px; margin-left: 6px; }
.b-human { background: var(--amber); color: #1a1206; }
.b-out { background: var(--accent-deep); color: #fff; }
.b-gap { background: #e2e8f0; color: #475569; }
/* layered architecture */
.layer { border: 1px solid var(--l-border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.layer .l-name { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; margin-bottom: 10px; }
.layer .nodes { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #f6f4ee; border: 1px solid var(--l-border); border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; }
.chip.mono { font-family: ui-monospace, Menlo, monospace; font-weight: 500; color: var(--accent-deep); }
/* timeline */
.phase { display: grid; grid-template-columns: 92px 1fr; gap: 14px; margin-bottom: 12px; align-items: start; }
.phase .when { font-size: 12.5px; font-weight: 700; color: var(--l-dim); padding-top: 13px; text-align: right; }
.phase .what { background: #f6f4ee; border: 1px solid var(--l-border); border-left: 3px solid var(--accent-deep); border-radius: 10px; padding: 12px 16px; }
.phase .what .t { font-weight: 700; font-size: 14.5px; }
.phase .what .d { font-size: 13px; color: var(--l-muted); margin-top: 3px; }
.phase .what ul { margin: 8px 0 0 18px; font-size: 13px; color: var(--l-muted); }
@media (max-width: 640px) { .phase { grid-template-columns: 1fr; } .phase .when { text-align: left; padding-top: 0; } }
/* key-value definition panel */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14.5px; margin: 0; }
.kv dt { font-weight: 700; color: var(--accent-deep); }
.kv dd { margin: 0; color: var(--l-muted); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 10px; } }
/* stage groups inside layered tracks */
.layer .l-sub { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--l-dim); font-weight: 700; margin: 12px 0 8px; }
