/* Agentic IT — Architecture Documentation
   VIAcode brand: navy #1F455E + orange #F27242 → #E85D3D on white.
   Modern 2026 feel: clean, confident, motion-aware, interactive.       */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* surfaces */
  --bg: #FFFFFF;
  --bg-soft: #F5F5FA;
  --bg-tint: #F9FAFC;
  --rule: #E5E9EF;
  --rule-soft: #EEF1F6;

  /* ink */
  --ink: #1F455E;
  --ink-deep: #102A3B;
  --ink-soft: #4F6B7E;
  --ink-mute: #7E94A4;
  --ink-faint: #A8B7C2;

  /* brand */
  --orange: #F27242;
  --orange-deep: #E85D3D;
  --orange-soft: #FCE3D6;
  --orange-tint: #FFF3EC;
  --grad: linear-gradient(135deg, #F27242 0%, #E85D3D 100%);
  --grad-flat: linear-gradient(180deg, #F27242, #E85D3D);

  /* code */
  --code-bg: #102A3B;
  --code-bg-2: #16344A;
  --code-ink: #E8EEF3;
  --code-key: #F8B89C;
  --code-str: #9BC9DE;
  --code-com: #5A7689;

  /* typography */
  --display: "Roboto Condensed", "Roboto", system-ui, sans-serif;
  --body: "Roboto", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* layout */
  --max-w: 1380px;
  --side-w: 304px;

  /* shadows (layered, soft) */
  --shadow-1: 0 1px 2px rgba(31,69,94,0.04), 0 2px 4px rgba(31,69,94,0.04);
  --shadow-2: 0 4px 12px -4px rgba(31,69,94,0.10), 0 2px 4px rgba(31,69,94,0.06);
  --shadow-3: 0 16px 40px -16px rgba(31,69,94,0.18), 0 4px 12px -4px rgba(31,69,94,0.08);
  --shadow-orange: 0 12px 32px -12px rgba(242,114,66,0.45), 0 4px 8px -2px rgba(242,114,66,0.20);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-weight: 400;
  background: var(--bg);
  color: var(--ink-deep);
  line-height: 1.62;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga";
}

/* subtle constellation accent — echoes the dotted pattern in the VIAcode mark */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 6% 8%, rgba(242,114,66,0.05) 0, transparent 24%),
    radial-gradient(circle at 94% 94%, rgba(31,69,94,0.04) 0, transparent 28%);
}

/* ── Layout ──────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

aside.nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 32px 24px 48px 28px;
  border-right: 1px solid var(--rule);
  background: var(--bg);
  font-size: 14px;
}

aside.nav::-webkit-scrollbar { width: 6px; }
aside.nav::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 3px;
}
aside.nav::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
aside.nav::-webkit-scrollbar-track { background: transparent; }

main.doc {
  padding: 48px 64px 96px;
  min-width: 0;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  aside.nav {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 20px 24px 16px;
  }
  main.doc { padding: 32px 24px 64px; }
}

/* ── Sidebar / brand ─────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 18px;
  background-image: none;
  background-size: 0;
}
.brand:hover { background-size: 0; }
.brand:hover .product { color: var(--orange-deep); }
.brand img {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand .product {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.15;
}
.brand .product .small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 4px;
}

.nav-section {
  margin-top: 14px;
  padding-top: 0;
  border-top: none;
}
.nav-section + .nav-section {
  margin-top: 4px;
}

.nav-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary::marker { content: ""; }
.nav-section > summary:hover { background: var(--bg-soft); }
.nav-section > summary .num {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--orange);
  width: 22px;
  display: inline-block;
  letter-spacing: 0;
}
.nav-section > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 18px;
  font-weight: 500;
  transition: transform 0.2s, color 0.2s;
  line-height: 1;
}
.nav-section[open] > summary { color: var(--orange-deep); }
.nav-section[open] > summary::after {
  transform: rotate(90deg);
  color: var(--orange);
}

.nav-section ul {
  list-style: none;
  padding: 4px 0 6px 32px;
  margin: 0;
  border-left: 1px solid var(--rule-soft);
  margin-left: 21px;
}
.nav-section li { margin: 0; }
.nav-section a {
  display: block;
  padding: 5px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -11px;
  padding-left: 12px;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  background-image: none;
  background-size: 0;
  font-weight: 400;
}
.nav-section a:hover { background-size: 0; }
.nav-section a:hover {
  color: var(--ink);
  background: var(--bg-soft);
  border-left-color: var(--rule);
}
.nav-section a[aria-current="page"] {
  color: var(--orange-deep);
  font-weight: 500;
  border-left-color: var(--orange);
  background: var(--orange-tint);
}

/* ── Breadcrumb / eyebrow ───────────────────────────────────────── */

.breadcrumb {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 32px;
}
.breadcrumb a {
  color: var(--ink-mute);
  text-decoration: none;
  transition: color 0.12s;
}
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb .sep {
  margin: 0 10px;
  color: var(--ink-faint);
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin: 0 0 16px;
  padding: 4px 12px;
  background: var(--orange-tint);
  border-radius: 999px;
  font-weight: 500;
}

/* ── Headings ───────────────────────────────────────────────────── */

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.022em;
  margin: 0 0 20px;
  color: var(--ink);
}
h1 .accent {
  color: transparent;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
}

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.18;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 64px 0 16px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  position: relative;
}
h2::before {
  content: attr(data-num);
  position: absolute;
  top: 32px;
  left: -48px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--orange);
  padding-top: 8px;
  letter-spacing: 0.04em;
}
@media (max-width: 980px) {
  h2::before {
    position: static;
    display: block;
    margin-bottom: 6px;
  }
}

h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  margin: 40px 0 10px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

h4 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 28px 0 10px;
}

p {
  margin: 0 0 14px;
  max-width: 72ch;
  color: var(--ink-deep);
}

.lede {
  font-family: var(--body);
  font-weight: 300;
  font-size: 21px;
  line-height: 1.55;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  max-width: 38em;
  margin: 0 0 36px;
}

a {
  color: var(--orange-deep);
  text-decoration: none;
  font-weight: 500;
  background-image: linear-gradient(var(--orange), var(--orange));
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.25s ease;
  padding-bottom: 1px;
}
a:hover {
  background-size: 100% 1.5px;
}

ul, ol {
  padding-left: 22px;
  margin: 0 0 16px;
  max-width: 72ch;
}
li {
  margin-bottom: 6px;
  color: var(--ink-deep);
}
li::marker { color: var(--orange); }
li > ul, li > ol { margin-top: 6px; }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

hr {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: 48px 0;
}

/* ── Code ───────────────────────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-soft);
  color: var(--ink);
  padding: 1.5px 6px;
  border-radius: 4px;
  border: 1px solid var(--rule-soft);
  font-weight: 500;
}

pre {
  background: var(--code-bg);
  background-image: linear-gradient(180deg, var(--code-bg-2) 0%, var(--code-bg) 100%);
  color: var(--code-ink);
  padding: 20px 24px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 18px 0 24px;
  position: relative;
  box-shadow: var(--shadow-2);
}
pre::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
  border-radius: 10px 10px 0 0;
}
pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  font-weight: 400;
}

.path {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-mute);
  letter-spacing: -0.01em;
}
.path .accent { color: var(--orange); }

/* ── Tables ─────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 18px 0 26px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow-1);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  background: transparent;
}
th {
  text-align: left;
  font-family: var(--body);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
  vertical-align: bottom;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--ink-deep);
}
td code {
  font-size: 12px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-tint); }

/* ── Cards ──────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 18px;
  margin: 32px 0 8px;
}
.card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 24px 24px 22px;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.25s;
  background-image: none;
  background-size: 0;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}
.card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-3);
  transform: translateY(-2px);
}
.card:hover::before { transform: scaleX(1); }

.card .num {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--orange);
  text-transform: uppercase;
  font-weight: 500;
  display: block;
  margin-bottom: 10px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -0.005em;
  font-weight: 600;
  color: var(--ink);
}
.card p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
  font-weight: 400;
}
.card .arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink-faint);
  font-size: 18px;
  transition: transform 0.25s, color 0.2s;
  line-height: 1;
}
.card:hover .arrow {
  color: var(--orange);
  transform: translateX(4px);
}

/* ── Callouts ───────────────────────────────────────────────────── */

.callout {
  border-left: 3px solid var(--orange);
  background: var(--orange-tint);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-size: 14.5px;
  color: var(--ink-deep);
}
.callout.warn {
  border-left-color: var(--orange-deep);
  background: linear-gradient(90deg, #FCE5DA 0%, #FFF6F1 100%);
}
.callout .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}
.callout p:last-child { margin-bottom: 0; }
.callout ul, .callout ol { margin-bottom: 0; }

/* ── Diagrams ───────────────────────────────────────────────────── */

.diagram {
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 24px 28px;
  margin: 24px 0 28px;
  overflow-x: auto;
  position: relative;
}
.diagram::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 80px;
  height: 2px;
  background: var(--grad);
  border-radius: 0 0 2px 0;
}
.diagram pre {
  background: transparent;
  color: var(--ink);
  border: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0;
  box-shadow: none;
}
.diagram pre::before { display: none; }
.diagram-caption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
  margin-top: 14px;
}

/* ── Definition list ────────────────────────────────────────────── */

dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 28px;
  row-gap: 10px;
  margin: 20px 0 24px;
  font-size: 14.5px;
}
dl.kv dt {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--orange-deep);
  font-weight: 500;
  white-space: nowrap;
  padding-top: 1px;
}
dl.kv dd {
  margin: 0;
  color: var(--ink-deep);
}

/* ── Pager ──────────────────────────────────────────────────────── */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.pager a {
  display: block;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 22px;
  text-decoration: none;
  color: var(--ink);
  background-image: none;
  background-size: 0;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  font-weight: 400;
  position: relative;
  overflow: hidden;
}
.pager a:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.pager a:hover .label { color: var(--orange); }
.pager .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  font-weight: 500;
  transition: color 0.2s;
}
.pager .next { text-align: right; }
.pager .prev:empty, .pager .next:empty {
  background: transparent;
  border-color: transparent;
}

footer.foot {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule-soft);
  font-size: 12px;
  color: var(--ink-mute);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Tags & badges ──────────────────────────────────────────────── */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
  background: var(--orange-tint);
  border-radius: 4px;
  padding: 2px 8px;
  vertical-align: 1px;
  font-weight: 500;
}
.tag.warn {
  color: var(--orange-deep);
  background: var(--orange-soft);
}
.tag.mute {
  color: var(--ink-mute);
  background: var(--bg-soft);
}

.figure-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
  margin-right: 8px;
}

/* ── Hero (landing) ─────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 28px 0 40px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--rule);
}
.hero::before {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 120px;
  height: 3px;
  background: var(--grad);
  border-radius: 2px;
}

.hero .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.hero .meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero .meta span::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--orange);
  border-radius: 50%;
  display: inline-block;
}

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange-deep);
  background: var(--orange-tint);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  font-weight: 500;
  border: 1px solid var(--orange-soft);
}

/* ── Buttons (used in hero / CTAs if any) ───────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 11px 22px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--grad);
  color: white;
  border: none;
  cursor: pointer;
  background-image: var(--grad);
  background-size: 100%;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  box-shadow: var(--shadow-orange);
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  background-size: 100%;
}
.btn.ghost {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: none;
}
.btn.ghost:hover {
  border-color: var(--orange);
  color: var(--orange-deep);
}

/* ── Reveal-on-load animation ───────────────────────────────────── */

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
main.doc > .breadcrumb { animation: reveal 0.5s ease both; }
main.doc > .eyebrow,
main.doc > .hero { animation: reveal 0.55s 0.05s ease both; }
main.doc > h1   { animation: reveal 0.6s 0.1s ease both; }
main.doc > .lede,
main.doc > .hero + h2 { animation: reveal 0.6s 0.15s ease both; }
main.doc > h2,
main.doc > .cards,
main.doc > .diagram { animation: reveal 0.6s 0.2s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Selection ──────────────────────────────────────────────────── */

::selection {
  background: var(--orange-tint);
  color: var(--orange-deep);
}

/* ── Misc ───────────────────────────────────────────────────────── */

img { max-width: 100%; height: auto; }

.subtle-grid {
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Scenario / story callout ────────────────────────────────────── */

.scenario {
  position: relative;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F2 100%);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--orange);
  border-radius: 12px;
  padding: 28px 32px 26px;
  margin: 32px 0;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.scenario::before {
  content: "“";
  position: absolute;
  top: -16px;
  right: 28px;
  font-family: var(--display);
  font-size: 96px;
  font-weight: 700;
  color: var(--orange-tint);
  line-height: 1;
}
.scenario .stamp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange-deep);
  font-weight: 500;
  margin-bottom: 12px;
  display: inline-block;
}
.scenario p {
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 400;
  margin: 0 0 14px;
  max-width: 56em;
}
.scenario p.lead {
  font-weight: 600;
  font-size: 22px;
  color: var(--orange-deep);
  letter-spacing: -0.005em;
  text-transform: none;
}
.scenario p:last-child { margin-bottom: 0; }

/* ── Before / After comparison (CSS-only tabs) ───────────────────── */

.compare {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg);
  margin: 28px 0;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.compare > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.compare-tabs {
  display: flex;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
}
.compare-tabs label {
  flex: 1;
  padding: 16px 20px;
  text-align: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  user-select: none;
}
.compare-tabs label:hover { color: var(--ink); }
.compare-tabs label .badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: var(--bg);
  color: var(--ink-mute);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
}
.compare-panes > .compare-pane { display: none; padding: 28px 32px 24px; }
.compare > input:nth-of-type(1):checked ~ .compare-tabs label:nth-of-type(1),
.compare > input:nth-of-type(2):checked ~ .compare-tabs label:nth-of-type(2) {
  color: var(--orange-deep);
  background: var(--bg);
  border-bottom-color: var(--orange);
}
.compare > input:nth-of-type(1):checked ~ .compare-tabs label:nth-of-type(1) .badge,
.compare > input:nth-of-type(2):checked ~ .compare-tabs label:nth-of-type(2) .badge {
  background: var(--orange-tint);
  color: var(--orange-deep);
}
.compare > input:nth-of-type(1):checked ~ .compare-panes > .compare-pane:nth-of-type(1),
.compare > input:nth-of-type(2):checked ~ .compare-panes > .compare-pane:nth-of-type(2) {
  display: block;
  animation: pane-fade 0.25s ease;
}
@keyframes pane-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.compare-pane h4 {
  margin: 0 0 16px;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--display);
  font-size: 17px;
  color: var(--ink);
}
.compare-pane ol {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
}
.compare-pane ol li {
  counter-increment: step;
  padding-left: 48px;
  position: relative;
  margin-bottom: 14px;
  color: var(--ink-deep);
  font-size: 14.5px;
  line-height: 1.5;
}
.compare-pane ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1.5px solid var(--rule);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-pane.good ol li::before {
  background: var(--orange-tint);
  border-color: var(--orange);
  color: var(--orange-deep);
}
.compare-pane .summary {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
.compare-pane.good .summary {
  background: var(--orange-tint);
  color: var(--orange-deep);
}
.compare-pane .summary span strong {
  color: inherit;
  font-weight: 600;
  margin-right: 4px;
}

/* ── Pain-point cards ────────────────────────────────────────────── */

.pains {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0 8px;
}
.pain {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 22px 20px;
  position: relative;
  transition: border-color 0.18s, box-shadow 0.2s, transform 0.15s;
}
.pain:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.pain .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--orange);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}
.pain h4 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16.5px;
  margin: 0 0 8px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.005em;
}
.pain p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 14px;
}
.pain .cost {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange-deep);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-soft);
}
.pain .cost::before {
  content: "▸";
  color: var(--orange);
}

/* ── Stats row ──────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin: 32px 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-1);
}
.stat {
  padding: 28px 18px 24px;
  text-align: center;
  border-right: 1px solid var(--rule-soft);
  position: relative;
  transition: background 0.15s;
}
.stat:hover { background: var(--bg-tint); }
.stat:last-child { border-right: none; }
.stat .num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.025em;
  display: block;
  margin-bottom: 10px;
  animation: stat-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes stat-pop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.stat:nth-child(1) .num { animation-delay: 0.05s; }
.stat:nth-child(2) .num { animation-delay: 0.10s; }
.stat:nth-child(3) .num { animation-delay: 0.15s; }
.stat:nth-child(4) .num { animation-delay: 0.20s; }
.stat:nth-child(5) .num { animation-delay: 0.25s; }
.stat:nth-child(6) .num { animation-delay: 0.30s; }
.stat .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

/* ── Persona cards ─────────────────────────────────────────────── */

.personas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.persona {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 22px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s, transform 0.15s, box-shadow 0.2s;
}
.persona::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.persona:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.persona:hover::before { transform: scaleX(1); }
.persona .role {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 500;
  display: block;
  margin-bottom: 10px;
}
.persona h4 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.005em;
}
.persona p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

/* ── "Not" boundary list ───────────────────────────────────────── */

.not-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}
.not-list li {
  background: var(--bg-tint);
  border: 1px dashed var(--rule);
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
  position: relative;
  padding-left: 48px;
  transition: border-color 0.18s, background 0.15s;
}
.not-list li:hover {
  border-color: var(--orange);
  border-style: solid;
  background: var(--bg);
}
.not-list li::before {
  content: "✕";
  position: absolute;
  left: 18px;
  top: 16px;
  color: var(--orange);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 14px;
}
.not-list li strong {
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
}

/* ── Capability tiles ──────────────────────────────────────────── */

.capabilities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.cap {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 22px 20px;
  position: relative;
  transition: border-color 0.18s, box-shadow 0.2s, transform 0.15s;
  overflow: hidden;
}
.cap:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.cap .glyph {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
  display: block;
  line-height: 1;
}
.cap h4 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.005em;
}
.cap p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 12px;
}
.cap ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule-soft);
  padding-top: 12px;
}
.cap ul li {
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--ink-mute);
  padding: 3px 0 3px 16px;
  position: relative;
  margin: 0;
}
.cap ul li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--orange);
  font-weight: 600;
}

/* ── Principles (numbered) ─────────────────────────────────────── */

.principles {
  margin: 28px 0;
  display: grid;
  gap: 16px;
}
.principle {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 22px;
  padding: 22px 24px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  align-items: start;
  transition: border-color 0.18s, transform 0.15s;
}
.principle:hover {
  border-color: var(--orange);
  transform: translateX(2px);
}
.principle .n {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.025em;
}
.principle h4 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -0.005em;
}
.principle p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ── Interactive topology diagram ────────────────────────────────── */

.topo-diagram {
  position: relative;
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px 24px 16px;
  margin: 28px 0 32px;
  overflow: hidden;
}
.topo-diagram::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 96px;
  height: 3px;
  background: var(--grad);
  border-radius: 0 0 3px 0;
}
.topo-diagram::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 6%, rgba(242,114,66,0.04) 0, transparent 35%),
    radial-gradient(circle at 92% 96%, rgba(31,69,94,0.04) 0, transparent 38%);
  pointer-events: none;
}
.topo-figure {
  margin: 0;
  position: relative;
  z-index: 1;
}
.topo-figure svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--body);
}

/* Default node styling */
.topo-node {
  cursor: pointer;
  outline: none;
  text-decoration: none;
  background-image: none !important;
  background-size: 0 !important;
}
.topo-node:focus { outline: none; }
.topo-rect {
  fill: #FFFFFF;
  stroke: var(--rule);
  stroke-width: 1.5;
  transition: fill 0.18s ease, stroke 0.18s ease, stroke-width 0.18s ease, filter 0.2s ease;
}
.topo-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  fill: var(--ink);
  pointer-events: none;
  letter-spacing: 0.005em;
}
.topo-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: var(--ink-mute);
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Frame variant — outer container around inner clickable blocks */
.topo-frame > .topo-rect {
  fill: rgba(245, 245, 250, 0.55);
  stroke-dasharray: 0;
}
.topo-frame-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13.5px;
  fill: var(--ink);
  pointer-events: none;
  letter-spacing: 0.02em;
}
.topo-frame-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: var(--ink-mute);
  pointer-events: none;
}
.topo-frame-hint {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink-faint);
  pointer-events: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Emphasised node — agent core */
.topo-emphasis > .topo-rect {
  fill: #FFF8F2;
  stroke: var(--orange-soft);
  stroke-width: 1.5;
}
.topo-emphasis .topo-title { fill: var(--ink); }

/* Hover & focus — every clickable node */
.topo-node:hover .topo-rect,
.topo-node:focus-visible .topo-rect {
  fill: var(--orange-tint);
  stroke: var(--orange);
  stroke-width: 2;
  filter: drop-shadow(0 10px 24px rgba(242, 114, 66, 0.22));
}
.topo-node:hover .topo-title,
.topo-node:focus-visible .topo-title {
  fill: var(--orange-deep);
}
.topo-node:hover .topo-frame-title,
.topo-node:focus-visible .topo-frame-title {
  fill: var(--orange-deep);
}
.topo-node:hover .topo-frame-hint,
.topo-node:focus-visible .topo-frame-hint {
  fill: var(--orange);
}

/* Connection lines & their labels */
.topo-lines line {
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.topo-line-label {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Legend */
.topo-legend rect:first-child { /* legend frame */ }
.topo-legend-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  fill: var(--ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}
.topo-legend-text {
  font-family: var(--body);
  font-size: 12px;
  fill: var(--ink-soft);
  pointer-events: none;
}
.topo-legend-swatch {
  fill: #FFFFFF;
  stroke: var(--rule);
  stroke-width: 1.5;
}
.topo-legend-swatch-em {
  fill: #FFF8F2;
  stroke: var(--orange-soft);
}

/* Caption */
.topo-caption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
  margin-top: 12px;
}

/* Entrance animation — staged opacity reveal */
@keyframes topo-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.topo-figure svg .topo-node,
.topo-figure svg .topo-lines,
.topo-figure svg .topo-legend {
  animation: topo-fade 0.5s ease both;
}
.topo-figure svg .topo-lines { animation-delay: 0.10s; }
.topo-figure svg .topo-node:nth-of-type(1) { animation-delay: 0.05s; }
.topo-figure svg .topo-node:nth-of-type(2) { animation-delay: 0.10s; }
.topo-figure svg .topo-node:nth-of-type(3) { animation-delay: 0.15s; }
.topo-figure svg .topo-node:nth-of-type(4) { animation-delay: 0.20s; }
.topo-figure svg .topo-node:nth-of-type(5) { animation-delay: 0.25s; }
.topo-figure svg .topo-node:nth-of-type(6) { animation-delay: 0.30s; }
.topo-figure svg .topo-node:nth-of-type(7) { animation-delay: 0.35s; }
.topo-figure svg .topo-node:nth-of-type(8) { animation-delay: 0.40s; }
.topo-figure svg .topo-node:nth-of-type(9) { animation-delay: 0.45s; }
.topo-figure svg .topo-node:nth-of-type(10) { animation-delay: 0.50s; }
.topo-figure svg .topo-legend { animation-delay: 0.55s; }

/* ── Cross-reference pill ───────────────────────────────────────── */

.xref {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--orange-deep);
  background: var(--orange-tint);
  padding: 1px 8px 2px;
  border-radius: 4px;
  border: 1px solid var(--orange-soft);
  margin: 0 2px;
  text-decoration: none;
  background-image: none !important;
  background-size: 0 !important;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: 1px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.xref:hover {
  background: var(--orange);
  color: #FFFFFF;
  border-color: var(--orange);
}

/* ── Mermaid diagram card ───────────────────────────────────────── */

.diagram-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 24px 24px 16px;
  margin: 24px 0;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.diagram-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 80px;
  height: 2px;
  background: var(--grad);
  border-radius: 0 0 2px 0;
}
.diagram-card [data-mermaid] {
  display: flex;
  justify-content: center;
  background: transparent;
  font-family: var(--body);
}
.diagram-card [data-mermaid] svg {
  max-width: 100%;
  height: auto;
}
.diagram-card .diagram-caption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
  margin: 12px 0 0;
}

/* Mermaid post-processing — make click anchors look brand-native */
.diagram-card a {
  cursor: pointer;
  background-image: none !important;
  background-size: 0 !important;
}
.diagram-card a:hover rect,
.diagram-card a:hover path,
.diagram-card a:hover polygon {
  stroke: var(--orange) !important;
  stroke-width: 2 !important;
}
