﻿/* ============================================================
   漫剧制作教程站 · 教程页 3 栏布局 CSS
   基于 MDN / Vue.js / React 官方文档风格
   左:全教程目录(9 大类) 中:正文 右:本页 TOC
   玉哥 · 2026-09-15
   ============================================================ */

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

:root {
  --bg: #FFFCF6;
  --bg-soft: #F8F9FA;
  --bg2: #F5F5F5;
  --line: #E5E7EB;
  --line2: #D1D5DB;
  --text: #1F2937;
  --muted: #6B7280;
  --blue: #0055A4;
  --blue-soft: #E6F0FA;
  --lime: #DCF4A2;
  --warn: #D97706;
  --ok: #059669;
  --bad: #DC2626;

  --top-h: 56px;
  --side-l-w: 240px;
  --side-r-w: 200px;
  --content-w: 760px;
  --max: 1280px;
}

/* ============== 顶栏扩展(主题切换按钮) ============== */
.topbar .theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar .theme-toggle:hover {
  background: var(--blue-soft);
}

/* ============== 3 栏布局 ============== */
.layout-3col {
  display: grid;
  grid-template-columns: var(--side-l-w) minmax(0, 1fr) var(--side-r-w);
  max-width: var(--max);
  margin: 0 auto;
  min-height: calc(100vh - var(--top-h));
  align-items: start;
}

/* ============== 左侧目录 ============== */
.sidebar-left {
  border-right: 1px solid var(--line);
  padding: 20px 14px 60px;
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  font-size: 13px;
  background: var(--bg);
}
.sidebar-left .filter {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 10px;
  margin-bottom: 14px;
  background: var(--bg-soft);
}
.sidebar-left .filter input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  width: 100%;
}

/* 大类容器 */
.sidebar-cat {
  margin: 4px 0 6px;
  position: relative;
}

/* 折叠箭头按钮(标题左侧) — 独立点击,只切换折叠,不跳转 */
.cat-toggle {
  position: absolute;
  left: -2px;
  top: 8px;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, color 0.15s;
  user-select: none;
}
.cat-toggle:hover {
  color: var(--blue);
}
.cat-toggle:not(.collapsed) {
  transform: rotate(90deg);
  color: var(--blue);
}

/* 大类标题(button) — 点击折叠/展开 accordion */
.sidebar-cat-title {
  display: block;
  width: 100%;
  padding: 10px 10px 10px 8px;
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.3px;
  border-radius: 6px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}
.sidebar-cat-title:hover {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}
.sidebar-cat-title.current {
  background: var(--blue-soft);
  color: var(--blue);
  border-left-color: var(--blue);
}

/* 子页面列表 */
.sidebar-pages {
  list-style: none;
  padding: 4px 0 8px 14px;
  margin: 0 0 6px 0;
  max-height: 1200px;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.sidebar-pages.collapsed {
  max-height: 0;
  padding: 0 0 0 14px;
  margin: 0;
}
.sidebar-pages li a {
  display: block;
  padding: 4px 8px 4px 8px;
  margin: 1px 0;
  font-size: 12px;        /* 比大类小一截 */
  font-weight: 400;       /* 子页面正常粗 */
  color: var(--text-soft);/* 子页面用弱色 */
  border-radius: 4px;
  text-decoration: none;
  line-height: 1.6;
  transition: background 0.15s, color 0.15s;
}
.sidebar-pages li a:hover {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}
.sidebar-pages li a.current {
  background: var(--blue);
  color: #fff !important;
  font-weight: 600;
}

.sidebar-left a.done::before { content: "✓ "; color: var(--ok); font-size: 11px; }

/* 分割线 + 专题区标题 */
.sidebar-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 4px 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-divider::before,
.sidebar-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.sidebar-divider span {
  white-space: nowrap;
}

/* 专题板块视觉 */
.sidebar-cat.is-topic .sidebar-cat-title {
  font-weight: 600;
  color: var(--text);
}
.sidebar-cat.is-topic .sidebar-cat-title.current {
  background: var(--blue-soft);
  color: var(--blue);
  border-left-color: var(--blue);
}

/* override 玉哥 index.html 嵌入的 .layout-runoob .sidebar-left 样式 */
.layout-runoob .sidebar-left {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  padding: 14px 14px 60px !important;
}
.layout-runoob .sidebar-left .filter { display: flex !important; }
.layout-runoob .sidebar-left ul,
.layout-runoob .sidebar-left ul ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  display: block !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
}
.layout-runoob .sidebar-left li { width: auto !important; }
.layout-runoob .sidebar-left li a {
  display: block !important;
  padding: 10px 12px !important;
  margin: 2px 0 !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  border-left: 3px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  text-decoration: none !important;
}
.layout-runoob .sidebar-left li a:hover {
  background: var(--blue-soft) !important;
  border-left-color: var(--blue) !important;
  color: var(--blue) !important;
}
.layout-runoob .sidebar-left li a.current {
  background: var(--blue-soft) !important;
  color: var(--blue) !important;
  border-left-color: var(--blue) !important;
  font-weight: 700 !important;
}

/* ============== 中间正文 ============== */
.content {
  padding: 28px 36px 60px;
  max-width: var(--content-w);
  width: 100%;
  justify-self: center;
  min-width: 0;
}

.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 4px; }

.content h1 {
  font-size: 28px;
  color: var(--blue);
  margin: 6px 0 8px;
  line-height: 1.3;
}
.content .meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.lead {
  font-size: 16px;
  color: var(--text);
  background: var(--blue-soft);
  padding: 14px 18px;
  border-left: 4px solid var(--blue);
  border-radius: 4px;
  margin: 18px 0 24px;
  line-height: 1.7;
}

.content h2 {
  font-size: 19px;
  color: var(--blue);
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--top-h) + 12px);
}
.content h3 {
  font-size: 16px;
  color: var(--text);
  margin: 24px 0 10px;
  scroll-margin-top: calc(var(--top-h) + 12px);
}

.content p {
  margin: 10px 0;
  line-height: 1.8;
}
.content ul, .content ol {
  margin: 8px 0 14px 24px;
}
.content li {
  margin: 4px 0;
  line-height: 1.7;
}
.content strong {
  color: var(--text);
  font-weight: 600;
}
.content code {
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 3px;
  color: #B91C1C;
  font-size: 0.92em;
}

.example {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 14px 0;
}
.example .label {
  display: inline-block;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}
.example h4 {
  margin: 6px 0 8px;
  font-size: 16px;
}
.example p { margin: 4px 0; }
.example ul, .example ol { margin: 6px 0 4px 20px; }
.example .src {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 4px;
  margin: 14px 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  line-height: 1.7;
}
.callout .ico { font-size: 18px; flex-shrink: 0; }
.callout.ok { background: var(--blue-soft); border-color: #93C5FD; }
.callout.warn { background: #FEF3C7; border-color: #FCD34D; }
.callout.bad { background: #FEE2E2; border-color: #FCA5A5; }
.callout p { margin: 0; }

.tbl-wrap {
  overflow-x: auto;
  margin: 14px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
th {
  background: var(--bg2);
  color: var(--muted);
  font-weight: 600;
}
tr:hover td { background: var(--bg-soft); }

.checklist {
  list-style: none;
  padding-left: 0;
}
.checklist li {
  padding: 4px 0;
  line-height: 1.7;
}
.checklist li::before {
  content: "☐ ";
  color: var(--blue);
  font-weight: 700;
}

/* 6 步流水线图(A-3 用) */
.flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.flow-step {
  background: linear-gradient(135deg, #DBEAFE, #EFF6FF);
  border: 2px solid var(--blue);
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
}
.flow-step .num {
  position: absolute;
  top: -10px;
  left: -10px;
  background: var(--blue);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.flow-step h4 {
  color: var(--blue);
  margin: 4px 0 8px;
  font-size: 15px;
}
.flow-step .result {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--blue);
  color: var(--blue);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}
.flow-step ul {
  margin: 4px 0 0 18px;
  font-size: 12px;
  line-height: 1.7;
}
.flow-loop {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #FEF3C7, #FEFCE8);
  border: 2px dashed #D97706;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
  color: #92400E;
  font-weight: 600;
}
.flow-loop .arrow { font-size: 18px; }

/* 上下节导航 */
.bottom-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
}
.bottom-nav a:hover {
  background: var(--bg-soft);
  text-decoration: none;
  border-color: var(--blue);
}
.bottom-nav .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bottom-nav .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  margin-top: 4px;
  display: block;
}
.bottom-nav .next { text-align: right; }

/* ============== 右侧 TOC ============== */
.sidebar-right {
  border-left: 1px solid var(--line);
  padding: 20px 16px 60px;
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  font-size: 13px;
  background: var(--bg);
}
.sidebar-right .toc-title {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 12px;
  font-weight: 600;
}
.sidebar-right ul { list-style: none; }
.sidebar-right li { margin: 4px 0; }
.sidebar-right a {
  display: block;
  padding: 3px 8px;
  color: var(--muted);
  border-left: 2px solid transparent;
  line-height: 1.5;
  font-size: 12.5px;
}
.sidebar-right a:hover { color: var(--blue); text-decoration: none; }
.sidebar-right a.current {
  color: var(--blue);
  font-weight: 600;
  border-left-color: var(--blue);
  background: var(--blue-soft);
}
.sidebar-right .back-top {
  display: block;
  margin-top: 18px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
.sidebar-right .back-top:hover {
  color: var(--blue);
  border-color: var(--blue);
  text-decoration: none;
}

/* ============== 底部 ============== */
footer.dock {
  background: var(--bg2);
  border-top: 1px solid var(--line);
  padding: 24px;
  text-align: center;
  margin-top: 30px;
}
footer.dock .row {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
}
footer.dock a { color: var(--muted); }
footer.dock a:hover { color: var(--blue); }
footer.dock .copy { color: var(--muted); font-size: 12px; }

/* ============== 响应式 ============== */
@media (max-width: 1024px) {
  .layout-3col {
    grid-template-columns: 1fr;
  }
  .sidebar-left {
    display: none;
  }
  .sidebar-right {
    display: none;
  }
  .content {
    max-width: 100%;
    padding: 24px 20px 60px;
  }
}

/* ============== 深色主题(配色 v3 · Stripe 风蓝紫) ============== */
html.dark {
  --bg: #0F0F12;
  --bg-soft: #18181B;
  --bg2: #27272A;
  --line: #3F3F46;
  --line2: #52525B;
  --text: #FFF7E8;
  --muted: #A1A1AA;
  --blue: #7B7AFF;
  --blue-soft: rgba(99, 91, 255, 0.16);
  --blue-deep: #9B95FF;
  --accent: #818CF8;
  --accent-soft: rgba(129, 140, 248, 0.18);
}
html.dark body { background: var(--bg); color: var(--text); }
html.dark .topbar { background: var(--bg); border-bottom-color: var(--line); }
html.dark .lead { color: var(--text); background: var(--blue-soft); border-left-color: var(--blue); }
html.dark .example { background: var(--bg-soft); border-color: var(--line); }
html.dark .callout { background: var(--bg-soft); border-color: var(--line); }
html.dark .callout p { color: var(--text); }
html.dark .callout.ok { background: var(--blue-soft); border-color: var(--blue); }
html.dark .callout.warn { background: rgba(217, 119, 6, 0.15); border-color: rgba(217, 119, 6, 0.5); }
html.dark .callout.bad { background: rgba(220, 38, 38, 0.15); border-color: rgba(220, 38, 38, 0.5); }
html.dark pre { background: #18181B; color: #E8DFC8; }
html.dark pre code { background: transparent; color: inherit; }
html.dark code { background: var(--bg2); color: #F0ABFC; }
html.dark h1, html.dark h2, html.dark h3, html.dark h4 { color: var(--text); }
html.dark a { color: var(--blue); }
html.dark a:hover { color: var(--blue-deep); }
html.dark .content h1 { color: var(--blue); }
html.dark .content h2 { color: var(--text); border-bottom-color: var(--line); }
html.dark .table-wrap { border-color: var(--line); }
html.dark .table-wrap th { background: var(--bg2); color: var(--text); }
html.dark .table-wrap tr:hover td { background: var(--bg-soft); }
html.dark .table-wrap td, html.dark .table-wrap th { border-color: var(--line); }
html.dark .flow-step { background: rgba(99, 91, 255, 0.1); border-color: var(--blue); }
html.dark .flow-step h4 { color: var(--blue); }
html.dark .flow-step .badge { background: var(--bg); color: var(--blue); border-color: var(--blue); }
html.dark .path-card { background: var(--bg-soft); border-color: var(--line); }
html.dark .path-card .tag { color: var(--blue); }
html.dark .work-grid .card { background: var(--bg-soft); border-color: var(--line); }
html.dark .work-grid .card .tag { color: var(--muted); }
html.dark .identity-picker { color: var(--text); }
html.dark .identity-card { background: var(--bg-soft); border-color: var(--line); color: var(--text); }
html.dark .identity-card h3 { color: var(--blue); }
html.dark .identity-card a { color: var(--blue); }
html.dark .search-big { background: var(--bg); border-color: var(--blue); }
html.dark .hero-v2 h1 { color: var(--text); }
html.dark .hero-v2 .stats { background: var(--bg-soft); border-color: var(--line); }
html.dark .cat-card { background: var(--bg-soft); border-color: var(--line); color: var(--text); }
html.dark .cat-card:hover { background: rgba(99, 91, 255, 0.12); border-color: var(--blue); }
html.dark .cat-card .ic { background: rgba(99, 91, 255, 0.18); color: var(--blue); }
html.dark .cat-card .t { color: var(--text); }
html.dark .dock-run { background: var(--bg); border-top-color: var(--line); }
html.dark .dock-run dt { color: var(--blue); }
html.dark .dock-run dd a { color: var(--muted); }
html.dark .dock-run dd a:hover { color: var(--blue); }
html.dark .dock-run .copy { color: var(--muted); border-top-color: var(--line); }
html.dark .dock-run .copy strong { color: var(--text); }
html.dark .dock-run .copy .copy-sub { color: #6F6657; }
html.dark .dock-run .qr-img { background: linear-gradient(135deg, #27272A 0%, #3F3F46 100%); border-color: var(--line); color: var(--blue); }
html.dark .sidebar-left .group-title { background: var(--bg-soft); border-color: var(--line); color: var(--text); }
html.dark .sidebar-left ul { background: var(--bg-soft); border-color: var(--line); }
html.dark .sidebar-left li a { color: var(--muted); }
html.dark .sidebar-left li a:hover { background: var(--blue-soft); color: var(--blue); }
html.dark .sidebar-left li a.current { background: var(--blue-soft); color: var(--blue); }
html.dark .sidebar-right .toc-title { background: var(--bg-soft); border-color: var(--line); color: var(--muted); }
html.dark .sidebar-right ul { background: var(--bg-soft); border-color: var(--line); }
html.dark .sidebar-right a { color: var(--muted); border-left-color: transparent; }
html.dark .sidebar-right a:hover { color: var(--blue); }
html.dark .sidebar-right a.current { color: var(--blue); background: var(--blue-soft); border-left-color: var(--blue); }
html.dark .sidebar-right .back-top { background: var(--bg-soft); border-color: var(--line); color: var(--muted); }
html.dark .bottom-nav a { background: var(--bg-soft); border-color: var(--line); }
html.dark .bottom-nav a:hover { border-color: var(--blue); }
html.dark .bottom-nav .label { color: var(--muted); }
html.dark .bottom-nav .title { color: var(--blue); }
html.dark footer.dock { background: var(--bg); border-top-color: var(--line); }
html.dark footer.dock a { color: var(--muted); }
html.dark footer.dock a:hover { color: var(--blue); }
html.dark footer.dock .copy { color: var(--muted); }
html.dark .theme-toggle { color: var(--text); }
html.dark .badge { background: rgba(217, 119, 6, 0.18); color: #FBBF24; }

/* ============================================================
   响应式布局(玉哥定稿 2026-09-19)
   - 桌面 ≥1090px:3 栏布局(左目录 + 主区 + 右 TOC)
   - 平板 768-1089px:2 栏(隐藏右 TOC,左目录保留)
   - 手机 <768px:1 栏 + sidebar 折叠成顶部按钮 + 抽屉
   ============================================================ */

/* ---------- 平板端(768-1089px) ---------- */
@media (max-width: 1089px) {
  .layout-3col {
    grid-template-columns: var(--side-l-w) minmax(0, 1fr);
  }
  /* 隐藏右侧 TOC */
  .sidebar-right {
    display: none !important;
  }
  /* 主区占满 */
  .tut-main, .content {
    max-width: 100% !important;
    padding-right: 16px;
  }
  /* sidebar 稍窄 */
  :root { --side-l-w: 200px; }
}

/* ---------- 手机端(<768px) ---------- */
@media (max-width: 767px) {
  /* 1 栏布局 */
  .layout-3col {
    display: block !important;
    padding: 0 !important;
  }

  /* sidebar 默认隐藏(变成抽屉) */
  .sidebar-left {
    position: fixed !important;
    top: var(--top-h) !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: calc(100vh - var(--top-h)) !important;
    background: var(--bg) !important;
    border-right: 1px solid var(--line) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.12) !important;
    transform: translateX(-100%) !important;
    transition: transform .28s ease !important;
    z-index: 999 !important;
    padding: 16px 14px 60px !important;
    overflow-y: auto !important;
  }
  .sidebar-left.is-open {
    transform: translateX(0) !important;
  }

  /* 主区占满 */
  .tut-main, .content {
    max-width: 100% !important;
    padding: 16px !important;
  }

  /* 顶栏加个"目录"按钮(JS 注入) */
  .topbar {
    position: relative !important;
  }
  .topbar .menu-toggle {
    display: inline-flex !important;
  }

  /* 抽屉打开时遮罩 */
  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 998;
  }

  /* 隐藏右侧 TOC */
  .sidebar-right { display: none !important; }

  /* 表格横向滚动 */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* 代码块可滚动 */
  pre {
    overflow-x: auto;
  }

  /* 图片自适应 */
  img { max-width: 100%; height: auto; }
}

/* ---------- 顶栏菜单按钮(默认隐藏,手机端显示) ---------- */
.topbar .menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 36px;
  height: 36px;
  margin-right: 4px;
  cursor: pointer;
  font-size: 16px;
  align-items: center;
  justify-content: center;
}

/* ---------- 横屏手机 ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar-left {
    width: 240px !important;
  }
}
