/* syllabus 课程大纲索引/详情页样式 - 与 glossary/code-templates 暖色调一致 */
:root {
  --paper: #fbf6ee;
  --paper-strong: #f5ecdc;
  --paper-deep: #eadbc8;
  --ink: #3d2c1f;
  --ink-soft: #5b4329;
  --muted: #8a6f54;
  --line: rgba(110, 79, 54, 0.14);
  --shadow: 0 14px 32px rgba(81, 58, 35, 0.1);
  --shadow-hover: 0 18px 36px rgba(81, 58, 35, 0.16);

  /* 暖色 accent - 不同课程领域用同色系不同深浅，避免与站外冷色冲突 */
  --accent-nlp: #b35b2a;
  --accent-cv:  #8a5a2b;
  --accent-llm: #946226;
  --accent-rl:  #a64b2a;
  --accent-ml:  #5b4329;
  --accent-default: #6e4f36;

  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC",
           "Times New Roman", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC",
           "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.syl-body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(180deg, #fbf6ee 0%, #f3e7d2 100%);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

.syl-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

/* 顶栏 - 与 glossary-topbar 完全一致风格 */
.syl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  height: 30px;
  line-height: 1;
}
.syl-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.syl-topbar__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  line-height: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8f1e7, #eadbc8);
  color: #6e4f36;
  font-weight: 700;
  font-size: 14px;
}
.syl-topbar__crumbs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}
.syl-topbar__crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}
.syl-topbar__crumbs a:hover { color: var(--ink); }
.syl-topbar__crumbs-sep {
  color: var(--muted);
  opacity: .55;
}
.syl-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.syl-topbar__back:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(94, 63, 39, 0.12);
  color: var(--ink);
}

/* Hero - 与 code-templates 一致的暖色调 + 论文感的网格底纹 + 编号水印 */
.syl-hero {
  text-align: center;
  padding: 4px 12px 8px;
  margin-top: 4px;
  margin-bottom: 20px;
}
.syl-hero__heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.syl-hero__eyebrow {
  justify-self: end;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  white-space: nowrap;
}
.syl-hero__title-wrap {
  position: relative;
  display: inline-block;
  justify-self: start;
}
.syl-hero__title {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.syl-hero__count {
  position: absolute;
  top: 2px;
  right: -6px;
  transform: translate(100%, 0);
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9a6a32;
  background: linear-gradient(135deg, #fbf2dd, #f4debb);
  border: 1px solid rgba(178, 124, 58, 0.22);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(178, 124, 58, 0.10);
  z-index: 2;
}
.syl-hero__desc {
  max-width: 720px;
  margin: 0px auto 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
}
.syl-hero__meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}
.syl-hero__meta strong {
  color: var(--ink-soft);
  margin-right: 4px;
}

/* 筛选条（粘性） - 与 glossary search 风格一致 */
.syl-toolbar {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin-top: 18px;
  padding: 12px 16px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(81, 58, 35, 0.06);
}
.syl-search {
  flex: 1; min-width: 220px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.syl-search input {
  flex: 1;
  border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--ink);
}
.syl-search input::placeholder { color: var(--muted); }
.syl-search svg { color: var(--muted); flex: 0 0 16px; }

.syl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.syl-chip {
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.syl-chip:hover { color: var(--ink); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(94, 63, 39, 0.1); }
.syl-chip.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.syl-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* 卡片网格 - 与 glossary 卡片风格一致：圆角 + paper 背景 + 暖阴影 */
.syl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.syl-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px 22px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  overflow: hidden;
}
.syl-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-default);
  transition: width 180ms ease;
}
.syl-card[data-accent="nlp"]::before { background: var(--accent-nlp); }
.syl-card[data-accent="cv"]::before  { background: var(--accent-cv); }
.syl-card[data-accent="llm"]::before { background: var(--accent-llm); }
.syl-card[data-accent="rl"]::before  { background: var(--accent-rl); }
.syl-card[data-accent="ml"]::before  { background: var(--accent-ml); }

.syl-card:hover {
  transform: translateY(-2px);
  background: var(--paper-strong);
  box-shadow: var(--shadow-hover);
}
.syl-card:hover::before { width: 5px; }

.syl-card__code {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}
.syl-card__code strong {
  color: var(--ink);
  font-weight: 600;
}
.syl-card__code::after {
  content: "";
  flex: 1; height: 1px;
  background: var(--line);
  margin-left: 4px;
}

.syl-card__title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  margin: 12px 0 8px;
  color: var(--ink);
}
.syl-card__summary {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.syl-card__tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.syl-card__tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(110, 79, 54, 0.08);
  color: var(--ink-soft);
  border-radius: 999px;
}
.syl-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.syl-card__level { color: var(--ink-soft); font-weight: 600; }
.syl-card__arrow {
  display: inline-block;
  transition: transform 180ms ease;
}
.syl-card:hover .syl-card__arrow { transform: translateX(4px); }

.syl-empty {
  display: none;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--paper-strong);
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin-top: 24px;
}
.syl-empty.is-visible { display: block; }
.syl-empty button {
  margin-top: 12px;
  padding: 8px 18px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.syl-empty button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(94, 63, 39, 0.18);
}

/* 详情页：单栏阅读版式 + 粘性 TOC + 暖色纸张背景 */
.syl-article {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  margin-top: 28px;
}
@media (max-width: 960px) {
  .syl-article { grid-template-columns: 1fr; gap: 20px; }
}

.syl-aside {
  position: sticky;
  top: 16px;
  align-self: start;
  font-size: 13px;
  color: var(--ink-soft);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 4px 0;
}
.syl-aside__heading {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.24em;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.syl-toc { list-style: none; padding: 0; margin: 0 0 28px; }
.syl-toc ul { list-style: none; padding: 0; margin: 0; }
.syl-toc li { margin: 0; }
.syl-toc a {
  display: block;
  padding: 6px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: background 180ms ease, border-color 180ms ease;
}
.syl-toc a:hover {
  background: var(--paper-strong);
  border-left-color: var(--ink-soft);
}
.syl-toc a.is-active {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--accent-default);
  background: var(--paper-strong);
}
.syl-toc ul.syl-toc a { padding-left: 22px; font-size: 12.5px; }

.syl-aside__related {
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.syl-aside__related h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
}
.syl-aside__related ul { margin: 0; padding: 0; list-style: none; }
.syl-aside__related li { margin: 6px 0; }
.syl-aside__related a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 2px;
  transition: color 180ms ease, border-color 180ms ease;
}
.syl-aside__related a:hover {
  color: var(--accent-default);
  border-bottom-color: var(--accent-default);
}

/* 主内容 - 米色纸张背景 + 顶部暖色细线 */
.syl-content {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 44px 44px;
  position: relative;
  box-shadow: 0 8px 22px rgba(81, 58, 35, 0.08);
  overflow: hidden;
}
.syl-content::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: var(--accent-default);
  border-radius: 14px 14px 0 0;
}
.syl-content[data-accent="nlp"]::before { background: var(--accent-nlp); }
.syl-content[data-accent="cv"]::before  { background: var(--accent-cv); }
.syl-content[data-accent="llm"]::before { background: var(--accent-llm); }
.syl-content[data-accent="rl"]::before  { background: var(--accent-rl); }
.syl-content[data-accent="ml"]::before  { background: var(--accent-ml); }

.syl-content h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.01em;
  color: var(--ink);
}
.syl-content h2:first-child { margin-top: 12px; }

.syl-content h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 8px;
  padding-left: 14px;
  border-left: 3px solid var(--accent-default);
  color: var(--ink);
}
.syl-content[data-accent="nlp"] h3 { border-left-color: var(--accent-nlp); }
.syl-content[data-accent="cv"] h3  { border-left-color: var(--accent-cv); }
.syl-content[data-accent="llm"] h3 { border-left-color: var(--accent-llm); }
.syl-content[data-accent="rl"] h3  { border-left-color: var(--accent-rl); }
.syl-content[data-accent="ml"] h3  { border-left-color: var(--accent-ml); }

.syl-content p { margin: 0 0 12px; }

.syl-content ul, .syl-content ol { padding-left: 22px; margin: 0 0 14px; }
.syl-content li { margin: 4px 0; }

.syl-content strong { color: var(--ink); }
.syl-content code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--paper-strong);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}

.syl-content a {
  color: var(--accent-default);
  text-decoration: none;
  border-bottom: 1px solid rgba(110, 79, 54, 0.3);
  transition: border-color 180ms ease, color 180ms ease;
}
.syl-content a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* 顶部工具条 - 胶囊风格 */
.syl-tools {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 4px;
  font-family: var(--mono);
  font-size: 12px;
}
.syl-tools a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.syl-tools a:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(94, 63, 39, 0.12);
  color: var(--ink);
}
.syl-tools__spacer { flex: 1; }
.syl-tools button {
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.syl-tools button:hover {
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(94, 63, 39, 0.12);
}

/* 移动端 TOC 抽屉 */
.syl-toc-toggle {
  display: none;
  margin-bottom: 12px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
@media (max-width: 960px) {
  .syl-toc-toggle { display: inline-block; }
  .syl-aside { position: static; max-height: none; padding: 0; }
  .syl-aside.is-collapsed { display: none; }
}

/* 响应式 */
@media (max-width: 720px) {
  .syl-hero { padding: 22px 20px 18px; }
  .syl-hero__title { font-size: 24px; }
  .syl-hero::after { display: none; }
  .syl-content { padding: 24px 22px 28px; font-size: 15px; }
  .syl-toolbar { top: 8px; }
  .syl-topbar { flex-wrap: wrap; }
}

/* Markdown 表格 - 与 syllabus 暖色调一致 */
.syl-content table {
  width: 100%;
  margin: 18px 0 22px;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.syl-content thead {
  background: var(--paper-strong);
}
.syl-content th,
.syl-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.syl-content th {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
  font-size: 13px;
  border-bottom: 2px solid var(--ink-soft);
}
.syl-content tbody tr:last-child td {
  border-bottom: 0;
}
.syl-content tbody tr:hover {
  background: rgba(245, 236, 220, 0.5);
}
.syl-content td code {
  font-size: 0.85em;
}

/* 回到顶部按钮 - 与 glossary 同款 */
.syl-body .book-back-to-top {
  position: fixed;
  right: 124px;
  bottom: 28px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.94);
  color: rgba(81, 58, 35, 0.92);
  box-shadow: 0 10px 24px rgba(81, 58, 35, 0.16);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.syl-body .book-back-to-top:hover {
  background: #fff;
  box-shadow: 0 14px 28px rgba(81, 58, 35, 0.2);
}

.syl-body .book-back-to-top:focus-visible {
  outline: 2px solid rgba(112, 85, 54, 0.28);
  outline-offset: 3px;
}

.syl-body .book-back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.syl-body .book-back-to-top svg {
  width: 22px;
  height: 22px;
}

/* 页面底部 footer */
.syl-footer {
  margin-top:162.5px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}
.syl-footer__sep { margin: 0 10px; opacity: 0.6; }
.syl-footer a { color: var(--ink-soft); text-decoration: none; }
.syl-footer a:hover { text-decoration: underline; }
