/* ------------------------------------------------------------------
   儒濟生 · 中醫學習 — 中藥學 → 方劑學 反向跨科藥名超連結
   build-time 注入（_build/build_herb_links.py 內 reverse 段落），全程零 JavaScript。

   對稱設計：
     a.zh-link     中藥學正文裡的藥名（連去方劑學真正使用該藥的方劑章節）
     a.hb-anchor   方劑學筆記裡的落點（空元素，零高度，不影響排版）

   用方劑學代表色「墨藍 #3F5E7A」——與內科跳去方劑的 fx-link 同色（同一目的地
   方劑學），令讀者見墨藍即知「去方劑」。落版偏移由 [id^="hb-"] 的
   scroll-margin-top 處理，閃開 sticky .note-topbar。
   ------------------------------------------------------------------ */

a.zh-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px dotted #3F5E7A;
  padding-bottom: 1px;
}

a.zh-link:hover,
a.zh-link:focus-visible {
  color: #3F5E7A;
  border-bottom-style: solid;
  background: #E8EEF4;
  border-radius: 2px;
}

/* 落點錨點：空元素，不佔位 */
a.hb-anchor {
  display: inline;
  font-size: 0;
  line-height: 0;
}

[id^="hb-"] {
  scroll-margin-top: 84px;
}

a.hb-anchor:target + h3,
a.hb-anchor:target + h4 {
  box-shadow: -14px 0 0 -6px #3F5E7A;
}

@media (max-width: 640px) {
  [id^="hb-"] {
    scroll-margin-top: 104px;
  }
}

@media print {
  a.zh-link {
    color: inherit;
    border-bottom: none;
    background: none;
  }
}
