/* Xplora SDK 对外文档 — 静态站样式（参考主流 XR 开发者文档布局） */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #38bdf8;
  --sidebar-hover: #e2e8f0;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --accent: #0284c7;
  --accent-soft: #e0f2fe;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --tip: #0369a1;
  --radius: 8px;
  --sidebar-w: 280px;
  --header-h: 56px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "Consolas", "Courier New", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  color: var(--sidebar-text);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}

.sidebar-brand .logo:hover {
  text-decoration: none;
  color: #fff;
}

.sidebar-brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.sidebar-brand .ver {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.sidebar-brand .ver strong {
  color: var(--sidebar-active);
  font-weight: 600;
}

/* Version picker (top-left under logo) */
.version-picker {
  margin-top: 12px;
}

.version-picker label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}

.version-picker select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.version-picker select:hover,
.version-picker select:focus {
  border-color: var(--sidebar-active);
}

.version-picker .ver-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.nav-section {
  padding: 16px 12px 8px;
}

.nav-section-title {
  padding: 4px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  text-decoration: none;
}

.nav-link.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--sidebar-active);
  font-weight: 600;
}

.nav-link.sub {
  padding-left: 24px;
  font-size: 13px;
  color: #64748b;
}

/* 子目录选中：须在 .sub 之后，避免被 color 覆盖 */
.nav-link.sub.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--sidebar-active);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 24px;
  font-size: 11px;
  color: #475569;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.topbar-title {
  font-size: 14px;
  color: var(--text-secondary);
}

.topbar-title strong {
  color: var(--text);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.green {
  background: #d1fae5;
  color: var(--success);
}

.badge.orange {
  background: #fef3c7;
  color: var(--warning);
}

.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}

.content {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 40px 80px;
}

/* Typography */
.content h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #0f172a;
}

.content h2 {
  margin: 40px 0 14px;
  padding-top: 8px;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  border-top: 1px solid var(--border);
  scroll-margin-top: 72px;
}

.content h2:first-of-type {
  border-top: none;
  margin-top: 28px;
}

.content h3 {
  margin: 28px 0 10px;
  font-size: 16px;
  font-weight: 650;
  color: #1e293b;
  scroll-margin-top: 72px;
}

.content h4 {
  margin: 20px 0 8px;
  font-size: 14.5px;
  font-weight: 650;
}

.content p {
  margin: 0 0 14px;
  color: var(--text);
}

.content ul,
.content ol {
  margin: 0 0 16px;
  padding-left: 1.4em;
}

.content li {
  margin: 4px 0;
}

.content li::marker {
  color: #94a3b8;
}

.lead {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px !important;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

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

tr:hover td {
  background: #fafbfc;
}

/* Code */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #f1f5f9;
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

pre {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Callouts */
.callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 4px solid var(--tip);
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: 14px;
}

.callout.warn {
  border-left-color: var(--warning);
  background: #fffbeb;
  color: #78350f;
}

.callout.ok {
  border-left-color: var(--success);
  background: #ecfdf5;
  color: #065f46;
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

/* Cards / home */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 28px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}

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

.card:hover {
  border-color: #7dd3fc;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.08);
  text-decoration: none;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #0f172a;
}

.card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Download hub — PICO-like large entry cards */
.dl-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 28px 0 36px;
}

.dl-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 148px;
  padding: 28px 24px 24px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.dl-card:hover {
  border-color: #7dd3fc;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.1);
  text-decoration: none;
  transform: translateY(-2px);
}

.dl-card .dl-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
}

.dl-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
}

.dl-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* Version blocks in changelog */
.version-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.version-block h2 {
  border: none;
  margin-top: 0;
  padding-top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.version-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.change-list {
  margin: 0;
  padding-left: 1.2em;
}

.change-list li {
  margin: 8px 0;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.tag.new {
  background: #d1fae5;
  color: #047857;
}

.tag.improve {
  background: #e0f2fe;
  color: #0369a1;
}

.tag.fix {
  background: #fef3c7;
  color: #b45309;
}

.tag.remove {
  background: #fee2e2;
  color: #b91c1c;
}

.tag.breaking {
  background: #fce7f3;
  color: #be185d;
}

/* TOC mini */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toc a {
  display: block;
  font-size: 13.5px;
  padding: 3px 0;
  color: #334155;
}

.toc a:hover {
  color: var(--accent);
}

.page-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* Mobile */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-btn {
    display: inline-flex;
  }

  .content {
    padding: 24px 18px 64px;
  }

  .topbar {
    padding: 0 16px;
  }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 90;
  }

  .overlay.show {
    display: block;
  }
}
