/* ============================================================
   ctxc — subpages (home page styles untouched)
   ============================================================ */

.page {
  min-height: 100vh;
}

[hidden] { display: none !important; }

.page .site-header .nav-links a[aria-current="page"] {
  color: var(--text);
}

/* ---------- page hero ---------- */

.page-hero {
  position: relative;
  padding: 62px 0 38px;
  overflow: hidden;
  overflow: clip;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: -40% 30% auto -10%;
  height: 520px;
  background: radial-gradient(closest-side, rgba(200, 255, 61, 0.08), transparent 72%);
  pointer-events: none;
  z-index: -1;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}
.breadcrumb a { color: var(--muted); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: rgba(255, 255, 255, 0.18); }

.page-hero h1 {
  max-width: 900px;
  font-size: clamp(2.6rem, 5vw, 4.15rem);
  line-height: 1.01;
  letter-spacing: -0.047em;
  font-weight: 670;
  margin-bottom: 20px;
}
.page-hero h1 .accent { color: var(--accent); }

.page-lead {
  max-width: 690px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
}
.page-lead code,
.page-hero h1 code {
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 0.92em;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.page-meta .chip { text-transform: none; letter-spacing: 0.02em; font-size: 10.5px; }

/* ---------- page body / docs ---------- */

.page-body { padding: 22px 0 104px; }

.doc-grid {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  min-width: 0;
}
.doc-grid > * { min-width: 0; }

.toc {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.toc .mono-label { margin-bottom: 10px; }
.toc a {
  padding: 5px 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--dim);
  transition: color 0.2s;
}
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent); }

.prose {
  max-width: 830px;
  min-width: 0;
}
.prose > :first-child { margin-top: 0; }
.example,
.table-wrap,
.pipeline,
.tool-detail,
.faq,
.invite-hero-card {
  min-width: 0;
}

.prose h2 {
  margin: 66px 0 18px;
  font-size: clamp(1.65rem, 2.7vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 640;
  scroll-margin-top: 96px;
}
.prose h2:first-of-type { margin-top: 0; }
.prose h3 {
  margin: 34px 0 10px;
  font-size: 1.12rem;
  font-weight: 620;
  letter-spacing: -0.015em;
  scroll-margin-top: 96px;
}
.prose p {
  max-width: 72ch;
  margin-bottom: 16px;
  font-size: 14.8px;
  line-height: 1.75;
  color: var(--muted);
}
.prose ul,
.prose ol {
  max-width: 72ch;
  margin: 0 0 20px;
  padding-left: 22px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--muted);
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: rgba(200, 255, 61, 0.55); }
.prose strong { color: var(--text); font-weight: 600; }
.prose code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--accent-2);
  font-size: 0.9em;
}
.prose a {
  color: var(--accent-2);
  border-bottom: 1px solid rgba(141, 233, 195, 0.28);
  transition: color 0.2s, border-color 0.2s;
}
.prose a:hover {
  color: var(--accent);
  border-color: rgba(200, 255, 61, 0.4);
}
.prose hr {
  margin: 44px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---------- callouts ---------- */

.callout {
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.014);
}
.callout p { margin: 0; font-size: 14px; line-height: 1.7; }
.callout p + p { margin-top: 8px; }
.callout .mono-label { display: block; margin-bottom: 7px; }
.callout.accent {
  border-color: rgba(200, 255, 61, 0.24);
  background: rgba(200, 255, 61, 0.04);
}
.callout.accent .mono-label { color: var(--accent); }
.callout.discord {
  border-color: rgba(111, 122, 255, 0.32);
  background: rgba(88, 101, 242, 0.075);
}
.callout.discord .mono-label { color: #aab4ff; }
.callout.warn {
  border-color: rgba(255, 138, 117, 0.24);
  background: rgba(255, 138, 117, 0.04);
}
.callout.warn .mono-label { color: var(--danger); }

/* ---------- code examples ---------- */

.example {
  margin: 22px 0 30px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #080b09;
  overflow: hidden;
}
.example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.example pre {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.8px;
  line-height: 1.8;
  color: #cbd6cc;
  white-space: pre-wrap;
  word-break: break-word;
}
.example .hl { color: var(--accent); }
.example .ok { color: var(--accent-2); }
.example .dim { color: var(--dim); }
.example .err { color: var(--danger); }

/* ---------- tables ---------- */

.table-wrap {
  margin: 22px 0 30px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.spec-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}
.spec-table th {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.018);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
}
.spec-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
  vertical-align: top;
}
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table td:first-child {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  white-space: nowrap;
}
.spec-table code { font-size: 0.92em; }

/* ---------- page cards / links ---------- */

.page-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 44px;
}
.page-link {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 17px 42px 17px 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.012);
  transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease);
}
.page-link:hover {
  border-color: rgba(200, 255, 61, 0.24);
  background: rgba(200, 255, 61, 0.025);
  transform: translateY(-2px);
}
.page-link span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.page-link strong { font-size: 14px; font-weight: 600; }
.page-link .arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 12px;
}

/* ---------- step list ---------- */

.step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 26px 0 8px;
  border-left: 1px solid var(--line);
}
.step-item {
  position: relative;
  padding: 0 0 30px 26px;
}
.step-item:last-child { padding-bottom: 0; }
.step-item::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 255, 61, 0.08);
}
.step-item h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
}
.step-item p {
  margin: 0;
  font-size: 13.8px;
  line-height: 1.65;
  color: var(--muted);
}

/* ---------- tool detail ---------- */

.tool-detail {
  padding: 26px 26px 22px;
  margin: 30px 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.005));
  scroll-margin-top: 96px;
}
.tool-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.tool-detail h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tool-detail h2 .dim { color: var(--dim); }
.tool-detail .tool-index {
  position: static;
  padding-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
}
.tool-detail > p { margin-bottom: 18px; }

/* ---------- pipeline diagram ---------- */

.pipeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 10px;
  margin: 24px 0 30px;
}
.pipe-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}
.pipe-card .mono-label { display: block; margin-bottom: 7px; }
.pipe-card strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.pipe-card p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--dim); }
.pipe-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- benchmark ---------- */

.bench-panel {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(180deg, #0d1210, #090c0a);
  box-shadow: 0 45px 110px -45px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}
.bench-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 26px 22px;
  border-bottom: 1px solid var(--line);
}
.bench-head h2 {
  margin: 6px 0 6px;
  font-size: clamp(1.5rem, 2.7vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 650;
}
.bench-head p {
  max-width: 560px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}
.bench-head .btn { flex-shrink: 0; }
.bench-head .btn[disabled] {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.bench-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.bench-metric {
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}
.bench-metric:last-child { border-right: 0; }
.bench-metric span {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
}
.bench-metric strong {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}
.bench-metric strong.accent { color: var(--accent); }
.bench-metric strong.ok { color: var(--accent-2); }

.bench-table-wrap { overflow-x: auto; }
.bench-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 11.5px;
}
.bench-table th {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.bench-table th.num,
.bench-table td.num { text-align: right; }
.bench-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}
.bench-table tr:last-child td { border-bottom: 0; }
.bench-table td:first-child { color: var(--text); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.bench-table td:first-child small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  letter-spacing: 0.01em;
}
.bench-table .codec { color: var(--accent-2); font-family: var(--mono); font-size: 10.5px; }
.bench-table .tokens { font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.bench-table .tokens .dim { color: var(--dim); }
.bench-row.is-running td { opacity: 0.65; }
.bench-row.is-pending td { opacity: 0.45; }

.sbar {
  display: inline-block;
  width: 86px;
  height: 4px;
  margin-right: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  vertical-align: middle;
}
.sbar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.7s var(--ease);
}
.bench-saving { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.badge.pass { color: var(--accent); border-color: rgba(200, 255, 61, 0.25); background: rgba(200, 255, 61, 0.06); }
.badge.fail { color: var(--danger); border-color: rgba(255, 138, 117, 0.25); background: rgba(255, 138, 117, 0.06); }
.badge.run { color: var(--accent-2); border-color: rgba(141, 233, 195, 0.25); background: rgba(141, 233, 195, 0.06); }

.bench-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.bench-foot .live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(200, 255, 61, 0.7);
}

/* ---------- demo page extras ---------- */

.demo-block { margin-top: 36px; }
.demo-block .demo-shell { box-shadow: 0 40px 90px -45px rgba(0, 0, 0, 0.8); }
.page .demo-controls {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.page .demo-controls .btn {
  width: 100%;
  margin-left: 0;
}

.demo-extra {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}
.demo-extra .why-card { padding: 18px; }
.demo-extra .why-card h3 { font-size: 13.5px; margin-bottom: 5px; }
.demo-extra .why-card p { font-size: 12.5px; line-height: 1.55; }

/* ---------- invite page ---------- */

.invite-hero-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
  margin: 30px 0;
  padding: 28px;
  border: 1px solid rgba(111, 122, 255, 0.3);
  border-radius: 16px;
  background:
    radial-gradient(500px 220px at 0% 0%, rgba(88, 101, 242, 0.16), transparent 70%),
    rgba(255, 255, 255, 0.012);
}
.invite-hero-card .invite-mark { flex-shrink: 0; }
.invite-hero-card h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.03em; }
.invite-hero-card p { margin: 0 0 16px; max-width: 62ch; font-size: 14px; line-height: 1.7; color: var(--muted); }
.invite-hero-card .invite-actions { flex-direction: row; align-items: center; flex-wrap: wrap; }
.invite-hero-card .invite-actions .btn { width: auto; }

.dm-template {
  position: relative;
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #080b09;
}
.dm-template p {
  margin: 0;
  max-width: none;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #cfd8cf;
}
.dm-template .copy {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* ---------- faq page ---------- */

.faq-group { margin-top: 44px; }
.faq-group:first-of-type { margin-top: 0; }
.faq-group h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.faq-group p.group-lead {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--dim);
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
  .doc-grid { gap: 42px; grid-template-columns: 178px minmax(0, 1fr); }
  .bench-summary { grid-template-columns: repeat(2, 1fr); }
  .bench-metric:nth-child(2) { border-right: 0; }
  .bench-metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .page-hero { padding: 48px 0 30px; }
  .page-body { padding-bottom: 78px; }
  .doc-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0;
    border-left: 0;
    margin-bottom: 8px;
  }
  .toc .mono-label { width: 100%; margin-bottom: 4px; }
  .toc a {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 11px;
  }
  .toc a.is-active { border-color: rgba(200, 255, 61, 0.3); }
  .pipeline { grid-template-columns: 1fr; }
  .pipe-arrow { padding: 2px 0; transform: rotate(90deg); }
  .page-links { grid-template-columns: 1fr; }
  .demo-extra { grid-template-columns: 1fr; }
  .bench-head { flex-direction: column; align-items: flex-start; }
  .bench-head .btn { width: 100%; }
  .invite-hero-card { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page-hero h1 { font-size: clamp(2.2rem, 9vw, 2.9rem); }
  .page-lead { font-size: 15.5px; }
  .page-meta { margin-top: 22px; }
  .prose h2 { margin-top: 52px; }
  .prose h3 { margin-top: 28px; }
  .bench-summary { grid-template-columns: 1fr 1fr; }
  .bench-metric { padding: 14px 16px; }
  .bench-metric strong { font-size: 17px; }
  .bench-head, .bench-foot { padding-left: 18px; padding-right: 18px; }
  .bench-table th, .bench-table td { padding-left: 12px; padding-right: 12px; }
  .invite-hero-card { padding: 22px; }
  .invite-hero-card .invite-actions { flex-direction: column; align-items: stretch; }
  .invite-hero-card .btn { width: 100%; }
  .tool-detail { padding: 20px 18px; }
  .tool-detail h2 { font-size: 18px; }
  .dm-template { padding-top: 48px; }
  .page .hero-note { font-size: 10px; }

  /* tables fit the phone instead of hiding columns */
  .table-wrap {
    overflow: hidden;
    margin: 18px 0 24px;
  }
  .spec-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 11px;
  }
  .spec-table th,
  .spec-table td {
    padding: 8px 7px;
    font-size: 10.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .spec-table th { font-size: 8px; letter-spacing: 0.07em; }
  .spec-table td:first-child { white-space: normal; font-size: 10.5px; }
  .spec-table th:first-child,
  .spec-table td:first-child { width: 27%; }
  .spec-table th:nth-child(2),
  .spec-table td:nth-child(2) { width: 24%; }
  .spec-table th:nth-child(4),
  .spec-table td:nth-child(4) { width: 18%; }

  /* benchmark rows become cards */
  .bench-table-wrap { overflow: visible; }
  .bench-table {
    min-width: 0;
    display: block;
  }
  .bench-table thead { display: none; }
  .bench-table tbody { display: block; }
  .bench-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 9px 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
  }
  .bench-row:last-child { border-bottom: 0; }
  .bench-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .bench-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim);
  }
  .bench-table td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 2px;
    white-space: normal;
    font-size: 12px;
  }
  .bench-table td:first-child::before { display: none; }
  .bench-table td.num { text-align: left; }
  .bench-table .badge { margin-top: 2px; }
}
