/* GroundWave Documentation — Shared Styles */

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

:root {
  --gray-950: #030712;
  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB;
  --blue-500: #3B82F6;
  --blue-400: #60A5FA;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-900: #1E3A5F;
  --green-400: #4ADE80;
  --green-500: #22C55E;
  --amber-400: #FBBF24;
  --amber-500: #F59E0B;
  --red-400: #F87171;
  --purple-400: #A78BFA;
  --cyan-400: #22D3EE;

  --sidebar-w: 280px;
  --toc-w: 220px;
  --nav-h: 56px;
  --content-max: 800px;
  --layout-max: 1400px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-950);
  color: var(--gray-300);
  line-height: 1.7;
  font-size: 15px;
}

/* ───── Focus ───── */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ───── Top Nav ───── */
.doc-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-h);
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.doc-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
}

.doc-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.doc-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gray-50);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.doc-nav-logo svg { width: 32px; height: 32px; }

.doc-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.doc-nav-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--gray-200);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.doc-nav-github:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.doc-nav-github svg { width: 16px; height: 16px; }

/* Disabled links (beta period — source not yet public) */
.disabled-link {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
  position: relative;
}
.disabled-link:hover { text-decoration: none; background: inherit; border-color: inherit; transform: none; }
a.doc-nav-github.disabled-link:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08); }

.disabled-link::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: var(--gray-200);
  font-size: 12px;
  font-weight: 450;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 300;
  border: 1px solid rgba(255,255,255,0.1);
}
.disabled-link:hover::after { opacity: 1; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  padding: 6px;
}

/* ───── Layout ───── */
.doc-layout {
  display: flex;
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
  max-width: var(--layout-max);
  margin-left: auto;
  margin-right: auto;
}

/* ───── Sidebar ───── */
.doc-sidebar {
  position: fixed;
  top: var(--nav-h);
  left: max(0px, calc((100vw - var(--layout-max)) / 2));
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 24px 16px 48px;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(3, 7, 18, 0.6);
  z-index: 100;
}

.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-track { background: transparent; }
.doc-sidebar::-webkit-scrollbar-thumb { background: var(--gray-800); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--gray-400);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
  font-weight: 450;
}

.sidebar-links a:hover {
  color: var(--gray-100);
  background: rgba(255,255,255,0.04);
}

.sidebar-links a.active {
  color: var(--blue-400);
  background: rgba(59,130,246,0.08);
  font-weight: 550;
}

.sidebar-links a .sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.5;
}

.sidebar-links a.active .sidebar-icon { opacity: 0.9; }

/* ───── Main Content ───── */
.doc-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-right: var(--toc-w);
  padding: 40px 48px 80px;
  max-width: calc(var(--content-max) + 96px);
}

.doc-content {
  max-width: var(--content-max);
}

/* ───── On This Page (TOC) ───── */
.doc-toc {
  position: fixed;
  top: var(--nav-h);
  right: max(0px, calc((100vw - var(--layout-max)) / 2));
  bottom: 0;
  width: var(--toc-w);
  padding: 32px 16px 48px;
  overflow-y: auto;
  border-left: 1px solid rgba(255,255,255,0.06);
}

.doc-toc::-webkit-scrollbar { width: 4px; }
.doc-toc::-webkit-scrollbar-track { background: transparent; }
.doc-toc::-webkit-scrollbar-thumb { background: var(--gray-800); border-radius: 2px; }

.toc-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.toc-links {
  list-style: none;
}

.toc-links a {
  display: block;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.15s;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -1px;
}

.toc-links a:hover { color: var(--gray-200); }
.toc-links a.active { color: var(--blue-400); border-left-color: var(--blue-400); }
.toc-links a.toc-h3 { padding-left: 24px; }

/* ───── Typography ───── */
.doc-content h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-50);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.doc-content .subtitle {
  font-size: 16px;
  color: var(--gray-400);
  margin-bottom: 32px;
  line-height: 1.6;
}

.doc-content .read-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  background: rgba(255,255,255,0.04);
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.doc-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-50);
  letter-spacing: -0.02em;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.doc-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.doc-content h3 {
  font-size: 18px;
  font-weight: 650;
  color: var(--gray-100);
  margin-top: 32px;
  margin-bottom: 12px;
}

.doc-content h4 {
  font-size: 15px;
  font-weight: 650;
  color: var(--gray-200);
  margin-top: 24px;
  margin-bottom: 8px;
}

.doc-content p {
  margin-bottom: 16px;
  color: var(--gray-300);
}

.doc-content a {
  color: var(--blue-400);
  text-decoration: none;
  font-weight: 500;
}
.doc-content a:hover { text-decoration: underline; }

.doc-content strong { color: var(--gray-100); font-weight: 600; }

.doc-content ul, .doc-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.doc-content li {
  margin-bottom: 8px;
}

.doc-content li::marker { color: var(--gray-600); }

.doc-content hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 32px 0;
}

/* ───── Code ───── */
.doc-content code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 13px;
  background: rgba(255,255,255,0.06);
  color: var(--blue-400);
  padding: 2px 6px;
  border-radius: 4px;
}

.doc-content pre {
  background: var(--gray-900);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  position: relative;
}

.doc-content pre code {
  background: none;
  padding: 0;
  color: var(--gray-300);
  font-size: 13px;
  line-height: 1.7;
}

.code-label {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  color: var(--gray-600);
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Syntax highlights */
.token-keyword { color: #C084FC; }
.token-string  { color: #86EFAC; }
.token-comment { color: var(--gray-600); }
.token-number  { color: #FBBF24; }
.token-method  { color: var(--blue-400); }
.token-prop    { color: var(--cyan-400); }
.token-type    { color: #F9A8D4; }

/* ───── Tables ───── */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13.5px;
}

.doc-content th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-200);
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-content td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

.doc-content tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* ───── Callout Boxes ───── */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.callout p { margin-bottom: 0; font-size: 14px; }
.callout p + p { margin-top: 8px; }

.callout-info {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.15);
  color: var(--gray-200);
}
.callout-info .callout-icon { color: var(--blue-400); }

.callout-tip {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.15);
  color: var(--gray-200);
}
.callout-tip .callout-icon { color: var(--green-400); }

.callout-warn {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.15);
  color: var(--gray-200);
}
.callout-warn .callout-icon { color: var(--amber-400); }

.callout-danger {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.15);
  color: var(--gray-200);
}
.callout-danger .callout-icon { color: var(--red-400); }

/* ───── Badge / Tag ───── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.badge-get    { background: rgba(59,130,246,0.15); color: var(--blue-400); }
.badge-post   { background: rgba(34,197,94,0.15);  color: var(--green-400); }
.badge-put    { background: rgba(245,158,11,0.15); color: var(--amber-400); }
.badge-patch  { background: rgba(167,139,250,0.15); color: var(--purple-400); }
.badge-delete { background: rgba(248,113,113,0.15); color: var(--red-400); }

.badge-role   { background: rgba(255,255,255,0.06); color: var(--gray-400); font-size: 10px; }

/* ───── Endpoint Block ───── */
.endpoint {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.endpoint-path {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--gray-100);
  font-weight: 500;
}

.endpoint-desc {
  font-size: 13px;
  color: var(--gray-400);
}

.endpoint-params {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gray-500);
}

.endpoint-params code {
  font-size: 12px;
}

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

.card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

a.card:hover {
  border-color: rgba(59,130,246,0.2);
  background: rgba(59,130,246,0.04);
  transform: translateY(-2px);
  text-decoration: none;
}

.card h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--gray-100);
  margin-top: 0;
  margin-bottom: 6px;
}

.card p {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 0;
  line-height: 1.5;
}

.card-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

/* ───── Step List ───── */
.steps {
  list-style: none;
  padding: 0;
  counter-reset: steps;
}

.steps li {
  counter-increment: steps;
  padding: 16px 16px 16px 52px;
  position: relative;
  border-left: 2px solid rgba(59,130,246,0.15);
  margin-left: 14px;
  margin-bottom: 0;
}

.steps li:last-child { border-left-color: transparent; }

.steps li::before {
  content: counter(steps);
  position: absolute;
  left: -15px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(59,130,246,0.15);
  color: var(--blue-400);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ───── Page Navigation (Prev/Next) ───── */
.page-nav {
  display: flex;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.page-nav a {
  flex: 1;
  display: block;
  padding: 16px 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
}

.page-nav a:hover {
  border-color: rgba(59,130,246,0.2);
  background: rgba(59,130,246,0.04);
}

.page-nav-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.page-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-100);
}

.page-nav .next { text-align: right; }

/* ───── Responsive ───── */
@media (max-width: 1200px) {
  .doc-toc { display: none; }
  .doc-main { margin-right: 0; }
}

@media (max-width: 900px) {
  .doc-sidebar {
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 150;
    background: var(--gray-950);
  }
  .doc-sidebar.open {
    transform: translateX(0);
  }
  .doc-main {
    margin-left: 0;
    padding: 32px 24px 80px;
  }
  .sidebar-toggle { display: block; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
  }
  .sidebar-overlay.visible { display: block; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .endpoint-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}
