/* ============================================================
   新土共建 · BDS+LL3 开服指南 — Apple-Inspired Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:slnt,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Brand & Accent */
  --blue: #0066cc;
  --blue-focus: #0071e3;
  --blue-on-dark: #2997ff;

  /* Surface */
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --tile-dark-1: #272729;
  --black: #000000;

  /* Text */
  --ink: #1d1d1f;
  --ink-muted: #86868b;
  --text-on-dark: #ffffff;
  --text-on-dark-muted: #cccccc;
  --text-secondary: #6e6e73;

  /* Borders */
  --hairline: #e0e0e0;
  --divider-soft: #f0f0f0;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-elevated: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-dramatic: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-product: rgba(0,0,0,0.22) 3px 5px 30px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;
  --space-5xl: 80px;

  /* Layout */
  --max-width: 1440px;
  --gutter: 24px;
  --sidebar-width: 280px;
  --nav-height: 52px;

  /* Typography */
  --font-display: 'Inter', 'SF Pro Display', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'SF Pro Text', system-ui, -apple-system, sans-serif;
  --weight-light: 300;
  --weight-normal: 400;
  --weight-strong: 600;
  --weight-bold: 700;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: var(--weight-normal);
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--ink);
  background: var(--canvas);
}

/* ====== TOP NAVIGATION ====== */
.global-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
}

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

.nav-brand {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: var(--weight-strong);
  letter-spacing: 0.011em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: var(--weight-normal);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.016em;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
}

/* ====== DOCUMENTATION LAYOUT ====== */
.doc-wrapper {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-height) - 200px);
  position: relative;
}

/* Sidebar */
.doc-sidebar {
  position: sticky;
  top: var(--nav-height);
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  padding: var(--space-2xl) var(--space-xl) var(--space-4xl) var(--gutter);
  border-right: 0.5px solid rgba(0,0,0,0.08);
  background: var(--canvas);
}

.sidebar-heading {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: var(--weight-strong);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: var(--space-lg);
}

.sidebar-toc {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-toc a {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  border-left: 2px solid transparent;
  margin-left: -12px;
}

.sidebar-toc a:hover {
  color: var(--ink);
  background: rgba(0,0,0,0.03);
}

.sidebar-toc a.active {
  color: var(--blue);
  background: rgba(0,102,204,0.06);
  border-left-color: var(--blue);
  font-weight: var(--weight-strong);
}

/* Indent H2 vs H3 vs H4 */
.sidebar-toc .toc-h2 { padding-left: 10px; }
.sidebar-toc .toc-h3 { padding-left: 28px; font-size: 12px; }
.sidebar-toc .toc-h4 { padding-left: 44px; font-size: 11px; color: var(--ink-muted); }

/* Main Content */
.doc-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-3xl) var(--gutter) var(--space-5xl);
  max-width: calc(100% - var(--sidebar-width));
}

.doc-content {
  max-width: 780px;
  margin: 0 auto;
}

/* ====== TYPOGRAPHY ====== */
.doc-content h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: var(--weight-strong);
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: var(--space-xl);
}

.doc-content h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: var(--weight-strong);
  letter-spacing: -0.019em;
  line-height: 1.2;
  color: var(--ink);
  margin-top: var(--space-4xl);
  margin-bottom: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 0.5px solid var(--divider-soft);
}

.doc-content h2:first-of-type {
  border-top: none;
  margin-top: var(--space-2xl);
}

.doc-content h3 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: var(--weight-strong);
  letter-spacing: 0.011em;
  line-height: 1.3;
  color: var(--ink);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.doc-content h4 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: var(--weight-strong);
  letter-spacing: -0.022em;
  line-height: 1.4;
  color: var(--ink);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.doc-content h5 {
  font-size: 15px;
  font-weight: var(--weight-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.doc-content p {
  margin-bottom: var(--space-lg);
  line-height: 1.7;
}

.doc-content strong {
  font-weight: var(--weight-strong);
}

.doc-content a {
  color: var(--blue);
  text-decoration: none;
}

.doc-content a:hover {
  text-decoration: underline;
}

/* Blockquotes */
.doc-content blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-xl);
  border-left: 3px solid var(--blue);
  background: var(--parchment);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.doc-content blockquote p {
  margin-bottom: 0;
}

/* Code */
.doc-content code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px;
  background: var(--parchment);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--ink);
  border: 0.5px solid var(--divider-soft);
}

.doc-content pre {
  margin: var(--space-lg) 0;
  padding: var(--space-xl);
  background: var(--tile-dark-1);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.doc-content pre code {
  background: none;
  color: #e0e0e0;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

/* Lists */
.doc-content ul,
.doc-content ol {
  margin: var(--space-md) 0 var(--space-lg);
  padding-left: var(--space-2xl);
  line-height: 1.7;
}

.doc-content li {
  margin-bottom: var(--space-xs);
}

.doc-content li > ul,
.doc-content li > ol {
  margin-top: var(--space-xs);
  margin-bottom: 0;
}

/* Horizontal Rule */
.doc-content hr {
  border: none;
  border-top: 0.5px solid var(--hairline);
  margin: var(--space-3xl) 0;
}

/* Tables */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0 var(--space-xl);
  font-size: 14px;
}

.doc-content thead {
  background: var(--parchment);
}

.doc-content th {
  font-weight: var(--weight-strong);
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.doc-content td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 0.5px solid var(--divider-soft);
  line-height: 1.5;
}

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

/* Images */
.doc-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  margin: var(--space-lg) 0;
}

/* ====== MOBILE SIDEBAR TOGGLE ====== */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-dramatic);
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* ====== FOOTER ====== */
.site-footer {
  background: var(--parchment);
  padding: var(--space-4xl) var(--gutter) var(--space-3xl);
  border-top: 0.5px solid rgba(0,0,0,0.04);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-headline {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: var(--weight-strong);
  letter-spacing: -0.019em;
  margin-bottom: var(--space-2xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-col h6 {
  font-size: 12px;
  font-weight: var(--weight-strong);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: var(--space-md);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.5;
}

.footer-col a:hover {
  color: var(--ink);
}

.footer-divider {
  border: none;
  border-top: 0.5px solid var(--hairline);
  margin: var(--space-xl) 0;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  font-size: 12px;
  color: var(--ink-muted);
}

.footer-bottom a {
  color: var(--ink-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--ink);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 260px; --gutter: 20px; }
  .doc-content h1 { font-size: 36px; }
  .doc-content h2 { font-size: 28px; }
}

@media (max-width: 834px) {
  :root { --gutter: 16px; }
  .doc-sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 300px;
    box-shadow: var(--shadow-dramatic);
    background: var(--canvas);
    height: calc(100vh - var(--nav-height));
  }
  .doc-sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .doc-main { max-width: 100%; }
  .doc-content { max-width: 100%; }
}

@media (max-width: 640px) {
  .doc-content h1 { font-size: 28px; }
  .doc-content h2 { font-size: 24px; margin-top: var(--space-3xl); }
  .doc-content h3 { font-size: 18px; }
  .doc-content pre { padding: var(--space-lg); font-size: 12px; }
  .nav-links { display: none; }
}
