:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --paper: #ffffff;
  --ink: #17211f;
  --muted: #5f6d68;
  --line: #d9e0dd;
  --soft: #edf2f0;
  --deep: #163c38;
  --teal: #15766c;
  --red: #9d2838;
  --gold: #b07a27;
  --blue: #315f93;
  --code: #15201e;
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.62;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 30;
  background: var(--ink);
  color: white;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  padding: 0 1.25rem;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--deep);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: -0.2rem;
}

.topnav {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  overflow-x: auto;
  min-width: 0;
}

.topnav a {
  color: var(--muted);
  font-size: 0.94rem;
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.topnav a:hover {
  background: var(--soft);
  color: var(--deep);
}

.docs-shell {
  max-width: calc(var(--max) + 260px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 2rem;
  padding: 0 1.25rem;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  padding: 1rem 0;
  min-width: 0;
}

.sidebar nav {
  display: grid;
  gap: 0.2rem;
  border-left: 1px solid var(--line);
  min-width: 0;
}

.sidebar a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0 0.45rem 1rem;
  font-size: 0.94rem;
}

.sidebar a:hover {
  color: var(--teal);
}

.content {
  min-width: 0;
}

.section {
  padding: 4.5rem 0;
  border-bottom: 1px solid var(--line);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 2.25rem;
  align-items: center;
  min-height: calc(100vh - 68px);
  padding-top: 3rem;
}

.hero > *,
.feature-grid > *,
.code-grid > *,
.example-runner > *,
.artifact-list > *,
.api-list > * {
  min-width: 0;
}

.eyebrow {
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 0.65rem;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.24;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 4.6vw, 4.25rem);
  line-height: 1.07;
}

h2 {
  margin: 0;
  font-size: clamp(1.72rem, 3vw, 2.45rem);
}

h3 {
  margin: 0 0 0.45rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 68ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.primary-link,
.secondary-link,
#runScenario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0.68rem 1rem;
  text-decoration: none;
  font-weight: 800;
}

.primary-link,
#runScenario {
  border: 0;
  background: var(--teal);
  color: white;
  cursor: pointer;
}

.secondary-link {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--deep);
}

.system-figure {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.system-figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.canvas {
  fill: #fbfcfb;
  stroke: var(--line);
}

.flow-node rect {
  fill: white;
  stroke: var(--teal);
  stroke-width: 3;
}

.flow-node.warn rect {
  stroke: var(--red);
}

.flow-node text {
  text-anchor: middle;
  fill: var(--ink);
  font-weight: 800;
}

.flow-node text + text {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.flow-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.manifest {
  text-anchor: middle;
  fill: var(--muted);
  font-weight: 800;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 1.2rem 0;
}

.status-strip span,
.guardrail-grid span {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  color: var(--deep);
  font-weight: 700;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 1.6rem;
}

.section-heading p:last-child {
  color: var(--muted);
  font-size: 1.04rem;
}

.feature-grid,
.artifact-list,
.api-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.feature-grid article,
.boundary-box,
.code-grid article,
.runner-output,
.artifact-list article,
.api-list article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.feature-grid p,
.artifact-list p,
.api-list p,
.boundary-box p {
  color: var(--muted);
  margin-bottom: 0;
}

.boundary-box {
  margin-top: 1rem;
  border-left: 4px solid var(--red);
  background: #fffafa;
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

pre {
  margin: 0;
  background: var(--code);
  color: #f2f8f6;
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  white-space: pre;
}

.code-grid pre {
  margin-top: 0.8rem;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

.example-runner {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
}

.scenario-list {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.scenario-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--deep);
  text-align: left;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  font-weight: 800;
}

.scenario-button.is-active,
.scenario-button:hover {
  border-color: var(--teal);
  background: #eef7f5;
}

.output-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.output-header p {
  color: var(--muted);
  margin-bottom: 0;
}

#scenarioOutput {
  min-height: 360px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--deep);
  color: white;
}

td:first-child {
  font-weight: 800;
  color: var(--deep);
}

.guardrail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.roadmap {
  margin: 0;
  padding-left: 1.25rem;
}

.roadmap li {
  margin-bottom: 0.8rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 1.25rem;
  background: var(--deep);
  color: white;
}

.footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.footer a {
  color: white;
}

@media (max-width: 1040px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 0.8rem 0 0;
    overflow-x: auto;
    max-width: 100%;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    width: 100%;
    max-width: 100%;
  }

  .sidebar a {
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    padding-top: 0.75rem;
    padding-bottom: 0.65rem;
  }

  .topnav {
    justify-content: flex-start;
  }

  .brand small {
    display: none;
  }

  .section {
    padding: 3rem 0;
  }

  h1 {
    font-size: 2.15rem;
  }

  .feature-grid,
  .code-grid,
  .example-runner,
  .artifact-list,
  .api-list,
  .guardrail-grid {
    grid-template-columns: 1fr;
  }

  .output-header,
  .footer {
    display: block;
  }

  #runScenario {
    margin-top: 0.8rem;
    width: 100%;
  }
}
