/* 上师语露（窍诀）、教证集，将来公案集同用 - one passage per card, words first at reading size.

   Same column and palette as 堪布语露, which this grows out of: serif text ranged
   left, everything about the passage - who said it, where on the site it is
   read in full, which 类 it sits in - on one quiet line under it. */
.hj {
  margin: 0 auto;
  max-width: 1080px;
  padding: 6px 14px 30px;
  text-align: left;
}

.hj-head {
  border-bottom: 1px solid #ddddc8;
  padding-bottom: 10px;
}

.hj-head__title {
  color: #4e0d0d;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1.35em;
  margin: 0;
}

.hj-head__meta {
  color: #6f6152;
  font-size: 0.85em;
  margin: 4px 0 0;
}

.hj-head__meta strong {
  color: #3f6e4d;
  font-weight: 600;
}

.hj-search {
  align-items: center;
  border: 1px solid #ddddc8;
  border-radius: 999px;
  display: flex;
  gap: 2px;
  margin-top: 8px;
  max-width: 360px;
  padding: 2px 10px 2px 2px;
}

.hj-search:focus-within {
  background-color: #fff;
  border-color: #b9a94a;
}

/* Typing in it: a 2px ring round the whole pill in the sources' green (#3f6e4d,
   about 5:1 on the #e9e7e7 ground). The gold border alone was all but
   invisible (10-26). The field itself draws none, the pill being the control. */
.hj-search:has(.hj-search__input:focus-visible),
.hj-search__go:focus-visible {
  outline: 2px solid #3f6e4d;
  outline-offset: 2px;
}

.hj-search__go:focus-visible {
  border-radius: 999px;
}

.hj-search__go {
  background: none;
  border: 0;
  color: #4e0d0d;
  cursor: pointer;
  height: 30px;
  width: 30px;
}

.hj-search .hj-search__input {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0;
  min-width: 0;
  outline: none;
  padding: 4px 0;
  width: 100%;
}

/* The 类 as a wrapping row of quiet chips: sixteen of them fit in two or three
   lines on a phone, and the one being read is the only filled one. */
.hj-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 4px;
}

/* Each filter row named at its left: 侧面, 篇幅, 标签 (or a 经论's 品). Unnamed,
   three rows of chips read as one row that wrapped. */
.hj-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.hj-filter {
  align-items: baseline;
  display: flex;
  gap: 10px;
}

.hj-filter__label {
  color: #6f6152;
  flex: none;
  font-size: 0.82em;
  letter-spacing: 0.1em;
  width: 2.6em;
}

.hj-filter .hj-cats,
.hj-filter .hj-lens,
.hj-filter .hj-jumps {
  margin: 0;
  min-width: 0;
}

/* A phone: each row one line that scrolls sideways, so three rows of filters
   are three lines and not a screen; heji.js brings the chip being read into view. */
@media (max-width: 560px) {
  .hj-filter {
    align-items: center;
  }

  .hj-filter .hj-cats,
  .hj-filter .hj-lens,
  .hj-filter .hj-jumps {
    flex-wrap: nowrap;
    overflow-x: auto;
    /* room for a focus ring, which the scroller would otherwise clip */
    padding-block: 3px;
    scrollbar-width: none;
  }

  .hj-filter .hj-cats::-webkit-scrollbar,
  .hj-filter .hj-lens::-webkit-scrollbar,
  .hj-filter .hj-jumps::-webkit-scrollbar {
    display: none;
  }

  .hj-filter .hj-cat,
  .hj-filter .hj-len,
  .hj-filter .hj-jump {
    flex: none;
    white-space: nowrap;
  }
}

.hj-cat,
.hj-len {
  border: 1px solid #ddddc8;
  border-radius: 999px;
  color: #4e0d0d;
  font-size: 0.88em;
  padding: 3px 11px;
  text-decoration: none;
}

.hj-cat:hover,
.hj-len:hover {
  border-color: #b9a94a;
  color: #6a1414;
}

.hj-cat.is-on,
.hj-len.is-on {
  background-color: #4e0d0d;
  border-color: #4e0d0d;
  color: #fff;
}

.hj-cat__n,
.hj-len__n {
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  opacity: 0.65;
}

.hj-cat-note {
  color: #6f6152;
  font-size: 0.85em;
  margin: 6px 0 0;
}

.hj-lens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}

.hj-len {
  border-style: dashed;
  font-size: 0.82em;
}

.hj-card__text {
  border: 0;
  color: #2b2620;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1.05em;
  line-height: 1.85;
  margin: 0;
  padding: 0;
}

.hj-card__text p {
  margin: 0 0 0.6em;
  text-indent: 2em;
}

.hj-card__text p:last-child {
  margin-bottom: 0;
}

.hj-card__foot {
  align-items: baseline;
  color: #6f6152;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82em;
  gap: 4px 12px;
  margin-top: 10px;
}

.hj-card__speaker {
  color: #6b5d50;
  white-space: nowrap;
}

.hj-card__source {
  color: #3f6e4d;
  text-decoration: none;
}

.hj-card__source:hover {
  text-decoration: underline;
}

.hj-card__tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 出处一律落在右下：标签、讲解处数在左，出处在右（站长 10-19） */
.hj-card__cite {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: flex-end;
  margin-left: auto;
  text-align: right;
}

.hj-tag {
  color: #7a5f28;
  display: inline-block;
  font-size: 0.85em;
  margin: -13px -7px;
  padding: 13px 7px;
  text-decoration: none;
}

.hj-tag::before {
  content: "#";
  opacity: 0.6;
}

a.hj-tag:hover {
  text-decoration: underline;
}

.hj-empty {
  color: #6f6152;
  padding: 24px 0;
}

.hj-back {
  color: #6f6152;
  display: inline-block;
  font-size: 0.85em;
  margin-block: -11px -7px;
  padding-block: 11px;
  text-decoration: none;
}

.hj-back:hover {
  color: #4e0d0d;
}

/* 单条页：回本部、回所在的类，两层都给（站长 10-20） */
.hj-crumbs {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
}

/* 今日一条: the one passage written out in full on the front page, on a faint
   ground so it reads as the day's line rather than the first of a list. */
.hj-today {
  background-color: #faf7ec;
  border: 1px solid #ecebdc;
  border-radius: 6px;
  margin: 14px 0 6px;
  padding: 12px 16px 12px;
}

.hj-today__bar {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.hj-today__label {
  color: #7a5f28;
  font-size: 0.8em;
  letter-spacing: 0.1em;
}

.hj-today__random {
  color: #3f6e4d;
  font-size: 0.82em;
  text-decoration: none;
}

.hj-today__title {
  color: #4e0d0d;
  display: block;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1.05em;
  font-weight: 600;
  margin-bottom: 6px;
  text-decoration: none;
}

/* The 类 as a directory: a tile each with its count and the first few titles,
   one to a row on a phone, where two cut every sample title to a few characters. */
.hj-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

@media (max-width: 480px) {
  .hj-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hj-tile {
  min-width: 0;
  border: 1px solid #d6d2c4;
  border-radius: 6px;
  padding: 10px 12px;
}

.hj-tile__head {
  align-items: baseline;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  text-decoration: none;
}

.hj-tile__title {
  color: #4e0d0d;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-weight: 600;
}

.hj-tile__n {
  color: #6f6152;
  flex: none;
  font-size: 0.78em;
  font-variant-numeric: tabular-nums;
}

.hj-tile__samples {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-tile__samples li {
  font-size: 0.92em;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hj-tile__samples a {
  color: #6b5d50;
  text-decoration: none;
}

.hj-tile__samples a:hover {
  color: #4e0d0d;
}

.hj-group {
  margin-top: 18px;
  scroll-margin-top: 84px;
}

.hj-group__title {
  border-bottom: 1px solid #ddddc8;
  color: #4e0d0d;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1em;
  font-weight: 600;
  margin: 0;
  padding-bottom: 4px;
}

.hj-group__n {
  color: #6f6152;
  font-size: 0.8em;
  font-weight: 400;
  margin-left: 6px;
}

.hj-group__note {
  color: #6f6152;
  font-size: 0.82em;
  margin: 4px 0 0;
}

/* A row: the title, then the words themselves. A longer passage stops at eight
   lines under a fade until 展开全文 opens it. */
.hj-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Dividers in #d6d2c4: the pale ones (#f0efe3, #ecebdc) were lighter than the
   #e9e7e7 ground and all but vanished (10-26). */
.hj-row {
  border-bottom: 1px solid #d6d2c4;
  padding: 14px 0 12px;
}

.hj-row__title {
  color: #4e0d0d;
  display: inline-block;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-weight: 600;
  margin-block: -9px -3px;
  padding-block: 9px;
  text-decoration: none;
}

.hj-row__title:hover {
  text-decoration: underline;
}

.hj-row.is-clamped:not(.is-open) .hj-row__text {
  -webkit-mask-image: linear-gradient(#000 85%, transparent);
  mask-image: linear-gradient(#000 85%, transparent);
  max-height: calc(1.85em * 8);
  overflow: hidden;
}

.hj-row__more {
  background: none;
  border: 0;
  color: #3f6e4d;
  cursor: pointer;
  font-size: 0.85em;
  margin-block: -8px -10px;
  padding: 12px 0;
}

.hj-row__more:hover {
  text-decoration: underline;
}

.hj-row__more:focus-visible {
  outline: 2px solid #b9a94a;
  outline-offset: 2px;
}

.hj-one {
  padding: 14px 0 6px;
}

.hj-one__cats {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 14px;
}

.hj-pn {
  border-top: 1px solid #d6d2c4;
  display: flex;
  font-size: 0.88em;
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
}

/* 上一条/下一条: a small label over the verse line, both muted, so the pair reads as
   navigation and not as two more links in the green of the sources above. */
.hj-pn a {
  color: #6b5d50;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-decoration: none;
}

.hj-pn a:hover {
  color: #4e0d0d;
}

.hj-pn__label {
  color: #6f6152;
  font-size: 0.85em;
}

.hj-pn__next {
  align-items: flex-end;
  text-align: right;
}

/* 长行的条目标题是一整句：上一条、下一条只留一行，多的用省略号（站长 10-19） */
.hj-pn__title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A phone: 上一条 over 下一条, each the full width, or side by side each title was
   cut to eight characters (10-26). */
@media (max-width: 560px) {
  .hj-pn {
    flex-direction: column;
    gap: 14px;
  }

  .hj-pn__next {
    align-items: flex-start;
    text-align: left;
  }
}

.hj-related {
  margin-top: 22px;
}

.hj-related__list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-related__list li {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 5px 0;
}

.hj-related__list a {
  color: #4e0d0d;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 0.95em;
  text-decoration: none;
}

.hj-related__list a:hover {
  text-decoration: underline;
}

/* 教证的标题是颂的头一句，开头一样的靠经论名分 */
.hj-related__work {
  color: #6f6152;
  font-size: 0.85em;
}

.hj-related__why {
  display: inline-flex;
  font-size: 0.8em;
  gap: 6px;
}

/* 单条页 is one passage read through: a narrower column keeps its lines short. */
.hj--one {
  max-width: 860px;
}

/* 侧面 directory over a paged category, and the pager rows. */
.hj-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.hj-jump {
  border: 1px solid #ddddc8;
  border-radius: 999px;
  color: #4e0d0d;
  font-size: 0.88em;
  padding: 3px 11px;
  text-decoration: none;
}

.hj-jump:hover {
  border-color: #b9a94a;
  color: #6a1414;
}

/* The 侧面 being read, or 不分侧面. */
.hj-jump.is-on {
  background-color: #4e0d0d;
  border-color: #4e0d0d;
  color: #fff;
}

/* Touch: every chip a 44px target. */
@media (max-width: 560px), (pointer: coarse) {
  .hj-cat,
  .hj-len,
  .hj-jump {
    align-items: center;
    display: inline-flex;
    min-height: 44px;
  }
}

.hj-pager {
  color: #6f6152;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.88em;
  gap: 14px;
  justify-content: center;
  margin: 20px 0 8px;
}

.hj-pager--top {
  justify-content: flex-start;
  margin: 14px 0 0;
}

.hj-pager a {
  color: #3f6e4d;
  margin-block: -12px;
  padding-block: 12px;
  text-decoration: none;
}

.hj-pager a:hover {
  color: #4e0d0d;
}

/* 教证集: a verse is set as verse - each line flush, no first-line indent - and
   its row links through to the 堪布's explanations beneath it on its own page. */
.hj-verse p {
  text-indent: 0;
  margin-bottom: 0.15em;
  text-wrap: pretty;
}

/* 一句不折开：一行两句手机上放不下，在句与句之间换行（Heji_item.verse_lines） */
.hj-ju {
  display: inline-block;
}

/* 颂居中；经文、长行照常靠左（站长 10-19） */
.hj-verse--center {
  text-align: center;
}

/* 今日一条的出处照书上引文的写法：「——」起头，颂居中也落在卡片右下（站长 10-19） */
.hj-today__quote {
  margin: 0;
}

.hj-today__quote .hj-card__foot {
  justify-content: flex-end;
}

/* 讲解 N 处 靠左、出处仍在右下，同列表那一行（站长 10-21） */
.hj-today__notes {
  margin-right: auto;
}

/* A phone: the 出处 gets a line of its own under 讲解 N 处. Squeezed in beside it,
   it broke inside the 经论's name (10-26, 375px). */
@media (max-width: 560px) {
  .hj-today .hj-card__cite {
    flex-basis: 100%;
  }
}

/* The 出处 in its pieces (_cite.html): a line breaks between 作者, 《经论· and
   品》, never inside one, and a piece too long for the line still wraps. */
.hj-cite__unit {
  display: inline-block;
}

.hj-card__origin {
  border: 1px solid #ddddc8;
  border-radius: 999px;
  color: #6f6152;
  font-size: 0.85em;
  line-height: 1.5;
  margin-left: 6px;
  padding: 0 6px;
  white-space: nowrap;
}

/* 讲记引文的去处：引它的那篇讲记，篇名长的截断 */
.hj-cite__from {
  color: #3f6e4d;
  display: inline-block;
  font-size: 0.9em;
  max-width: 20em;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.hj-card__notes {
  color: #6b5d50;
  text-decoration: none;
}

.hj-card__notes:hover {
  color: #4e0d0d;
}

/* 单条页的出处：颂文底下右侧一行，「——作者《经论》」后跟一个小字的去处 */
.hj-one__cite {
  align-items: baseline;
  font-size: 1em;
}

.hj-one__open {
  color: #3f6e4d;
  font-size: 0.85em;
}

/* 按经论: one row per 经论, its 品 laid out in columns as a table of contents -
   name left, count right - each one a way into that 品 on the 经论's page. */
.hj-group__title--next {
  margin-top: 26px;
}

.hj-works {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-work {
  border-bottom: 1px solid #ecebdc;
  padding: 10px 0 12px;
}

.hj-work:last-child {
  border-bottom: 0;
}

.hj-work__head {
  align-items: baseline;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  margin-inline: -8px;
  padding: 4px 8px;
  text-decoration: none;
  transition: background-color 0.15s;
}

/* 整行是链接：悬停整条铺底色、书名画线（站长 10-19 嫌只给「全部」画线不显眼） */
.hj-work__head:hover {
  background-color: #f8f6ea;
}

.hj-work__head:hover .hj-tile__title {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.hj-work__all {
  color: #3f6e4d;
  font-size: 0.8em;
  margin-left: auto;
}

.hj-work__head:hover .hj-work__all {
  color: #2f5e3c;
  text-decoration: underline;
}

.hj-work__chapters {
  display: grid;
  gap: 0 24px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-work__chapters a {
  align-items: baseline;
  border-bottom: 1px dotted #d6d2c4;
  color: #6b5d50;
  display: flex;
  font-size: 0.85em;
  gap: 8px;
  justify-content: space-between;
  line-height: 2;
  text-decoration: none;
}

.hj-work__chapters a:hover {
  color: #4e0d0d;
}

.hj-work__chapter {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hj-work__n {
  color: #74665a;
  flex: none;
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .hj-work__chapters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
  }
}

/* 首页按经论只列常引的：一格一部，有品的点开看品目录（站长 10-20：444 部全铺太长）。 */
.hj-wgrid {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

@media (max-width: 480px) {
  .hj-wgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hj-wtile {
  border: 1px solid #d6d2c4;
  border-radius: 6px;
  min-width: 0;
  padding: 8px 10px;
}

.hj-wtile .hj-tile__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hj-wtile .hj-tile__head:hover .hj-tile__title {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.hj-wtile__more summary {
  color: #3f6e4d;
  cursor: pointer;
  font-size: 0.8em;
  margin-top: 4px;
}

/* 点开品目录的那格占满一行，品名排几栏 */
.hj-wtile:has(.hj-wtile__more[open]) {
  grid-column: 1 / -1;
}

.hj-wall {
  margin: 12px 0 0;
  text-align: right;
}

.hj-wall a {
  color: #3f6e4d;
  font-size: 0.9em;
  text-decoration: none;
}

.hj-wall a:hover {
  text-decoration: underline;
}

/* 全部经论页：名字左、条数右，几栏排开，筛的时候就地藏起。 */
.hj-wlist {
  display: grid;
  gap: 0 24px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-wlist a {
  align-items: baseline;
  border-bottom: 1px dotted #d6d2c4;
  color: #4e0d0d;
  display: flex;
  font-size: 0.92em;
  gap: 8px;
  justify-content: space-between;
  line-height: 2.1;
  text-decoration: none;
}

.hj-wlist a:hover .hj-work__chapter {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* A phone: two to a row, each a 44px target; a long name wraps rather than
   being cut, the count staying right (10-26: one column was 50,000px). */
@media (max-width: 480px) {
  .hj-wlist {
    gap: 0 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hj-wlist a {
    align-items: center;
    line-height: 1.4;
    min-height: 44px;
  }

  /* wrapping, not clipped: a closing 》 trimmed at the line end still counts as
     overflow and drew an ellipsis on a name that fit */
  .hj-wlist .hj-work__chapter {
    overflow: visible;
    white-space: normal;
  }
}

/* 只引一次 folded: its heading is the way to open it. */
.hj-wfold > summary {
  cursor: pointer;
  list-style-position: inside;
  padding-block: 10px 6px;
}

.hj-wfold > summary:hover {
  color: #6a1414;
}

.hj-wall--found {
  margin-top: 8px;
  text-align: left;
}

.hj-notes {
  margin-top: 22px;
}

.hj-notes__list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.hj-note {
  border-top: 1px solid #d6d2c4;
  padding: 10px 0;
}

.hj-note__text {
  border: 0;
  color: #3b342c;
  font-size: 0.95em;
  line-height: 1.8;
  margin: 0 0 4px;
  padding: 0;
}

.hj-note__text p {
  margin: 0;
}

.hj-note__foot {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82em;
  gap: 2px 0;
}

.hj-note__foot .hj-card__origin {
  font-size: 0.9em;
}

/* Compact website cards: hover keeps the full source in title; keyboard focus
   expands it. Detail pages and print retain the complete, wrapping text. */
.hj-card__cite {
  max-width: 100%;
  min-width: 0;
}
/* A 讲记's name, 《书》·第几课: break at its punctuation, not mid-word; a name
   with none still breaks where it must. */
.hj-card__source {
  overflow-wrap: anywhere;
  word-break: keep-all;
}
/* The source line is the card's way out, and 讲解 N 处 or 此条 the way to the
   item's page: 44px targets without moving the line. */
.hj-card__cite > a,
.hj-card__notes,
.hj-today__random {
  margin-block: -12px;
  padding-block: 12px;
}
@media screen {
  .hj-row .hj-card__source,
  .hj-today .hj-card__source {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 100%;
  }
  .hj-row .hj-card__source:focus-visible,
  .hj-today .hj-card__source:focus-visible {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}
