/* ================================================
   Unify Docs — Shared Stylesheet
   Matches unify.onl design language
   ================================================ */

:root {
  --surface: #ffffff;
  --surface-low: #f5f5f7;
  --on-surface: #1d1d1f;
  --on-surface-variant: #6e6e73;
  --accent: #0066cc;
  --outline: #e8e8ed;
  --sidebar-width: 240px;
  --topbar-height: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 1.5rem);
}

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 0 1rem;
  z-index: 200;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-brand {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.topbar-brand:hover {
  color: var(--on-surface);
  text-decoration: none;
}

.topbar-back {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-back:hover {
  color: var(--on-surface);
  text-decoration: none;
}

/* ── Hamburger ───────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--on-surface);
  transition: all 0.2s ease;
  transform-origin: center;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--outline);
  overflow-y: auto;
  padding: 1.5rem 0 3rem;
  z-index: 100;
}

.sidebar-logo {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--on-surface);
  text-decoration: none;
  padding: 0 1.25rem;
  margin-bottom: 1.75rem;
}

.sidebar-logo:hover {
  text-decoration: none;
  color: var(--on-surface);
}

.nav-section {
  margin-bottom: 0.25rem;
}

.nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  padding: 0.875rem 1.25rem 0.375rem;
}

.nav-item {
  display: block;
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  text-decoration: none;
  padding: 0.375rem 1.25rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.5;
}

.nav-item:hover {
  color: var(--on-surface);
  background: var(--surface-low);
  text-decoration: none;
}

.nav-item.active {
  color: var(--on-surface);
  font-weight: 600;
  border-left-color: var(--accent);
  background: #f0f7ff;
}

.nav-divider {
  height: 1px;
  background: var(--outline);
  margin: 0.75rem 1.25rem;
}

/* ── Overlay (mobile) ────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

.overlay.visible {
  display: block;
}

/* ── Main content ────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2.5rem 6rem;
}

/* ── Typography ──────────────────────────────── */
.content h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--on-surface);
  margin-bottom: 0.625rem;
}

.content .subtitle {
  font-size: 1.0625rem;
  color: var(--on-surface-variant);
  line-height: 1.65;
  margin-bottom: 2.5rem;
  max-width: 54ch;
}

.content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--on-surface);
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.content h2:first-of-type {
  margin-top: 0;
}

.content h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content p {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.content p:last-child {
  margin-bottom: 0;
}

.content ul, .content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.content li {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
  line-height: 1.75;
  margin-bottom: 0.25rem;
}

.content strong {
  font-weight: 600;
  color: var(--on-surface);
}

.page-divider {
  height: 1px;
  background: var(--outline);
  margin: 2.5rem 0;
}

/* ── Page header ─────────────────────────────── */
.page-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--outline);
  margin-bottom: 2.5rem;
}

.page-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.625rem;
  display: block;
  font-family: var(--font-mono);
}

/* ── Agent card grid ─────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--outline);
  border: 1px solid var(--outline);
  margin-bottom: 2rem;
}

.agent-card {
  background: var(--surface);
  padding: 1.5rem;
  text-decoration: none;
  display: block;
  transition: background 0.15s;
}

.agent-card:hover {
  background: var(--surface-low);
  text-decoration: none;
}

.agent-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 50%;
}

.agent-card-name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin-bottom: 0.25rem;
}

.agent-card-stage {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  margin-bottom: 0.625rem;
  font-family: var(--font-mono);
}

.agent-card-desc {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 0.875rem;
}

.agent-card-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
}

/* ── Stepper ─────────────────────────────────── */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--outline);
  margin-bottom: 2rem;
}

.step {
  padding: 1.5rem;
  border-right: 1px solid var(--outline);
}

.step:last-child {
  border-right: none;
}

.step-num {
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}

.step-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.step-desc {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  line-height: 1.65;
}

/* ── Flow diagram ────────────────────────────── */
.flow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--outline);
  border: 1px solid var(--outline);
  margin-bottom: 2rem;
}

.flow-col {
  background: var(--surface);
  padding: 1.5rem;
}

.flow-col-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 1rem;
  display: block;
}

.flow-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.flow-col li {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  line-height: 1.6;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--outline);
}

.flow-col li:last-child {
  border-bottom: none;
}

.flow-col p {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  line-height: 1.7;
  margin: 0;
}

/* ── Integration pills ───────────────────────── */
.integration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.integration-group {
  padding: 1.25rem;
  border: 1px solid var(--outline);
}

.integration-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  margin-bottom: 0.75rem;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pill {
  font-size: 0.8125rem;
  color: var(--on-surface);
  background: var(--surface-low);
  border: 1px solid var(--outline);
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Proof metric callout ────────────────────── */
.proof-block {
  background: var(--surface-low);
  border: 1px solid var(--outline);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
}

.proof-block blockquote {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  line-height: 1.5;
  margin-bottom: 0.625rem;
}

.proof-block .proof-note {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin: 0;
}

/* ── Table ───────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.data-table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--outline);
  background: var(--surface-low);
  font-family: var(--font-mono);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--outline);
  color: var(--on-surface-variant);
  vertical-align: top;
  line-height: 1.6;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table td:first-child {
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
}

.data-table tbody tr:hover td {
  background: var(--surface-low);
}

/* ── FAQ accordion ───────────────────────────── */
.faq-group {
  margin-bottom: 2.5rem;
}

.faq-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--outline);
  margin-bottom: 0;
}

.faq-item {
  border-bottom: 1px solid var(--outline);
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.5;
  transition: color 0.15s;
}

.faq-question:hover {
  color: var(--accent);
}

.faq-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: transform 0.2s ease;
}

.faq-icon::after {
  content: '+';
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding-bottom: 1.25rem;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-answer p {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
  line-height: 1.75;
  margin: 0;
}

/* ── Inline FAQ (agent pages) ────────────────── */
.faq-simple .faq-item {
  border-bottom: 1px solid var(--outline);
}

/* ── CTA block ───────────────────────────────── */
.cta-block {
  background: var(--surface-low);
  border: 1px solid var(--outline);
  padding: 2rem;
  margin-top: 3rem;
  text-align: center;
}

.cta-block h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--on-surface);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.cta-block p {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
  margin-bottom: 1.25rem;
}

.cta-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  transition: opacity 0.15s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.8;
}

.btn-primary {
  background: var(--on-surface);
  color: var(--surface);
}

.btn-outline {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline);
}

.btn-outline:hover {
  border-color: var(--on-surface);
  opacity: 1;
}

/* ── Inline notice ───────────────────────────── */
.notice {
  background: #f0f7ff;
  border: 1px solid #cce0ff;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

.notice p {
  font-size: 0.875rem;
  color: var(--on-surface);
  margin: 0;
  line-height: 1.6;
}

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 150;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 2rem 1.25rem 4rem;
  }

  .content h1 {
    font-size: 1.625rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .agent-card:last-child:nth-child(odd) {
    grid-column: auto;
    max-width: none;
  }

  .stepper {
    grid-template-columns: 1fr 1fr;
  }

  .step {
    border-right: 1px solid var(--outline);
    border-bottom: 1px solid var(--outline);
  }

  .step:nth-child(2n) {
    border-right: none;
  }

  .step:nth-child(3),
  .step:nth-child(4) {
    border-bottom: none;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .integration-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .stepper {
    grid-template-columns: 1fr;
  }

  .step {
    border-right: none;
    border-bottom: 1px solid var(--outline);
  }

  .step:last-child {
    border-bottom: none;
  }
}
