/* SSOS Docs — 基于 Litopia docs-site 布局系统 + SSOS Swiss Style 设计系统 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Mono:wght@400;500&family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

/* ============================================================
   Design Tokens — SSOS Swiss Style 设计系统
   ============================================================ */
:root {
  --background: 210 40% 98%;
  --foreground: 210 40% 12%;
  --card: 0 0% 100%;
  --card-foreground: 210 40% 12%;
  --popover: 0 0% 100%;
  --popover-foreground: 210 40% 12%;
  --primary: 210 60% 45%;
  --primary-foreground: 0 0% 100%;
  --primary-dark: 210 65% 35%;
  --primary-light: 210 55% 92%;
  --secondary: 210 25% 94%;
  --secondary-foreground: 210 50% 30%;
  --muted: 210 20% 96%;
  --muted-foreground: 210 15% 45%;
  --accent: 210 50% 90%;
  --accent-foreground: 210 60% 35%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --success: 142 50% 45%;
  --warning: 38 92% 50%;
  --border: 210 20% 88%;
  --input: 210 20% 88%;
  --ring: 210 60% 45%;
  --radius: 0.5rem;
  --gradient-brand: linear-gradient(135deg, hsl(210 60% 45%) 0%, hsl(220 65% 50%) 100%);
  --gradient-hero: linear-gradient(180deg, hsl(210 40% 98%) 0%, hsl(210 55% 92%) 100%);
  --shadow-sm: 0 1px 2px 0 hsl(210 25% 50% / 0.1);
  --shadow-md: 0 2px 4px -1px hsl(210 25% 50% / 0.08), 0 4px 8px -2px hsl(210 25% 50% / 0.06);
  --shadow-lg: 0 4px 6px -2px hsl(210 60% 45% / 0.08), 0 10px 20px -5px hsl(210 60% 45% / 0.12);
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'SF Mono', 'Fira Code', monospace;
  --font-serif: 'Noto Serif SC', Georgia, serif;
  --sidebar-w: 268px;
  --toc-w: 220px;
}

.dark {
  --background: 210 40% 6%;
  --foreground: 200 25% 93%;
  --card: 210 30% 10%;
  --card-foreground: 200 25% 93%;
  --popover: 210 30% 10%;
  --popover-foreground: 200 25% 93%;
  --primary: 210 55% 52%;
  --primary-foreground: 210 40% 6%;
  --primary-dark: 210 60% 58%;
  --primary-light: 210 40% 16%;
  --secondary: 210 25% 16%;
  --secondary-foreground: 210 55% 75%;
  --muted: 210 20% 14%;
  --muted-foreground: 210 12% 58%;
  --accent: 210 40% 18%;
  --accent-foreground: 210 65% 75%;
  --border: 210 20% 18%;
  --input: 210 20% 18%;
  --ring: 210 55% 55%;
  --gradient-hero: linear-gradient(180deg, hsl(210 30% 9%) 0%, hsl(210 20% 14%) 100%);
  --shadow-sm: 0 1px 2px 0 hsl(210 40% 2% / 0.6);
  --shadow-md: 0 2px 4px -1px hsl(210 40% 2% / 0.6), 0 4px 8px -2px hsl(210 40% 2% / 0.5);
  --shadow-lg: 0 4px 6px -2px hsl(210 40% 2% / 0.7), 0 10px 20px -5px hsl(210 40% 2% / 0.6);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-serif); line-height: 1.35; }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 600; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.75rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }
a { color: hsl(var(--primary-dark)); text-decoration: none; transition: color 0.15s; }
a:hover { color: hsl(var(--primary)); }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.3rem; }
code { font-size: 0.9em; background: hsl(var(--muted)); padding: 0.15em 0.4em; border-radius: 4px; font-family: var(--font-mono); }
pre { background: hsl(var(--muted)); padding: 1rem; border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
pre code { background: none; padding: 0; }
table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th, td { padding: 0.6rem 0.8rem; border: 1px solid hsl(var(--border)); text-align: left; font-size: 0.9rem; }
th { background: hsl(var(--muted)); font-weight: 600; }
blockquote { border-left: 4px solid hsl(var(--ring)); padding: 0.5rem 1rem; margin: 1rem 0; background: hsl(var(--muted)); border-radius: 0 var(--radius) var(--radius) 0; }
img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ============================================================
   Top Nav
   ============================================================ */
.topnav {
  position: sticky; top: 0; z-index: 200;
  background: hsl(var(--card) / 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid hsl(var(--border));
  height: 56px;
}
.topnav-inner {
  max-width: 100%; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; height: 100%; gap: 1.5rem;
}
.topnav-logo {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.05rem;
  color: hsl(var(--foreground)); white-space: nowrap; display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
}
.ui-icon, .inline-icon {
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.ui-icon { width: 1.15rem; height: 1.15rem; }
.inline-icon { width: 1rem; height: 1rem; }
.topnav-logo img { width: 26px; height: 26px; object-fit: contain; }
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.topnav-cta {
  background: var(--gradient-brand); color: #fff; padding: 0.35rem 0.9rem; border-radius: var(--radius);
  font-size: 0.82rem; font-weight: 600; white-space: nowrap; transition: opacity 0.2s, transform 0.2s;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.topnav-cta:hover { opacity: 0.92; transform: translateY(-1px); text-decoration: none; color: #fff; }
.theme-btn {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 0.5rem;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: hsl(var(--foreground));
}
.theme-btn .icon-moon { display: none; }
.dark .theme-btn .icon-sun { display: none; }
.dark .theme-btn .icon-moon { display: block; }
.mobile-toggle {
  display: none; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 0.5rem;
  width: 34px; height: 34px; align-items: center; justify-content: center;
  color: hsl(var(--foreground)); cursor: pointer;
}

/* ============================================================
   Layout: sidebar + main + toc
   ============================================================ */
.app-layout {
  display: flex;
  max-width: 1480px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
}

/* --- Left Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  padding: 1.25rem 0 3rem;
  -webkit-overflow-scrolling: touch;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 4px; }
.sidebar-section { margin-bottom: 0.4rem; }
.sidebar-section-header {
  display: flex; align-items: center;
  min-height: 2.25rem;
}
.sidebar-category-link, .sidebar-category-label {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.5rem 0.55rem 1.25rem;
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s;
  font-family: var(--font-sans);
  text-align: left;
}
.sidebar-category-link:hover { color: hsl(var(--foreground)); text-decoration: none; }
.sidebar-category-toggle, .sidebar-group-toggle {
  border: 0; background: transparent; color: hsl(var(--muted-foreground));
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-category-toggle {
  width: 2.5rem; align-self: stretch;
}
.sidebar-category-toggle:hover, .sidebar-group-toggle:hover { color: hsl(var(--foreground)); }
.sidebar-category-toggle .arrow, .sidebar-group-toggle .arrow {
  width: 0.9rem; height: 0.9rem; transition: transform 0.2s;
}
.sidebar-section.collapsed .sidebar-category-toggle .arrow,
.sidebar-group.collapsed .sidebar-group-toggle .arrow { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-items { display: none; }
.sidebar-items { list-style: none; padding: 0; margin: 0; }
.sidebar-items li a {
  display: block; padding: 0.4rem 1.25rem 0.4rem 2rem;
  font-size: 0.85rem; color: hsl(var(--muted-foreground));
  border-left: 2px solid transparent; transition: all 0.12s;
  line-height: 1.5;
}
.sidebar-items li a:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); text-decoration: none; }
.sidebar-items li a.active { color: hsl(var(--primary-dark)); background: hsl(var(--primary-light)); border-left-color: hsl(var(--ring)); font-weight: 500; }
.sidebar-group { list-style: none; margin: 0.15rem 0; }
.sidebar-group-toggle {
  width: 100%; padding: 0.42rem 1.25rem 0.42rem 2rem;
  font: 600 0.78rem/1.4 var(--font-sans); letter-spacing: 0.02em; text-align: left;
}
.sidebar-group-toggle > span:first-child { flex: 1; }
.sidebar-group-items { list-style: none; margin: 0; padding: 0; }
.sidebar-group-items li a {
  display: block; padding: 0.36rem 1.25rem 0.36rem 2.75rem;
  font-size: 0.84rem; line-height: 1.5; color: hsl(var(--muted-foreground));
  border-left: 2px solid transparent; transition: all 0.12s;
}
.sidebar-group-items li a:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); text-decoration: none; }
.sidebar-group-items li a.active { color: hsl(var(--primary-dark)); background: hsl(var(--primary-light)); border-left-color: hsl(var(--ring)); font-weight: 500; }
.sidebar-group.collapsed .sidebar-group-items { display: none; }

/* --- Main Content --- */
.main-content {
  flex: 1; min-width: 0;
  padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem) 5rem;
}

/* --- Right TOC --- */
.page-toc {
  width: var(--toc-w); flex-shrink: 0;
  position: sticky; top: 80px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  height: fit-content;
  padding: 1.5rem 0.75rem 2rem 1rem;
  font-size: 0.8rem;
  border-left: 1px solid hsl(var(--border));
  margin: 1rem 0 0;
}
.toc-title {
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0; color: hsl(var(--foreground));
  padding: 0 0.75rem 0.65rem;
}
.page-toc ul { list-style: none; padding: 0; margin: 0; }
.page-toc ul ul { padding-left: 0.75rem; }
.page-toc li a {
  display: block; padding: 0.28rem 0.75rem; color: hsl(var(--muted-foreground));
  border-left: 2px solid transparent; transition: all 0.12s; line-height: 1.45;
}
.page-toc li a.toc-level-3 { padding-left: 1.5rem; font-size: 0.76rem; }
.page-toc li a:hover, .page-toc li a.active {
  color: hsl(var(--foreground));
  border-left-color: hsl(var(--ring));
  text-decoration: none;
}

/* ============================================================
   Content components
   ============================================================ */
.content-header { border-bottom: 1px solid hsl(var(--border)); padding-bottom: 1.25rem; margin-bottom: 2rem; }
.content-header h1 { margin-bottom: 0.3rem; }
.content-header .subtitle { color: hsl(var(--muted-foreground)); font-size: 0.95rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow-md); transition: box-shadow 0.25s, transform 0.25s;
  color: inherit;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.card-icon {
  width: 44px; height: 44px; border-radius: 0.65rem;
  background: hsl(var(--primary-light)); color: hsl(var(--primary-dark));
  display: flex; align-items: center; justify-content: center; margin-bottom: 0.85rem;
}
.card-icon svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; color: hsl(var(--foreground)); }
.card p { font-size: 0.88rem; color: hsl(var(--muted-foreground)); margin-bottom: 0; line-height: 1.6; }
.card-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.85rem; font-size: 0.85rem; font-weight: 600; color: hsl(var(--primary-dark)); }
.card-link::after { content: ''; width: 0.48rem; height: 0.48rem; border-top: 1.8px solid currentColor; border-right: 1.8px solid currentColor; transform: rotate(45deg); }
.card-link:hover { color: hsl(var(--primary)); }

/* Article list */
.doc-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.doc-list li a {
  display: block; padding: 0.8rem 1.1rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); transition: all 0.18s;
}
.doc-list li a:hover { border-color: hsl(var(--ring)); box-shadow: var(--shadow-md); text-decoration: none; }
.doc-list .doc-title { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
.doc-list .doc-desc { font-size: 0.82rem; color: hsl(var(--muted-foreground)); margin-top: 0.15rem; }

.badge { display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 50px; font-weight: 500; }
.badge-new  { background: hsl(var(--primary-light)); color: hsl(var(--primary-dark)); }
.badge-soon { background: hsl(45 93% 47% / 0.15); color: hsl(45 80% 35%); }

/* Prose */
.prose { font-family: var(--font-serif); font-size: 1rem; line-height: 1.78; letter-spacing: 0.02em; max-width: 70ch; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.15rem; }
.prose p { margin-bottom: 1.25em; }

.callout {
  background: hsl(var(--muted)); border-left: 4px solid hsl(var(--ring));
  padding: 0.9rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; font-size: 0.92rem;
}
.callout p { margin-bottom: 0; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 2.8rem; margin-bottom: 1.2rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.75rem; height: 1.75rem; background: var(--gradient-brand); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; font-family: var(--font-sans);
}

.section-divider { margin: 3rem 0 1.5rem; }
.section-divider h2 { margin-bottom: 0.2rem; }
.section-divider p { color: hsl(var(--muted-foreground)); font-size: 0.9rem; }

/* Hero */
.hero { text-align: center; padding: 4rem 2rem 3rem; background: var(--gradient-hero); }
.hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 0.5rem; }
.hero h1 .brand { background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 1.05rem; color: hsl(var(--muted-foreground)); max-width: 600px; margin: 0 auto 1.5rem; }

/* Sidebar toggle (mobile) */
.sidebar-overlay { display: none; }
.sidebar-close { display: none; }

/* Footer */
.footer {
  border-top: 1px solid hsl(var(--border));
  padding: 1.25rem 2rem 2.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.82rem;
  background: hsl(var(--muted));
}
.footer a { color: hsl(var(--muted-foreground)); }
.footer a:hover { color: hsl(var(--foreground)); }
.footer-desktop { display: block; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  text-align: left;
  font-size: 0.875rem;
}
.footer-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-section h3 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: hsl(var(--foreground));
}
.footer-stack {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-stack a {
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-meta {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid hsl(var(--border));
}
.footer-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-meta-row-main {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.footer-company {
  font-weight: 500;
  color: hsl(var(--foreground));
}
.footer-meta-row-sub {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.footer-filing, .footer-contact {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.footer-version {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.footer-mobile { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .page-toc { display: none; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 300;
    width: 280px; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.3);
  }
  .sidebar-overlay.show { display: block; }
  .sidebar-close {
    display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 0.75rem; right: 0.75rem;
    width: 34px; height: 34px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 0.5rem; cursor: pointer;
    color: hsl(var(--muted-foreground));
  }
  .mobile-toggle { display: inline-flex; }
  .main-content { padding: 1.5rem 1rem 4rem; }
  .card-grid { grid-template-columns: 1fr; }
  .footer-desktop { display: none; }
  .footer-mobile { display: block; }
  .footer-mobile-links {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem; text-align: center; margin-bottom: 1rem;
  }
  .footer-mobile-links a {
    display: block; padding: 0.45rem 0.6rem; border-radius: 0.6rem;
    background: hsl(var(--card)); border: 1px solid hsl(var(--border)); text-decoration: none;
  }
  .footer-mobile-meta {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.45rem; text-align: center; padding-top: 0.9rem; border-top: 1px solid hsl(var(--border));
  }
}
@media (max-width: 640px) {
  html { font-size: 15px; }
  .topnav-cta { font-size: 0.78rem; padding: 0.3rem 0.7rem; }
}

/* Screenshot placeholders */
.screenshot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 1.5rem 0;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem;
  position: relative;
}
.screenshot-placeholder::before {
  content: "📷";
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}
.screenshot-placeholder .screenshot-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--foreground);
  opacity: 0.6;
}
.screenshot-placeholder .screenshot-desc {
  display: block;
  opacity: 0.5;
  max-width: 360px;
}

.screenshot-figure {
  margin: 2rem 0;
}
.screenshot-media {
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: var(--shadow-sm);
}
.screenshot-media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}
.screenshot-figure figcaption {
  margin-top: 0.65rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.84rem;
  line-height: 1.6;
  text-align: center;
}
.screenshot-figure .figure-label {
  color: hsl(var(--foreground));
  font-weight: 600;
}
.screenshot-gallery .screenshot-media {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: hsl(var(--border));
}

@media (max-width: 640px) {
  .screenshot-gallery .screenshot-media { grid-template-columns: 1fr; }
}
