/* Page hero */
.page-hero {
  padding: 64px 0 48px;
}
.page-hero h1 {
  font-size: 64px;
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
  text-wrap: balance;
}
.page-hero h1 em {
  font-style: normal;
  color: var(--accent-text);
}
.page-hero .lede {
  font-size: 20px;
  line-height: 1.45;
  max-width: 720px;
  color: var(--text-2);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  padding: 32px 0 64px;
}

/* TOC */
.toc {
  position: sticky;
  top: 84px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 20px;
}
.toc h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  margin: 0 0 12px;
}
.toc-link {
  display: block;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 0 6px 12px;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard);
}
.toc-link:hover,
.toc-link.on {
  color: var(--text-1);
  border-color: var(--accent);
}
.toc-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Doc */
.doc h2 {
  font-size: 36px;
  margin: 64px 0 16px;
  padding-top: 12px;
  letter-spacing: -0.02em;
  scroll-margin-top: 84px;
}
.doc h2:first-child {
  margin-top: 0;
}
.doc h3 {
  font-size: 22px;
  margin: 32px 0 12px;
}
.doc p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  margin-bottom: 16px;
  max-width: 720px;
}
.doc ul,
.doc ol {
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.7;
  padding-left: 20px;
  max-width: 720px;
}
.doc strong {
  color: var(--text-1);
}
.doc code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-1);
}
.doc a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: rgba(46, 219, 143, 0.4);
  text-underline-offset: 3px;
}
.doc a:hover {
  text-decoration-color: var(--accent);
}

/* State flow diagram */
.state-flow {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 32px;
  overflow-x: auto;
  margin: 32px 0;
}
.state-flow .row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: max-content;
}
.state-node {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  white-space: nowrap;
}
.state-node.signal {
  background: var(--accent-wash);
  color: var(--accent-wash-text);
  border-color: var(--accent);
}
html[data-theme="dark"] .state-node.signal,
html[data-theme="dim"] .state-node.signal {
  background: var(--accent-wash);
  color: var(--accent-wash-text);
}
.state-node.warn {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning-text);
  border-color: rgba(245, 158, 11, 0.3);
}
.state-node.ok {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success-text);
  border-color: rgba(34, 197, 94, 0.3);
}
.state-arr {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 16px;
}

/* Integrations grid */
.integrations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
  max-width: 720px;
}
.int-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 20px;
}
.int-card .h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}
.int-card h4 {
  font-size: 17px;
  margin: 0;
}
.int-card .ph {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.int-card .ph.live {
  background: var(--accent-wash);
  color: var(--accent-wash-text);
}
html[data-theme="dark"] .int-card .ph.live,
html[data-theme="dim"] .int-card .ph.live {
  background: var(--accent-wash);
  color: var(--accent-wash-text);
}
.int-card p {
  font-size: 14px;
  margin: 0;
  color: var(--text-2);
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .toc {
    position: static;
  }
  .integrations {
    grid-template-columns: 1fr;
  }
  .page-hero {
    padding: 48px 0 32px;
  }
  .page-hero h1 {
    font-size: 40px;
  }
  .doc h2 {
    font-size: 28px;
    margin: 48px 0 12px;
  }
}
