/* ==========================================================================
   高分讲义阅读样式 —— 对齐 foco-book / PDF（3.5）
   PDF：ctexart 11pt · Songti TC · BrandNavy #003459 · BrandInk #1E1E1E
   说明：旁注栏在网页改为划线词弹层；复杂 TikZ 图暂用占位。
   ========================================================================== */

:root {
  --foco-navy: #003459;
  --foco-cyan: #00a7e1;
  --foco-ink: #1e1e1e;
  --foco-white: #ffffff;
  --foco-slate: #5a7389;
  --foco-tbl-head: #eef5ff;
  --foco-cite-fill: #fffdf6;
  --foco-cite-border: #ffe8b2;
  --foco-cite-mark: #f3a8b3;
  --foco-paper: #f7f5f1;
  --foco-rule: rgba(0, 52, 89, 0.45);
  /* 与 11pt 正文对应的字号阶梯（LaTeX large ≈ 12pt） */
  --foco-body: 11pt;
  --foco-large: 12pt;
  --foco-Large: 14.4pt;
  --foco-lead: 1.55;
  --foco-song: "Songti TC", "Songti SC", "Source Han Serif TC",
    "Noto Serif TC", "Noto Serif SC", "STSong", serif;
}

/* ---------- 阅读纸面 ---------- */
.pane-scroll.lecture-reader,
.lecture-reader {
  font-family: var(--foco-song) !important;
  color: var(--foco-ink);
  font-size: var(--foco-body);
  line-height: var(--foco-lead);
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem 1.35rem 2.5rem;
  background: var(--foco-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  counter-reset: foco-zi foco-ii foco-item;
}

.lecture-reader * {
  font-family: inherit;
}

.lecture-reader p {
  margin: 0.28em 0 0.55em;
  text-align: justify;
  text-justify: inter-ideograph;
}

.lecture-reader ul,
.lecture-reader ol {
  margin: 0.28em 0 0.65em;
  padding-left: 1.45em;
}

.lecture-reader li {
  margin: 0.18em 0;
}

.lecture-reader ol.alpha {
  list-style-type: lower-alpha;
}
.lecture-reader ol.Alpha {
  list-style-type: upper-alpha;
}

.lecture-reader strong {
  font-weight: 700;
  color: var(--foco-ink);
}

/* ---------- 第 N 節盾牌标题（对齐 \shieldtitle） ---------- */
.foco-section-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0 1.2rem;
}

.foco-shield {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.4em;
  padding: 0.32em 0.55em 0.55em;
  background: var(--foco-navy);
  color: #fff;
  font-size: var(--foco-large);
  font-weight: 700;
  line-height: 1.2;
  clip-path: polygon(
    8% 0%,
    92% 0%,
    100% 12%,
    100% 78%,
    50% 100%,
    0% 78%,
    0% 12%
  );
  letter-spacing: 0.02em;
}

.foco-section-title {
  font-size: var(--foco-Large);
  font-weight: 700;
  color: var(--foco-ink);
  line-height: 1.35;
}

.foco-scope-note {
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  font-size: 9.5pt;
  line-height: 1.45;
  color: var(--foco-slate);
  background: rgba(0, 52, 89, 0.04);
  border-left: 2.5pt solid var(--foco-navy);
  border-radius: 0 6px 6px 0;
}

/* ---------- 标题层级（对齐 titlesec / subsubsubsection / FocoItemHead） ---------- */
/*
  h3  ← \subsubsection　　Songti · large · bold · navy · 「一、」
  h4  ← \subsubsubsection　Songti bold · normalsize · navy · 「(一)」
  h5  ← \FocoItemHead　　　Songti bold · ink · 「1.」
*/
.lecture-reader h2,
.lecture-reader h3,
.lecture-reader h4,
.lecture-reader h5 {
  font-family: var(--foco-song) !important;
  line-height: 1.35;
  text-align: left;
}

.lecture-reader h3 {
  font-size: var(--foco-large);
  font-weight: 700;
  color: var(--foco-navy);
  margin: 1.15em 0 0.3em;
  padding: 0;
  border: none;
}

.lecture-reader h4 {
  font-size: var(--foco-body);
  font-weight: 700;
  color: var(--foco-navy);
  margin: 0.9em 0 0.32em;
}

.lecture-reader h3,
.lecture-reader h4,
.lecture-reader h5,
.lecture-reader strong,
.foco-table th,
.foco-table td.foco-td-key {
  -webkit-text-stroke: 0.3px currentColor;
}

.lecture-reader h4 .foco-num {
  margin-right: 0.35em;
}

.lecture-reader h5.foco-item-head {
  font-size: var(--foco-body);
  font-weight: 700;
  color: var(--foco-ink);
  margin: 0.6em 0 0.15em;
}

.lecture-reader h5.foco-item-head .foco-num {
  margin-right: 0.35em;
}

/* ---------- 列表：(1) / ① / a. / •○（对齐 enumitem 设置） ---------- */
@counter-style foco-paren {
  system: extends decimal;
  prefix: "(";
  suffix: ") ";
}
@counter-style foco-circ {
  system: fixed;
  symbols: "①" "②" "③" "④" "⑤" "⑥" "⑦" "⑧" "⑨" "⑩" "⑪" "⑫" "⑬" "⑭" "⑮" "⑯" "⑰" "⑱" "⑲" "⑳";
  suffix: " ";
}
@counter-style foco-alpha-dot {
  system: extends lower-alpha;
  suffix: ". ";
}
@counter-style foco-Alpha-dot {
  system: extends upper-alpha;
  suffix: ". ";
}
.lecture-reader ol.foco-ol-paren { list-style-type: foco-paren; padding-left: 2.15em; }
.lecture-reader ol.foco-ol-circ { list-style-type: foco-circ; padding-left: 1.9em; }
.lecture-reader ol.foco-ol-alpha { list-style-type: foco-alpha-dot; padding-left: 1.9em; }
.lecture-reader ol.foco-ol-Alpha { list-style-type: foco-Alpha-dot; padding-left: 2.1em; }
.lecture-reader ol.foco-ol-dot { list-style-type: decimal; padding-left: 1.9em; }
.lecture-reader ul.foco-ul-disc { list-style-type: disc; padding-left: 1.25em; }
.lecture-reader ul.foco-ul-circ { list-style-type: circle; padding-left: 1.2em; }
.lecture-reader ol > li::marker,
.lecture-reader .foco-num {
  font-family: "Times New Roman", Times, var(--foco-song);
  font-variant-numeric: tabular-nums;
}
.lecture-reader h3 .foco-num {
  font-family: var(--foco-song);
}
.lecture-reader ol.foco-ol-circ > li::marker,
.lecture-reader ol.foco-ol-Alpha > li::marker {
  font-weight: 700;
}
.lecture-reader li > p:first-child {
  margin-top: 0;
}
.lecture-reader li > p:last-child {
  margin-bottom: 0.2em;
}

/* ---------- 教材段落号（\focoref：小标题右上角灰蓝小框） ---------- */
.foco-ref {
  display: inline-block;
  margin-left: 0.32em;
  padding: 0.02em 0.32em;
  border: 0.25pt solid rgba(0, 52, 89, 0.3);
  border-radius: 2px;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 7pt;
  font-weight: 400;
  line-height: 1.3;
  color: #2c4a63;
  background: #f2f5f8;
  vertical-align: 0.9em;
  letter-spacing: 0.01em;
}

/* ---------- FocoInlineItem：1. 標題：說明（悬挂缩进） ---------- */
.lecture-reader p.foco-inline-item {
  margin: 0.1em 0 0.3em;
  padding-left: 1.7em;
  text-indent: -1.7em;
}
.foco-inline-item .foco-num {
  display: inline-block;
  width: 1.7em;
  text-indent: 0;
  font-weight: 700;
}
.foco-inline-item strong {
  color: var(--foco-ink);
  font-weight: 700;
}

.foco-box-num {
  display: inline-block;
  min-width: 2em;
  text-indent: 0;
}
.lecture-reader p:has(> .foco-box-num:first-child) {
  padding-left: 2em;
  text-indent: -2em;
}

/* ---------- 表格（对齐 focotblr 表头亮蓝） ---------- */
.foco-table-wrap {
  margin: 0.55em 0 0.85em;
  overflow-x: auto;
  border: 0.35pt solid rgba(90, 115, 137, 0.55);
  border-radius: 2px;
  background: var(--foco-white);
}
.foco-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
  line-height: 1.45;
}
.foco-table th,
.foco-table td {
  border-bottom: 0.35pt solid rgba(90, 115, 137, 0.45);
  border-right: 0.35pt solid rgba(90, 115, 137, 0.35);
  padding: 0.4em 0.55em;
  vertical-align: middle;
  text-align: left;
}
.foco-table th:last-child,
.foco-table td:last-child {
  border-right: none;
}
.foco-table tr:last-child td {
  border-bottom: none;
}
.foco-table th {
  background: var(--foco-tbl-head);
  color: var(--foco-navy);
  font-weight: 700;
  text-align: center;
}
.foco-table td.foco-td-key {
  color: var(--foco-navy);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.foco-table p {
  margin: 0.12em 0;
  text-align: left;
}
.foco-table th p,
.foco-table td.foco-td-key p {
  text-align: center;
}
.foco-table td.foco-td-key {
  white-space: normal;
  min-width: 6em;
}
.foco-table ul,
.foco-table ol {
  margin: 0.12em 0;
  padding-left: 1.1em;
  text-align: left;
}

/* ---------- 时间轴（年份框 + 竖线圆点 + 正文） ---------- */
.foco-timeline {
  --tl-time: 6.6em;
  --tl-gap: 0.55em;
  --tl-line: calc(var(--tl-time) + var(--tl-gap) + 4px);
  list-style: none;
  margin: 1.1em 0 1.2em;
  padding: 0;
}
.foco-timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: var(--tl-time) 1fr;
  column-gap: calc(var(--tl-gap) * 2 + 9px + 0.5em);
  align-items: start;
  margin: 0;
  padding: 0 0 0.75em;
}
.foco-timeline > li::before {
  content: "";
  position: absolute;
  left: calc(var(--tl-line) - 0.5px);
  top: 0;
  bottom: 0;
  width: 1.05pt;
  background: rgba(0, 52, 89, 0.38);
}
.foco-timeline > li:first-child::before {
  top: 0.6em;
}
.foco-timeline > li:last-child::before {
  bottom: auto;
  height: 0.6em;
}
.foco-timeline > li:only-child::before {
  display: none;
}
.foco-timeline > li::after {
  content: "";
  position: absolute;
  left: calc(var(--tl-line) - 4px);
  top: calc(0.6em - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--foco-navy);
}
.foco-tl-time {
  box-sizing: border-box;
  width: 100%;
  padding: 0.12em 0.3em;
  border: 0.35pt solid rgba(0, 52, 89, 0.32);
  border-radius: 1mm;
  background: rgba(0, 52, 89, 0.09);
  color: var(--foco-navy);
  font-size: 9pt;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.foco-tl-body {
  font-size: 10pt;
  line-height: 1.55;
  color: var(--foco-ink);
  text-align: justify;
}

/* ---------- 知识拓展框 ---------- */
.foco-extend {
  margin: 0.75em 0 0.95em;
  padding: 0.7em 0.85em;
  border: 0.7pt dashed rgba(90, 115, 137, 0.55);
  border-left: 2.2pt solid rgba(0, 52, 89, 0.78);
  border-radius: 2px;
  background: rgba(0, 52, 89, 0.035);
}
.foco-extend > p:first-child {
  margin-top: 0;
  font-weight: 700;
  color: var(--foco-navy);
}

/* ---------- 流程图（TikZ 节点框 + 箭头） ---------- */
.foco-flow {
  margin: 0.5em 0 0.9em;
}
.foco-flow-row {
  display: flex;
  gap: 2.8mm;
}
.foco-flow-box {
  flex: 1 1 0;
  padding: 0.42em 0.5em;
  border: 0.35pt solid rgba(0, 52, 89, 0.28);
  border-radius: 1.2pt;
  background: rgba(0, 52, 89, 0.08);
  color: var(--foco-ink);
  font-size: 10pt;
  line-height: 1.45;
  text-align: center;
}
.foco-flow-need {
  background: rgba(0, 52, 89, 0.18);
  border-color: rgba(0, 52, 89, 0.4);
}
.foco-flow-mode {
  background: rgba(0, 52, 89, 0.32);
  border-color: rgba(0, 52, 89, 0.55);
}
.foco-flow-arrow {
  position: relative;
  height: 1.1em;
}
.foco-flow-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.1em;
  bottom: 0.25em;
  width: 0.5pt;
  background: rgba(0, 52, 89, 0.55);
}
.foco-flow-arrow::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  bottom: 0.05em;
  border: 3px solid transparent;
  border-top: 5px solid rgba(0, 52, 89, 0.55);
  border-bottom: 0;
}

/* ---------- \cite 划线词 ---------- */
.foco-cite {
  display: inline;
  padding: 0;
  margin: 0 0.04em;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-bottom: 2px solid var(--foco-cite-mark);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
.foco-cite:hover,
.foco-cite:hover .foco-cite-mark,
.foco-cite.active .foco-cite-mark {
  background: var(--foco-cite-fill);
}
.foco-cite-mark {
  border-radius: 2px;
  padding: 0 0.08em;
  transition: background 0.12s ease;
}

.foco-secnote {
  display: inline;
  margin: 0 0 0 0.08em;
  padding: 0 0.1em;
  border: none;
  border-radius: 2px;
  color: var(--foco-slate);
  background: transparent;
  font-size: 7.5pt;
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
  transform: none;
}
.foco-secnote:hover {
  background: rgba(90, 115, 137, 0.12);
  transform: none;
}

.foco-todo,
.foco-fig-fallback {
  color: var(--foco-slate);
  font-size: 10pt;
  font-style: italic;
  padding: 0.55em 0.7em;
  border: 0.7pt dashed rgba(90, 115, 137, 0.4);
  border-radius: 2px;
}

/* ---------- cite 弹层（替代 PDF 旁注） ---------- */
.foco-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.foco-popup {
  position: absolute;
  max-width: min(340px, calc(100vw - 2rem));
  padding: 0.7em 0.8em;
  background: var(--foco-cite-fill);
  border: 0.7pt solid var(--foco-cite-border);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(30, 30, 30, 0.12);
  color: var(--foco-ink);
  font-family: var(--foco-song);
  font-size: 9.5pt;
  line-height: 1.5;
  pointer-events: auto;
}
.foco-popup::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2.5pt;
  border-radius: 4px 0 0 4px;
  background: var(--foco-cite-mark);
}
.foco-popup-title {
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--foco-slate);
  margin: 0 0 0.3em;
  letter-spacing: 0.04em;
}
.foco-popup p {
  margin: 0.2em 0;
}
.foco-popup[hidden] {
  display: none !important;
}

.tree-item .badge-ready,
.tree-label .badge-soon {
  font-size: 0.65rem;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  vertical-align: middle;
}
.badge-ready {
  background: rgba(61, 154, 139, 0.18);
  color: #3d9a8b;
}
.badge-soon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.side-scope {
  margin: 0.55rem 0.75rem 0.85rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-dim, #8b93a1);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}
