/* =========================================================
   MuLaCover demo page — academic layout
   - Horizontal sticky TOC at the top, full-width body below
   - Each case is a single horizontal row of panels
   - First case in each subsection is expanded; rest collapsed
   ========================================================= */

:root {
  --serif: 'Crimson Pro', 'Crimson Text', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  /* ============================================================
     调色板 —— 改色只需改下面 13 个变量的右值，整页同步更新。
     当前主题 "Mulberry & Petals"：粉色面板 + 深紫结构撞色 + 玫瑰胭脂 Ours。
     建议：要换主调色，先改 --accent 一组；要换高亮色，改 --ours-* 一组。
     ============================================================ */

  /* ---- 文字色（4 处） ---- */
  --ink: #3a2c40;
  /* 正文 / 章节大标题 / 子标题 / 大段描述的主文字色。改深=更黑，改浅=更柔，太浅会读不清。 */
  --ink-soft: #5d4f63;
  /* 段落正文 / 单元格标签 / 抽象段落的次级文字。比 --ink 浅一档。 */
  --muted: #9a8ea0;
  /* 提示性灰文字：页脚、case 副标题（斜体那行）、"Click to expand"、歌词折叠按钮、cell 副说明、case 折叠箭头。 */

  /* ---- 分隔线（2 处） ---- */
  --rule: #d6cad6;
  /* 正常分隔线（目前几乎没直接用到，留作备用）。 */
  --rule-faint: #ead7df;
  /* 几乎所有面板边框 + TOC 横条下沿 + 案例卡边框 + 段落分隔。整页"骨架线"都来自这里。 */

  /* ---- 表面底色（3 处） ---- */
  --bg: #fdf6f4;
  /* 页面整体底色（极浅粉象牙）。也用于 case-card 卡片底、歌词盒和 style 盒的内底。 */
  --bg-tint: #faeaee;
  /* 单元格底色 / 抽象段落框底 / 歌词折叠按钮条底。这个色决定整页"粉调浓度"，调它最影响整体氛围。 */
  --bg-deep: #e8c5d2;
  /* 备用更深粉色，目前没直接用到。可保留，删掉也不影响显示。 */

  /* ---- 主调色：深紫（3 处）。出现在：链接、TOC 当前项文字与底、
         章节大标题下划线、子标题左侧 3px 竖线、❖ 装饰符、Case N 徽章、
         partial 面板边框与底色、抽象段开头的 "Demo page." 前缀。       */
  --accent: #6e3c8a;
  /* 主调实色，用于以上所有"线条 / 文字 / 强调色"。 */
  --accent-soft: rgba(110, 60, 138, 0.10);
  /* 主调的低透明度铺底，用于 TOC 当前项背景、partial 面板底色。
                                 改色时把前三个数(110, 60, 138)同步换成 --accent 对应的 RGB；
                                 后面 0.10 是不透明度，越大颜色越浓，0.06~0.15 之间比较合适。 */
  --link: #6e3c8a;
  /* 链接颜色，一般跟 --accent 保持一致；要让链接显眼可单独改深。 */

  /* ---- "Ours"（MuLaCover）高亮，玫瑰胭脂粉系（5 处）。
         同色系从浅到深排列：bg-2 → bg → border → strip → fg。
         改色时建议保持这个明度梯度，否则会失去层次感。               */
  --ours-bg-2: #f7c2d8;
  /* ours 单元渐变的"上半部分"（更亮）。 */
  --ours-bg: #f0a8c4;
  /* ours 单元渐变的"下半部分"（稍深）；也用于抽象段里 "highlighted" 胶囊的底色。 */
  --ours-border: #c87aa2;
  /* ours 单元的外边框；也用于 highlighted 胶囊的描边。 */
  --ours-strip: #a64a7a;
  /* ours 单元最左侧 3px 竖条，是最显眼的"标志色"。 */
  --ours-fg: #8a3863;
  /* ours 单元的标签文字色 + 右上角 "Ours" 胶囊底色（白字深玫瑰底）；也用于抽象段 "highlighted" 文字色。 */
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

a:hover {
  border-bottom-color: var(--link);
}

em {
  font-style: italic;
  color: var(--ink);
}

strong {
  font-weight: 600;
}

/* ============================================================
   Header
   ============================================================ */
.paper-header {
  max-width: 880px;
  margin: 64px auto 28px;
  padding: 0 32px;
  text-align: center;
}

.paper-header::before {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  background: var(--ink);
  margin: 0 auto 32px;
}

.paper-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.18;
  letter-spacing: -0.3px;
  margin: 0 0 24px;
  color: var(--ink);
}

.paper-authors {
  margin: 0 0 8px;
}

.paper-authors .affil-line {
  margin: 2px 0 6px;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
  font-weight: 500;
}

.paper-authors .link-line {
  margin: 2px 0;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.paper-authors a,
.paper-footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-faint);
  text-underline-offset: 3px;
}

.paper-authors a:hover,
.paper-footer a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.paper-authors .link-sep {
  margin: 0 8px;
}

.paper-abstract {
  text-align: left;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 32px auto 0;
  max-width: 740px;
  padding: 22px 28px;
  background: var(--bg-tint);
  border: 1px solid var(--rule-faint);
  border-radius: 3px;
}

.paper-abstract strong {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
  font-style: italic;
  font-family: var(--serif);
  font-size: 17px;
}

.paper-abstract em {
  color: var(--ink);
  font-style: italic;
}

.ours-inline {
  background: var(--ours-bg);
  padding: 0 6px;
  border-radius: 2px;
  font-style: normal;
  color: var(--ours-fg);
  font-weight: 600;
  border: 1px solid var(--ours-border);
}

/* ============================================================
   Sticky horizontal TOC at the top
   - "TOC" label pinned left, links flow right-aligned
   - All items use a single weight; the active item is the
     only one tinted in the accent color (avoids competing
     emphasis cues between bold and color highlight)
   ============================================================ */
.toc {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-faint);
}

.toc-inner {
  max-width: 1800px;
  margin: 0 auto;
  padding: 8px 36px;
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-family: var(--sans);
}

.toc-label {
  flex-shrink: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1px;
  padding: 6px 0;
}

.toc-items {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 2px 4px;
  font-size: 13px;
  line-height: 1.4;
}

.toc a {
  border: 0;
  padding: 6px 8px;
  border-radius: 2px;
  font-weight: 400;
  transition: color 0.12s, background 0.12s;
}

.toc a.toc-top {
  color: var(--ink);
  font-size: 13.5px;
}

.toc a.toc-sub {
  color: var(--muted);
  font-size: 12.5px;
}

.toc a:hover {
  color: var(--accent);
  border: 0;
  background: var(--accent-soft);
}

.toc a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.toc-sep {
  color: var(--rule);
  padding: 0 8px;
  font-weight: 300;
  user-select: none;
}

/* ============================================================
   Page body
   ============================================================ */
.paper-body {
  max-width: 1800px;
  margin: 32px auto 80px;
  padding: 0 36px;
}

/* ----- Sections ----- */
.section {
  margin: 56px 0 48px;
}

.section:first-of-type {
  margin-top: 8px;
}

.section:not(:first-of-type) {
  padding-top: 32px;
}

.section:not(:first-of-type)::before {
  content: "❖";
  display: block;
  text-align: center;
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: 12px;
  padding-left: 12px;
}

.section-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  margin: 8px 0 16px;
  color: var(--ink);
  letter-spacing: -0.3px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--accent);
  display: inline-block;
}

.subsection-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 14px;
  color: var(--ink);
  letter-spacing: -0.1px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.subsection-note {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: -6px 0 16px;
  padding-left: 15px;
}

/* ============================================================
   ZH / EN language badge shown in each case banner.
   ============================================================ */
.lang-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 3px;
  margin: 0 4px 0 2px;
  vertical-align: middle;
  border: 1px solid var(--rule-faint);
  background: var(--bg);
  color: var(--ink-soft);
}
.lang-badge.lang-zh {
  background: #fff1c4;            /* soft amber — distinct from page pink */
  border-color: #e8c97c;
  color: #6b4a00;
}
.lang-badge.lang-en {
  background: #d8ecff;            /* soft cyan-blue */
  border-color: #a9c9ec;
  color: #154075;
}

/* Section descriptions occupy the same outer column as the
   case blocks they introduce, but the text itself is inset
   from the left/right edges so reading lines stay comfortable. */
.prose {
  max-width: none;
  padding: 0 64px;
}

.section-intro {
  font-size: 17px;
  margin: 0 0 16px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.feature-list {
  font-size: 17px;
  margin: 12px 0 16px;
  padding-left: 24px;
  color: var(--ink-soft);
}

.feature-list li {
  margin: 8px 0;
}

.feature-list strong {
  color: var(--ink);
}

/* ============================================================
   Demo cards (intro) and case cards (sections 2, 3)
   ============================================================ */
.demo-card,
.case-card {
  border: 1px solid var(--rule-faint);
  border-radius: 4px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.015);
  margin: 16px 0 18px;
}

.demo-card {
  padding: 18px;
}

/* ============================================================
   Case header (always visible) + collapsible body
   ============================================================ */
.case-card {
  padding: 0;
  overflow: hidden;
}

.case-header {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.12s;
}

.case-header:hover {
  background: var(--bg-tint);
}

.case-card.expanded .case-header {
  border-bottom: 1px solid var(--rule-faint);
}

.case-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.case-id {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.case-title {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-hint {
  font-family: var(--sans);
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  flex-shrink: 0;
}

.case-card.expanded .case-hint {
  display: none;
}

.case-toggle {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  display: inline-block;
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.case-card.expanded .case-toggle {
  transform: rotate(0deg);
}

.case-body {
  display: none;
  padding: 16px 18px 18px;
}

.case-card.expanded .case-body {
  display: block;
}

/* ============================================================
   Single-row case layout
   ============================================================ */
.case-row {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

/* Section 2: 7 columns */
.case-row-full {
  grid-template-columns:
    minmax(140px, 1.05fr) minmax(180px, 1.5fr) minmax(140px, 0.95fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr);
}

/* Section 3: 6 columns */
.case-row-partial {
  grid-template-columns:
    minmax(180px, 1.3fr) minmax(180px, 1.4fr) minmax(140px, 0.95fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr);
}

/* Intro 1.1: 6 columns */
.case-row-intro-full {
  grid-template-columns:
    minmax(160px, 1fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr);
}

/* Intro 1.2: 6 columns */
.case-row-intro-partial {
  grid-template-columns:
    minmax(160px, 1fr) minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(170px, 1.2fr) minmax(170px, 1.2fr) minmax(170px, 1.2fr);
}

/* ============================================================
   Cells
   ============================================================ */
.cell {
  border: 1px solid var(--rule-faint);
  border-radius: 3px;
  padding: 12px;
  background: var(--bg-tint);
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 6px;
}

.cell-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.1px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.3;
}

.cell-sublabel {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.1px;
  margin-top: 4px;
}

.cell audio {
  width: 100%;
  display: block;
  height: 34px;
  border-radius: 2px;
  margin-top: auto;
}

/* ============================================================
   MuLaCover (ours) highlight — only used in §2 and §3 outputs
   ============================================================ */
.ours-cell {
  background: linear-gradient(180deg, var(--ours-bg-2) 0%, var(--ours-bg) 100%);
  border: 1px solid var(--ours-border);
  position: relative;
  overflow: hidden;
}

.ours-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ours-strip);
}

.ours-cell .cell-label {
  color: var(--ours-fg);
}

.ours-cell .cell-label::after {
  content: "Ours";
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--ours-fg);
  /* deeper rose for readable white text */
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  line-height: 1.3;
  display: inline-block;
}

/* ============================================================
   Lyrics box (collapsible + scrollable)
   ============================================================ */
.lyrics-box {
  position: relative;
  border: 1px solid var(--rule-faint);
  border-radius: 3px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lyrics-text {
  margin: 0;
  padding: 8px 10px;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 6.5em;
  transition: max-height 0.25s ease;
  color: var(--ink-soft);
}

.lyrics-box.expanded .lyrics-text {
  max-height: 32em;
}

.lyrics-toggle {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--rule-faint);
  background: var(--bg-tint);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.1px;
  padding: 5px 0;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  margin-top: auto;          /* 把按钮推到 .lyrics-box 的底部 */
}

.lyrics-toggle:hover {
  background: var(--rule-faint);
  color: var(--ink);
}

/* ============================================================
   Style box
   ============================================================ */
.style-box {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--rule-faint);
  border-radius: 3px;
  padding: 10px 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  flex: 1;
}

/* ============================================================
   "Samples pending" placeholders — shown for §2.2 cases that don't
   have samples yet, plus the intro's new-lyrics column.
   ============================================================ */
.case-pending {
  font-family: var(--sans);
  background: var(--bg);
  border: 1px dashed var(--rule-faint);
  border-radius: 3px;
  padding: 12px 14px;
  color: var(--muted);
  text-align: center;
  flex: 1;
}
.case-pending {
  padding: 28px 14px;
  margin: 0 12px 12px;
}
.case-pending-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.case-pending-note {
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
}

/* ============================================================
   Partial-reference visible-part panel (inside ref cell)
   ============================================================ */
.partial-panel {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 8px 10px;
  margin-top: 8px;
}

.partial-panel-title {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.1px;
}

.partial-panel-config {
  font-family: var(--serif);
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 6px;
  line-height: 1.4;
}

.partial-panel audio {
  height: 30px;
}

/* ============================================================
   Footer
   ============================================================ */
.paper-footer {
  text-align: center;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  padding: 28px 16px 40px;
  border-top: 1px solid var(--rule-faint);
  max-width: 1800px;
  margin: 0 auto;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1500px) {
  .case-row-full {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }

  .case-row-partial {
    grid-template-columns: repeat(6, minmax(130px, 1fr));
  }

  .case-row-intro-full {
    grid-template-columns: repeat(6, minmax(140px, 1fr));
  }

  .case-row-intro-partial {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
  }
}

@media (max-width: 1100px) {

  .case-row-full,
  .case-row-partial,
  .case-row-intro-full,
  .case-row-intro-partial {
    grid-template-columns: repeat(2, 1fr);
  }

  .toc-inner {
    padding: 8px 24px;
  }

  .paper-body {
    padding: 0 24px;
  }

  .case-hint {
    display: none;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 17px;
  }

  .case-row-full,
  .case-row-partial,
  .case-row-intro-full,
  .case-row-intro-partial {
    grid-template-columns: 1fr;
  }

  .paper-title {
    font-size: 26px;
  }

  .section-title {
    font-size: 24px;
  }

  .toc-sep {
    display: none;
  }
}