/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── TOKENS ── */
:root {
  --bg: #0e0e0e;
  --bg-alt: #0b0b0b;
  --surface: #111111;
  --surface2: #161616;
  --border: #1a1a1a;
  --border2: #242424;
  --accent: #00d1c1;
  --accent-dark: #00a99f;
  --text: #e6e6e6;
  --text-muted: #c7c7c7;
  --text-dim: #8b8b8b;
  --sidebar-w: 240px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Fira Mono", "Courier New", monospace;
}

/* ── BASE ── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
LAYOUT
============================================================ */

.docs-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
SIDEBAR
============================================================ */

.docs-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}

/* Logo */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-logo img.logo {
  height: 20px;
  width: auto;
}

.sidebar-logo span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-group {
  margin-bottom: 24px;
  padding: 0 12px;
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-link {
  display: block;
  padding: 7px 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: 6px;
  transition: 0.15s;
  margin-bottom: 1px;
}

.nav-link:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-link.active {
  background: rgba(0, 209, 193, 0.08);
  color: var(--accent);
  font-weight: 500;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-support {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.sidebar-support:hover {
  color: var(--text-muted);
}

/* ============================================================
MAIN CONTENT
============================================================ */

.docs-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  max-width: 780px;
  padding: 56px 48px 80px;
}

/* ============================================================
PAGE HEADER
============================================================ */

.page-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.page-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 14px;
  line-height: 1.15;
}

.page-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.7;
}

/* ============================================================
SECTIONS
============================================================ */

.doc-section {
  margin-bottom: 48px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.section-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.subsection-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}

/* ============================================================
CODE BLOCKS
============================================================ */

.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.code-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.code-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.code-body {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.75;
  color: var(--text-muted);
  padding: 18px 20px;
  overflow-x: auto;
  white-space: pre;
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent);
}

/* ============================================================
CALLOUT
============================================================ */

.callout {
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.845rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.callout strong {
  color: var(--text);
}

/* ============================================================
FIELD TABLE
============================================================ */

.field-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.field-row {
  display: grid;
  grid-template-columns: 200px 100px 1fr;
  border-bottom: 1px solid var(--border);
}

.field-row:last-child {
  border-bottom: none;
}

.field-row-header {
  background: var(--surface2);
}

.field-col {
  padding: 11px 14px;
  font-size: 0.8rem;
}

.field-row-header .field-col {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ============================================================
FLOW LIST
============================================================ */

.flow-list {
  display: flex;
  flex-direction: column;
}

.flow-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px;
  position: relative;
}

.flow-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: -8px;
  width: 1px;
  background: var(--border2);
}

.flow-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}

/* ============================================================
BUTTON
============================================================ */

.btn {
  display: inline-block;
  background: linear-gradient(270deg, #00d1c1, #00a99f, #00d1c1);
  background-size: 600% 600%;
  color: #0e0e0e;
  padding: 12px 24px;
  font-weight: 700;
  border-radius: 999px;
  animation: gradientMove 6s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.callout {
  background: rgba(0, 209, 193, 0.04);
  border: 1px solid rgba(0, 209, 193, 0.12);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.callout strong {
  color: #ffffff;
  font-weight: 600;
}

.callout .inline-code {
  background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
MOBILE
============================================================ */

@media (max-width: 768px) {
  .docs-sidebar {
    width: 100%;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .docs-layout {
    flex-direction: column;
  }

  .docs-main {
    margin-left: 0;
    padding: 32px 20px 60px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}