/* ==========================================================================
   पीपा परंपरा — design system
   A quiet, printed-page aesthetic: warm paper, ink, madder, hairline gold.
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- 2. Tokens ---------- */
:root {
  --paper:      #f8f3e8;
  --paper-2:    #f1e9d8;
  --paper-3:    #e8dcc4;
  --ink:        #1a1613;
  --ink-2:      #3b332c;
  --ink-3:      #665a50;
  --ink-4:      #91857a;

  --madder:     #97382a;
  --madder-dk:  #742619;
  --indigo:     #1e3550;
  --gold:       #a67c2e;
  --gold-text:  #85601c; /* 4.7:1 on paper, 4.6:1 on paper-2 */
  --gold-lt:    #c9a45c;

  --rule:       rgba(26, 22, 19, .16);
  --rule-soft:  rgba(26, 22, 19, .09);
  --wash:       rgba(151, 56, 42, .055);

  --font-display: "Tiro Devanagari Hindi", "Noto Serif Devanagari", Georgia, serif;
  --font-body:    "Noto Serif Devanagari", "Tiro Devanagari Hindi", Georgia, serif;
  --font-ui:      "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;

  --step--1: clamp(.82rem, .8rem + .1vw, .88rem);
  --step-0:  clamp(1rem, .97rem + .16vw, 1.09rem);
  --step-1:  clamp(1.16rem, 1.1rem + .3vw, 1.3rem);
  --step-2:  clamp(1.4rem, 1.28rem + .6vw, 1.72rem);
  --step-3:  clamp(1.75rem, 1.5rem + 1.2vw, 2.35rem);
  --step-4:  clamp(2.15rem, 1.7rem + 2.2vw, 3.3rem);
  --step-5:  clamp(2.6rem, 1.8rem + 4vw, 5rem);

  --wrap: 1160px;
  --measure: 66ch;
  --pad: clamp(1.15rem, 4vw, 2.5rem);
  --sect: clamp(4rem, 9vw, 7.5rem);
}

/* ---------- 3. Base ---------- */
html, body { background: var(--paper); }
body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.85;
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(166,124,46,.07), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, rgba(30,53,80,.05), transparent 60%);
}
body > * { position: relative; z-index: 1; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -.005em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); line-height: 1.4; }

p { text-wrap: pretty; }
p + p { margin-top: .85em; }

a { text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--madder); }

strong, b { font-weight: 600; }
em { font-style: italic; }

::selection { background: rgba(151,56,42,.16); }

:focus-visible {
  outline: 2px solid var(--madder);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 4. Layout ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--paper);
  color: var(--ink);
  padding: .8rem 1.2rem;
  border: 1px solid var(--madder);
  font-family: var(--font-ui);
  font-size: .85rem;
  text-decoration: none;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.wrap--narrow { max-width: 860px; }
.measure { max-width: var(--measure); }
.center { margin-inline: auto; }

.section { padding-block: var(--sect); }
.section--tight { padding-block: clamp(2.6rem, 5vw, 4rem); }
.section + .section { border-top: 1px solid var(--rule-soft); }

.grid { display: grid; gap: clamp(1.4rem, 3vw, 2.6rem); }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.split > *, .grid > * { min-width: 0; }

.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }

/* ---------- 5. Small type ---------- */
.eyebrow {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: none;
  color: var(--madder);
  display: flex;
  align-items: center;
  gap: .7em;
  margin-bottom: 1.1rem;
}
.eyebrow::before {
  content: "";
  width: 1.9em; height: 1px;
  background: currentColor; opacity: .55;
  flex: none;
}
.eyebrow--plain::before { display: none; }

.lede {
  font-size: var(--step-1);
  line-height: 1.72;
  color: var(--ink-2);
  max-width: 58ch;
}
.small { font-size: var(--step--1); line-height: 1.7; color: var(--ink-3); }
.tiny  { font-size: .78rem; line-height: 1.65; color: var(--ink-3); font-family: var(--font-ui); }
.num   { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }

.rule { border: 0; border-top: 1px solid var(--rule); }
.rule--gold { border-top-color: rgba(166,124,46,.4); }

/* ---------- 6. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule-soft);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  min-height: 72px;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; flex: none; }
.brand__mark { width: 34px; height: 34px; color: var(--madder); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__hi { font-family: var(--font-display); font-size: 1.28rem; letter-spacing: .01em; }
.brand__en { font-family: var(--font-ui); font-size: .58rem; letter-spacing: .22em; color: var(--ink-3); margin-top: .2rem; }

.nav { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.nav a {
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  color: var(--ink-2);
  padding: .5rem .62rem;
  border-radius: 3px;
  position: relative;
  white-space: nowrap;
}
.nav a:hover { color: var(--madder); background: var(--wash); }
.nav a[aria-current="page"] { color: var(--madder); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: .62rem; right: .62rem; bottom: .18rem;
  height: 1px; background: var(--madder);
}
.nav a.nav__extra { display: none; }

/* Desktop "more" menu */
.nav-more { position: relative; }
.nav-more > summary {
  list-style: none; cursor: pointer;
  font-family: var(--font-ui); font-size: .82rem; font-weight: 500;
  color: var(--ink-2); padding: .5rem .62rem; white-space: nowrap;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: "▾"; font-size: .72em; margin-left: .3em; opacity: .55; }
.nav-more > summary:hover { color: var(--madder); background: var(--wash); }
.nav-more[open] > summary,
.nav-more > summary.is-current { color: var(--madder); }
.nav-more__panel {
  position: absolute; right: 0; top: calc(100% + .55rem);
  background: var(--paper); border: 1px solid var(--rule);
  min-width: 11.5rem; padding: .35rem 0; z-index: 70;
  box-shadow: 0 16px 40px rgba(26,22,19,.10);
  display: flex; flex-direction: column;
}
.nav-more__panel a { padding: .55rem 1rem; }
.nav-more__panel a[aria-current="page"]::after { display: none; }
.nav-more__panel a[aria-current="page"] { background: var(--wash); }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--rule);
  border-radius: 3px; padding: .45rem .6rem;
  font-family: var(--font-ui); font-size: .78rem; letter-spacing: .06em;
  cursor: pointer;
}

/* ---------- 7. Hero ---------- */
.hero {
  padding-block: clamp(3rem, 8vw, 7rem) clamp(3rem, 7vw, 6rem);
  position: relative;
  overflow: hidden;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.hero__title {
  font-size: var(--step-5);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin-block: .2em .5em;
}
.hero__title em {
  font-style: normal;
  color: var(--madder);
}
.hero__lede {
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 44ch;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero__note {
  margin-top: 1.6rem;
  font-family: var(--font-ui);
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.hero__seal { justify-self: center; }

/* Seal */
.seal { position: relative; width: 100%; max-width: 330px; aspect-ratio: 1; color: var(--gold); }
.seal svg { width: 100%; height: 100%; }
.seal__text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--ink);
  gap: .1rem;
}
.seal__hi { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1; }
.seal__sub {
  font-family: var(--font-ui); font-size: .62rem; letter-spacing: .42em;
  color: var(--madder); margin-top: .45rem; padding-left: .42em;
}
.seal__rule { width: 34px; height: 1px; background: var(--gold); margin-top: .55rem; opacity: .8; }

/* ---------- 8. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--font-ui);
  font-size: .84rem; font-weight: 600; letter-spacing: .04em;
  text-decoration: none;
  padding: .82rem 1.35rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
}
.btn:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
.btn--solid { background: var(--madder); border-color: var(--madder); color: #fdf8ef; }
.btn--solid:hover { background: var(--madder-dk); border-color: var(--madder-dk); color: #fdf8ef; }
.btn--ghost { border-color: var(--rule); }
.btn--ghost:hover { background: var(--ink); border-color: var(--ink); }
.btn--sm { padding: .5rem .85rem; font-size: .76rem; }

/* ---------- 9. Section header ---------- */
.s-head { margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.s-head__index {
  font-family: var(--font-ui);
  font-size: .72rem; letter-spacing: .2em;
  color: var(--gold-text); display: block; margin-bottom: .7rem;
}
.s-head h2 { max-width: 22ch; }
.s-head p { margin-top: 1rem; color: var(--ink-2); max-width: 58ch; }
.s-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }

/* ---------- 10. Cards ---------- */
.card {
  border-top: 1px solid var(--rule);
  padding-top: 1.3rem;
  display: flex; flex-direction: column;
  gap: .55rem;
  min-width: 0;
}
.card__kicker {
  font-family: var(--font-ui); font-size: .7rem; letter-spacing: .16em;
  color: var(--madder); font-weight: 600;
}
.card h3, .card h2 { font-size: var(--step-1); line-height: 1.4; }
.card p { font-size: .95rem; line-height: 1.72; color: var(--ink-2); }
.card__link {
  margin-top: auto; padding-top: .8rem;
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; text-decoration: none; color: var(--madder);
  display: inline-flex; align-items: center; gap: .4em;
}
.card__link::after { content: "→"; transition: transform .18s ease; }
.card__link:hover::after { transform: translateX(3px); }

/* Phase cards — the four places */
.phases { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--rule); }
.phase {
  padding: 1.7rem 1.5rem 1.9rem;
  border-right: 1px solid var(--rule-soft);
  text-decoration: none;
  position: relative;
  transition: background .2s ease;
}
.phase:first-child { padding-left: 0; }
.phase:last-child { padding-right: 0; border-right: 0; }
.phase:hover { background: var(--wash); }
.phase__n {
  font-family: var(--font-ui); font-size: .7rem; letter-spacing: .18em;
  color: var(--gold-text); display: block; margin-bottom: 1.6rem;
}
.phase h3 { font-size: var(--step-2); margin-bottom: .35rem; }
.phase__sub { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .14em; color: var(--ink-3); display: block; margin-bottom: .8rem; }
.phase p { font-size: .92rem; line-height: 1.7; color: var(--ink-2); }
.phase__go { font-family: var(--font-ui); font-size: .72rem; color: var(--madder); letter-spacing: .05em; margin-top: 1rem; display: block; }

/* ---------- 11. Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; border-block: 1px solid var(--rule); }
.stat { padding: 1.6rem 1.4rem 1.5rem; border-right: 1px solid var(--rule-soft); }
.stat:first-child { padding-left: 0; }
.stat:last-child { padding-right: 0; border-right: 0; }
.stat__n { font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3.1rem); line-height: 1; color: var(--madder); display: block; white-space: nowrap; }
.stat__n small { font-size: .42em; color: var(--ink-3); margin-left: .2em; }
.stat__l { font-family: var(--font-ui); font-size: .74rem; letter-spacing: .1em; color: var(--ink-3); display: block; margin-top: .7rem; }

/* ---------- 12. Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--font-ui); font-size: .68rem; font-weight: 500;
  letter-spacing: .05em; line-height: 1;
  padding: .32em .6em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255,255,255,.25);
  white-space: nowrap;
  vertical-align: .12em;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge--ok   { color: #35603a; border-color: rgba(53,96,58,.3); }
.badge--trad { color: #8a5c12; border-color: rgba(138,92,18,.3); }
.badge--local{ color: #1e4f6b; border-color: rgba(30,79,107,.3); }
.badge--diff { color: var(--madder); border-color: rgba(151,56,42,.3); }

/* ---------- 13. Verse ---------- */
.verse {
  border-left: 2px solid var(--gold-lt);
  padding: .2rem 0 .2rem 1.6rem;
  margin-block: 1.8rem;
}
.verse__text {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-line;
}
.verse__gloss { margin-top: .9rem; font-size: .95rem; color: var(--ink-3); max-width: 58ch; }
.verse__src {
  display: block; margin-top: 1rem;
  font-family: var(--font-ui); font-size: .7rem; letter-spacing: .1em; color: var(--ink-3);
}
.verse--lg .verse__text { font-size: var(--step-3); line-height: 1.62; }

/* Verse card grid */
.vgrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--rule); }
.vcard {
  padding: 1.7rem 1.7rem 1.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
  border-right: 1px solid var(--rule-soft);
  display: flex; flex-direction: column; gap: .7rem;
  min-width: 0;
}
.vcard:nth-child(2n) { padding-right: 0; padding-left: 1.7rem; border-right: 0; }
.vcard__text { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.75; white-space: pre-line; }
.vcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: auto; padding-top: .5rem; }
.vcard { scroll-margin-top: 92px; }
.vcard:target { background: var(--wash); box-shadow: inset 0 0 0 1px var(--rule); }
.vcard__action {
  font-family: var(--font-ui);
  font-size: .72rem;
  line-height: 1;
  padding: .42rem .6rem;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.vcard__action:hover, .vcard__action:focus-visible { color: var(--madder); border-color: var(--madder); }
.vcard__action--poster { margin-left: auto; }
.vcard__action.is-copied { color: var(--madder); border-color: var(--madder); }
.vcard__gloss { font-size: .88rem; line-height: 1.65; color: var(--ink-3); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 2rem; }
.chip {
  font-family: var(--font-ui); font-size: .76rem; font-weight: 500;
  border: 1px solid var(--rule); background: transparent;
  padding: .42rem .8rem; border-radius: 999px; cursor: pointer;
  transition: all .15s ease; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.searchbox {
  width: 100%; max-width: 420px;
  font-family: var(--font-ui); font-size: .92rem;
  padding: .72rem .95rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(255,255,255,.35);
}
.searchbox::placeholder { color: var(--ink-4); }
.searchbox:focus { outline: none; border-color: var(--madder); background: rgba(255,255,255,.6); }

/* ---------- 14. Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Organisation blocks ---------- */
.org { padding-block: 2.6rem; border-top: 1px solid var(--rule); }
.org:first-child { border-top: 0; padding-top: 0; }
.org:last-child { padding-bottom: 0; }

/* ---------- Three dating frames ---------- */
.eras {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 0; border-top: 1px solid var(--rule);
}
.eras > div { padding: 1.5rem 1.5rem 1.5rem 0; border-right: 1px solid var(--rule-soft); }
.eras > div + div { padding-left: 1.5rem; }
.eras > div:last-child { border-right: 0; padding-right: 0; }

table.data {
  width: 100%; border-collapse: collapse;
  font-size: .93rem;
  font-family: var(--font-ui);
  line-height: 1.55;
}
table.data caption {
  text-align: left; font-family: var(--font-ui); font-size: .74rem;
  letter-spacing: .1em; color: var(--ink-3); padding-bottom: .9rem;
}
table.data th {
  text-align: left; font-weight: 600; font-size: .7rem;
  letter-spacing: .12em; color: var(--ink-3);
  padding: .7rem .9rem .7rem 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  background: var(--paper);
}
table.data td {
  padding: .62rem .9rem .62rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
table.data tr:hover td { background: var(--wash); }
table.data td:first-child { font-weight: 500; }
table.data .muted { color: var(--ink-3); }

/* ---------- 15. Definition rows ---------- */
.dl { border-top: 1px solid var(--rule); }
.dl__row {
  display: grid; grid-template-columns: 11rem minmax(0,1fr);
  gap: 1.5rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: .95rem;
}
.dl__k { font-family: var(--font-ui); font-size: .78rem; letter-spacing: .06em; color: var(--ink-3); padding-top: .18rem; }
.dl__v { line-height: 1.7; }

/* ---------- 16. Note / callout ---------- */
.note {
  background: var(--paper-2);
  border-left: 3px solid var(--gold);
  padding: 1.5rem 1.7rem;
  font-size: .96rem;
  line-height: 1.75;
}
.note--warn { border-left-color: var(--madder); background: rgba(151,56,42,.05); }
.note__label {
  font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
  letter-spacing: .16em; color: var(--madder); display: block; margin-bottom: .5rem;
}
.note p + p { margin-top: .7em; }

/* ---------- 17. Timeline ---------- */
.timeline { border-left: 1px solid var(--rule); margin-left: .4rem; padding-left: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 2rem 2rem; }
.timeline li::before {
  content: ""; position: absolute; left: -4.5px; top: .55rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--madder);
}
.timeline__date {
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .1em;
  color: var(--madder); display: block; margin-bottom: .25rem;
}
.timeline__title { font-family: var(--font-display); font-size: var(--step-1); display: block; margin-bottom: .3rem; }
.timeline p { font-size: .93rem; color: var(--ink-2); max-width: 58ch; }

/* ---------- 18. Patti bars ---------- */
.bars { display: grid; gap: 1.1rem; }
.bar { display: grid; grid-template-columns: 9.5rem minmax(0,1fr) 3.5rem; align-items: center; gap: 1rem; }
.bar__label { font-family: var(--font-ui); font-size: .82rem; }
.bar__track { height: 7px; background: var(--paper-3); position: relative; overflow: hidden; }
.bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--madder); width: var(--w); }
.bar:nth-child(2) .bar__fill { background: #a8503c; }
.bar:nth-child(3) .bar__fill { background: #b96a45; }
.bar:nth-child(4) .bar__fill { background: var(--gold); }
.bar:nth-child(5) .bar__fill { background: var(--indigo); }
.bar__n { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-3); text-align: right; }

/* ---------- 19. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
  margin-top: var(--sect);
  background: var(--paper-2);
}
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: clamp(1.8rem, 4vw, 3.5rem); }
.footer__brand p { font-size: .9rem; color: var(--ink-3); margin-top: .9rem; max-width: 32ch; }
.footer h3 {
  font-family: var(--font-ui); font-size: .7rem; font-weight: 600;
  letter-spacing: .16em; color: var(--ink-3); margin-bottom: 1rem;
}
.footer ul { list-style: none; padding: 0; display: grid; gap: .45rem; }
.footer a { text-decoration: none; font-size: .88rem; color: var(--ink-2); }
.footer a:hover { color: var(--madder); }
.footer__bottom {
  margin-top: 3rem; padding-top: 1.4rem;
  border-top: 1px solid var(--rule-soft);
  display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  font-family: var(--font-ui); font-size: .72rem; color: var(--ink-3);
}
.footer__bottom p { max-width: 64ch; margin: 0; }
.footer__bottom a { color: var(--ink-3); text-decoration: underline; text-underline-offset: .16em; }
.footer__bottom a:hover { color: var(--madder); }
.footer__legend { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer__seal { margin-top: 1.7rem; }
.footer__seal svg { width: 92px; height: 92px; display: block; color: var(--gold); opacity: .7; }

/* ---------- 20. Page hero ---------- */
.page-hero { padding-block: clamp(2.6rem, 6vw, 4.5rem) clamp(1.8rem, 3vw, 2.6rem); border-bottom: 1px solid var(--rule-soft); }
.page-hero h1 { font-size: var(--step-4); max-width: 24ch; }
.page-hero .lede { margin-top: 1.1rem; }
.crumbs {
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .08em;
  color: var(--ink-3); margin-bottom: 1.4rem; display: flex; gap: .5em; flex-wrap: wrap;
}
.crumbs a { text-decoration: none; display: inline-block; padding-block: .2rem; }
.crumbs span { opacity: .5; }

/* ---------- 21. Prose ---------- */
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 3rem; margin-bottom: 1rem; }
.prose h3 { margin-top: 2.2rem; margin-bottom: .7rem; }
.prose p { margin-bottom: 1.1rem; line-height: 1.85; }
.prose ul, .prose ol { padding-left: 1.3rem; margin-bottom: 1.2rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--madder); }
.prose blockquote {
  margin: 1.8rem 0; padding-left: 1.5rem; border-left: 2px solid var(--gold-lt);
  font-family: var(--font-display); font-size: var(--step-1); line-height: 1.75;
  color: var(--ink-2);
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose a { color: var(--madder); }

/* ---------- 22. Episode list ---------- */
.episodes { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.episode {
  display: grid; grid-template-columns: 3.2rem minmax(0,1fr);
  gap: 1.2rem;
  padding: 1.45rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.episode__n {
  font-family: var(--font-ui); font-size: .74rem; letter-spacing: .1em;
  color: var(--gold-text); padding-top: .28rem;
}
.episode h3 { font-size: var(--step-1); margin-bottom: .35rem; }
.episode p { font-size: .95rem; line-height: 1.75; color: var(--ink-2); }
.episode--star { background: linear-gradient(90deg, rgba(166,124,46,.06), transparent 70%); }
.episodes--news .episode { grid-template-columns: 6.2rem minmax(0,1fr); }
.episodes--news .episode__n { line-height: 1.5; }

/* ---------- 23. Tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--rule); margin-bottom: 2.2rem; }
.tab {
  font-family: var(--font-ui); font-size: .84rem; font-weight: 500;
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: .85rem 1.1rem; cursor: pointer; color: var(--ink-3);
  margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--madder); border-bottom-color: var(--madder); }
.tabpanel[hidden] { display: none; }

/* ---------- 24. Tirth ---------- */
.tirth-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--rule); }
.tirth {
  padding: 1.8rem 1.6rem 1.9rem 0;
  border-bottom: 1px solid var(--rule-soft);
  border-right: 1px solid var(--rule-soft);
}
.tirth:nth-child(3n) { border-right: 0; padding-right: 0; }
.tirth__state { font-family: var(--font-ui); font-size: .68rem; letter-spacing: .14em; color: var(--gold-text); display: block; margin-bottom: .6rem; }
.tirth h3 { font-size: var(--step-1); margin-bottom: .2rem; }
.tirth__type { font-family: var(--font-ui); font-size: .74rem; color: var(--ink-3); display: block; margin-bottom: .7rem; }
.tirth p { font-size: .9rem; line-height: 1.68; color: var(--ink-2); }

/* ---------- 25. Itinerary ---------- */
.itin { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); border-top: 1px solid var(--rule); }
.itin__stop { padding: 1.4rem 1rem 1.5rem 0; border-right: 1px solid var(--rule-soft); position: relative; }
.itin__stop:last-child { border-right: 0; }
.itin__day { font-family: var(--font-ui); font-size: .66rem; letter-spacing: .16em; color: var(--gold-text); display: block; margin-bottom: .9rem; }
.itin h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.itin p { font-size: .82rem; line-height: 1.6; color: var(--ink-3); }

/* ---------- 26. Quiz ---------- */
.quiz { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.q { border-bottom: 1px solid var(--rule-soft); padding: 1.3rem 0; }
.q__q { font-size: 1.02rem; font-weight: 500; display: block; margin-bottom: .9rem; }
.q__opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.q__opt {
  font-family: var(--font-ui); font-size: .82rem;
  border: 1px solid var(--rule); background: transparent;
  padding: .48rem .9rem; border-radius: 2px; cursor: pointer;
}
.q__opt:hover { border-color: var(--ink-3); }
.q__opt.is-right { background: #35603a; color: #fff; border-color: #35603a; }
.q__opt.is-wrong { background: rgba(151,56,42,.12); border-color: var(--madder); color: var(--madder); }
.q__a { margin-top: .8rem; font-size: .88rem; color: var(--ink-3); display: none; }
.q__a.show { display: block; }

/* ---------- 27. Forms ---------- */
.field { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.field label { font-family: var(--font-ui); font-size: .76rem; letter-spacing: .06em; color: var(--ink-3); }
.field input, .field select, .field textarea {
  font-family: var(--font-ui); font-size: .92rem;
  padding: .7rem .85rem;
  border: 1px solid rgba(26,22,19,.24);
  border-radius: 2px;
  background: #fffdfa;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--madder); background: #fff;
  box-shadow: 0 0 0 3px rgba(151,56,42,.08);
}
.field textarea { min-height: 140px; resize: vertical; }

/* ---------- 28. Map-ish panel ---------- */
.map-note {
  border: 1px solid var(--rule);
  padding: 1.6rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(26,22,19,.05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(26,22,19,.05) 39px 40px);
  font-family: var(--font-ui); font-size: .8rem; color: var(--ink-3);
}

/* Content is never hidden behind an animation — see note in app.js. */

/* ---------- 30. Responsive ---------- */
@media (max-width: 1020px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .phases { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .phase:nth-child(2) { border-right: 0; }
  .phase:nth-child(odd) { padding-left: 0; }
  .phase:nth-child(even) { padding-right: 0; }
  .phase:nth-child(1), .phase:nth-child(2) { border-bottom: 1px solid var(--rule-soft); }
  .tirth-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .tirth:nth-child(3n) { border-right: 1px solid var(--rule-soft); padding-right: 1.6rem; }
  .tirth:nth-child(2n) { border-right: 0; padding-right: 0; }
  .itin { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .itin__stop { border-bottom: 1px solid var(--rule-soft); }
}

@media (max-width: 880px) {
  .nav {
    position: fixed; inset: 72px 0 auto 0;
    flex-direction: column; align-items: stretch;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: .8rem var(--pad) 1.2rem;
    gap: 0;
    display: none;
    max-height: calc(100vh - 72px); overflow-y: auto;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .8rem .2rem; border-bottom: 1px solid var(--rule-soft); font-size: .95rem; }
  .nav a.nav__extra { display: block; }
  .nav-more { display: none; }
  .nav a[aria-current="page"]::after { display: none; }
  .nav-toggle { display: block; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__seal { display: none; }
  .split { grid-template-columns: 1fr; }
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(odd) { padding-left: 0; }
  .stat:nth-child(even) { padding-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--rule-soft); }
  .vgrid { grid-template-columns: 1fr; }
  .vcard:nth-child(2n) { padding-left: 0; }
  .vcard { border-right: 0; }
  .dl__row { grid-template-columns: 1fr; gap: .2rem; }
  table.data th { position: static; }
  .eras { grid-template-columns: 1fr; }
  .eras > div { padding: 1.2rem 0; border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .eras > div + div { padding-left: 0; }
  .eras > div:last-child { border-bottom: 0; }
}

@media (max-width: 620px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .phases { grid-template-columns: 1fr; }
  .phase { border-right: 0; border-bottom: 1px solid var(--rule-soft); padding-inline: 0; }
  .tirth-grid { grid-template-columns: 1fr; }
  .tirth { border-right: 0; padding-right: 0; }
  .itin { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 7.5rem minmax(0,1fr) 2.5rem; gap: .6rem; }
  .footer__grid { grid-template-columns: 1fr; }
  .hero__title { font-size: clamp(2.2rem, 11vw, 3rem); }
  .episode, .episodes--news .episode { grid-template-columns: 1fr; gap: .3rem; }
  .episode__n { padding-top: 0; }
}

/* ---------- 31. Print ---------- */
@media print {
  .site-header, .site-footer, .nav-toggle, .hero__actions, .filters { display: none; }
  body { background: #fff; color: #000; }
  .section { padding-block: 1.5rem; }
  a { text-decoration: none; }
}

/* Long URLs and place-names must never widen the page. */
body { overflow-wrap: break-word; }
.chapter a, .prose a, .note a, .src-list dd { overflow-wrap: anywhere; }

/* ==========================================================================
   32. Reading preferences — themes, type, measure, motion
   ========================================================================== */

:root {
  --field: rgba(255, 255, 255, .38);
  --field-focus: rgba(255, 255, 255, .68);
  --shadow: 0 18px 50px rgba(26, 22, 19, .14);
  --glow-a: rgba(166, 124, 46, .07);
  --glow-b: rgba(30, 53, 80, .05);
  color-scheme: light;
}

/* Numerals: Western digits by default, Devanagari on request. The build emits
   both forms inside .num so the swap needs no JavaScript and no repaint. */
.num { font-variant-numeric: tabular-nums; }
.num-l { display: inline; }
.num-d { display: none; }
html[data-numerals="dev"] .num-l { display: none; }
html[data-numerals="dev"] .num-d { display: inline; }

html { font-size: 100%; }
html[data-size="s"]  { font-size: 93.75%; }
html[data-size="l"]  { font-size: 112.5%; }
html[data-size="xl"] { font-size: 125%; }

html[data-font="sans"] {
  --font-display: "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
  --font-body: "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
}

html[data-measure="wide"] { --measure: 82ch; }

::selection { background: color-mix(in srgb, var(--madder) 22%, transparent); }

body::before {
  background:
    radial-gradient(120% 80% at 50% -10%, var(--glow-a), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, var(--glow-b), transparent 60%);
}

/* Night — warm ink on a dark desk */
:root[data-theme="night"] {
  --paper:      #14161a;
  --paper-2:    #1a1d22;
  --paper-3:    #242830;
  --ink:        #ece4d6;
  --ink-2:      #d2c8b8;
  --ink-3:      #a99d8e;
  --ink-4:      #82776b;
  --madder:     #e28a75;
  --madder-dk:  #f0a08c;
  --indigo:     #a8c3e0;
  --gold:       #d6ac61;
  --gold-text:  #d6ac61; /* 8.4:1 on night */
  --gold-lt:    #b8904a;
  --rule:       rgba(236, 228, 214, .2);
  --rule-soft:  rgba(236, 228, 214, .1);
  --wash:       rgba(226, 138, 117, .08);
  --field:      rgba(255, 255, 255, .05);
  --field-focus:rgba(255, 255, 255, .09);
  --shadow:     0 18px 50px rgba(0, 0, 0, .5);
  --glow-a:     rgba(214, 172, 97, .07);
  --glow-b:     rgba(168, 195, 224, .05);
  color-scheme: dark;
}

/* Soft — low-glare warm grey */
:root[data-theme="soft"] {
  --paper:      #efe9df;
  --paper-2:    #e7e0d4;
  --paper-3:    #ddd4c5;
  --ink:        #35302a;
  --ink-2:      #4b443c;
  --ink-3:      #6a6054;
  --ink-4:      #857a6c;
  --madder:     #8c4a3d;
  --madder-dk:  #70382d;
  --indigo:     #35506b;
  --gold:       #87652c;
  --gold-text:  #7b5a17; /* 4.8:1 on soft paper */
  --gold-lt:    #a9884d;
  --rule:       rgba(53, 48, 42, .17);
  --rule-soft:  rgba(53, 48, 42, .09);
  --wash:       rgba(140, 74, 61, .06);
  --field:      rgba(255, 255, 255, .3);
  --field-focus:rgba(255, 255, 255, .55);
  --glow-a:     rgba(135, 101, 44, .05);
  --glow-b:     rgba(53, 80, 107, .04);
}

/* High contrast — plain paper, black ink */
:root[data-theme="contrast"] {
  --paper:      #ffffff;
  --paper-2:    #f4f4f4;
  --paper-3:    #e6e6e6;
  --ink:        #000000;
  --ink-2:      #151515;
  --ink-3:      #333333;
  --ink-4:      #4d4d4d;
  --madder:     #8a1c0d;
  --madder-dk:  #651208;
  --indigo:     #10365c;
  --gold:       #614300;
  --gold-text:  #614300; /* 6.4:1 on white */
  --gold-lt:    #7d5800;
  --rule:       rgba(0, 0, 0, .55);
  --rule-soft:  rgba(0, 0, 0, .22);
  --wash:       rgba(138, 28, 13, .07);
  --field:      #ffffff;
  --field-focus:#ffffff;
  --glow-a:     transparent;
  --glow-b:     transparent;
  color-scheme: light;
}
:root[data-theme="contrast"] .site-header { background: var(--paper); backdrop-filter: none; }
:root[data-theme="contrast"] main a,
:root[data-theme="contrast"] .site-footer p a { text-decoration: underline; text-underline-offset: .18em; }
:root[data-theme="contrast"] .brand, :root[data-theme="contrast"] .nav a, :root[data-theme="contrast"] .btn, :root[data-theme="contrast"] .chip { text-decoration: none; }
:root[data-theme="contrast"] .btn { border-width: 2px; }
:root[data-theme="contrast"] .badge { border-color: currentColor; }

html[data-motion="off"] { scroll-behavior: auto; }
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   33. Header tools + dialogs
   ========================================================================== */

.header-tools { display: flex; align-items: center; gap: .35rem; margin-left: .7rem; flex: none; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 36px; padding: .35rem .6rem;
  background: transparent; border: 1px solid var(--rule);
  border-radius: 3px; cursor: pointer;
  font-family: var(--font-ui); font-size: .78rem; font-weight: 500;
  color: var(--ink-2); letter-spacing: .02em;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.tool-btn:hover { border-color: var(--ink-3); color: var(--madder); background: var(--wash); }
.tool-btn--icon { font-family: var(--font-display); font-size: .95rem; min-width: 36px; padding-inline: .45rem; }
.tool-btn__label { white-space: nowrap; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(18, 14, 11, .58); backdrop-filter: blur(2px); }

.prefs {
  position: fixed; inset: 0; margin: auto;
  width: min(580px, calc(100vw - 1.6rem)); max-height: min(86vh, 760px);
  padding: 0; border: 0; background: transparent; overflow: visible;
}
.prefs__inner {
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 3vw, 1.9rem);
  max-height: min(86vh, 760px); overflow-y: auto;
}
.prefs__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.prefs__head h2 { font-size: var(--step-2); }
.prefs__close,
.searchdlg__close {
  background: transparent; border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--font-ui); font-size: .78rem; cursor: pointer;
  padding: .35rem .55rem; color: var(--ink-3);
}
.prefs__close:hover, .searchdlg__close:hover { border-color: var(--madder); color: var(--madder); }
.prefs__group { border: 0; border-top: 1px solid var(--rule-soft); margin: 0; padding: 1rem 0 0; }
.prefs__group + .prefs__group { margin-top: .5rem; }
.prefs__group legend {
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .16em;
  color: var(--gold-text); padding: 0; margin-bottom: .7rem;
}
.prefs__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.prefs__grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prefs__grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.swatch, .opt {
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid var(--rule); border-radius: 3px;
  padding: .55rem .6rem; cursor: pointer;
  font-family: var(--font-ui); font-size: .8rem; line-height: 1.3;
  background: var(--paper);
  transition: border-color .15s ease, background .15s ease;
}
.swatch:hover, .opt:hover { border-color: var(--ink-3); }
.swatch input, .opt input { accent-color: var(--madder); flex: none; }
.swatch:has(input:checked), .opt:has(input:checked) {
  border-color: var(--madder);
  box-shadow: inset 0 0 0 1px var(--madder);
  background: var(--wash);
}
.swatch__chip {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 1px solid rgba(0,0,0,.22);
  background: #f8f3e8;
  position: relative; overflow: hidden;
}
.swatch__chip--paper { background: linear-gradient(135deg, #f8f3e8 0 55%, #97382a 55% 72%, #a67c2e 72%); }
.swatch__chip--night { background: linear-gradient(135deg, #14161a 0 55%, #e28a75 55% 72%, #d6ac61 72%); }
.swatch__chip--soft { background: linear-gradient(135deg, #efe9df 0 55%, #8c4a3d 55% 72%, #87652c 72%); }
.swatch__chip--contrast { background: linear-gradient(135deg, #fff 0 55%, #000 55% 72%, #8a1c0d 72%); }
.prefs__foot {
  position: sticky; bottom: calc(-1 * clamp(1.2rem, 3vw, 1.9rem));
  z-index: 2;
  margin: 1.3rem calc(-1 * clamp(1.2rem, 3vw, 1.9rem)) calc(-1 * clamp(1.2rem, 3vw, 1.9rem));
  padding: 1rem clamp(1.2rem, 3vw, 1.9rem);
  background: var(--paper);
  border-top: 1px solid var(--rule-soft);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
}
.prefs__foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: -18px; height: 18px;
  background: linear-gradient(to bottom, transparent, var(--paper));
  pointer-events: none;
}
.prefs__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.prefs__foot .tiny { max-width: 34ch; }

/* Search dialog */
.searchdlg {
  position: fixed; inset: 0; margin: auto;
  width: min(690px, calc(100vw - 1.4rem));
  max-height: min(86vh, 720px);
  padding: 0; border: 0; background: transparent; overflow: visible;
}
.searchdlg__inner {
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  max-height: min(86vh, 720px);
}
.searchdlg__bar { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-bottom: 1px solid var(--rule); }
.searchdlg__bar svg { color: var(--ink-3); flex: none; }
.searchdlg__bar input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: 0;
  font-family: var(--font-body); font-size: 1.05rem; color: var(--ink);
}
.searchdlg__bar input::placeholder { color: var(--ink-4); }
.searchdlg__scopes { display: flex; flex-wrap: wrap; gap: .35rem; padding: .7rem 1rem; border-bottom: 1px solid var(--rule-soft); }
.searchdlg__scopes button {
  font-family: var(--font-ui); font-size: .74rem; color: var(--ink-2);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: .28rem .65rem; cursor: pointer;
}
.searchdlg__scopes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.searchdlg__status { font-family: var(--font-ui); font-size: .72rem; color: var(--ink-3); padding: .55rem 1rem 0; }
.searchdlg__results { list-style: none; margin: 0; padding: .4rem 0 .6rem; overflow-y: auto; flex: 1; }
.searchdlg__results:empty { display: none; }
.searchdlg__results a {
  display: block; text-decoration: none; padding: .65rem 1rem;
  border-left: 2px solid transparent;
}
.searchdlg__results a:hover,
.searchdlg__results a.is-active { background: var(--wash); border-left-color: var(--madder); }
.sr__page { display: block; font-family: var(--font-ui); font-size: .66rem; letter-spacing: .12em; color: var(--gold-text); margin-bottom: .18rem; }
.sr__title { display: block; font-family: var(--font-display); font-size: .98rem; line-height: 1.4; color: var(--ink); }
.sr__snippet { display: block; font-size: .82rem; line-height: 1.55; color: var(--ink-3); margin-top: .22rem; }
.sr__snippet mark { background: color-mix(in srgb, var(--gold-lt) 32%, transparent); color: inherit; padding: 0 .08em; }
.searchdlg__suggest { padding: .9rem 1rem 1.1rem; border-bottom: 1px solid var(--rule-soft); }
.searchdlg__suggest .tiny { margin: 0 0 .55rem; }
.searchdlg__chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.searchdlg__chips .chip { font-size: .8rem; padding: .32rem .7rem; }
.searchdlg__empty { padding: 1rem 1rem 1.2rem; }
.searchdlg__empty p { font-size: .9rem; color: var(--ink-2); }
.searchdlg__empty p + p { margin-top: .5rem; }
.searchdlg__hint {
  display: flex; flex-wrap: wrap; gap: 1rem; padding: .65rem 1rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-ui); font-size: .68rem; color: var(--ink-4);
}
kbd {
  font-family: var(--font-ui); font-size: .92em;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px;
  padding: .05em .32em; margin-right: .18em; background: var(--paper-2);
}

/* ==========================================================================
   34. Page sources + citation
   ========================================================================== */

.page-sources { border-top: 1px solid var(--rule); background: var(--paper-2); padding-block: clamp(2.6rem, 6vw, 4.5rem); }
.page-sources__head { max-width: 62ch; margin-bottom: 1.6rem; }
.page-sources__head h2 { font-size: var(--step-2); margin-top: .3rem; }
.page-sources__head p { margin-top: .7rem; color: var(--ink-2); font-size: .92rem; }
.src-list { margin: 0; border-top: 1px solid var(--rule-soft); }
.src-list__row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.2rem; padding: .7rem 0; border-bottom: 1px solid var(--rule-soft); }
.src-list dt { font-family: var(--font-ui); font-size: .68rem; letter-spacing: .13em; color: var(--gold-text); padding-top: .18rem; }
.src-list dd { margin: 0; font-size: .9rem; line-height: 1.6; color: var(--ink-2); }
.src-list a { color: var(--madder); text-decoration-thickness: 1px; text-underline-offset: .18em; }
.cite { margin-top: 1.8rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.cite__text { font-size: .8rem; color: var(--ink-3); max-width: 70ch; }
.cite__text em { color: var(--ink-2); }
.cite__actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.prefs__field { display: block; }
.prefs__field .select { width: 100%; }

/* ==========================================================================
   35. Khoj page
   ========================================================================== */

.khoj-hero { padding-block: clamp(2.4rem, 6vw, 4rem) clamp(1.4rem, 3vw, 2rem); }
.khoj-box { max-width: 760px; margin-top: 1.6rem; }
.khoj-box .searchbox { max-width: none; font-size: 1.05rem; padding: .9rem 1.1rem; }
.khoj-scopes { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.khoj-status { margin-top: 1.4rem; font-family: var(--font-ui); font-size: .78rem; color: var(--ink-3); }
.khoj-results { list-style: none; margin: 1.2rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.khoj-results li { border-bottom: 1px solid var(--rule-soft); }
.khoj-results a { display: block; padding: 1rem .2rem; text-decoration: none; }
.khoj-results a:hover { background: var(--wash); }
.khoj-results .sr__title { font-size: 1.12rem; }
.khoj-empty { margin-top: 1.4rem; }
.khoj-tips { margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.khoj-tips .chip { font-size: .74rem; }

/* ==========================================================================
   36. Book reader
   ========================================================================== */

.book-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--madder); z-index: 120; pointer-events: none;
}
.book-hero { padding-block: clamp(2.6rem, 6vw, 4.5rem) clamp(1.6rem, 3vw, 2.4rem); border-bottom: 1px solid var(--rule-soft); }
.book-hero h1 { max-width: 20ch; }
.book-hero .lede { margin-top: 1rem; }
.book-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; align-items: center; }
.book-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: clamp(1.6rem, 4vw, 3.6rem); align-items: start; padding-block: clamp(2rem, 5vw, 3.6rem); }
.book-toc { position: sticky; top: 92px; max-height: calc(100vh - 112px); overflow-y: auto; padding-right: .6rem; }
.book-toc h2 { font-family: var(--font-ui); font-size: .68rem; letter-spacing: .18em; color: var(--gold-text); margin-bottom: .8rem; }
.book-toc ol { list-style: none; margin: 0; padding: 0; }
.book-toc li { min-width: 0; }
.book-toc a {
  display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); gap: .35rem;
  padding: .35rem 0; text-decoration: none;
  font-family: var(--font-ui); font-size: .79rem; line-height: 1.45; color: var(--ink-2);
  border-bottom: 1px solid var(--rule-soft);
}
.book-toc .toc__n { color: var(--ink-3); font-size: .7rem; padding-top: .12rem; font-variant-numeric: tabular-nums; }
.book-toc a:hover, .book-toc a.is-active { color: var(--madder); }
.book-toc a.is-active { font-weight: 600; }
.book-body { max-width: 72ch; min-width: 0; }
.book-body > .chapter:first-child { padding-top: 0; border-top: 0; }
.chapter { padding-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid var(--rule); margin-top: clamp(2rem, 4vw, 3rem); scroll-margin-top: 96px; }
.chapter:first-child { margin-top: 0; }
.chapter__n { display: block; font-family: var(--font-ui); font-size: .7rem; letter-spacing: .2em; color: var(--gold-text); margin-bottom: .5rem; }
.chapter h2 { font-size: var(--step-3); max-width: 26ch; }
.chapter__lede { margin-top: .9rem; font-size: var(--step-1); line-height: 1.72; color: var(--ink-2); }
.chapter h3 { margin-top: 2.2rem; font-size: var(--step-1); }
.chapter p { margin-top: 1rem; line-height: 1.95; }
.chapter ul, .chapter ol { margin-top: 1rem; padding-left: 1.3rem; }
.chapter li { margin-bottom: .4rem; line-height: 1.8; }
.chapter .verse { margin-block: 1.6rem; }
.book .episode { grid-template-columns: 2.6rem minmax(0, 1fr); padding-block: 1.1rem; }
.book .episode__n { font-size: .72rem; padding-top: .35rem; color: var(--gold-text); }
.book .episode h3 { margin-top: 0; font-family: var(--font-display); font-size: var(--step-1); }
.book .episode p { margin-top: .35rem; font-size: .97rem; line-height: 1.8; }
.book .episode--star { background: transparent; }
.book__nav { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1.2rem; }
.book__nav a { font-family: var(--font-ui); font-size: .8rem; color: var(--madder); text-decoration: none; max-width: 46%; padding-block: .25rem; }
.book__nav a:last-child { text-align: right; margin-left: auto; }
.book-appendix { border-top: 1px solid var(--rule); margin-top: 2.4rem; padding-top: 1.4rem; }
.book-appendix summary { cursor: pointer; font-family: var(--font-ui); font-size: .84rem; color: var(--ink-2); }
.book-appendix summary:hover { color: var(--madder); }
.book-appendix .table-wrap { margin-top: 1rem; }
.book-footnote { font-size: .82rem; color: var(--ink-3); line-height: 1.7; margin-top: .7rem; }

/* Print the whole book cleanly */
@media print {
  .book-toc, .book-toolbar, .book-progress, .book__nav, .prefs, .searchdlg, .gt-banner, .header-tools { display: none !important; }
  .book-shell { display: block; padding: 0; }
  .book-body { max-width: none; }
  .chapter { break-before: page; border-top: 0; margin-top: 0; padding-top: 0; }
  .chapter:first-child { break-before: auto; }
  .chapter h2 { font-size: 22pt; }
  .book .episode { break-inside: avoid; }
  .page-sources { background: #fff; }
  .src-list__row { grid-template-columns: 8rem 1fr; }
}

/* ==========================================================================
   37. Translation
   ========================================================================== */

.gt-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Google's own toolbar/balloon never shows; the site banner replaces it. */
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-te-spinner-pos,
.skiptranslate iframe { display: none !important; }
html.translated-ltr body,
html.translated-rtl body { top: 0 !important; }
.goog-text-highlight { background: transparent !important; box-shadow: none !important; }
.gt-banner {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  z-index: 110; width: min(680px, calc(100vw - 1.6rem));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1rem; box-shadow: var(--shadow);
  font-family: var(--font-ui); font-size: .78rem;
}
.gt-banner a, .gt-banner button {
  color: var(--paper); background: transparent; border: 1px solid color-mix(in srgb, var(--paper) 45%, transparent);
  padding: .3rem .6rem; border-radius: 2px; cursor: pointer; text-decoration: none; font: inherit;
}
.gt-banner button:hover, .gt-banner a:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }
.gt-banner[data-state="failed"] { background: var(--madder); }
.gt-banner [data-gt-status] strong { font-weight: 600; }
.gt-banner [data-gt-retry] { margin-top: .4rem; }
body.is-translated .site-header { top: 0; }
body.is-translated { padding-top: 0; }

/* ==========================================================================
   38. English page + misc
   ========================================================================== */

.prose--en { max-width: 70ch; }
.prose--en p { line-height: 1.85; }
.prose--en h2 { margin-top: 2.6rem; }
.lang-note { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-family: var(--font-ui); font-size: .72rem; color: var(--ink-3); }
.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; }
.searchbox, .select { background: var(--field); }
.searchbox:focus, .select:focus { background: var(--field-focus); }
.select { max-width: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.note--warn { background: color-mix(in srgb, var(--madder) 6%, var(--paper-2)); }

@media (max-width: 1080px) {
  .tool-btn__label { display: none; }
  .nav { gap: 0; }
  .nav a { padding-inline: .48rem; font-size: .78rem; }
}
@media (max-width: 880px) {
  .header-tools { margin-left: auto; }
  .book-shell { grid-template-columns: 1fr; }
  .book-toc { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
  .book-toc ol { columns: 2; column-gap: 1.4rem; }
  .book-toc li { break-inside: avoid; }
}
@media (max-width: 620px) {
  .prefs__grid, .prefs__grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .searchdlg, .prefs {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    inset: 0; margin: 0;
  }
  .searchdlg__inner, .prefs__inner {
    height: 100%; max-height: 100dvh;
    border-left: 0; border-right: 0; border-top: 0; border-bottom: 0;
  }
  .src-list__row { grid-template-columns: 1fr; gap: .15rem; }
  .book-toc ol { columns: 1; }
  .chapter h2 { font-size: var(--step-2); }
  .khoj-box .searchbox { font-size: 1rem; }
  .book-toolbar .tiny { margin-left: 0 !important; width: 100%; }
}

/* Very narrow phones: the brand and the three header tools must still fit. */
@media (max-width: 400px) {
  .site-header__inner { gap: .55rem; min-height: 62px; }
  .brand { gap: .5rem; }
  .brand__mark { width: 28px; height: 28px; }
  .brand__hi { font-size: 1.1rem; }
  .brand__en { font-size: .5rem; letter-spacing: .16em; }
  .header-tools { gap: .22rem; margin-left: .1rem; }
  .tool-btn, .nav-toggle { min-height: 32px; padding: .28rem .45rem; font-size: .72rem; }
  .tool-btn--icon { min-width: 32px; padding-inline: .3rem; }
}
