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

:root {
  --orange: #FFA533;
  --orange-dark: #E8901A;
  --orange-light: #FFF7ED;
  --text: #0F172A;
  --text-2: #334155;
  --text-3: #64748B;
  --text-4: #94A3B8;
  --bg: #FFFFFF;
  --bg-alt: #F8FAFC;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --sidebar-w: 240px;
  --topbar-h: 52px;
}

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ─── Top Bar ─────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
}

.topbar-brand:hover { text-decoration: none; }

.topbar-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.topbar-sep {
  color: var(--text-4);
  font-weight: 400;
  margin: 0 2px;
}

.topbar-label {
  color: var(--text-3);
  font-weight: 500;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-nav a {
  color: var(--text-3);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}

.topbar-nav a:hover { color: var(--text); text-decoration: none; }

.topbar-cta {
  background: var(--text) !important;
  color: #fff !important;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600 !important;
}

.topbar-cta:hover { opacity: 0.88; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

/* ─── Layout ──────────────────────────────────── */
.layout {
  display: flex;
  justify-content: center;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  padding-left: var(--sidebar-w);
}

/* ─── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 20px 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 50;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 24px;
}

.sidebar-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: block;
  padding: 5px 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.1s;
}

.sidebar-link:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--orange-dark);
  background: var(--orange-light);
  font-weight: 600;
}

/* ─── Content ─────────────────────────────────── */
.content {
  width: 100%;
  max-width: 860px;
  padding: 40px 48px 80px;
  margin: 0;
}

.content-group {
  margin-bottom: 72px;
}

.group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: 12px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

section {
  margin-bottom: 60px;
  padding-top: 12px;
}

section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
  line-height: 1.2;
}

section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.lead {
  font-size: 1.05rem;
  color: var(--text-2);
  margin-bottom: 28px;
  line-height: 1.75;
}

section p {
  margin-bottom: 14px;
  font-size: 0.93rem;
  color: var(--text-2);
  line-height: 1.7;
}

section ul, section ol {
  margin-bottom: 18px;
  padding-left: 20px;
}

section li {
  font-size: 0.93rem;
  color: var(--text-2);
  margin-bottom: 8px;
  line-height: 1.65;
}

section li strong {
  color: var(--text);
}

/* ─── Code Blocks ─────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-2);
}

.code-block {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.code-block code {
  display: block;
  background: none;
  padding: 0;
  margin-bottom: 4px;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block code:last-child { margin-bottom: 0; }

.code-block.dark {
  background: #0F172A;
  border-color: #1E293B;
}

.code-block.dark pre,
.code-block.dark code {
  color: #CBD5E1;
  background: none;
}

.code-block pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
}

/* ─── Tables ──────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody td code {
  font-size: 0.78rem;
}

/* ─── Badge ───────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--orange-light);
  color: var(--orange-dark);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: var(--mono);
  white-space: nowrap;
}

section h2 .badge {
  vertical-align: middle;
  margin-left: 6px;
  font-size: 0.62rem;
}

/* ─── Callout ─────────────────────────────────── */
.callout {
  background: var(--orange-light);
  border-left: 3px solid var(--orange);
  padding: 16px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 20px 0;
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.65;
}

.callout strong {
  color: var(--orange-dark);
}

/* ─── Protocol Stack ──────────────────────────── */
.stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}

.stack-layer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  font-size: 0.88rem;
  color: var(--text-2);
}

.stack-layer:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.stack-layer:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.stack-layer + .stack-layer { border-top: none; }

/* ─── Roadmap Timeline ────────────────────────── */
.roadmap-timeline {
  position: relative;
  padding-left: 36px;
  margin-bottom: 32px;
}

/* Vertical line */
.roadmap-timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.roadmap-timeline.done::before { background: linear-gradient(to bottom, #16A34A, #22C55E); }
.roadmap-timeline.progress::before { background: linear-gradient(to bottom, var(--orange-dark), var(--orange)); }
.roadmap-timeline.planned::before { background: var(--border); }

.roadmap-timeline li {
  position: relative;
  padding: 8px 0 8px 16px;
  margin-bottom: 4px;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.5;
  list-style: none;
}

/* Timeline node */
.roadmap-timeline li::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  z-index: 2;
}

/* Done = filled green circle with checkmark */
.roadmap-timeline.done li::before {
  background: #16A34A;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.roadmap-timeline.done li::after {
  content: '\2713';
  position: absolute;
  left: -29px;
  top: 12px;
  font-size: 0.55rem;
  font-weight: 900;
  color: #fff;
  width: 12px;
  text-align: center;
  line-height: 14px;
  z-index: 3;
}

/* In-progress = pulsing orange ring */
.roadmap-timeline.progress li::before {
  background: #fff;
  border: 2.5px solid var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 165, 51, 0.2);
  animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 165, 51, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(255, 165, 51, 0.08); }
}

/* Planned = empty gray dot */
.roadmap-timeline.planned li::before {
  background: var(--bg);
  border: 2px solid var(--text-4);
}

/* Phase label */
.roadmap-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.roadmap-phase.done { background: #F0FDF4; color: #16A34A; }
.roadmap-phase.progress { background: var(--orange-light); color: var(--orange-dark); }
.roadmap-phase.planned { background: var(--bg-alt); color: var(--text-3); }

.roadmap-phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.roadmap-phase.done .roadmap-phase-dot { background: #16A34A; }
.roadmap-phase.progress .roadmap-phase-dot { background: var(--orange); }
.roadmap-phase.planned .roadmap-phase-dot { background: var(--text-4); }

/* ─── Links Grid ──────────────────────────────── */
.links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.link-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.link-card:hover {
  border-color: var(--text-4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-decoration: none;
}

.link-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 2px;
}

.link-card span {
  font-size: 0.78rem;
  color: var(--text-3);
  font-family: var(--mono);
}

/* ─── Footer ──────────────────────────────────── */
.docs-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  margin-top: 48px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-4);
}

.docs-footer a {
  color: var(--text-3);
  font-weight: 500;
}

/* ─── Mobile ──────────────────────────────────── */
@media (max-width: 860px) {
  .topbar-nav { display: none; }
  .sidebar-toggle { display: block; }

  .layout {
    padding-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: none;
  }

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

  .content {
    margin: 0;
    padding: 32px 20px 64px;
    max-width: 100%;
  }

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

  .docs-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  section { margin-bottom: 44px; }
  .content-group { margin-bottom: 56px; }
  .lead { font-size: 0.95rem; margin-bottom: 20px; }

  table { font-size: 0.78rem; }
  thead th { padding: 8px 10px; font-size: 0.7rem; }
  tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .topbar-brand { font-size: 0.88rem; }

  section h1 { font-size: 1.3rem; }
  section h2 { font-size: 1rem; margin-top: 28px; }

  .content { padding: 24px 14px 56px; }

  .code-block { padding: 10px 12px; border-radius: 6px; }
  .code-block code { font-size: 0.72rem; }
  .code-block pre { font-size: 0.72rem; }

  section p { font-size: 0.88rem; }
  section li { font-size: 0.88rem; }
  .callout { padding: 12px 14px; font-size: 0.82rem; }

  .stack-layer { padding: 10px 12px; font-size: 0.82rem; }
}
