/* ==========================================================================
   CC Switch v4.0 极简技术文档阅读器样式表 (css/style.css)
   Design Reference: 格式参考.html (Mono / Zinc Typographic Design System)
   ========================================================================== */

/* 色板变量定义 (基于 Mono / Zinc 色阶) */
:root {
  --mono-50: #fafafa;
  --mono-100: #f4f4f5;
  --mono-200: #e4e4e7;
  --mono-300: #d4d4d8;
  --mono-400: #a1a1aa;
  --mono-500: #71717a;
  --mono-600: #52525b;
  --mono-700: #3f3f46;
  --mono-800: #27272a;
  --mono-900: #18181b;
  --mono-950: #09090b;

  /* 默认浅色模式 (Light Mode) */
  --bg-body: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-subtle: #fafafa;
  --bg-card: #ffffff;
  --bg-card-header: #f4f4f5;
  --bg-quote: #fafafa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --text-heading: #000000;
  --text-body: #18181b;
  --text-muted: #52525b;
  --text-dim: #71717a;
  --text-inverse: #ffffff;

  --link-color: #18181b;
  --link-hover-bg: #000000;
  --link-hover-color: #ffffff;

  --code-bg: #f4f4f5;
  --code-border: #e4e4e7;
  --code-color: #09090b;

  --progress-bar-bg: #18181b;

  /* 尺寸基准 */
  --font-base: 16px;
  --header-height: 56px;
  --sidebar-width: 230px;
  --max-page-width: 1320px;
}

/* 深色模式 (Dark Mode) */
html.dark {
  --bg-body: #09090b;
  --bg-header: rgba(9, 9, 11, 0.92);
  --bg-subtle: #18181b;
  --bg-card: #09090b;
  --bg-card-header: #18181b;
  --bg-quote: #18181b;
  --border: #27272a;
  --border-strong: #3f3f46;

  --text-heading: #ffffff;
  --text-body: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --text-inverse: #09090b;

  --link-color: #ffffff;
  --link-hover-bg: #ffffff;
  --link-hover-color: #000000;

  --code-bg: #18181b;
  --code-border: #27272a;
  --code-color: #fafafa;

  --progress-bar-bg: #f4f4f5;
}

/* 字号缩放档位 */
html.font-sm { --font-base: 14.5px; }
html.font-base { --font-base: 16px; }
html.font-lg { --font-base: 17.5px; }

/* 基础重置与排版规范 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-base);
  line-height: 1.7;
  color: var(--text-body);
  background-color: var(--bg-body);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-body);
  color: var(--text-body);
  transition: background-color 0.15s ease, color 0.15s ease;
}

::selection {
  background-color: #000;
  color: #fff;
}
html.dark ::selection {
  background-color: #fff;
  color: #000;
}

/* 顶部细进度条 */
#progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 1000;
}
#progress-bar {
  height: 100%;
  background-color: var(--progress-bar-bg);
  width: 0%;
  transition: width 0.08s linear;
}

/* 极简固定顶栏 (Header) */
.site-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 900;
  transition: border-color 0.15s ease;
}

.header-inner {
  max-width: var(--max-page-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-dot {
  width: 9px;
  height: 9px;
  background-color: var(--text-heading);
  border-radius: 50%;
  display: inline-block;
}

.brand-title {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
}

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

/* 顶栏控制按钮组 (A-, A+, 目录, 深色) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.btn-ctrl {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-ctrl:hover {
  background-color: var(--mono-100);
  color: var(--text-heading);
}
html.dark .btn-ctrl:hover {
  background-color: var(--mono-900);
  color: var(--text-heading);
}

.ctrl-divider {
  width: 1px;
  height: 14px;
  background-color: var(--border);
  margin: 0 0.2rem;
}

/* ==========================================================================
   页面容器与布局系统 (Fixed Left Sidebar + Wide Right Content)
   ========================================================================== */
.page-container {
  max-width: var(--max-page-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
  width: 100%;
  flex: 1;
  display: flex;
  gap: 3rem;
}

/* 固定左侧导航栏 (Sticky / Fixed Sidebar) */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.sidebar-sticky-wrapper {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sidebar-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  line-height: 1.45;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-heading);
  background-color: var(--bg-subtle);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text-heading);
  font-weight: 600;
  background-color: var(--bg-card-header);
}

/* 右侧大空间正文 (Wide Main Content) */
.docs-main {
  flex: 1;
  min-width: 0; /* 防止子元素溢出 */
}

/* ==========================================================================
   文章排版与语义元素 (Typography & Article Elements)
   ========================================================================== */
.article-section {
  margin-bottom: 3.5rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3.5rem 0;
}

/* 标题体系 */
h1.doc-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-heading);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.doc-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

h2.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-heading);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
}

h3.sub-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
}

h4.leaf-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 1.2rem;
  margin-bottom: 0.45rem;
}

p {
  font-size: 0.98rem;
  line-height: 1.75;
  margin-bottom: 1rem;
  color: var(--text-body);
}

strong {
  font-weight: 700;
  color: var(--text-heading);
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-body);
}

li {
  margin-bottom: 0.4rem;
  line-height: 1.65;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--code-color);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

/* 引用块 (Blockquote) - 遵循参考规范 */
blockquote.quote-block {
  border-left: 2px solid var(--text-heading);
  padding: 0.65rem 1rem;
  margin: 1.25rem 0;
  background-color: var(--bg-quote);
  color: var(--text-body);
}

blockquote.quote-block p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   图片展示与新旧对比组件 (Image & Comparison Layout)
   ========================================================================== */
.image-box {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.image-box img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.image-caption {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
}

/* 新旧双栏并排对比网格 (Wide Comparison Grid) */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.compare-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
}

.compare-card-header {
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-header);
  color: var(--text-heading);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compare-card-header .version-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
}

.compare-card-media {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.compare-card-media img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.compare-card-content {
  padding: 1rem;
  font-size: 0.9rem;
  flex: 1;
}

.compare-card-content ul {
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.compare-card-content li {
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

/* 差异对比表格 (Table) - 遵循参考规范 */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background-color: var(--bg-card-header);
  color: var(--text-heading);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  color: var(--text-body);
}

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

/* 信息指标小卡片 (Stats Inline) */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg-subtle);
}

.stat-box {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  font-feature-settings: "tnum";
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* 占位小卡片 (未开始章节) */
.placeholder-box {
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  background: var(--bg-subtle);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: auto;
}

/* ==========================================================================
   全屏极简图片灯箱 (Minimalist Lightbox Modal)
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  max-width: 96vw;
  max-height: 92vh;
  position: relative;
  cursor: default;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: 3px;
  border: 1px solid #3f3f46;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: block;
}

.lightbox-caption {
  text-align: center;
  color: #d4d4d8;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ==========================================================================
   响应式调整 (Mobile / Tablet)
   ========================================================================== */
@media (max-width: 960px) {
  .page-container {
    flex-direction: column;
    padding: 1.5rem 1rem 4rem;
    gap: 1.5rem;
  }
  .docs-sidebar {
    width: 100%;
  }
  .sidebar-sticky-wrapper {
    position: static;
    max-height: none;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  h1.doc-title {
    font-size: 1.65rem;
  }
}
