/* ==========================================================================
   清靜覺 · 光明讀經
   A reading surface for the Sutra of Perfect Enlightenment.
   ========================================================================== */

@font-face {
  font-family: 'Qingjing Serif';
  src: url('/assets/NotoSerifTC-subset.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Qingjing Serif';
  src: url('/assets/NotoSerifTC-SemiBold-subset.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #04070d;
  --bg-deep: #020409;
  --paper: #e8dfcc;
  --paper-bright: #f4ebd8;
  --ink-dim: #b8af9e;
  --ink-faint: #817b70;
  --gold: #d8c38f;
  --gold-bright: #f1dfb2;
  --gold-dim: rgba(216, 195, 143, .58);
  --line: rgba(216, 195, 143, .16);
  --line-soft: rgba(232, 223, 204, .09);
  --red: #9b392e;
  --red-bright: #b54838;
  --serif: 'Qingjing Serif', 'Noto Serif CJK TC', 'Source Han Serif TC', 'Songti TC', 'STSong', 'SimSun', serif;
  --sans: 'Noto Sans CJK TC', 'Source Han Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --reading-size: 19px;
  --reading-leading: 2.08;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --header-h: 78px;
}

html[data-font="s"] { --reading-size: 17px; }
html[data-font="m"] { --reading-size: 19px; }
html[data-font="l"] { --reading-size: 21.5px; }
html[data-font="l"] .sutra-panel { max-width: 780px; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-width: 300px;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; }
body.overlay-open { overflow: hidden; }

::selection { background: rgba(216, 195, 143, .25); color: var(--paper-bright); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
em { font-style: normal; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 16px;
  top: 14px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--paper);
  color: #111;
  font-family: var(--sans);
  font-size: 12px;
  transform: translateY(-160%);
  transition: transform .25s var(--ease);
}
.skip-link:focus { transform: none; }

/* ---------- the living ground -------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}
.stage canvas { display: block; width: 100%; height: 100%; }

.stage-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(110% 80% at 50% 44%, transparent 0%, transparent 46%, rgba(2, 4, 9, .28) 76%, rgba(2, 4, 9, .58) 100%),
    linear-gradient(180deg, rgba(2, 4, 9, .42) 0%, transparent 20%, transparent 70%, rgba(2, 4, 9, .55) 100%);
}

.grain {
  position: fixed;
  inset: -40%;
  z-index: 2;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
  animation: grainShift 18s steps(6) infinite;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 4, 9, .62) 0%, transparent 16%, transparent 82%, rgba(2, 4, 9, .76) 100%),
    radial-gradient(120% 100% at 50% 50%, transparent 54%, rgba(2, 4, 9, .46) 100%);
}

body.no-webgl .stage {
  background:
    radial-gradient(60% 60% at 60% 38%, rgba(78, 101, 131, .24), transparent 70%),
    radial-gradient(50% 50% at 25% 75%, rgba(122, 88, 50, .12), transparent 72%),
    #04070d;
}

@keyframes grainShift {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-1.5%, 1%, 0); }
  50% { transform: translate3d(.8%, -1.4%, 0); }
  75% { transform: translate3d(1.2%, .8%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ---------- loader ------------------------------------------------------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg-deep);
  transition: opacity 1s var(--ease), visibility 1s;
}
.loader-mark {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 195, 143, .55);
  color: var(--gold);
  font-size: 30px;
  position: relative;
  animation: sealBreathe 2.6s ease-in-out infinite;
}
.loader-mark::before,
.loader-mark::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(216, 195, 143, .14);
}
.loader-mark::after { inset: -10px; border-color: rgba(216, 195, 143, .08); }
.loader p {
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .5em;
  color: var(--ink-faint);
}
body.is-ready .loader { opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes sealBreathe {
  0%, 100% { opacity: .68; transform: scale(.98); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---------- header ------------------------------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(18px, 3.6vw, 46px);
  transition: background .55s var(--ease), border-color .55s, backdrop-filter .55s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(3, 6, 12, .66);
  border-bottom-color: var(--line-soft);
  -webkit-backdrop-filter: blur(18px) saturate(.85);
  backdrop-filter: blur(18px) saturate(.85);
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--red);
  color: #f2e6d2;
  font-size: 18px;
  line-height: 1;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 206, .18), 0 2px 14px rgba(0, 0, 0, .24);
  transform: rotate(-1.2deg);
}
.brand-word { display: flex; align-items: baseline; gap: 10px; }
.brand-word strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--paper-bright);
  white-space: nowrap;
}
.brand-word small {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .34em;
  color: var(--gold-dim);
  white-space: nowrap;
}
.now-reading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateY(6px);
  margin: 0;
  max-width: min(46vw, 520px);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .28em;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  pointer-events: none;
}
.site-header.has-chapter .now-reading { opacity: 1; transform: translate(-50%, -50%); }

.site-nav { display: flex; align-items: center; gap: clamp(16px, 2.2vw, 30px); }
.nav-text {
  position: relative;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .26em;
  color: var(--ink-dim);
  padding: 6px 0;
  transition: color .3s;
}
.nav-text::after {
  content: '';
  position: absolute;
  left: 0;
  right: .26em;
  bottom: 0;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav-text:hover { color: var(--gold-bright); }
.nav-text:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-icon {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 13px;
  color: var(--gold-dim);
  transition: border-color .3s, color .3s, background .3s;
}
.nav-icon:hover, .nav-icon[aria-expanded="true"] {
  border-color: rgba(216, 195, 143, .46);
  color: var(--gold-bright);
  background: rgba(216, 195, 143, .06);
}

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
  background: rgba(255, 255, 255, .025);
}
.read-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, rgba(155, 57, 46, .5), var(--gold), var(--gold-bright));
  box-shadow: 0 0 16px rgba(216, 195, 143, .35);
}

/* ---------- cover -------------------------------------------------------- */

.cover {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--header-h) + 26px) clamp(22px, 5vw, 72px) clamp(24px, 4vh, 48px);
}
.cover-grid {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(150px, .7fr) auto minmax(90px, .55fr);
  align-items: center;
  gap: clamp(24px, 5vw, 90px);
}
.cover-left { justify-self: start; align-self: center; padding-bottom: 5vh; }
.cover-kicker, .cover-translator {
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .25em;
  color: var(--ink-dim);
}
.cover-kicker { color: var(--gold-dim); margin-bottom: 9px; }
.cover-translator { color: var(--ink-faint); }
.cover-seal {
  width: 62px;
  height: 62px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--red);
  color: #f2e6d2;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: .08em;
  box-shadow: inset 0 0 0 1px rgba(255, 235, 205, .2), inset 0 0 18px rgba(52, 5, 2, .18), 0 6px 28px rgba(0, 0, 0, .2);
  transform: rotate(-2deg);
}
.cover-line { width: 54px; height: 1px; background: var(--line); margin: 30px 0 18px; }
.cover-source {
  margin: 0;
  font-family: var(--sans);
  font-size: 9px;
  line-height: 2;
  letter-spacing: .16em;
  color: var(--ink-faint);
}

.cover-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  animation: coverIn 1.6s var(--ease) .2s both;
}
.cover-eyebrow {
  margin: 0 0 clamp(24px, 5vh, 46px);
  padding-left: .65em;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .65em;
  color: var(--gold-dim);
}
.cover-title {
  margin: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: clamp(20px, 3.2vw, 48px);
  font-weight: 600;
  line-height: 1;
  color: var(--paper-bright);
  text-shadow: 0 0 50px rgba(216, 195, 143, .16), 0 2px 30px rgba(0, 0, 0, .5);
}
.cover-title span {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: clamp(44px, 9.2vh, 86px);
  letter-spacing: .13em;
}
.cover-title-main { color: var(--gold-bright); }
.cover-title-rest { color: var(--paper); }
.cover-sub {
  margin: clamp(26px, 4.2vh, 42px) 0 0;
  padding-left: .55em;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .55em;
  color: var(--ink-faint);
}

.cover-right {
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: flex-start;
  gap: 30px;
  padding-bottom: 5vh;
}
.cover-vertical {
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 12px;
  letter-spacing: .34em;
  color: rgba(216, 195, 143, .52);
}
.cover-number {
  margin: 0;
  writing-mode: vertical-rl;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .3em;
  color: var(--ink-faint);
}

.cover-bottom {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 20px;
  padding-top: clamp(20px, 3vh, 34px);
  border-top: 1px solid rgba(232, 223, 204, .07);
}
.cover-index { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cover-index span {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .24em;
  color: var(--ink-faint);
}
.cover-index i { width: 1px; height: 11px; background: var(--line); }
.cover-index p {
  flex-basis: 100%;
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--ink-dim);
}
.enter-link {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .46em;
  color: var(--gold);
  transition: color .3s;
}
.enter-link svg { width: 18px; height: 18px; opacity: .7; animation: descend 2.6s ease-in-out infinite; }
.enter-link:hover { color: var(--gold-bright); }
.cover-note {
  justify-self: end;
  margin: 0;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .2em;
  color: rgba(129, 123, 112, .7);
}

@keyframes coverIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes descend {
  0%, 100% { transform: translateY(-2px); opacity: .45; }
  50% { transform: translateY(5px); opacity: .9; }
}

/* ---------- chapters ----------------------------------------------------- */

.prologue, .chapter { position: relative; padding: clamp(100px, 14vh, 170px) 0 clamp(90px, 12vh, 150px); }
.prologue { min-height: 100svh; display: flex; align-items: center; padding-top: clamp(90px, 12vh, 150px); }
.prologue .chapter-inner { width: min(1090px, calc(100% - clamp(36px, 8vw, 120px))); }
.prologue .chapter-aside { position: static; }
.chapter + .chapter { padding-top: clamp(70px, 10vh, 120px); }

.chapter-inner {
  width: min(1090px, calc(100% - clamp(36px, 8vw, 120px)));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 760px);
  gap: clamp(34px, 5vw, 80px);
  align-items: start;
}

.chapter-aside {
  position: sticky;
  top: calc(var(--header-h) + 44px);
  padding-top: 4px;
}
.chapter-volume {
  margin: 0 0 20px;
  padding-top: 15px;
  width: 72px;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .38em;
  color: var(--gold-dim);
}
.chapter-index {
  margin: 0;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .34em;
  color: var(--ink-faint);
}
.chapter-index span { color: var(--gold); }
.chapter h2, .prologue h2 {
  margin: 18px 0 24px;
  font-size: clamp(26px, 2.6vw, 35px);
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: .09em;
  color: var(--paper-bright);
  text-shadow: 0 0 34px rgba(0, 0, 0, .35);
}
.chapter-realm {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  letter-spacing: .35em;
  color: var(--gold);
}
.chapter-realm span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(216, 195, 143, .32);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0;
  color: var(--gold-dim);
}
.chapter-epigraph {
  margin: 30px 0 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  max-width: 218px;
  font-size: 13px;
  line-height: 2.05;
  letter-spacing: .05em;
  color: #b8ad99;
}
.chapter-aside::after {
  content: '';
  display: block;
  width: 1px;
  height: clamp(62px, 12vh, 130px);
  margin: 34px 0 0 5px;
  background: linear-gradient(180deg, var(--line), transparent);
}

.sutra-wrap { min-width: 0; }

.sutra-panel {
  position: relative;
  padding: clamp(30px, 4.4vw, 58px) clamp(24px, 4.4vw, 62px) 28px;
  background:
    linear-gradient(180deg, rgba(5, 9, 15, .54), rgba(4, 7, 12, .70)),
    radial-gradient(120% 90% at 30% 0%, rgba(216, 195, 143, .045), transparent 55%);
  border: 1px solid rgba(216, 195, 143, .17);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, .30),
    inset 0 0 0 1px rgba(255, 255, 255, .015);
  -webkit-backdrop-filter: blur(9px) saturate(.85);
  backdrop-filter: blur(9px) saturate(.85);
}
.sutra-panel::before,
.sutra-panel::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: .55;
}
.sutra-panel::before {
  top: 9px;
  left: 9px;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
}
.sutra-panel::after {
  right: 9px;
  bottom: 9px;
  border-bottom: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
}

.panel-head, .panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .30em;
  color: rgba(184, 175, 158, .54);
}
.panel-head {
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head span:first-child { color: var(--gold-dim); }
.panel-foot {
  margin-top: clamp(32px, 5vw, 48px);
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
}
.panel-foot span:last-child { text-align: right; }

.sutra {
  padding-top: clamp(30px, 4vw, 42px);
  font-size: var(--reading-size);
  line-height: var(--reading-leading);
  letter-spacing: .015em;
  color: #e7dfce;
  text-align: justify;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .32);
  text-justify: inter-ideograph;
  overflow-wrap: anywhere;
}
.sutra p {
  margin: 0 0 1.28em;
  text-indent: 2em;
}
.sutra p:last-child { margin-bottom: 0; }
.sutra p:first-of-type { text-indent: 0; }
.sutra p:first-of-type::first-letter { color: var(--gold-bright); }
.sutra p.is-quote { text-indent: 2em; }
.sutra p.is-quote::first-letter { color: var(--gold); }

.verse-block {
  margin: clamp(38px, 6vw, 58px) 0 0;
  padding-top: clamp(24px, 3.5vw, 34px);
  border-top: 1px solid var(--line);
}
.verse-label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 clamp(22px, 3.5vw, 34px);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .44em;
  color: var(--gold-dim);
}
.verse-label::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.verse-lines { width: fit-content; max-width: 100%; margin: 0 auto; }
.verse-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.9em;
  margin: 0;
  padding: .10em 0;
  color: #eee5d3;
  font-size: 1.03em;
  line-height: 2.02;
  letter-spacing: .04em;
  text-align: left;
}
.verse-row span { display: block; white-space: nowrap; }
.verse-row span:first-child { text-align: right; }
.verse-row span:last-child { text-align: left; }
.verse-block + p { margin-top: 1.4em; }

.textual-note {
  margin: 26px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.9;
  letter-spacing: .08em;
  color: rgba(184, 175, 158, .68);
}
.textual-note span {
  display: inline-block;
  margin-right: 10px;
  color: var(--gold-dim);
  letter-spacing: .18em;
}

.scene-caption {
  margin: 16px 0 0;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .22em;
  color: rgba(184, 175, 158, .52);
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chapter-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: clamp(36px, 5vw, 52px);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .4em;
  color: rgba(184, 175, 158, .44);
}
.chapter-end::before, .chapter-end::after {
  content: '';
  width: 34px;
  height: 1px;
  background: var(--line-soft);
}
.chapter-end i {
  width: 5px;
  height: 5px;
  display: block;
  background: var(--gold-dim);
  transform: rotate(45deg);
  margin-right: -.4em;
}

/* reveal */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
  will-change: opacity, transform;
}
.js .reveal.in { opacity: 1; transform: none; }
.js .sutra-wrap.reveal { transition-delay: .10s; }

/* ---------- chapter dots ------------------------------------------------- */

.chapter-dots {
  position: fixed;
  z-index: 40;
  right: clamp(12px, 1.7vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 5px;
}
.chapter-dots button {
  position: relative;
  width: 28px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.chapter-dots button::before {
  content: '';
  width: 10px;
  height: 1px;
  background: rgba(232, 223, 204, .22);
  transition: width .35s var(--ease), background .35s;
}
.chapter-dots button::after {
  content: attr(data-label);
  position: absolute;
  right: 29px;
  top: 50%;
  transform: translateY(-50%) translateX(5px);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--ink-dim);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.chapter-dots button:hover::before,
.chapter-dots button.is-active::before { width: 22px; background: var(--gold); }
.chapter-dots button:hover::after { opacity: 1; transform: translateY(-50%); }
.chapter-dots button.is-active::before { box-shadow: 0 0 12px rgba(216, 195, 143, .45); }

/* ---------- colophon ----------------------------------------------------- */

.colophon {
  position: relative;
  padding: clamp(90px, 13vh, 160px) 0 42px;
  margin-top: 4vh;
  background:
    linear-gradient(180deg, rgba(3, 6, 11, .38), rgba(3, 6, 11, .9) 18%, rgba(3, 6, 11, .97)),
    radial-gradient(70% 50% at 50% 0%, rgba(216, 195, 143, .05), transparent 70%);
  border-top: 1px solid var(--line-soft);
}
.colophon-inner {
  width: min(1060px, calc(100% - clamp(36px, 8vw, 120px)));
  margin: 0 auto;
}
.section-eyebrow {
  margin: 0 0 20px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .44em;
  color: var(--gold-dim);
}
.colophon h2 {
  margin: 0 0 26px;
  font-size: clamp(32px, 4.6vw, 54px);
  line-height: 1.35;
  letter-spacing: .07em;
  font-weight: 600;
  color: var(--paper-bright);
}
.colophon-lead {
  max-width: 760px;
  margin: 0 0 clamp(48px, 8vw, 82px);
  font-size: 15px;
  line-height: 2.05;
  color: var(--ink-dim);
}
.colophon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 42px clamp(36px, 7vw, 90px);
  padding-top: 38px;
  border-top: 1px solid var(--line);
}
.colophon-block h3 {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .38em;
  color: var(--gold);
}
.colophon-block p, .colophon-block li {
  margin: 0 0 9px;
  font-size: 13px;
  line-height: 2;
  color: var(--ink-dim);
}
.colophon-block ul { margin: 0; padding: 0; list-style: none; }
.colophon-block li { position: relative; padding-left: 14px; }
.colophon-block li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .95em;
  width: 4px;
  height: 4px;
  border: 1px solid var(--gold-dim);
  transform: rotate(45deg);
}
.colophon-block a {
  color: var(--gold);
  border-bottom: 1px solid rgba(216, 195, 143, .28);
  transition: color .3s, border-color .3s;
}
.colophon-block a:hover { color: var(--gold-bright); border-color: var(--gold); }
.colophon-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 70px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .24em;
  color: rgba(129, 123, 112, .62);
}
.colophon-foot p { margin: 0; }

/* ---------- toc dialog --------------------------------------------------- */

.toc-dialog {
  width: min(1060px, calc(100% - 32px));
  max-height: 88svh;
  margin: auto;
  padding: 0;
  border: 1px solid rgba(216, 195, 143, .22);
  background: #070b12;
  color: var(--paper);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65);
  overflow: hidden;
}
.toc-dialog::backdrop {
  background: rgba(2, 4, 8, .74);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.toc-shell { display: flex; flex-direction: column; max-height: 88svh; }
.toc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(28px, 4vw, 48px) clamp(24px, 5vw, 58px) 24px;
  border-bottom: 1px solid var(--line);
}
.toc-head .section-eyebrow { margin-bottom: 12px; }
.toc-head h2 {
  margin: 0;
  font-size: clamp(27px, 3.4vw, 42px);
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--paper-bright);
}
.toc-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-dim);
  transition: border-color .3s, color .3s, transform .4s var(--ease);
}
.toc-close svg { width: 17px; height: 17px; }
.toc-close:hover { border-color: var(--gold); color: var(--gold-bright); transform: rotate(90deg); }
.toc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(30px, 6vw, 78px);
  padding: 18px clamp(24px, 5vw, 58px) 46px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.toc-group { min-width: 0; }
.toc-group-title {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 15px 0 8px;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .4em;
  color: var(--gold-dim);
}
.toc-group-title::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.toc-link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: color .3s, padding .35s var(--ease);
}
.toc-link:hover { color: var(--gold-bright); padding-left: 6px; }
.toc-link.is-current { color: var(--gold-bright); }
.toc-link .toc-num {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--gold-dim);
}
.toc-link .toc-name { font-size: 16px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-link .toc-realm { font-family: var(--sans); font-size: 9px; letter-spacing: .16em; color: var(--ink-faint); }
.toc-link.is-current .toc-realm { color: var(--gold-dim); }
.toc-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: auto;
  padding: 18px clamp(24px, 5vw, 58px) 22px;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .22em;
  color: var(--ink-faint);
}

/* ---------- settings ----------------------------------------------------- */

.settings {
  position: fixed;
  top: calc(var(--header-h) - 4px);
  right: clamp(14px, 3vw, 38px);
  z-index: 70;
  width: 304px;
  padding: 20px 21px 18px;
  background: rgba(7, 11, 18, .96);
  border: 1px solid rgba(216, 195, 143, .22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: panelIn .35s var(--ease) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.settings-head p {
  margin: 0;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .34em;
  color: var(--gold);
}
.settings-head button { color: var(--ink-faint); font-size: 20px; line-height: 1; padding: 0 3px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
}
.setting-row > span {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .24em;
  color: var(--ink-dim);
}
.segmented { display: flex; border: 1px solid var(--line); }
.segmented button {
  min-width: 37px;
  height: 27px;
  display: grid;
  place-items: center;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .05em;
  color: var(--ink-faint);
  border-left: 1px solid var(--line-soft);
  transition: color .25s, background .25s;
}
.segmented button:first-child { border-left: 0; }
.segmented button:hover { color: var(--paper); }
.segmented button[aria-pressed="true"] { color: #151008; background: var(--gold); }
.settings-note {
  margin: 14px 0 0;
  font-size: 10px;
  line-height: 1.8;
  color: rgba(129, 123, 112, .8);
}

/* ---------- noscript ----------------------------------------------------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 30px;
  background: var(--bg);
  color: var(--paper);
  font-size: 15px;
  line-height: 2;
  text-align: center;
}
.noscript a { color: var(--gold); border-bottom: 1px solid var(--gold-dim); }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 1180px) {
  .chapter-dots { display: none; }
  .cover-grid { grid-template-columns: minmax(130px, .55fr) auto minmax(60px, .4fr); gap: 34px; }
  .cover-vertical { font-size: 11px; }
}

@media (max-width: 1080px) {
  :root { --header-h: 68px; }
  .chapter-inner {
    grid-template-columns: minmax(0, 1fr);
    width: min(760px, calc(100% - clamp(30px, 8vw, 80px)));
    gap: 34px;
  }
  .chapter-aside { position: static; padding-top: 0; }
  .chapter-aside::after { display: none; }
  .chapter h2, .prologue h2 { margin-top: 14px; }
  .chapter-epigraph { max-width: 100%; margin-top: 22px; }
  .chapter-volume { width: 60px; margin-bottom: 16px; }
  .cover-grid { grid-template-columns: 1fr auto; }
  .cover-left { display: none; }
  .cover-center { grid-column: 1 / -1; }
  .cover-right { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
  .cover-bottom { grid-template-columns: 1fr auto 1fr; }
  .cover-note { display: none; }
  .colophon-grid { gap: 36px; }
}

@media (max-width: 720px) {
  .brand-word small { display: none; }
  .now-reading { display: none; }
  .site-nav { gap: 17px; }
  .cover { padding-left: 20px; padding-right: 20px; }
  .cover-title span { font-size: clamp(43px, 8.6vh, 66px); }
  .cover-right { display: none; }
  .cover-eyebrow { font-size: 9px; margin-bottom: 28px; }
  .cover-sub { margin-top: 26px; font-size: 9px; }
  .cover-bottom { grid-template-columns: 1fr; justify-items: center; gap: 22px; text-align: center; }
  .cover-index { justify-content: center; }
  .cover-index p { text-align: center; }
  .cover-bottom .enter-link { order: -1; }
  .sutra-panel { padding-left: clamp(19px, 5vw, 32px); padding-right: clamp(19px, 5vw, 32px); }
  .panel-head, .panel-foot { font-size: 7px; letter-spacing: .2em; }
  .sutra { line-height: 2; letter-spacing: 0; }
  .chapter h2, .prologue h2 { font-size: clamp(27px, 7vw, 34px); }
  .toc-body { grid-template-columns: 1fr; padding-top: 8px; }
  .toc-group + .toc-group { margin-top: 8px; }
  .toc-link .toc-name { font-size: 15px; }
  .colophon-grid { grid-template-columns: 1fr; }
  .colophon-foot { flex-direction: column; gap: 5px; }
  .settings { left: 12px; right: 12px; width: auto; top: calc(var(--header-h) + 6px); }
}

@media (max-width: 520px) {
  .cover-title { gap: 16px; }
  .cover-title span { font-size: clamp(39px, 8.2vh, 58px); letter-spacing: .08em; }
  .cover-seal { display: none; }
  .chapter-inner { width: calc(100% - 26px); }
  .sutra-panel { border-left: 0; border-right: 0; }
  .sutra { font-size: 17px; }
  html[data-font="s"] .sutra { font-size: 16px; }
  html[data-font="l"] .sutra { font-size: 19px; }
  .verse-row { gap: 1.25em; font-size: .96em; }
  .verse-row span { white-space: normal; }
  .chapter-dots { display: none; }
  .toc-dialog { width: calc(100% - 16px); max-height: 92svh; }
  .toc-shell { max-height: 92svh; }
  .toc-link { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 9px; }
  .toc-link .toc-realm { font-size: 8px; }
  .loader-mark { width: 58px; height: 58px; font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { transition-duration: .01ms; }
  .grain, .enter-link svg, .loader-mark { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* Explicit "quiet" setting: stop decorative CSS motion as well. */
html[data-motion="off"] { scroll-behavior: auto; }
html[data-motion="off"] .grain,
html[data-motion="off"] .enter-link svg,
html[data-motion="off"] .loader-mark { animation: none; }
html[data-motion="off"].js .reveal { transition-duration: .01ms; }
html[data-motion="off"] .cover-center { animation: none; }

:where(a, button):focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}
.chapter-dots button:focus-visible::after { opacity: 1; transform: translateY(-50%); }

/* ==========================================================================
   Dunhuang direction — mineral pigments, moonlight, a wall of faded fresco
   ========================================================================== */

:root {
  --bg: #04080e;
  --bg-deep: #02050a;
  --paper: #e7ddc9;
  --paper-bright: #f2e7d2;
  --ink-dim: #b9ac96;
  --ink-faint: #8f8270;
  --gold: #c8a96b;
  --gold-bright: #ead3a2;
  --gold-dim: rgba(200, 169, 107, .60);
  --line: rgba(200, 169, 107, .19);
  --line-soft: rgba(231, 221, 201, .09);
  --red: #9e4a3d;
}

.patina {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .55;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(45% 55% at 18% 35%, rgba(158, 74, 61, .14), transparent 70%),
    radial-gradient(40% 50% at 64% 28%, rgba(72, 111, 133, .15), transparent 72%),
    radial-gradient(50% 45% at 45% 88%, rgba(94, 124, 104, .10), transparent 74%),
    linear-gradient(180deg, rgba(26, 34, 39, .18), transparent 35%, rgba(38, 25, 18, .12) 100%);
}

.mural-frame {
  position: fixed;
  inset: 13px;
  z-index: 4;
  pointer-events: none;
  border: 1px solid rgba(200, 169, 107, .22);
  box-shadow: inset 0 0 70px rgba(2, 4, 8, .35);
}
.mural-frame::before,
.mural-frame::after {
  content: '';
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: rgba(200, 169, 107, .42);
  border-style: solid;
}
.mural-frame::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}
.mural-frame::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.stage-wash {
  background:
    linear-gradient(90deg, rgba(3, 6, 10, .36) 0%, rgba(3, 6, 10, .10) 20%, transparent 38%, rgba(3, 6, 10, .16) 56%, rgba(2, 4, 9, .58) 78%, rgba(2, 4, 9, .78) 100%),
    linear-gradient(180deg, rgba(2, 4, 9, .58) 0%, transparent 18%, transparent 70%, rgba(2, 4, 9, .62) 100%),
    radial-gradient(120% 100% at 48% 46%, transparent 48%, rgba(2, 4, 9, .30) 82%, rgba(2, 4, 9, .55) 100%);
}

.cover { isolation: isolate; }
.cover::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 30%, rgba(3, 6, 10, .08) 47%, rgba(3, 6, 10, .52) 68%, rgba(3, 6, 10, .76) 100%);
}
.cover-grid, .cover-bottom { position: relative; z-index: 1; }
.cover::after {
  content: '';
  position: absolute;
  left: clamp(22px, 5vw, 72px);
  bottom: clamp(82px, 10vh, 120px);
  width: 1px;
  height: 90px;
  z-index: 1;
  background: linear-gradient(180deg, transparent, rgba(200, 169, 107, .24), transparent);
  pointer-events: none;
}

.cover-title-main {
  color: transparent;
  background: linear-gradient(180deg, #f3e1b7 0%, #d9bb82 52%, #a7824d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 2px 26px rgba(0, 0, 0, .52));
}
.cover-title-rest { color: #ece2ce; text-shadow: 0 2px 26px rgba(0, 0, 0, .62); }
.cover-kicker, .cover-translator, .cover-source, .cover-index span, .cover-index p {
  text-shadow: 0 1px 12px rgba(0, 0, 0, .75);
}
.cover-seal { box-shadow: inset 0 0 0 1px rgba(255, 235, 205, .22), inset 0 0 22px rgba(52, 5, 2, .28), 0 8px 30px rgba(0, 0, 0, .35); }
.cover-vertical { color: rgba(234, 211, 162, .58); }

.chapter-aside, .prologue .chapter-aside {
  text-shadow: 0 1px 16px rgba(0, 0, 0, .72);
}
.chapter h2, .prologue h2 { text-shadow: 0 2px 24px rgba(0, 0, 0, .60); }

.sutra-panel {
  background:
    linear-gradient(180deg, rgba(7, 11, 16, .72), rgba(5, 8, 12, .82)),
    radial-gradient(120% 90% at 30% 0%, rgba(200, 169, 107, .055), transparent 58%);
  border-color: rgba(200, 169, 107, .22);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, .36),
    inset 0 0 0 1px rgba(255, 245, 224, .018),
    inset 0 0 70px rgba(0, 0, 0, .12);
}

.sutra { color: #e8dfcd; }
.verse-label, .panel-head span:first-child { color: var(--gold); }

.site-header.is-scrolled {
  background: rgba(4, 8, 13, .72);
  border-bottom-color: rgba(200, 169, 107, .14);
}

@media (max-width: 980px) {
  .mural-frame { inset: 9px; }
  .cover::before {
    background: radial-gradient(78% 62% at 50% 44%, rgba(3, 6, 10, .36), transparent 78%),
      linear-gradient(180deg, rgba(3, 6, 10, .22), transparent 30%, rgba(3, 6, 10, .24));
  }
}
@media (max-width: 720px) {
  .stage-wash {
    background:
      linear-gradient(180deg, rgba(2, 4, 9, .32) 0%, transparent 20%, transparent 66%, rgba(2, 4, 9, .42) 100%),
      radial-gradient(120% 100% at 50% 40%, transparent 42%, rgba(2, 4, 9, .28) 100%);
  }
  .cover::before {
    background: linear-gradient(180deg, rgba(3, 6, 10, .20) 0%, transparent 28%, rgba(3, 6, 10, .12) 66%, rgba(3, 6, 10, .36) 100%);
  }
  .patina { opacity: .34; }
}
@media (max-width: 520px) {
  .mural-frame { inset: 6px; }
  .patina { opacity: .40; }
  .cover-title-main { filter: drop-shadow(0 1px 14px rgba(0, 0, 0, .55)); }
  .cover-title-rest { text-shadow: 0 1px 16px rgba(0, 0, 0, .65); }
}

.cover-left { position: relative; isolation: isolate; padding: 18px 26px 18px 0; }
.cover-left::before {
  content: '';
  position: absolute;
  inset: -12px -40px -18px -22px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(65% 78% at 22% 48%, rgba(3, 6, 10, .48), transparent 74%);
}
.cover-kicker { color: rgba(234, 211, 162, .78); }
.cover-translator { color: rgba(231, 221, 201, .78); }
.cover-source { color: rgba(185, 172, 150, .82); }
.chapter-epigraph { color: #c6b8a2; }


@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .cover-title-main { color: var(--gold-bright); background: none; }
}

.chapter-aside { isolation: isolate; }
.chapter-aside::before {
  content: '';
  position: absolute;
  inset: -26px -48px -30px -34px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(72% 72% at 18% 36%, rgba(3, 6, 10, .48), transparent 76%);
}
.scene-caption {
  font-size: 9px;
  letter-spacing: .16em;
  color: rgba(198, 184, 162, .66);
}

.loader-fallback {
  max-width: 460px;
  padding: 0 28px;
  text-align: center;
  font-family: var(--sans);
  color: var(--ink-dim);
}
.loader-fallback p { margin: 0 0 12px; font-size: 12px; line-height: 2; letter-spacing: .08em; }
.loader-fallback code {
  display: inline-block;
  margin: 4px 0 14px;
  padding: 8px 12px;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .02em;
}
.loader-fallback a { color: var(--gold); border-bottom: 1px solid var(--gold-dim); }

/* editorial labels removed from scripture; only chapter titles and verbatim excerpts */
.epigraph-label {
  margin: 30px 0 9px;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .36em;
  color: var(--gold-dim);
}
.epigraph-label + .chapter-epigraph { margin-top: 0; }
.cover-vertical-label {
  margin: 0 0 12px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .28em;
  color: var(--gold-dim);
}
.toc-link { grid-template-columns: 24px minmax(0, 1fr); }
@media (max-width: 520px) {
  .toc-link { grid-template-columns: 20px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .brand-word small { letter-spacing: .18em; }
}

/* ==========================================================================
   Readability pass — auxiliary labels set a little larger
   ========================================================================== */

.site-nav .nav-text { font-size: 11px; letter-spacing: .20em; }
.brand-word small { font-size: 9.5px; letter-spacing: .20em; }
.now-reading { font-size: 11px; letter-spacing: .20em; }
.cover-kicker, .cover-translator { font-size: 12px; letter-spacing: .20em; }
.cover-source { font-size: 10.5px; line-height: 1.9; }
.cover-sub { font-size: 11.5px; letter-spacing: .38em; }
.cover-number { font-size: 10px; }
.cover-index span { font-size: 10.5px; letter-spacing: .16em; }
.cover-index p { font-size: 13px; letter-spacing: .12em; }
.cover-note { font-size: 10px; letter-spacing: .14em; }
.chapter-volume { font-size: 11px; letter-spacing: .28em; }
.chapter-index { font-size: 12px; letter-spacing: .24em; }
.panel-head, .panel-foot { font-size: 10px; letter-spacing: .22em; }
.verse-label { font-size: 10px; letter-spacing: .34em; }
.chapter-end { font-size: 10px; letter-spacing: .28em; }
.scene-caption { font-size: 10.5px; letter-spacing: .12em; color: rgba(211, 197, 175, .78); }
.chapter-dots button::after { font-size: 10px; }
.toc-head .section-eyebrow { font-size: 11px; letter-spacing: .30em; }
.toc-group-title, .toc-foot { font-size: 10px; letter-spacing: .26em; }
.toc-link .toc-num { font-size: 10px; }
.toc-link .toc-name { font-size: 17px; }
.settings-head p { font-size: 10px; letter-spacing: .26em; }
.setting-row > span { font-size: 10.5px; letter-spacing: .18em; }
.segmented button { font-size: 10.5px; }
.settings-note { font-size: 11.5px; line-height: 1.8; }
.colophon .section-eyebrow { font-size: 10.5px; letter-spacing: .32em; }
.colophon-block h3 { font-size: 10.5px; letter-spacing: .28em; }
.colophon-block p, .colophon-block li { font-size: 14px; line-height: 1.95; }
.colophon-lead { font-size: 15.5px; line-height: 1.95; }
.colophon-foot { font-size: 10px; letter-spacing: .18em; }
.loader p { font-size: 11px; letter-spacing: .36em; }
.loader-fallback p { font-size: 13px; }
.loader-fallback code { font-size: 12px; }

.cover-title span { font-size: clamp(42px, 8.6vh, 80px); }
@media (max-width: 720px) {
  .site-nav .nav-text { font-size: 10.5px; }
  .panel-head, .panel-foot { font-size: 9px; letter-spacing: .16em; }
  .toc-link .toc-name { font-size: 16px; }
  .colophon-block p, .colophon-block li { font-size: 13.5px; }
  .cover-title span { font-size: clamp(42px, 8.2vh, 58px); letter-spacing: .08em; }
}
@media (max-width: 520px) {
  .cover-title span { font-size: clamp(42px, 8.0vh, 56px); }
  .panel-head, .panel-foot { font-size: 9px; }
}

.enter-link { font-size: 12px; letter-spacing: .32em; }
.brand-word small { font-size: 10.5px; }
.cover-source { font-size: 11px; }
.cover-index span { font-size: 11px; }
.cover-note { font-size: 10.5px; }
@media (max-width: 720px) {
  .cover-sub { display: none; }
  .enter-link { font-size: 11px; }
}

@media (max-width: 720px) {
  .site-header.is-scrolled {
    background: rgba(4, 8, 13, .94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ==========================================================================
   清靜覺 · 光明色
   Day is the canon: warm white, pale gold, sky blue, lotus pink.
   Night keeps the same forms in a lower key.
   ========================================================================== */

:root {
  --bg: #f6f1e6;
  --bg-deep: #fbf6ec;
  --text: #2a241c;
  --text-bright: #1c1814;
  --text-dim: #5a5146;
  --text-faint: #746b60;
  --paper: var(--text);
  --paper-bright: var(--text-bright);
  --ink-dim: var(--text-dim);
  --ink-faint: var(--text-faint);
  --gold: #7a5420;
  --gold-bright: #4c3212;
  --gold-dim: rgba(122, 84, 32, .82);
  --line: rgba(122, 84, 32, .24);
  --line-soft: rgba(90, 64, 32, .12);
  --red: #8d3b32;
  --sutra-ink: #241f18;
  --verse-ink: #241f18;
  --panel-bg: rgba(255, 252, 247, .88);
  --header-bg: rgba(246, 241, 230, .86);
  --dialog: #fbf7f0;
  --settings-bg: rgba(255, 252, 247, .97);
  color-scheme: light;
}

html { color-scheme: light; }
body { color: var(--text); }
::selection { background: rgba(166, 124, 58, .22); color: var(--text-bright); }

.stage-wash {
  background:
    linear-gradient(180deg, rgba(255, 250, 242, .42) 0%, transparent 16%, transparent 74%, rgba(255, 248, 240, .35) 100%),
    radial-gradient(80% 60% at 72% 42%, rgba(255, 252, 247, .18), transparent 70%);
}
.vignette {
  background: radial-gradient(125% 100% at 50% 42%, transparent 58%, rgba(176, 132, 78, .07) 100%);
}
.patina {
  opacity: .55;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(42% 36% at 50% 30%, rgba(255, 244, 214, .9), transparent 72%),
    radial-gradient(28% 32% at 16% 72%, rgba(232, 170, 178, .45), transparent 74%),
    radial-gradient(26% 30% at 84% 68%, rgba(150, 196, 206, .4), transparent 74%);
}
.mural-frame {
  border-color: rgba(166, 124, 58, .32);
  box-shadow: none;
}
.mural-frame::before,
.mural-frame::after { border-color: rgba(138, 94, 42, .55); }

body.no-webgl .stage {
  background:
    radial-gradient(42% 36% at 50% 28%, rgba(255, 246, 220, .95), transparent 70%),
    linear-gradient(180deg, #dceaf0 0%, #f7f2e8 46%, #f6e4dc 100%);
}

.site-header.is-scrolled,
.site-header.is-scrolled {
  background: var(--header-bg);
  border-bottom-color: var(--line-soft);
}
.cover::before {
  background: radial-gradient(48% 42% at 46% 46%, rgba(255, 252, 247, .35), transparent 72%);
}
.cover::after { background: linear-gradient(180deg, transparent, rgba(122, 84, 32, .28), transparent); }
.cover-left::before,
.chapter-aside::before { background: none; }
.cover-title { color: #3a3126; text-shadow: none; }
.cover-title-main {
  background: linear-gradient(180deg, #b1843e 0%, #5c3d16 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: none;
}
.cover-title-rest { color: #3a3126; text-shadow: none; }
.cover-title[data-long] span { font-size: clamp(32px, 6.2vh, 62px); letter-spacing: .06em; }
.cover-kicker, .cover-translator, .cover-source,
.cover-index span, .cover-index p,
.chapter-aside, .prologue .chapter-aside,
.chapter h2, .prologue h2 { text-shadow: none; }
.cover-kicker { color: var(--gold); }
.cover-translator, .cover-source { color: var(--text-dim); }
.cover-vertical { color: var(--gold-dim); }

.sutra-panel {
  background: var(--panel-bg);
  border-color: rgba(138, 94, 42, .28);
  box-shadow: 0 18px 50px rgba(92, 62, 24, .08), inset 0 0 0 1px rgba(255, 255, 255, .65);
}
.sutra { color: var(--sutra-ink); text-shadow: none; }
.verse-row { color: var(--verse-ink); }
.panel-head, .panel-foot, .chapter-end, .scene-caption, .textual-note { color: var(--text-faint); }
.panel-head span:first-child, .verse-label { color: var(--gold); }
.textual-note span { color: var(--gold); }

.colophon {
  background:
    linear-gradient(180deg, rgba(246, 241, 230, .2), rgba(251, 247, 239, .92) 14%, rgba(251, 247, 239, .96)),
    radial-gradient(70% 40% at 50% 0%, rgba(255, 244, 220, .45), transparent 70%);
}
.toc-dialog {
  background: var(--dialog);
  color: var(--text);
  border-color: rgba(138, 94, 42, .28);
  box-shadow: 0 30px 80px rgba(70, 46, 16, .16);
}
.toc-dialog::backdrop { background: rgba(70, 50, 24, .28); }
.settings {
  background: var(--settings-bg);
  border-color: rgba(138, 94, 42, .28);
  box-shadow: 0 18px 50px rgba(70, 46, 16, .12);
}
.segmented button[aria-pressed="true"] { color: #fffaf3; background: var(--gold); }
.loader-fallback code { background: rgba(255, 252, 247, .8); color: var(--text); }
.read-progress { background: rgba(90, 60, 20, .06); }
.chapter-dots button::before { background: rgba(90, 60, 20, .28); }

.mantra {
  margin: 0;
  text-align: center;
  text-indent: 0;
  font-size: 1.16em;
  letter-spacing: .2em;
  line-height: 2.1;
  color: var(--gold);
}
.sutra-close {
  margin: 1.8em 0 0;
  text-align: center;
  text-indent: 0;
  letter-spacing: .42em;
  color: var(--text-dim);
}

/* ---------- homepage ----------------------------------------------------- */

.home .now-reading { opacity: 1; transform: translate(-50%, -50%); }
.home-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--header-h) + 12px) 22px 56px;
}
.home-halo {
  position: absolute;
  width: min(560px, 86vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 250, 236, .78) 0%, rgba(255, 236, 196, .28) 42%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.home-kicker, .home-title, .home-lede, .home-meta, .home-enter { position: relative; z-index: 1; }
.home-kicker {
  margin: 0 0 18px;
  padding-left: .42em;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .46em;
  color: var(--gold);
}
.home-title {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 3vw, 42px);
  margin: 0;
  font-weight: 600;
  font-size: clamp(72px, 13vw, 148px);
  line-height: .92;
  letter-spacing: .08em;
}
.home-title span {
  background: linear-gradient(180deg, #c4964a 0%, #6a4718 72%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-lede {
  margin: 22px 0 0;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: .28em;
  color: var(--text);
}
.home-meta {
  margin: 12px 0 0;
  max-width: 34em;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .16em;
  line-height: 1.8;
  color: var(--text-dim);
}
.home-enter { margin-top: 36px; }

.home-catalog {
  position: relative;
  padding: clamp(48px, 8vh, 88px) 0 clamp(36px, 6vh, 64px);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0), rgba(255, 250, 242, .78) 10%, rgba(255, 250, 242, .9));
}
.home-catalog-inner, .home-close-inner {
  width: min(1040px, calc(100% - clamp(28px, 6vw, 80px)));
  margin: 0 auto;
}
.home-catalog-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 22px;
}
.home-catalog-head h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: .18em;
  font-weight: 600;
}
.home-catalog-head p:last-child {
  margin: 0 0 0 auto;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--text-faint);
}
.sutra-list { display: flex; flex-direction: column; gap: 16px; }
.sutra-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: clamp(16px, 3vw, 32px);
  align-items: center;
  padding: clamp(18px, 3vw, 28px) clamp(18px, 3vw, 32px);
  background: rgba(255, 252, 247, .84);
  border: 1px solid rgba(138, 94, 42, .24);
  box-shadow: 0 16px 40px rgba(92, 62, 24, .06);
  color: var(--text);
  transition: transform .45s var(--ease), border-color .3s;
}
.sutra-card:hover { transform: translateY(-3px); border-color: rgba(138, 94, 42, .5); }
.sutra-card-seal {
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 26px;
  letter-spacing: .22em;
  color: #6e4a1c;
}
.sutra-card-kicker {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--gold);
}
.sutra-card h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.35;
}
.sutra-card-blurb {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text-dim);
}
.sutra-card-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--text-faint);
}
.sutra-card-aside span:last-child { color: var(--gold); letter-spacing: .28em; }

.home-close { position: relative; padding: 20px 0 64px; }
.home-close h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: .08em;
  font-weight: 600;
}
.home-close p { margin: 0 0 12px; max-width: 46em; font-size: 15px; line-height: 1.95; color: var(--text-dim); }
.home-close-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--text-faint);
}

@media (max-width: 720px) {
  .cover-sub { display: block; font-size: 11px; letter-spacing: .22em; }
  .site-header.is-scrolled {
    background: rgba(246, 241, 230, .94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .home-title { font-size: clamp(64px, 18vw, 92px); gap: 10px; }
  .home-lede { letter-spacing: .16em; font-size: 16px; }
  .home-meta { letter-spacing: .06em; }
  .home-catalog-head { flex-wrap: wrap; }
  .home-catalog-head p:last-child { margin-left: 0; }
  .sutra-card { grid-template-columns: 1fr auto; }
  .sutra-card-seal {
    writing-mode: horizontal-tb;
    grid-column: 1 / -1;
    font-size: 15px;
    letter-spacing: .32em;
  }
  .home-close-foot { flex-direction: column; }
  .stage-wash {
    background: linear-gradient(180deg, rgba(255, 250, 242, .3), transparent 22%, transparent 70%, rgba(255, 248, 240, .28));
  }
}

/* ---------- night ------------------------------------------------------- */

html[data-theme="night"] {
  --bg: #10161c;
  --bg-deep: #070b10;
  --text: #e7ddc9;
  --text-bright: #f4ead8;
  --text-dim: #c3b49c;
  --text-faint: #9a8d7c;
  --paper: var(--text);
  --paper-bright: var(--text-bright);
  --ink-dim: var(--text-dim);
  --ink-faint: var(--text-faint);
  --gold: #e0c48a;
  --gold-bright: #fff1cc;
  --gold-dim: rgba(224, 196, 138, .84);
  --line: rgba(224, 196, 138, .26);
  --line-soft: rgba(231, 221, 201, .12);
  --red: #a35348;
  --sutra-ink: #f3eadc;
  --verse-ink: #f7f0e4;
  --panel-bg: rgba(10, 14, 20, .8);
  --header-bg: rgba(8, 12, 18, .84);
  --dialog: #141b24;
  --settings-bg: rgba(16, 20, 28, .96);
  color-scheme: dark;
}
html[data-theme="night"] { color-scheme: dark; }
html[data-theme="night"] .stage-wash {
  background:
    linear-gradient(180deg, rgba(6, 10, 16, .45), transparent 18%, transparent 70%, rgba(6, 10, 16, .55)),
    radial-gradient(90% 80% at 50% 40%, transparent 40%, rgba(6, 10, 16, .35) 100%);
}
html[data-theme="night"] .vignette {
  background: radial-gradient(120% 100% at 50% 50%, transparent 50%, rgba(4, 6, 10, .45) 100%);
}
html[data-theme="night"] .patina { opacity: .28; }
html[data-theme="night"] .cover::before {
  background: linear-gradient(90deg, transparent 20%, rgba(6, 10, 16, .2) 70%, rgba(6, 10, 16, .45));
}
html[data-theme="night"] .cover-title-rest { color: #f0e6d4; }
html[data-theme="night"] .cover-title-main,
html[data-theme="night"] .home-title span {
  background: linear-gradient(180deg, #fff6e4 0%, #e4c78a 58%, #b8894a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html[data-theme="night"] .home-halo {
  background: radial-gradient(circle, rgba(255, 236, 196, .16), transparent 68%);
}
html[data-theme="night"] .colophon {
  background: linear-gradient(180deg, rgba(8, 12, 18, .2), rgba(8, 12, 18, .92) 16%, rgba(8, 12, 18, .96));
}
html[data-theme="night"] .toc-dialog::backdrop { background: rgba(2, 4, 8, .62); }
html[data-theme="night"] .segmented button[aria-pressed="true"] { color: #1a140c; background: var(--gold); }
html[data-theme="night"] .home-catalog {
  background: linear-gradient(180deg, transparent, rgba(10, 14, 20, .78) 12%, rgba(10, 14, 20, .9));
}
html[data-theme="night"] .sutra-card {
  background: rgba(16, 20, 28, .78);
  border-color: rgba(224, 196, 138, .24);
  box-shadow: none;
}
html[data-theme="night"] .sutra-card-seal { color: var(--gold); }
html[data-theme="night"] .loader-fallback code { background: rgba(0, 0, 0, .35); color: var(--gold-bright); }
@media (max-width: 720px) {
  html[data-theme="night"] .site-header.is-scrolled { background: rgba(8, 12, 18, .94); }
}
