/* Reading one scripture of the 乾隆大藏经.

   The crawled page is 1990s markup from the source site: an orange title bar in
   white-on-orange 宋体, a contents block of floated thirds in red and brown, the
   text, then the source site's own prev/next and a second orange bar. The old
   template printed all of it and hung four buttons off the right edge of the
   window. The view now takes that page apart; this is the frame the pieces sit
   in - a measured column, a bar with the way back and the text-size control, a
   contents card that folds away, and neighbours that say where they go. */
.dz-read {
  margin: 0 auto;
  max-width: 860px;
  padding: 0 14px 10px;
  text-align: left;
}

.dz-read__bar {
  align-items: center;
  border-bottom: 1px solid #ddddc8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  padding-bottom: 8px;
}

.dz-read__crumbs {
  color: #8a7a6a;
  font-size: 0.85em;
}

.dz-read__crumbs a {
  color: #4a7c59;
  text-decoration: none;
}

.dz-read__crumbs a:hover {
  text-decoration: underline;
}

.dz-read__crumb-sep {
  opacity: 0.5;
  padding: 0 6px;
}

.dz-read__tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.dz-read__step {
  color: #4a7c59;
  font-size: 0.85em;
  text-decoration: none;
  white-space: nowrap;
}

.dz-read__step:hover {
  text-decoration: underline;
}

.dz-read__step--off {
  color: #bdbdac;
  cursor: default;
}

/* Three steps, not a slider: the body scales in 0.2em steps, and a reader who
   wants larger text wants it in one click. */
.dz-textsize {
  display: inline-flex;
  gap: 4px;
}

.dz-textsize__btn {
  background-color: rgba(255, 255, 255, 0.55);
  border: 1px solid #ccc;
  border-radius: 10px;
  color: #1a5276;
  font-size: 0.82em;
  line-height: 1.6;
  min-width: 2.2em;
  padding: 1px 7px;
  text-align: center;
  text-decoration: none;
}

.dz-textsize__btn:hover {
  border-color: #8a8a72;
  text-decoration: none;
}

.dz-read__mark {
  color: #4a7c59;
  font-size: 0.85em;
  text-decoration: none;
  white-space: nowrap;
}

.dz-read__mark:hover {
  text-decoration: underline;
}

/* A scripture already bookmarked reads as a state, not as an offer. */
.dz-read__mark--on {
  color: #8a7a4a;
}

.dz-read__head {
  padding: 16px 0 4px;
  text-align: center;
}

.dz-read__title {
  color: #4e0d0d;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  font-size: 1.5em;
  line-height: 1.4;
  margin: 0;
}

.dz-read__meta {
  color: #8a7a6a;
  font-size: 0.85em;
  margin: 6px 0 0;
}

.dz-read__meta a {
  color: #4a7c59;
  text-decoration: none;
}

.dz-read__meta a:hover {
  text-decoration: underline;
}

.dz-read__sep {
  opacity: 0.5;
  padding: 0 6px;
}

.dz-read__ref {
  color: #b0b09c;
}

.dz-read__link-icon {
  font-size: 0.85em;
  margin-left: 4px;
  opacity: 0.7;
}

/* The contents. Ten volumes of 大般若经 is a hundred kilobytes of scripture, so
   this is the one piece of navigation the page needs - and the one piece the
   reader wants out of the way once they are past it. */
.dz-toc {
  background-color: #fff;
  border: 1px solid #d9d9c6;
  border-radius: 10px;
  margin-top: 14px;
  padding: 8px 16px;
}

.dz-toc__summary {
  color: #4e0d0d;
  cursor: pointer;
  font-size: 0.95em;
  list-style: revert;
  padding: 4px 0;
}

.dz-toc__count {
  color: #8a8a78;
  font-size: 0.85em;
  padding-left: 6px;
}

.dz-toc__body {
  border-top: 1px solid #ececdc;
  margin-top: 6px;
  padding-top: 6px;
}

/* One row per 卷: the volume on the left, the 品 it contains on the right. The
   source markup floated both at fixed percentages, which stacked them into a
   ragged staircase on anything narrower than a desktop. */
.dz-toc__body .bm-bt {
  border-bottom: 1px dotted #ececdc;
  display: grid;
  gap: 2px 16px;
  grid-template-columns: minmax(0, 16em) 1fr;
  padding: 5px 0;
}

.dz-toc__body .bm-bt:last-child {
  border-bottom: 0;
}

/* The first row is the column labels the source page shipped with. */
.dz-toc__body .bm-bt:first-child {
  color: #a5a593;
  font-size: 0.8em;
}

.dz-toc__body .bm-jbt,
.dz-toc__body .bm-jbtbm {
  color: #6f6f5e;
  float: none;
  font-size: 0.9em;
  margin: 0;
  overflow: visible;
  padding: 1px 0;
  width: auto;
}

.dz-toc__body .bm-jbt a {
  color: #1a5276;
  text-decoration: none;
}

.dz-toc__body .bm-jbtbm a {
  color: #4a7c59;
  text-decoration: none;
}

.dz-toc__body .bm-jbt a:hover,
.dz-toc__body .bm-jbtbm a:hover {
  text-decoration: underline;
}

/* The text itself. White paper at a fixed measure, a serif face, and the line
   height a long classical read wants - the crawl set 宋体 at 200% line height
   inside a black-bordered box that ran the full width of the window. */
.dz-read__body {
  background-color: #fff;
  border: 1px solid #d9d9c6;
  border-radius: 12px;
  color: #333;
  font-family: "Songti SC", "SimSun", "宋体", serif;
  /* The size lives inline on the element, where text-utils.js reads and rewrites
     it: with it only in a stylesheet the first press of A- jumped the text up to
     the script's 1.3em default before stepping down. */
  line-height: 2;
  margin-top: 14px;
  padding: 26px 30px;
}

.dz-read__body p {
  margin: 0 0 1.1em;
}

/* Anchor targets: the contents links land on these, and a heading pinned to the
   very top edge of the viewport reads as if the page were cut off. */
.dz-read__body a[id] {
  scroll-margin-top: 16px;
}

/* The head of each 卷. Centred, the way the block is set in the canon, with a
   rule above it so a hundred kilobytes of continuous text still shows its
   joints. */
.dz-read__body .jwbt-box {
  border-top: 1px solid #ececdc;
  margin: 2em 0 1.4em;
  padding-top: 1.4em;
}

.dz-read__body .jwbt-box:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.dz-read__body .jwbt {
  color: #4e0d0d;
  font-size: 1.05em;
  line-height: 1.6;
  text-align: center;
}

.dz-read__body .jwbtbm {
  color: #8a7a6a;
  font-size: 0.85em;
  line-height: 1.6;
  text-align: center;
}

.dz-read__body .jwbtbm a {
  color: #8a7a6a;
  text-decoration: none;
}

.dz-read__body .jwbtbm a:hover {
  color: #4a7c59;
}

/* Neighbours, under the text where the reader ends up. The crawl's own pair were
   two bare list items linking to the source site's paths. */
.dz-read__nav {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  padding-top: 14px;
}

.dz-nav-card {
  background-color: #fff;
  border: 1px solid #d9d9c6;
  border-radius: 10px;
  display: block;
  padding: 10px 14px;
  text-decoration: none;
}

a.dz-nav-card:hover {
  border-color: #b9b9a0;
}

.dz-nav-card--next {
  text-align: right;
}

.dz-nav-card--empty {
  color: #a5a593;
  font-size: 0.85em;
}

.dz-nav-card__label {
  color: #8a8a78;
  display: block;
  font-size: 0.78em;
}

.dz-nav-card__title {
  color: #1a5276;
  display: block;
  line-height: 1.5;
  padding-top: 2px;
}

a.dz-nav-card:hover .dz-nav-card__title {
  text-decoration: underline;
}

.dz-nav-card__lei-bie {
  color: #a5a593;
  display: block;
  font-size: 0.78em;
  padding-top: 2px;
}

@media screen and (max-width: 600px) {
  .dz-read__body {
    padding: 18px 16px;
  }

  .dz-toc__body .bm-bt {
    grid-template-columns: 1fr;
  }

  .dz-read__nav {
    grid-template-columns: 1fr;
  }

  .dz-nav-card--next {
    text-align: left;
  }
}
