/* Captain Code product surface - opencode-inspired dark + captain blue */

html[data-theme="captain"] {
  color-scheme: dark;
}

html[data-theme="captain"] .hero-brand {
  font-size: clamp(3.6rem, 11vw, 7.2rem);
  letter-spacing: -0.05em;
  color: var(--ink);
}

html[data-theme="captain"] .hero h1 {
  max-width: 28ch;
  color: var(--muted);
  font-weight: 500;
}

.brand-mark {
  border-radius: 0;
}

.hero-terminal {
  position: absolute;
  inset: auto 0 8% auto;
  width: min(48vw, 520px);
  margin-right: max(4vw, 24px);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(12, 16, 22, 0.55), rgba(5, 7, 10, 0.2));
  border-top: 1px solid rgba(92, 156, 245, 0.28);
  border-left: 1px solid rgba(92, 156, 245, 0.12);
  padding: 1.1rem 1.25rem 1.25rem;
  z-index: 0;
  pointer-events: none;
  animation: rise 1s var(--ease) 0.18s both;
}

.hero-terminal .prompt { color: var(--accent); }
.hero-terminal .dim { color: var(--faint); }
.hero-terminal .ok { color: #7dcea0; }

@media (max-width: 900px) {
  .hero-terminal { display: none; }
}

.feature-stack {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.feature-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.6rem, 3vw, 2.4rem) 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.feature-row h3 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  letter-spacing: -0.02em;
  font-weight: 600;
}

.feature-row p {
  color: var(--muted);
  max-width: 52ch;
  margin: 0;
}

@media (max-width: 720px) {
  .feature-row {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
}

.install-block {
  margin: 1.5rem 0 0;
  padding: 1.15rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.92rem;
  overflow-x: auto;
}

.install-block code {
  display: block;
  white-space: pre-wrap;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink);
  font-size: inherit;
}

.legs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.88rem;
}

.legs-list li::before {
  content: "▸ ";
  color: var(--accent);
}

.page-hero {
  padding: clamp(48px, 8vw, 88px) 0 1.5rem;
}

.page-hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0.35rem 0 0.85rem;
}

.doc-toc {
  display: grid;
  gap: 0.85rem;
  margin: 1.5rem 0 0;
}

.doc-toc a {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.doc-toc a span {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.doc-toc a:hover { color: var(--accent); }

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

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--display);
  letter-spacing: -0.01em;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq details p {
  margin-top: 0.65rem;
  color: var(--muted);
  max-width: 62ch;
}

.oss-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin: 1.75rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.oss-meta dt {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.oss-meta dd {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
}

html[data-theme="captain"] .style-selector {
  border-color: rgba(92, 156, 245, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-brand {
    animation: rise 0.85s var(--ease) both;
  }
}

/* ------------------------------------------------------------
   Hero: copy left, live terminal right. The headline is the pitch.
   ------------------------------------------------------------ */

:root {
  --ink-2: #c4cdda;
  --ok: #7dcea0;
}

.hero-captain .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero-captain .hero-brand,
html[data-theme="captain"] .hero-captain .hero-brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
  padding-bottom: 0;
}

.hero-captain h1,
html[data-theme="captain"] .hero-captain h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--ink);
  max-width: 14ch;
  margin-bottom: 1.35rem;
}

.hero-captain h1 em {
  font-style: normal;
  color: var(--accent);
  display: block;
}

.hero-captain .lede {
  max-width: 46ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-2);
}

.hero-captain .lede strong { color: var(--ink); font-weight: 600; }

.hero-captain .hero-actions { margin-top: 1.9rem; }

.ph-badge {
  flex: 1 0 100%;
  margin-top: 0.25rem;
}

.ph-badge a {
  display: inline-block;
  line-height: 0;
}

.ph-badge img {
  display: block;
  width: 250px;
  height: 54px;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  animation: rise 0.9s var(--ease) 0.3s both;
}

.hero-proof li::before { content: "✓ "; color: var(--ok); }

.hero-command-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.hero-command-strip code {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid rgba(92, 156, 245, 0.25);
  border-radius: 999px;
  background: rgba(92, 156, 245, 0.08);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.hero-captain .hero-terminal {
  position: static;
  width: 100%;
  margin: 0;
  inset: auto;
  pointer-events: auto;
  font-size: clamp(0.72rem, 0.95vw, 0.86rem);
  line-height: 1.6;
  padding: 0;
  background: rgba(8, 11, 16, 0.82);
  border: 1px solid rgba(92, 156, 245, 0.22);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 30px 80px -30px rgba(92, 156, 245, 0.35),
    0 20px 50px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  z-index: 1;
}

.hero-terminal .term-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid rgba(232, 238, 248, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--faint);
  font-size: 0.72rem;
}

.hero-terminal .term-bar .dots { display: flex; gap: 5px; }
.hero-terminal .term-bar .dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(232, 238, 248, 0.14);
}
.hero-terminal .term-bar .right { margin-left: auto; color: var(--ok); }

.hero-terminal .term-body {
  padding: 0.9rem 1rem 1rem;
  display: grid;
  gap: 0.12rem;
}

.hero-terminal .term-body > div {
  white-space: pre-wrap;
  word-break: break-word;
  animation: rise 0.6s var(--ease) both;
}

.hero-terminal .term-body > div:nth-child(1) { animation-delay: 0.25s; }
.hero-terminal .term-body > div:nth-child(2) { animation-delay: 0.55s; }
.hero-terminal .term-body > div:nth-child(3) { animation-delay: 0.8s; }
.hero-terminal .term-body > div:nth-child(4) { animation-delay: 1.05s; }
.hero-terminal .term-body > div:nth-child(5) { animation-delay: 1.3s; }
.hero-terminal .term-body > div:nth-child(6) { animation-delay: 1.75s; }
.hero-terminal .term-body > div:nth-child(7) { animation-delay: 2.05s; }
.hero-terminal .term-body > div:nth-child(8) { animation-delay: 2.35s; }
.hero-terminal .term-body > div:nth-child(9) { animation-delay: 2.65s; }
.hero-terminal .term-body > div:nth-child(10) { animation-delay: 3.0s; }

.hero-terminal .gap { height: 0.45rem; }
.hero-terminal .tag {
  display: inline-block;
  min-width: 9ch;
  color: var(--faint);
}
.hero-terminal .leg { color: var(--ink); font-weight: 500; }
.hero-terminal .warn { color: var(--warn); }
.hero-terminal .kw { color: var(--accent); }
.hero-terminal .cursor::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 900px) {
  .hero-captain .wrap { grid-template-columns: 1fr; }
  .hero-captain .hero-terminal { display: block; }
  .hero-captain h1 { max-width: none; }
}

/* ------------------------------------------------------------
   Home sections
   ------------------------------------------------------------ */

.section .lead-h2,
html[data-theme] .section .lead-h2 {
  max-width: 26ch;
}

.section .intro { color: var(--ink-2); }

.contrast {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2.25rem;
}

.contrast > div {
  padding: 1.5rem 1.6rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}

.contrast > div.after {
  border-color: rgba(92, 156, 245, 0.35);
  background: linear-gradient(160deg, rgba(92, 156, 245, 0.12), transparent 60%), var(--bg-elev);
}

.contrast h3 {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1rem;
}

.contrast .after h3 { color: var(--accent); }

.contrast ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
  color: var(--ink-2);
}

.contrast li { padding-left: 1.5em; position: relative; }
.contrast li::before {
  position: absolute; left: 0; top: 0;
  font-family: var(--mono);
}
.contrast .before li::before { content: "✗"; color: var(--warn); }
.contrast .after li::before { content: "✓"; color: var(--ok); }

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 2.5rem;
  margin-top: 2.25rem;
  counter-reset: step;
}

.steps > div {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  counter-increment: step;
}

.steps > div::before {
  content: "0" counter(step);
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.steps h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.45rem;
}

.steps p { color: var(--muted); max-width: 34ch; }

.commands {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.commands > div {
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.commands .cmd {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
}

.commands .cmd small {
  font-size: 0.78rem;
  color: var(--faint);
  font-weight: 400;
  margin-left: 0.4rem;
}

.commands p { color: var(--muted); font-size: 0.95rem; margin: 0; }

.commands code,
.chain-demo code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.chain-demo {
  margin-top: 2rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid rgba(92, 156, 245, 0.28);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(92, 156, 245, 0.1), transparent 55%), var(--bg-elev);
  display: grid;
  gap: 0.75rem;
}

.chain-demo h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.chain-demo code { font-size: 0.9rem; padding: 0.7rem 0.9rem; }
.chain-demo p { color: var(--muted); max-width: 70ch; }

.chain-demo .grammar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}
.chain-demo .grammar b { color: var(--accent); font-weight: 500; }

.legs-list { margin-top: 2rem; }

@media (max-width: 760px) {
  .contrast, .steps { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   Doc typography for content pages (<div class="wrap doc">).
   site.css resets every margin/padding to 0, so markdown output needs
   its own rhythm: lists indented inside the column, even paragraph gaps.
   ------------------------------------------------------------ */


.section .doc > h2,
html[data-theme] .section .doc > h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  line-height: 1.25;
  max-width: none;
  margin: 2.75rem 0 0.9rem;
  padding-bottom: 0;
}

.section .doc > .page-hero + h2,
.section .doc > .page-hero + p,
.section .doc > .oss-meta + h2 { margin-top: 1.25rem; }
.section .doc > .oss-meta + h2 { margin-top: 2.75rem; }

.section .doc > h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.6rem;
}

.section .doc > p,
html[data-theme] .section .doc > p {
  color: var(--ink-2);
  margin: 0 0 1.1rem;
  max-width: 68ch;
}

.section .doc > p.lede,
.section .doc > .page-hero .lede,
html[data-theme] .section .doc > .page-hero .lede { color: var(--ink-2); max-width: 52ch; }

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

.section .doc > ul,
.section .doc > ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5em;
  max-width: 68ch;
}

.section .doc > ul li,
.section .doc > ol li,
html[data-theme] .section .doc > ul li,
html[data-theme] .section .doc > ol li {
  color: var(--ink-2);
  margin: 0.4rem 0;
  padding-left: 0.2em;
}

.doc li::marker { color: var(--accent); }
.doc ol li::marker { font-family: var(--mono); font-size: 0.9em; }

.doc code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.4em;
}

.doc pre {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink);
  overflow-x: auto;
}

.doc pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.doc > .install-block { margin: 0 0 1.5rem; border-radius: 8px; }

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.doc th,
.doc td {
  padding: 0.65rem 0.85rem 0.65rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--ink-2);
}

.doc th {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.doc td code { white-space: nowrap; }

.doc .doc-toc { margin-bottom: 1rem; }
.doc .doc-toc a { padding: 1rem 0; }
.doc .doc-toc a span { margin-top: 0.3rem; }

.doc .cta-band { margin-top: 3rem; }

.doc .faq { margin-top: 0.5rem; border-top: 1px solid var(--line); }
.doc .faq details { padding: 1.15rem 0; }
.doc .faq summary { font-size: 1.05rem; }
.doc .faq details p { color: var(--ink-2); }

.doc .oss-meta { margin-top: 0.5rem; margin-bottom: 0; }

.doc-next {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.captain-demo {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.hero-captain h1,
html[data-theme="captain"] .hero-captain h1 {
  max-width: 15ch;
}

.hero-captain .lede { max-width: 44ch; }

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.demo-controls[hidden],
.demo-panel[hidden] { display: none; }

.demo-controls button {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--ink-2);
  font: 500 0.8rem var(--mono);
  cursor: pointer;
  min-height: 44px;
}

.demo-controls button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--accent);
  background: rgba(92, 156, 245, 0.16);
}

.demo-controls button:hover { border-color: var(--accent); }

.demo-controls button:focus-visible,
.comparison-scroll:focus-visible,
.command-table-scroll:focus-visible,
.feature-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.hero-captain .hero-terminal {
  font-size: 0.88rem;
  animation: none;
}

.demo-panel {
  padding: 1.25rem;
  display: grid;
  align-content: start;
  gap: 1rem;
  min-height: 385px;
}

.demo-prompt {
  color: var(--ink);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.demo-prompt .prompt { margin-right: 0.4rem; }
.demo-prompt code { font: inherit; }

.demo-decision {
  display: grid;
  gap: 0.2rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--accent);
}

.demo-label {
  font: 500 0.72rem var(--mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-decision strong,
.demo-stages strong { font-weight: 500; }
.demo-decision > span:last-child { color: var(--ink-2); font-size: 0.8rem; }

.demo-result {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  color: var(--ok);
  line-height: 1.65;
}

.demo-caption,
.demo-detail {
  font: 400 0.8rem/1.6 var(--sans);
  color: var(--muted);
}

.demo-caption { margin-top: 0.8rem; max-width: 60ch; }

.demo-stages {
  list-style: none;
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
}

.demo-stages li { display: grid; gap: 0.2rem; }

.value-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.value-cards article {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.feature-number {
  display: block;
  font: 500 0.75rem/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.value-cards h3 {
  font: 600 1.25rem/1.3 var(--display);
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}

.value-cards p { color: var(--ink-2); line-height: 1.7; }

.section-followup { margin-top: 1.5rem; max-width: 72ch; color: var(--ink-2); }
.section-followup code { font-family: var(--mono); font-size: 0.9em; }

.chain-demo code.inline-code {
  display: inline;
  font-size: 0.9em;
  padding: 0.05em 0.35em;
}

.comparison-callout {
  margin-top: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(92, 156, 245, 0.35);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(92, 156, 245, 0.09), transparent), var(--bg-elev);
}

.comparison-callout h3 {
  margin: 0 0 0.85rem;
  font: 600 1.35rem/1.3 var(--display);
}

.comparison-callout p { max-width: 76ch; margin: 0 0 1rem; color: var(--ink-2); line-height: 1.75; }

.cta-band p.cta-note { font-size: 0.85rem; margin-top: 1.25rem; color: var(--muted); }

.feature-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.feature-nav a {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}

.ranked-feature {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line);
  padding: 2.75rem 0;
}

.ranked-feature h2,
html[data-theme] .ranked-feature h2 {
  font: 600 clamp(1.5rem, 2.8vw, 2rem)/1.2 var(--display);
  letter-spacing: -0.025em;
  margin: 0;
  max-width: 22ch;
  padding: 0;
}

.ranked-feature p { margin: 0 0 1rem; color: var(--ink-2); max-width: 66ch; line-height: 1.75; }
.ranked-feature p:last-child { margin-bottom: 0; }
.ranked-feature .feature-benefit,
.feature-page > .feature-benefit { color: var(--ink); font-weight: 500; }
.ranked-feature .feature-detail,
.feature-page .feature-detail { font-size: 0.88rem; color: var(--muted); line-height: 1.7; }
.feature-page > .chain-demo { margin: 0 0 2.75rem; }
.feature-page .page-hero { padding-bottom: 2.75rem; }

.routing-signals {
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}

.routing-signals h2,
html[data-theme] .routing-signals h2 {
  margin: 0.5rem 0 1rem;
  padding: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.routing-signals > p { max-width: 78ch; line-height: 1.75; }
.routing-signals h3 {
  margin: 0.35rem 0 0.85rem;
  font: 600 1.35rem/1.3 var(--display);
}
.routing-signals .value-cards { margin: 1.25rem 0 1.5rem; }
.routing-signals .value-cards article { background: var(--bg); }
.routing-signals .value-cards + .section-kicker { display: block; margin-top: 0.5rem; }
.feature-page > .arch-follow { margin: 1.25rem 0 0; }

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

.signal-grid dt { color: var(--ink); font-weight: 600; margin-bottom: 0.5rem; }
.signal-grid dd { margin: 0; color: var(--ink-2); line-height: 1.7; }

.comparison-heading { border-top: 1px solid var(--line); padding-top: 3rem; }
.comparison-heading h2,
html[data-theme] .comparison-heading h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0.6rem 0 1rem; }
.comparison-heading p { max-width: 78ch; margin: 0 0 1rem; color: var(--ink-2); line-height: 1.7; }
.comparison-heading #comparison-method { font-size: 0.88rem; color: var(--muted); }
.comparison-heading p.table-hint { font: 400 0.78rem/1.6 var(--mono); color: var(--accent); }

.comparison-scroll,
.command-table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 1.25rem 0 2rem;
  scrollbar-color: var(--accent) var(--bg-elev);
}

.doc .comparison-table { min-width: 1000px; margin: 0; table-layout: fixed; font-size: 0.88rem; }
.doc .differentiation-table { min-width: 1080px; }
.doc .differentiation-table td:nth-child(3) { background: rgba(92, 156, 245, 0.05); }
.doc .differentiation-table thead th:nth-child(3) { color: var(--accent); }
.doc .comparison-table caption { text-align: left; padding: 1rem 1.1rem; color: var(--ink); background: var(--bg-elev); font-weight: 500; }
.doc .comparison-table th,
.doc .comparison-table td { padding: 1.1rem; line-height: 1.65; overflow-wrap: anywhere; }
.doc .comparison-table thead th { font-size: 0.72rem; color: var(--ink-2); background: var(--bg-elev); vertical-align: bottom; }
.doc .comparison-table th:first-child { width: 165px; }
.doc .comparison-table tbody th {
  font: 500 0.92rem/1.5 var(--sans);
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  position: sticky;
  left: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  z-index: 1;
}
.doc .comparison-table tbody th span { display: inline-block; margin-top: 0.35rem; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.doc .comparison-table .captain-row td { background: rgba(92, 156, 245, 0.07); }
.doc .comparison-table .captain-row th { color: var(--accent); border-left: 3px solid var(--accent); }
.doc .comparison-table tr:last-child > * { border-bottom: 0; }

.doc .command-table-scroll table { min-width: 780px; margin: 0; }
.doc .command-table-scroll th,
.doc .command-table-scroll td { padding: 1rem; line-height: 1.65; }
.doc .command-table-scroll code { white-space: normal; overflow-wrap: anywhere; }

.feature-page .comparison-sources { max-width: 90ch; }
.section .doc > .comparison-sources li { margin: 0.9rem 0; line-height: 1.75; overflow-wrap: anywhere; }
.feature-page [id] { scroll-margin-top: 100px; }

@media (max-width: 900px) {
  .hero-captain h1,
  html[data-theme="captain"] .hero-captain h1 { max-width: 20ch; }
  .hero-captain .lede { max-width: 56ch; }
  .captain-demo { max-width: 640px; width: 100%; }
}

@media (max-width: 760px) {
  .value-cards, .ranked-feature, .signal-grid { grid-template-columns: 1fr; }
  .ranked-feature { gap: 1.1rem; padding: 2rem 0; }
  .ranked-feature h2, html[data-theme] .ranked-feature h2 { max-width: none; }
  .demo-panel { min-height: 410px; padding: 1rem; }
  .demo-controls button { padding-inline: 0.7rem; }
  .doc .comparison-table th:first-child { width: 140px; }
  .value-cards article { padding: 1.25rem; }
  .commands { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-captain *, .hero-captain *::after { animation: none !important; }
}

.doc-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  margin: 0 0 1.75rem;
}

.doc-table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.doc .doc-table-scroll table { min-width: 580px; margin: 0; }
.doc .doc-table-scroll td code { white-space: normal; }

.doc p code,
.doc li code { overflow-wrap: anywhere; }

.addon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.addon-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-elev);
}

.addon-status {
  font: 500 0.72rem/1.6 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.addon-card h3 {
  font: 600 clamp(1.5rem, 3vw, 2rem)/1.2 var(--display);
  margin: 1rem 0 0.75rem;
}

.addon-card p { color: var(--ink-2); line-height: 1.75; margin: 0 0 1.25rem; }
.addon-card .addon-promise { color: var(--ink); font-weight: 500; }
.addon-card a { margin-top: auto; line-height: 1.65; }

.integration-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0;
  margin-top: 1rem;
  border-bottom: 1px solid var(--line);
}

.integration-strip h3 { font: 500 1.2rem/1.4 var(--display); margin-bottom: 0.75rem; }
.integration-strip p { color: var(--ink-2); max-width: 72ch; line-height: 1.75; }
.integration-strip > a { flex-shrink: 0; line-height: 1.65; }
.integration-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin: 0 0 3rem; }
.integration-flow > div { padding: 1.25rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-elev); }
.doc .integration-flow h2 { font: 500 1.1rem/1.5 var(--display); margin: 0.75rem 0; padding: 0; }
.doc .integration-flow p { font-size: 0.92rem; margin: 0; line-height: 1.75; color: var(--ink-2); }
.doc .integration-table { min-width: 860px; }
.comparison-heading #integration-method { font-size: 0.88rem; color: var(--muted); }
.addon-card a:focus-visible,
.integration-strip a:focus-visible,
.comparison-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

@media (max-width: 760px) {
  .addon-grid, .integration-flow { grid-template-columns: minmax(0, 1fr); }
  .integration-strip { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

.footer-meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.footer-meta a:hover { color: var(--accent, #c45c26); }

/* --- Architecture & Flow Stack (Interactive 4-Tier Illustration) --- */
.arch-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2.5rem;
  position: relative;
}

.arch-layer {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.arch-layer:hover {
  border-color: rgba(92, 156, 245, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(92, 156, 245, 0.15);
}

.arch-layer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.arch-layer-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.arch-layer-sub {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.arch-layer-title {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.arch-layer-desc {
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 1rem;
  max-width: 72ch;
}

.arch-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.arch-pills li {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.arch-pills li b {
  color: var(--ink);
  font-weight: 500;
}

.arch-pills li.highlight {
  border-color: rgba(92, 156, 245, 0.3);
  background: rgba(92, 156, 245, 0.06);
  color: var(--ink);
}

.arch-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  margin: -0.25rem 0;
}

.arch-connector::before,
.arch-connector::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.arch-connector span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--accent);
}

