:root {
  --color-bg: #0b0508;
  --color-bg-alt: #170a13;
  --color-panel: #1d0f1a;
  --color-gold: #f0a83c;
  --color-gold-light: #ffd27a;
  --color-magenta: #ff2ea6;
  --color-crimson: #e11d5c;
  --color-text: #f7ece9;
  --color-text-muted: #c7abb8;
  --color-border: rgba(240, 168, 60, 0.22);

  --font-display: 'Cinzel', serif;
  --font-body: 'Cormorant Garamond', serif;
  --font-ui: 'Inter', sans-serif;
  --font-sanskrit: 'Noto Sans Devanagari', sans-serif;
  --font-tamil: 'Noto Sans Tamil', sans-serif;

  --max-width: 900px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.glow-gold {
  background: linear-gradient(135deg, var(--color-gold-light), var(--color-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(240, 168, 60, 0.25);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 5, 8, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.navbar {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  font-family: var(--font-ui);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 38px;
  height: 38px;
}

.logo-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  color: var(--color-gold-light);
}

.nav-link.active {
  color: var(--color-gold-light);
  border-bottom-color: var(--color-gold);
}

@media (max-width: 600px) {
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    margin-top: 10px;
  }
}

/* Chant menu: one button opening a panel of collections, each of which
   expands (one at a time) to list its chants. */
.chant-menu-wrap {
  position: relative;
  min-width: 0;
}

.chant-menu-button {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 290px;
  padding: 6px 12px;
  background: var(--color-panel);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
}

.chant-menu-button:hover,
.chant-menu-button[aria-expanded='true'] {
  border-color: var(--color-gold);
}

.chant-menu-button-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chant-menu-button-collection {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.chant-menu-button-chant {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chant-menu-chevron {
  color: var(--color-gold);
  transition: transform 0.15s ease;
}

.chant-menu-button[aria-expanded='true'] .chant-menu-chevron {
  transform: rotate(180deg);
}

.chant-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  width: 320px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  font-family: var(--font-ui);
}

.chant-menu[hidden] {
  display: none;
}

.chant-menu-language {
  padding: 10px 10px 4px;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.chant-menu-collection-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--color-text);
  font: 500 0.9rem var(--font-ui);
  text-align: left;
  cursor: pointer;
}

.chant-menu-collection-toggle::before {
  content: '\203A';
  color: var(--color-gold);
  transition: transform 0.15s ease;
}

.chant-menu-collection-toggle[aria-expanded='true']::before {
  transform: rotate(90deg);
}

.chant-menu-collection-toggle:hover,
.chant-menu-item:hover {
  background: rgba(240, 168, 60, 0.09);
}

.chant-menu-collection-toggle[aria-expanded='true'] {
  color: var(--color-gold);
}

.chant-menu-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(240, 168, 60, 0.12);
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.chant-menu-list {
  margin: 0 0 6px 16px;
  padding-left: 8px;
  border-left: 1px solid var(--color-border);
}

.chant-menu-list[hidden] {
  display: none;
}

.chant-menu-subgroup {
  padding: 8px 10px 2px;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.chant-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--color-text);
  font: 0.85rem var(--font-ui);
  text-align: left;
  cursor: pointer;
}

.chant-menu-item.is-current {
  color: var(--color-gold);
  font-weight: 600;
}

@media (max-width: 600px) {
  .chant-menu-wrap {
    width: 100%;
  }

  .chant-menu-button {
    width: 100%;
    max-width: none;
  }

  .chant-menu-chevron {
    margin-left: auto;
  }

  .chant-menu {
    left: 0;
    width: auto;
  }
}

/* Hero-ish title block — kept compact (this sits above the sticky header +
   control-bar stack on every chant load, so its height is pure scroll-past
   cost on a long chant like Thirukkural) rather than full hero-sized. */
.chant-header {
  padding: 28px 0 18px;
  text-align: center;
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 46, 166, 0.16), transparent 55%),
    radial-gradient(circle at 78% 80%, rgba(240, 168, 60, 0.12), transparent 55%),
    var(--color-bg);
}

.chant-title-deva {
  font-family: var(--font-sanskrit);
  font-size: clamp(1.5rem, 4.5vw, 2.15rem);
  margin-bottom: 4px;
}

.chant-title-iast {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.chant-source {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.chant-source a {
  color: var(--color-gold-light);
  border-bottom: 1px dotted var(--color-border);
}

/* Toggle control bar */
.control-bar {
  position: sticky;
  top: 66px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 7px 24px;
  background: rgba(23, 10, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

/* Only present on chants.html, whose control-bar has two children (this +
   the toggle group) rather than one — space-between keeps the toggles from
   shifting off-center of the two-button layout the way it would if this
   were just centered alongside it. */
.control-bar:has(.control-bar-back) {
  justify-content: space-between;
}

.control-bar-toggles {
  display: flex;
  gap: 10px;
}

.control-bar-back {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.control-bar-back:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.translit-bubble {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.translit-bubble:hover {
  border-color: var(--color-gold);
}

.translit-bubble.active {
  border-color: var(--color-gold);
  background: rgba(240, 168, 60, 0.16);
  color: var(--color-gold-light);
  box-shadow: 0 0 10px rgba(240, 168, 60, 0.25);
}

/* Topic navigator (see buildTopicNav in app.js) — a collapsed-by-default
   map of a chant's SECTION_GROUPS, sitting above the reading columns. Only
   rendered for a chant that registers groups (currently Thirukkural's three
   books), so it never displaces the reading column's own top margin on a
   short chant. */
.topic-nav {
  margin-bottom: 20px;
}

.topic-nav-heading {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.topic-group {
  border-bottom: 1px solid var(--color-border);
}

.topic-group summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 2px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s ease;
}

.topic-group summary::-webkit-details-marker {
  display: none;
}

/* Rotating caret rather than the native marker, drawn with the same border
   colors used everywhere else on this site so it doesn't need its own hue. */
.topic-group summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--color-gold);
  border-bottom: 1.5px solid var(--color-gold);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.topic-group[open] summary::before {
  transform: rotate(45deg);
}

.topic-group summary:hover {
  color: var(--color-gold-light);
}

.topic-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 2px 12px;
}

.topic-chip {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.topic-chip:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
  background: rgba(240, 168, 60, 0.1);
}

/* Chant body */
.chant-body {
  padding: 22px 24px 80px;
  max-width: 1140px;
}

.chant-layout {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

/* A fixed reading-column width (not flex:1) so the rail — and the trunk it
   holds — sits right up against the text regardless of how wide the page
   is, instead of trailing off at the edge of a stretched container. Shrinks
   on narrow viewports via min-width:0. */
.chant-text {
  flex: 0 1 640px;
  min-width: 0;
}

/* Holds the network's trunk and the gutter its connector curves bend
   through. Wide enough that a curve reaching the trunk from either side
   has real room to bend gently rather than snapping into a sharp point —
   the translation column in particular sits much closer to the trunk than
   the wide Sanskrit/IAST column does, so this width is what keeps its
   curves comparably smooth rather than a narrow special case. */
.chant-rail {
  width: 80px;
  flex-shrink: 0;
}

.network-svg {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}

.network-path,
.network-trunk {
  fill: none;
  stroke: var(--color-gold-light);
  stroke-width: 1;
}

.chant-translation {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
}

/* Positioned absolutely via JS (alignTranslationLines) to match its
   verse-line's own vertical offset, so this column reads in lockstep with
   the Sanskrit instead of drifting out of sync as line heights differ. */
.translation-line {
  position: absolute;
  left: 0;
  right: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

/* Sits at the same vertical offset as its "Anuvāka N" label (see
   ANUVAKA_TAGLINES in app.js) — a caption for the label, not a verse
   translation, so it reads as a heading rather than body copy. */
.anuvaka-tagline {
  font-family: var(--font-ui);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-gold-light);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .chant-rail,
  .chant-translation {
    display: none;
  }
}

/* Translation toggled off via the control bar — same hidden columns as the
   narrow-viewport case above, but chant-text also drops its 640px cap so
   the reading column actually uses the freed-up width instead of leaving
   it empty next to two now-hidden columns. */
body.hide-translation .chant-rail,
body.hide-translation .chant-translation {
  display: none;
}

body.hide-translation .chant-text {
  flex: 1 1 auto;
  max-width: none;
}

.section-block {
  margin-bottom: 30px;
  /* Offsets a #topic-N jump so the target isn't hidden under the sticky
     site-header (66px) + control-bar (~40px) stack. */
  scroll-margin-top: 116px;
}

.section-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-magenta);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

/* Only sections with a registered note (see SECTION_NOTES in app.js) get
   this — a plain-text label otherwise, so the affordance never implies a
   popup that isn't actually there. */
.section-label.has-note {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
}

.section-label.has-note:hover {
  color: var(--color-gold-light);
}

.section-label.has-note::after {
  content: '∑';
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-gold);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.section-label.has-note:hover::after {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

/* --- Math note modal ---------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 2, 4, 0.75);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  position: relative;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 32px 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
  padding-right: 30px;
}

.modal-title .glow-gold {
  background: linear-gradient(135deg, var(--color-gold-light), var(--color-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-subtitle {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.modal-body p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 14px;
}

/* A short-term/longer-description list (see buildChamakamPantheonNote) —
   plain prose flow rather than a table, so long descriptions wrap normally
   instead of fighting the character tables' fixed narrow columns. */
.modal-glossary {
  margin-bottom: 20px;
}

.modal-glossary dt {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-gold-light);
  margin-top: 10px;
}

.modal-glossary dt:first-child {
  margin-top: 0;
}

.modal-glossary dd {
  margin: 2px 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--color-text);
}

.modal-body .math-callouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 520px) {
  .modal-body .math-callouts {
    grid-template-columns: 1fr;
  }
}

.math-callout {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.math-callout h4 {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-magenta);
  margin-bottom: 8px;
}

.math-callout .formula {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  color: var(--color-gold-light);
  font-size: 1rem;
  margin-bottom: 8px;
}

.math-callout .sequence {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  word-spacing: 2px;
}

.math-table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
}

.math-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.math-table th,
.math-table td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.math-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.math-table td.diff-col {
  color: var(--color-gold-light);
}

.math-table td.sum-col {
  color: var(--color-magenta);
}

.colophon {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  padding: 10px 16px;
  border-left: 2px solid var(--color-border);
}

.colophon .deva-line {
  font-family: var(--font-sanskrit);
  font-style: normal;
  font-size: 1rem;
  margin-bottom: 3px;
}

.verse-line {
  margin-bottom: 12px;
}

.deva-line {
  font-family: var(--font-sanskrit);
  font-size: 1.25rem;
  line-height: 1.6;
}

.iast-line {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.25;
  margin-top: 2px;
  padding-top: 3px;
  padding-bottom: 1px;
  transition: opacity 0.15s ease;
}

/* Tamil chants (see js/app.js renderChant) use the same .deva-line/
   .chant-title-deva markup as Devanagari ones, just with the script font
   swapped — Tamil text has no Vedic accent marks, so the .iast-line
   transliteration column needs no equivalent override. */
body.chant-lang-tamil .chant-title-deva,
body.chant-lang-tamil .deva-line,
body.chant-lang-tamil .colophon .deva-line {
  font-family: var(--font-tamil);
}

body.hide-transliteration .iast-line {
  display: none;
}

/* line-height:1 (not inherited 1.7) so this inline-block's own box is just
   the glyph's natural height — otherwise the accent strokes below are
   positioned relative to a box ~1.7x the character's height, floating them
   far from the letter even at small top/bottom offsets. */
.accented-char {
  position: relative;
  display: inline-block;
  line-height: 1;
}

/* Udatta/svarita are vertical strokes above the letter in the original
   Devanagari (॑ / ᳚) — matched here rather than the horizontal bars used
   below, so they read distinctly from a long-vowel macron (ā, ē, ō) sitting
   on the same letter. Anudatta (below) stays horizontal, as in the source. */
.accent-udatta::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 3px;
  background: var(--color-text);
}

/* Fixed pixel offsets from center, not percentages of the character's own
   width — a percentage-based gap collapses to nothing on a narrow letter
   (e.g. "i") and only looks right on a wide one, which is why the two
   ticks weren't reliably distinguishable as two strokes on IAST text. */
.accent-svarita::before,
.accent-svarita::after {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 1.5px;
  height: 3px;
  background: var(--color-text);
}

.accent-svarita::before {
  transform: translateX(-3px);
}

.accent-svarita::after {
  transform: translateX(1.5px);
}

.token-repeat {
  display: inline-block;
  border: 1px solid rgba(240, 168, 60, 0.25);
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 1px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.token-repeat.part-before,
.token-repeat.part-after {
  border-style: dotted;
}

.token-repeat.part-before {
  margin-left: 0;
  padding-left: 1px;
  border-left-width: 1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.token-repeat.part-after {
  margin-right: 0;
  padding-right: 1px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.token-repeat:hover {
  border-color: rgba(240, 168, 60, 0.55);
}

.token-repeat.active {
  border-color: var(--color-gold-light);
  background: rgba(240, 168, 60, 0.14);
  box-shadow: 0 0 10px rgba(240, 168, 60, 0.3);
}

.accent-anudatta::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 10%;
  right: 10%;
  height: 1.5px;
  background: var(--color-text);
}

.loading,
.error {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
}

.error {
  color: var(--color-crimson);
}

@media (max-width: 600px) {
  .navbar {
    flex-wrap: wrap;
  }
  .deva-line {
    font-size: 1.2rem;
  }
}

/* --- Sanskrit Language pages --------------------------------------------- */

.lang-hero {
  padding: 56px 0 28px;
  text-align: center;
  background:
    radial-gradient(circle at 22% 20%, rgba(255, 46, 166, 0.16), transparent 55%),
    radial-gradient(circle at 78% 80%, rgba(240, 168, 60, 0.12), transparent 55%),
    var(--color-bg);
}

.lang-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin-bottom: 10px;
}

.lang-hero p {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

.lang-subnav {
  position: sticky;
  top: 66px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(23, 10, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.lang-subnav a {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.lang-subnav a:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.lang-subnav a.active {
  border-color: var(--color-gold);
  background: rgba(240, 168, 60, 0.16);
  color: var(--color-gold-light);
  box-shadow: 0 0 10px rgba(240, 168, 60, 0.25);
}

.lang-breadcrumb {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.lang-breadcrumb a {
  color: var(--color-text-muted);
  border-bottom: 1px dotted var(--color-border);
}

.lang-breadcrumb a:hover {
  color: var(--color-gold-light);
}

/* Hub landing page: big link tiles to each Sanskrit Language subpage. */
.lang-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.lang-hub-card {
  display: block;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 30px 26px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.lang-hub-card:hover {
  border-color: var(--color-gold);
  box-shadow: 0 0 18px rgba(240, 168, 60, 0.18);
  transform: translateY(-2px);
}

.lang-hub-card-glyph {
  font-family: var(--font-sanskrit);
  font-size: 2.2rem;
  color: var(--color-gold-light);
  margin-bottom: 16px;
}

.lang-hub-card h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-text);
  margin-bottom: 8px;
}

.lang-hub-card p {
  font-family: var(--font-body);
  color: var(--color-text-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.lang-hub-card.is-placeholder {
  opacity: 0.6;
}

.lang-body {
  padding: 44px 24px 110px;
  max-width: 1140px;
}

.lang-block {
  margin-bottom: 64px;
}

.lang-block-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-gold-light);
  margin-bottom: 6px;
}

.lang-block-intro {
  font-family: var(--font-body);
  color: var(--color-text-muted);
  font-size: 1rem;
  max-width: 760px;
  margin-bottom: 28px;
}

.char-group {
  margin-bottom: 36px;
}

.char-group-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-magenta);
  margin-bottom: 6px;
}

/* A smaller heading than .char-group-title, for a named subset within one
   char-group's chart rather than the group itself — e.g. one syllabary
   grid's "vallinam & mellinam" rows vs. its "idaiyinam" rows, or one
   conjunct-consonants table's "regular half-forms" vs. "special ligatures". */
.chart-subgroup-title {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 20px 0 8px;
}

/* A large combination grid (syllabary/mātrā charts, conjunct tables) packs
   more columns into the same row height than this site's usual 4-6-column
   tables — shrunk further than .word-table's already-reduced size so a
   dozen-plus columns stays legible instead of forcing an oversized
   horizontal scroll. */
.chart-grid-table td .char-deva {
  font-size: 1.15rem;
}

.chart-grid-table th.row-head {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--color-gold-light);
}

.char-group-note {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  max-width: 700px;
}

.char-deva {
  font-family: var(--font-sanskrit);
  font-size: 1.9rem;
  line-height: 1.2;
}

.char-iast {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  color: var(--color-gold-light);
  font-size: 1rem;
  margin-top: 4px;
}

.char-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* rosetta-stone.html mixes Devanagari and Tamil script in the same table,
   unlike every other Characters-style page (which has exactly one native
   script and can rely on body.tamil-page to pick its font) — these two
   classes pin the font per cell instead of per page. */
.rosetta-tamil,
.rosetta-sanskrit {
  font-size: 1.9rem;
  line-height: 1.2;
}

.rosetta-tamil {
  font-family: var(--font-tamil);
}

.rosetta-sanskrit {
  font-family: var(--font-sanskrit);
}

.consonant-table td .rosetta-tamil,
.consonant-table td .rosetta-sanskrit {
  font-size: 1.5rem;
}

.char-digit {
  font-family: var(--font-sanskrit);
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* tamil-characters.html reuses .char-deva/.char-iast (see characters.html)
   for Tamil script + its own romanization rather than Devanagari + IAST —
   same key-reuse tradeoff as the chant reader's body.chant-lang-tamil. */
body.tamil-page .char-deva,
body.tamil-page .char-digit,
body.tamil-page .lang-hub-card-glyph {
  font-family: var(--font-tamil);
}

.consonant-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.consonant-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
}

.consonant-table th,
.consonant-table td {
  border: 1px solid var(--color-border);
  padding: 10px 6px;
  text-align: center;
}

.consonant-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(240, 168, 60, 0.06);
}

.consonant-table th.row-head {
  text-align: left;
  padding-left: 12px;
  font-size: 0.68rem;
}

.consonant-table td .char-deva {
  font-size: 1.5rem;
}

.consonant-table td .char-iast {
  font-size: 0.85rem;
  margin-top: 2px;
}

/* Numeral tables carry a whole word (catvāriṃśat...) rather than a single
   glyph, so they need a smaller Devanagari size than the single-letter
   Characters tables. */
.consonant-table.word-table td .char-deva {
  font-size: 1.2rem;
}

.consonant-table td .char-digit {
  margin-bottom: 2px;
}

.consonant-table td .char-label {
  margin-top: 4px;
}

/* A prominent number attached to a syllable/character cell — used on the
   Āryabhaṭa numeration page to show each consonant's or vowel's assigned
   value, bolder and more legible than the muted .char-label captions. */
.char-value {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-gold-light);
  margin-top: 4px;
}

.lang-footnote {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  border-left: 2px solid var(--color-border);
  padding: 10px 16px;
  margin-top: 8px;
  max-width: 760px;
}

.yantra-frame-wrap {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.yantra-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-ui);
}

.yantra-toolbar-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--color-gold-light);
}

.yantra-fullscreen {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.yantra-fullscreen:hover {
  color: var(--color-magenta);
}

.yantra-frame {
  display: block;
  width: 100%;
  height: 80vh;
  min-height: 560px;
  border: 0;
}

.vedic-math-frame {
  height: 88vh;
  min-height: 720px;
}

.lang-placeholder {
  font-family: var(--font-body);
  color: var(--color-text-muted);
  font-size: 1.05rem;
  font-style: italic;
  padding: 24px 0;
}

/* --- Sanskrit ↔ Slavic page (slavic.html) -------------------------------- */

.sl-proof {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 26px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sl-proof-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.sl-proof-skt,
.sl-proof-sl {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color-gold-light);
}

.sl-proof-sl b {
  color: var(--color-magenta);
  font-weight: 400;
}

.sl-proof-arrow {
  color: var(--color-text-muted);
}

.sl-proof-gloss,
.sl-proof-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.sl-proof-note {
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}

/* Two-branch family tree, pure HTML/CSS. */
.sl-tree {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  margin-bottom: 20px;
  max-width: 760px;
}

.sl-tree-root {
  text-align: center;
  color: var(--color-gold-light);
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.sl-tree-root span {
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.sl-tree-branches {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.sl-tree-branch {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sl-tree-node {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
  color: var(--color-text-muted);
}

.sl-tree-node.is-skt,
.sl-tree-node.is-sl {
  color: var(--color-text);
  border-color: var(--color-gold);
}

.sl-tree-link {
  text-align: center;
  color: var(--color-magenta);
  font-weight: 600;
  font-size: 0.75rem;
  border-top: 1px dashed var(--color-magenta);
  border-bottom: 1px dashed var(--color-magenta);
  padding: 6px 4px;
}

.sl-tree-link span {
  color: var(--color-text-muted);
  font-weight: 400;
}

@media (max-width: 600px) {
  .sl-tree-branches { grid-template-columns: 1fr; }
}

/* Ranking table */
.sl-rank {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  min-width: 720px;
}

.sl-rank th,
.sl-rank td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.sl-rank th {
  font-size: 0.66rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  cursor: help;
}

.sl-rank th.is-conv-col,
.sl-rank td.is-conv-col {
  background: rgba(240, 168, 60, 0.04);
}

.sl-rank th.sl-rank-lang,
.sl-rank td.sl-rank-lang {
  text-align: left;
}

.sl-rank tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.sl-rank tbody tr:hover,
.sl-rank tbody tr:focus-visible {
  background: rgba(240, 168, 60, 0.08);
  outline: none;
}

.sl-rank tbody tr.is-selected {
  background: rgba(255, 46, 166, 0.10);
}

.sl-rank tbody tr.is-selected .sl-rank-name {
  color: var(--color-gold-light);
}

.sl-rank tbody tr.is-reference {
  opacity: 0.72;
}

.sl-rank tbody tr.is-reference td {
  border-top: 1px dashed var(--color-border);
}

.sl-rank-name {
  display: block;
  font-weight: 600;
  color: var(--color-text);
}

.sl-rank-tag {
  display: block;
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.sl-rank-score {
  white-space: nowrap;
  min-width: 130px;
}

.sl-bar {
  display: inline-block;
  vertical-align: middle;
  width: 72px;
  height: 6px;
  border-radius: 3px;
  background: rgba(240, 168, 60, 0.14);
  overflow: hidden;
  margin-right: 8px;
}

.sl-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
}

.sl-bar-num {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.sl-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--color-gold);
  vertical-align: middle;
}

.sl-dot.is-full { background: var(--color-gold); }
.sl-dot.is-half { background: linear-gradient(90deg, var(--color-gold) 50%, transparent 50%); }
.sl-dot.is-none { border-color: rgba(199, 171, 184, 0.35); }
.sl-dot.is-unknown { border-style: dotted; border-color: rgba(199, 171, 184, 0.35); }
.sl-dot.is-conv { border-style: dashed; border-color: var(--color-magenta); }
.sl-dot.is-conv.is-full { background: var(--color-magenta); border-style: solid; }
.sl-dot.is-conv.is-half { background: linear-gradient(90deg, var(--color-magenta) 50%, transparent 50%); }

.sl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 22px;
}

.sl-legend .sl-dot {
  width: 10px;
  height: 10px;
  margin-right: 4px;
}

.sl-callout-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}

/* Explorer controls */
.sl-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.sl-control-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sl-control-label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-magenta);
  min-width: 72px;
  padding-top: 7px;
}

.sl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sl-chip {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sl-chip:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.sl-chip:focus-visible,
.sl-word:focus-visible {
  outline: 2px solid var(--color-gold-light);
  outline-offset: 2px;
}

.sl-chip.active {
  border-color: var(--color-gold);
  background: rgba(240, 168, 60, 0.16);
  color: var(--color-gold-light);
}

.sl-chip.kind-proof.active,
.sl-chip.kind-shared.active {
  border-color: var(--color-magenta);
  background: rgba(255, 46, 166, 0.14);
  color: #ffc2e4;
}

.sl-chip.is-small {
  font-size: 0.72rem;
  padding: 3px 10px;
}

@media (max-width: 600px) {
  .sl-control-row { flex-direction: column; gap: 6px; }
  .sl-control-label { padding-top: 0; }
}

/* Kind tags */
.sl-kind {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--color-gold);
  color: var(--color-gold-light);
}

.sl-kind.kind-proof { border-color: var(--color-crimson); color: #ff8fb3; background: rgba(225, 29, 92, 0.12); }
.sl-kind.kind-shared { border-color: var(--color-magenta); color: #ffc2e4; }
.sl-kind.kind-convergent { border-style: dashed; border-color: var(--color-magenta); color: #ffc2e4; }
.sl-kind.kind-divergent { border-style: dashed; border-color: var(--color-text-muted); color: var(--color-text-muted); }
.sl-kind.kind-slavic { border-color: rgba(199, 171, 184, 0.4); color: var(--color-text-muted); }

.sl-kind-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.sl-kind-key .sl-kind {
  margin-left: 10px;
}

.sl-kind-key .sl-kind:first-child {
  margin-left: 0;
}

/* Pattern panel */
.sl-pattern-panel {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 18px;
  background: var(--color-panel);
}

.sl-pattern-panel.is-empty {
  background: transparent;
  border-style: dashed;
}

.sl-panel-hint {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.sl-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.sl-panel-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-text);
}

.sl-pattern-panel .formula,
.sl-gcard .formula {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  color: var(--color-gold-light);
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.sl-gcard .formula b {
  color: var(--color-magenta);
  font-weight: 400;
}

.sl-panel-text {
  font-family: var(--font-body);
  font-size: 1.02rem;
  color: var(--color-text);
  max-width: 760px;
  margin-bottom: 10px;
}

.sl-link {
  margin-right: 10px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-gold-light);
  border-bottom: 1px dotted var(--color-gold);
}

/* Word grid */
.sl-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 64px;
}

.sl-word {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.15s ease;
}

.sl-word:hover {
  border-color: var(--color-gold);
}

.sl-word.is-dim {
  opacity: 0.28;
}

.sl-word.is-open {
  grid-column: span 2;
  border-color: var(--color-gold);
}

@media (max-width: 560px) {
  .sl-word.is-open { grid-column: auto; }
}

.sl-word-gloss {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.sl-word-pair {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.sl-word-skt {
  display: flex;
  flex-direction: column;
}

.sl-word-deva {
  font-family: var(--font-sanskrit);
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--color-gold-light);
}

.sl-word-iast {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--color-gold);
}

.sl-word-arrow {
  color: var(--color-text-muted);
}

.sl-form {
  display: inline-flex;
  flex-direction: column;
}

.sl-form-main {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text);
}

.sl-form.is-big .sl-form-main {
  font-size: 1.4rem;
  line-height: 1.2;
}

.sl-form-rom {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.sl-word-corr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.sl-corr {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 0.8rem;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.sl-corr.active {
  border-color: var(--color-magenta);
  color: #ffc2e4;
  background: rgba(255, 46, 166, 0.12);
}

.sl-word-pie {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.sl-word-all {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.sl-all-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sl-all-row .sl-form {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}

.sl-all-row.is-selected .sl-form-main {
  color: var(--color-gold-light);
}

.sl-all-lang {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  color: var(--color-text-muted);
  min-width: 70px;
}

.sl-word-note {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border-left: 2px solid var(--color-border);
  padding-left: 10px;
}

/* Grammar cards */
.sl-gcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  grid-auto-flow: dense;
  gap: 16px;
  margin-bottom: 64px;
}

.sl-gcard.is-wide {
  grid-column: 1 / -1;
}

@media (max-width: 460px) {
  .sl-gcards { grid-template-columns: 1fr; }
}

.sl-gcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px 20px;
  scroll-margin-top: 130px;
  min-width: 0;
}

.sl-gcard.is-lang-match {
  border-color: rgba(240, 168, 60, 0.55);
  box-shadow: 0 0 16px rgba(240, 168, 60, 0.08);
}

.sl-gcard .sl-kind {
  align-self: flex-start;
}

.sl-gcard h3 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: var(--color-text);
  line-height: 1.35;
}

.sl-gcard p {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.6;
}

.sl-gcard p a {
  color: var(--color-gold-light);
  border-bottom: 1px dotted var(--color-gold);
}

.sl-gfoot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-family: var(--font-ui);
  font-size: 0.66rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.sl-gcard .sl-gfoot:first-of-type {
  margin-top: auto;
}

.sl-plinks,
.sl-llinks {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  text-transform: none;
  letter-spacing: 0;
}

.sl-lchip {
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.sl-lchip.active {
  border-color: var(--color-gold);
  color: var(--color-gold-light);
  background: rgba(240, 168, 60, 0.12);
}

.sl-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.sl-table th,
.sl-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.sl-table thead th {
  font-size: 0.64rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.sl-table tbody th {
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.sl-table td {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
}

.sl-table td small {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.sl-table td.sl-conn {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  color: var(--color-text-muted);
  min-width: 170px;
}

.sl-table-note {
  font-family: var(--font-ui);
  font-size: 0.74rem !important;
  color: var(--color-text-muted) !important;
}

.sl-borrowed {
  margin-bottom: 20px;
}

/* Five sub-nav links don't fit a phone in one row; wrap them on this page. */
@media (max-width: 600px) {
  .sl-subnav {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }
  .sl-subnav a {
    padding: 5px 12px;
  }
}

/* --- Sound-Law Machine (sound-laws.html) --------------------------------- */

.slm-words {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.slm-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.slm-group .sl-control-label,
.slm-custom .sl-control-label {
  min-width: 150px;
}

.slm-chip-pie {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  font-size: 0.86rem;
  margin-right: 6px;
}

.slm-chip-gloss {
  font-size: 0.7rem;
  opacity: 0.8;
}

.slm-custom {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.slm-custom-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.slm-custom-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.slm-input {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 1.05rem;
  background: var(--color-panel);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 260px;
  max-width: 100%;
}

.slm-input:focus-visible {
  outline: 2px solid var(--color-gold-light);
  outline-offset: 1px;
}

.slm-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.slm-key {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 0.95rem;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-gold-light);
  cursor: pointer;
}

.slm-key:hover,
.slm-key:focus-visible {
  border-color: var(--color-gold);
  outline: none;
}

.slm-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
}

.slm-stepper .sl-chip:disabled {
  opacity: 0.4;
  cursor: default;
}

.slm-counter {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.slm-toggle {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: #ff8fb3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.slm-toggle input {
  accent-color: var(--color-crimson);
}

.slm-note {
  border-left: 2px solid var(--color-magenta);
  padding: 4px 0 4px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slm-note p {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  max-width: 760px;
}

.slm-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 64px;
}

.slm-col {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-panel);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.slm-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
}

.slm-col-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-gold-light);
}

.slm-current-form {
  font-family: 'Gentium Plus', var(--font-body);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--color-text);
}

.slm-rules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slm-rule {
  border-radius: 8px;
  padding: 7px 10px;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.slm-rule.is-fired {
  border-color: var(--color-border);
  background: rgba(240, 168, 60, 0.05);
}

.slm-rule.is-idle {
  opacity: 0.5;
}

.slm-rule.is-pending {
  opacity: 0.28;
}

.slm-rule.is-current {
  border-color: var(--color-gold);
  box-shadow: 0 0 12px rgba(240, 168, 60, 0.15);
}

.slm-rule.is-moved {
  border-style: dashed;
  border-color: var(--color-crimson);
}

.slm-rule-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.slm-rule-num {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 16px;
}

.slm-rule-name {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.slm-rule-pattern {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 0.75rem;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--color-magenta);
  color: #ffc2e4;
}

.slm-rule-pattern:hover {
  background: rgba(255, 46, 166, 0.14);
}

.slm-rule-idle {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.slm-change {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 4px 0 2px 24px;
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 1.05rem;
}

.slm-before {
  color: var(--color-text-muted);
}

.slm-arrow {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.slm-after {
  color: var(--color-text);
}

.slm-after mark {
  background: rgba(255, 46, 166, 0.22);
  color: #ffd6ec;
  border-radius: 3px;
  padding: 0 1px;
}

.slm-after mark.is-deletion {
  display: inline-block;
  width: 3px;
  height: 1em;
  vertical-align: -2px;
  background: var(--color-magenta);
  padding: 0;
}

.slm-rule-desc {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  color: var(--color-text-muted);
  margin-left: 24px;
  line-height: 1.55;
}

.slm-result {
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slm-result-label,
.slm-result-wait {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.slm-result.is-match .slm-result-label {
  color: var(--color-gold-light);
}

.slm-result.is-miss .slm-result-label {
  color: #ff8fb3;
}

.slm-result-form {
  font-family: 'Gentium Plus', var(--font-body);
  font-size: 1.25rem;
  color: var(--color-text);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.slm-result-form.is-predicted {
  color: #ff8fb3;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.slm-result-tag {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  min-width: 64px;
  display: inline-block;
  text-decoration: none;
}

.slm-deva {
  font-family: var(--font-sanskrit);
  font-size: 1.35rem;
  color: var(--color-gold-light);
}

.slm-modern,
.slm-result-note {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.slm-modern b {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 600;
}

.slm-demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 56px;
}

.slm-inline-btn {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  margin-left: 6px;
  padding: 1px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-gold);
  background: transparent;
  color: var(--color-gold-light);
  cursor: pointer;
}

@media (max-width: 600px) {
  .slm-group,
  .slm-custom {
    flex-direction: column;
    gap: 6px;
  }
  .slm-toggle {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slm-rule { transition: none; }
}

/* --- Lineages (guru–disciple chart) --------------------------------------- */

.lineage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}
.lineage-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-inst {
  display: inline-block;
  width: 22px;
  height: 12px;
  border: 1px dashed var(--color-gold);
  border-radius: 3px;
}

.lineage-scroll {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 25% 30%, rgba(240, 168, 60, 0.06), transparent 50%),
    radial-gradient(circle at 75% 60%, rgba(255, 46, 166, 0.06), transparent 50%),
    var(--color-bg-alt);
}
.lineage-sizer { margin: 0 auto; }
.lineage-canvas { position: relative; transform-origin: 0 0; }
.lineage-edges { position: absolute; inset: 0; pointer-events: none; }

.lineage-band {
  position: absolute;
  top: 10px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-gold);
}
.lineage-band-kriya { color: var(--color-magenta); }

.lineage-node {
  position: absolute;
  width: 136px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 8px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  z-index: 1;
}
.lineage-node:hover, .lineage-node:focus-visible {
  border-color: var(--color-gold);
  box-shadow: 0 0 14px rgba(240, 168, 60, 0.22);
  outline: none;
}
.lineage-node.lineage-kriya { border-color: rgba(255, 46, 166, 0.3); }
.lineage-node.lineage-root { border-color: var(--color-gold-light); }
.lineage-node.is-institution {
  border-style: dashed;
  background: transparent;
}
.lineage-node.is-selected {
  border-color: var(--color-gold-light);
  box-shadow: 0 0 18px rgba(255, 210, 122, 0.45);
}
.lineage-node.is-linked { border-color: var(--color-gold); }
.lineage-node-deva {
  font-family: var(--font-sanskrit);
  font-size: 0.82rem;
  color: var(--color-gold-light);
}
.lineage-kriya .lineage-node-deva { color: #ff8fcf; }
.lineage-node-name {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.15;
}
.lineage-node-dates {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  color: var(--color-text-muted);
}

.lineage-edge {
  fill: none;
  stroke-width: 1.8;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}
.edge-diksha { stroke: var(--color-gold); }
.edge-sannyasa { stroke: var(--color-gold-light); stroke-dasharray: 2 4; stroke-linecap: round; }
.edge-succession { stroke: var(--color-text-muted); stroke-dasharray: 7 5; }
.edge-encounter { stroke: var(--color-magenta); stroke-dasharray: 1 5; stroke-linecap: round; stroke-width: 2.4; }
.edge-parallel { stroke: var(--color-crimson); stroke-dasharray: 10 4 2 4; opacity: 0.75; }
.lineage-edge.is-active { stroke-width: 3; opacity: 1; }
.lineage-edge.is-dim { opacity: 0.18; }

.lineage-detail {
  margin-top: 18px;
  padding: 22px 26px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.55;
}
.lineage-detail-deva {
  font-family: var(--font-sanskrit);
  font-size: 1.4rem;
  color: var(--color-gold-light);
}
.lineage-detail h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 2px 0 4px;
}
.lineage-detail h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-gold);
  margin: 16px 0 8px;
}
.lineage-detail p { margin-bottom: 10px; }
.lineage-detail-meta { font-family: var(--font-ui); font-size: 0.78rem; color: var(--color-text-muted); }
.lineage-detail-role { font-style: italic; color: var(--color-text-muted); margin: 6px 0 12px; }
.lineage-detail-etym { color: var(--color-gold-light); }
.lineage-detail-caveat { font-size: 0.92rem; color: var(--color-text-muted); font-style: italic; }
.lineage-detail a, .lineage-cross-card a {
  color: var(--color-gold-light);
  border-bottom: 1px dotted var(--color-border);
}
.lineage-rels { list-style: none; padding: 0; }
.lineage-rels li { margin-bottom: 6px; }
.lineage-rel-label { color: var(--color-text-muted); }

.lineage-chip {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  vertical-align: middle;
}
.chip-diksha { color: var(--color-gold); }
.chip-sannyasa { color: var(--color-gold-light); }
.chip-succession { color: var(--color-text-muted); }
.chip-encounter { color: var(--color-magenta); }
.chip-parallel { color: var(--color-crimson); }

.lineage-cross-section { margin-top: 56px; }
.lineage-cross-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.lineage-cross-card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px 22px;
  font-family: var(--font-body);
  line-height: 1.5;
}
.lineage-cross-card h3 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  margin: 10px 0 2px;
}
.lineage-cross-arrow { color: var(--color-magenta); }
.lineage-cross-label { font-family: var(--font-ui); font-size: 0.75rem; color: var(--color-gold); margin-bottom: 8px; }
.lineage-cross-card p { color: var(--color-text-muted); }

/* Six top-level links: let them wrap and tighten on phones. */
@media (max-width: 600px) {
  .nav-links { flex-wrap: wrap; gap: 6px 14px; }
  .nav-link { font-size: 0.85rem; }
}
.lineage-page .lang-body { max-width: 1420px; }
.lineage-page .lang-block-intro { max-width: 820px; }
.lineage-band-chinmaya { color: #ff9a5a; }
.lineage-node.lineage-chinmaya { border-color: rgba(255, 154, 90, 0.35); }
.lineage-chinmaya .lineage-node-deva { color: #ffb98a; }
.lineage-node.is-order {
  background: rgba(240, 168, 60, 0.08);
  border: 1px dotted var(--color-gold-light);
  border-radius: 999px;
  padding: 7px 8px;
}
.legend-inst.legend-order { border: 1px dotted var(--color-gold-light); border-radius: 999px; background: rgba(240, 168, 60, 0.08); }
.lineage-edge.is-hidden { display: none; }
.lineage-edges-top { z-index: 2; }

.lineage-band-ramana { color: #7fd6c2; }
.lineage-node.lineage-ramana { border-color: rgba(127, 214, 194, 0.35); }
.lineage-ramana .lineage-node-deva { color: #a6e8d8; }
.edge-textual { stroke: #7fd6c2; stroke-dasharray: 12 4 2 4 2 4; stroke-width: 2; }
.chip-textual { color: #7fd6c2; }
.lineage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.lineage-toolbar .lineage-legend { margin-bottom: 0; }
.lineage-zoom { display: flex; gap: 6px; flex-shrink: 0; }
.lineage-zoom button {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.lineage-zoom button.active {
  border-color: var(--color-gold);
  background: rgba(240, 168, 60, 0.16);
  color: var(--color-gold-light);
}
.edge-split { stroke: #ff6b6b; stroke-dasharray: 3 3; stroke-width: 2.4; }
.chip-split { color: #ff6b6b; }
.lineage-rel-detail { font-size: 0.95rem; color: var(--color-text-muted); margin: 4px 0 4px 12px; padding-left: 10px; border-left: 2px solid var(--color-border); }
.lineage-band-nath { color: #b58cff; text-align: left; padding-left: 40px; }
.lineage-node.lineage-nath { border-color: rgba(181, 140, 255, 0.4); }
.lineage-nath .lineage-node-deva { color: #cdb3ff; }
.lineage-node.is-legend { border-style: dashed; background: transparent; font-style: italic; }
.edge-traditional { stroke: #b58cff; stroke-dasharray: 6 4; stroke-width: 1.8; }
.chip-traditional { color: #b58cff; }

/* Lineages: short lede + branch shortcuts, and the companion guide page. */
.lineage-lede a { color: var(--color-gold-light); border-bottom: 1px dotted var(--color-border); white-space: nowrap; }
.lineage-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
  margin: -8px 0 22px;
}
.lineage-branch {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--branch, var(--color-gold));
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lineage-branch:hover { box-shadow: 0 0 12px rgba(240, 168, 60, 0.18); border-color: var(--branch, var(--color-gold)); }
.lineage-branch strong { font-family: var(--font-display); font-size: 0.9rem; color: var(--branch, var(--color-gold-light)); }
.lineage-branch span { font-family: var(--font-body); font-size: 0.95rem; color: var(--color-text-muted); }
.b-root { --branch: var(--color-gold-light); }
.b-ramakrishna { --branch: var(--color-gold); }
.b-kriya { --branch: var(--color-magenta); }
.b-chinmaya { --branch: #ff9a5a; }
.b-ramana { --branch: #7fd6c2; }
.b-nath { --branch: #b58cff; }

.guide-section { max-width: 760px; margin: 0 auto 44px; font-family: var(--font-body); font-size: 1.08rem; line-height: 1.7; color: var(--color-text); }
.guide-section h2 { font-family: var(--font-display); font-size: 1.35rem; color: var(--branch, var(--color-gold-light)); margin-bottom: 4px; }
.guide-section .guide-chain { font-family: var(--font-ui); font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 12px; }
.guide-section p { margin-bottom: 12px; }
.guide-section a { color: var(--color-gold-light); border-bottom: 1px dotted var(--color-border); }
.guide-key { list-style: none; padding: 0; }
.guide-key li { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.guide-key svg { flex-shrink: 0; transform: translateY(-2px); }
/* ∑ badge — same look as the chant pages' .section-label.has-note::after */
.sigma-badge {
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1;
  color: var(--color-gold);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
  font-style: normal;
}
.sigma-badge:hover, .lineage-howto:hover .sigma-badge { border-color: var(--color-gold); color: var(--color-gold-light); }
.lineage-branch { cursor: pointer; }
.lineage-branch strong { display: inline-flex; align-items: center; gap: 7px; }
.lineage-howto {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
}
.lineage-howto:hover { color: var(--color-gold-light); }
.modal-more a { color: var(--color-gold-light); border-bottom: 1px dotted var(--color-border); font-family: var(--font-ui); font-size: 0.85rem; }
.modal-body .guide-key { list-style: none; padding: 0; }
.lineage-node.is-text {
  border-radius: 4px;
  border-left: 3px solid #7fd6c2;
  background: rgba(127, 214, 194, 0.05);
}
.edge-influence { stroke: #8fa8ff; stroke-dasharray: 1 4 6 4; stroke-linecap: round; stroke-width: 1.8; }
.chip-influence { color: #8fa8ff; }
.lineage-detail-note { margin: 4px 0 6px; font-size: 0.8rem; color: var(--color-gold-light); }
.note-verse { margin: 10px 0 16px; padding: 12px 16px; border-left: 2px solid var(--color-gold); background: rgba(240, 168, 60, 0.05); }
.note-verse .v-deva { font-family: var(--font-sanskrit); font-size: 1.05rem; color: var(--color-gold-light); line-height: 1.8; }
.note-verse .v-iast { white-space: pre-line; font-family: 'Gentium Plus', var(--font-body); font-style: italic; font-size: 0.95rem; color: var(--color-text-muted); margin-top: 6px; }
.note-verse .v-tr { font-size: 0.98rem; margin-top: 8px; }
.guide-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 0.98rem; }
.guide-table th, .guide-table td { text-align: left; vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--color-border); }
.guide-table th { font-family: var(--font-ui); font-size: 0.72rem; color: var(--color-gold); font-weight: 600; letter-spacing: 0.3px; }
.guide-section h3, .modal-body h3 { font-family: var(--font-display); font-size: 1rem; color: var(--color-gold); margin: 18px 0 6px; }
.lineage-node.lineage-yoga { border-color: rgba(198, 216, 107, 0.5); border-left: 3px solid #c6d86b; border-radius: 4px; }
.lineage-yoga .lineage-node-deva { color: #dbe89a; }
.b-yoga { --branch: #c6d86b; }

/* Lineage time axis: year labels in a left gutter, faint gridlines across. */
.lineage-axis { position: absolute; inset: 0; pointer-events: none; }
.axis-grid {
  position: absolute;
  left: 64px;
  right: 8px;
  border-top: 1px dashed rgba(240, 168, 60, 0.10);
}
.axis-label {
  position: absolute;
  left: 4px;
  width: 56px;
  text-align: right;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
  opacity: 0.8;
}
.axis-legend-line {
  position: absolute;
  left: 64px;
  right: 8px;
  border-top: 1px solid rgba(181, 140, 255, 0.35);
}
.axis-label-legend { font-weight: 500; font-style: italic; color: #b58cff; }

/* --- Sāṃkhya page (samkhya.html) ------------------------------------------ */
.sk-page {
  --sk-sattva: #ffd27a;
  --sk-rajas: #ff7aa8;
  --sk-tamas: #8ea3d6;
  --sk-seer: #f7ece9;
}
.sk-page section[id],
.sk-page .sk-subtitle { scroll-margin-top: var(--sk-anchor-offset, 132px); }
.sk-page .sk-subnav { top: var(--sk-header-h, 66px); }
.sk-page .lang-block-intro { margin-bottom: 20px; }
.sk-page .lang-block-intro em,
.sk-lede em { color: var(--color-gold-light); }
.sk-lede {
  font-size: 1.12rem;
  max-width: 760px;
  margin-bottom: 16px;
}
.sk-subtitle {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--color-magenta);
  margin: 34px 0 10px;
}
.sk-subnav {
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 8px;
}
.sk-subnav::-webkit-scrollbar { display: none; }
.sk-subnav a { white-space: nowrap; padding: 6px 14px; }
@media (min-width: 760px) { .sk-subnav { justify-content: center; } }

.sk-c-sattva { color: var(--sk-sattva); fill: var(--sk-sattva); }
.sk-c-rajas { color: var(--sk-rajas); fill: var(--sk-rajas); }
.sk-c-tamas { color: var(--sk-tamas); fill: var(--sk-tamas); }

/* the map */
.sk-layer-bar { margin-bottom: 14px; }
.sk-layer-note {
  font-family: var(--font-ui);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 760px;
  min-height: 3.1em;
  margin-top: 10px;
}
.sk-scroll {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-alt);
  margin-bottom: 14px;
}
.sk-map { display: block; width: 100%; min-width: 780px; height: auto; }
.sk-map text { pointer-events: none; }
.sk-node { cursor: pointer; outline: none; transition: opacity 0.2s ease; }
.sk-node rect,
.sk-node > circle {
  fill: var(--color-panel);
  stroke: var(--color-border);
  stroke-width: 1.4;
  transition: stroke 0.15s ease, fill 0.15s ease;
}
.sk-node.sk-sattva rect { stroke: rgba(255, 210, 122, 0.55); }
.sk-node.sk-rajas rect { stroke: rgba(255, 122, 168, 0.55); }
.sk-node.sk-tamas rect { stroke: rgba(142, 163, 214, 0.6); }
.sk-node.sk-gross rect { stroke: rgba(142, 163, 214, 0.6); fill: rgba(142, 163, 214, 0.13); }
.sk-node.sk-inner rect,
.sk-node.sk-prakriti rect { stroke: var(--color-gold); }
.sk-node.sk-prakriti rect { fill: rgba(240, 168, 60, 0.07); }
.sk-node.sk-purusha > circle { stroke: var(--sk-seer); stroke-width: 1.8; fill: rgba(247, 236, 233, 0.06); }
.sk-node.sk-purusha > circle.sk-halo { fill: none; stroke: rgba(247, 236, 233, 0.3); stroke-width: 1; stroke-dasharray: 2 5; }
.sk-node:hover rect,
.sk-node:hover > circle:not(.sk-halo),
.sk-node:focus-visible rect,
.sk-node:focus-visible > circle:not(.sk-halo) { stroke: var(--color-gold-light); stroke-width: 2.2; }
.sk-node.is-selected rect,
.sk-node.is-selected > circle:not(.sk-halo) { stroke: var(--color-gold-light); stroke-width: 2.6; fill: rgba(240, 168, 60, 0.16); }
.sk-node.is-dim { opacity: 0.2; }
.sk-name { font-family: 'Gentium Plus', var(--font-body); font-size: 16px; fill: var(--color-text); }
.sk-name-big { font-size: 20px; fill: var(--color-gold-light); }
.sk-purusha .sk-name-big { fill: var(--sk-seer); }
.sk-gloss { font-family: var(--font-ui); font-size: 11px; fill: var(--color-text-muted); }
.sk-num { font-family: var(--font-ui); font-size: 11px; font-weight: 600; fill: var(--color-magenta); }
.sk-dot { stroke: none; }
.sk-dot.sk-dot-sattva { fill: var(--sk-sattva); }
.sk-dot.sk-dot-rajas { fill: var(--sk-rajas); }
.sk-dot.sk-dot-tamas { fill: var(--sk-tamas); }
.sk-dot-letter { font-family: var(--font-ui); font-size: 10.5px; font-weight: 700; fill: #1d0f1a; }
.sk-group { fill: rgba(255, 255, 255, 0.015); stroke-width: 1; stroke-dasharray: 3 5; }
.sk-group-sattva { stroke: rgba(255, 210, 122, 0.4); }
.sk-group-rajas { stroke: rgba(255, 122, 168, 0.4); }
.sk-group-tamas { stroke: rgba(142, 163, 214, 0.45); }
.sk-edge { fill: none; stroke: var(--color-text-muted); stroke-width: 1.4; }
.sk-edge-dashed { stroke-dasharray: 4 5; }
.sk-e-sattva { stroke: var(--sk-sattva); }
.sk-e-rajas { stroke: var(--sk-rajas); }
.sk-e-tamas { stroke: var(--sk-tamas); }
.sk-arrowhead { fill: context-stroke; }
.sk-label { font-family: var(--font-ui); font-size: 11px; fill: var(--color-text-muted); }
.sk-label.sk-c-sattva { fill: var(--sk-sattva); }
.sk-label.sk-c-rajas { fill: var(--sk-rajas); }
.sk-label.sk-c-tamas { fill: var(--sk-tamas); }
.sk-caps { font-size: 10px; font-weight: 600; letter-spacing: 1.1px; }
.sk-aside { font-family: var(--font-body); font-style: italic; font-size: 13.5px; }
.sk-term { font-family: 'Gentium Plus', var(--font-body); font-style: italic; font-size: 14px; }
.sk-col-title { font-family: 'Gentium Plus', var(--font-body); font-size: 15px; fill: var(--color-text); }
.sk-col-sub { font-size: 10.5px; }

/* detail sheet for a tapped tattva */
.sk-sheet {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 24px));
  max-height: 60vh;
  overflow-y: auto;
  z-index: 200;
  background: var(--color-panel);
  border: 1px solid var(--color-gold);
  border-radius: 14px;
  padding: 16px 44px 14px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 22px rgba(240, 168, 60, 0.14);
}
.sk-sheet[hidden] { display: none; }
.sk-sheet-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.sk-sheet-close:hover { color: var(--color-gold-light); }
.sk-sheet-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.sk-sheet-num { font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; color: var(--color-magenta); }
.sk-sheet-head h3 { font-family: 'Gentium Plus', var(--font-body); font-weight: 400; font-size: 1.45rem; color: var(--color-gold-light); }
.sk-sheet-deva { font-family: var(--font-sanskrit); font-size: 1.05rem; color: var(--color-text-muted); }
.sk-sheet-gloss { font-family: var(--font-ui); font-size: 0.78rem; letter-spacing: 0.8px; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 8px; }
.sk-sheet-body { font-size: 1.02rem; line-height: 1.55; }
.sk-sheet-meta { font-family: var(--font-ui); font-size: 0.74rem; color: var(--color-text-muted); margin-top: 10px; }

/* guṇa cards */
.sk-gunas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.sk-guna {
  position: relative;
  border: 1px solid var(--color-border);
  border-top: 3px solid currentColor;
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--color-panel);
}
.sk-guna-sattva { color: var(--sk-sattva); }
.sk-guna-rajas { color: var(--sk-rajas); }
.sk-guna-tamas { color: var(--sk-tamas); }
.sk-guna h3 { font-family: var(--font-display); font-size: 1.2rem; }
.sk-guna-deva { position: absolute; top: 14px; right: 16px; font-family: var(--font-sanskrit); font-size: 1rem; opacity: 0.8; }
.sk-guna-key { font-family: var(--font-ui); font-size: 0.74rem; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.sk-guna p:last-child { color: var(--color-text-muted); font-size: 0.98rem; line-height: 1.5; }
.sk-guna p:last-child em { color: var(--color-text); }

/* tables */
.sk-table-wrap { overflow-x: auto; margin-bottom: 20px; }
.sk-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  line-height: 1.5;
}
.sk-table th,
.sk-table td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}
.sk-table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  vertical-align: bottom;
}
.sk-table thead th.sk-c-sattva { color: var(--sk-sattva); }
.sk-table thead th.sk-c-rajas { color: var(--sk-rajas); }
.sk-table thead th.sk-c-tamas { color: var(--sk-tamas); }
.sk-table thead th span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--color-text-muted); }
.sk-table tbody th,
.sk-table tfoot th { font-weight: 600; color: var(--color-gold-light); white-space: nowrap; }
.sk-table td { color: var(--color-text); }
.sk-table i { font-family: 'Gentium Plus', var(--font-body); color: var(--color-text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.sk-table tfoot th,
.sk-table tfoot td { border-top: 1px solid var(--color-gold); border-bottom: none; background: rgba(240, 168, 60, 0.06); }
.sk-dots td { text-align: center; color: var(--color-gold); }
.sk-dots thead th:not(:first-child) { text-align: center; }
.sk-dots td:last-child,
.sk-dots thead th:last-child { text-align: left; color: var(--color-text-muted); }
.sk-compare { min-width: 620px; }
.sk-compare td { width: 41%; }

/* pañcīkaraṇa bars */
.sk-panchi { max-width: 620px; margin-bottom: 8px; }
.sk-panchi-row { display: flex; align-items: center; gap: 12px; margin-bottom: 7px; }
.sk-panchi-name { flex: 0 0 96px; font-family: var(--font-ui); font-size: 0.8rem; color: var(--color-text-muted); }
.sk-panchi-bar { flex: 1; display: flex; gap: 2px; height: 20px; }
.sk-panchi-bar i { flex: 1; border-radius: 3px; }
.sk-panchi-bar i.half { flex: 4; }
.sk-panchi .e-space { background: #b79cf0; }
.sk-panchi .e-air { background: #7fd3d6; }
.sk-panchi .e-fire { background: #f58a3c; }
.sk-panchi .e-water { background: #4f93e6; }
.sk-panchi .e-earth { background: #c2a15a; }
.sk-panchi-key { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0 108px; font-family: var(--font-ui); font-size: 0.76rem; color: var(--color-text-muted); }
.sk-panchi-key span { display: inline-flex; align-items: center; gap: 6px; }
.sk-panchi-key i { width: 11px; height: 11px; border-radius: 2px; }

/* bodies and sheaths */
.sk-strata {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  gap: 6px 10px;
  margin-bottom: 22px;
}
.sk-atma {
  grid-column: 1 / -1;
  text-align: center;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(247, 236, 233, 0.55);
  background: radial-gradient(ellipse at 50% 0%, rgba(247, 236, 233, 0.16), transparent 75%);
  margin-bottom: 6px;
}
.sk-atma strong { display: block; font-family: var(--font-display); font-size: 1.2rem; color: var(--sk-seer); }
.sk-atma span { font-family: var(--font-ui); font-size: 0.84rem; color: var(--color-text-muted); }
.sk-body,
.sk-kosha {
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
}
.sk-body { grid-column: 1; border-left-width: 4px; }
.sk-kosha { grid-column: 2; }
.sk-body-subtle.sk-body { grid-row: span 3; }
.sk-body-causal { border-color: rgba(183, 156, 240, 0.5); }
.sk-body-subtle { border-color: rgba(255, 210, 122, 0.45); }
.sk-body-gross { border-color: rgba(142, 163, 214, 0.55); }
.sk-body h3 { font-family: var(--font-display); font-size: 1.05rem; color: var(--color-gold-light); margin-bottom: 4px; }
.sk-kosha h4 { font-family: var(--font-ui); font-size: 0.9rem; font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.sk-kosha h4 span { color: var(--color-magenta); margin-right: 6px; }
.sk-body h3 i,
.sk-kosha h4 i { font-family: 'Gentium Plus', var(--font-body); font-size: 0.92rem; font-weight: 400; color: var(--color-text-muted); margin-left: 4px; }
.sk-body p,
.sk-kosha p { font-family: var(--font-ui); font-size: 0.83rem; line-height: 1.55; color: var(--color-text-muted); }
.sk-kosha p b { color: var(--color-gold-light); }
@media (max-width: 600px) {
  .sk-strata { grid-template-columns: 1fr; }
  .sk-body, .sk-kosha { grid-column: 1; }
  .sk-body-subtle.sk-body { grid-row: auto; }
  .sk-kosha { margin-left: 16px; }
  .sk-body { margin-top: 8px; }
}

.sk-callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 22px; }
.sk-callouts .sequence { word-spacing: 0; }
.sk-callouts .sequence b { color: var(--color-text); font-weight: 600; }
.sk-laws .formula { font-style: normal; font-size: 1.08rem; }

/* perception chain */
.sk-chain {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin-bottom: 20px;
}
.sk-chain li {
  position: relative;
  flex: 1 1 130px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--color-panel);
}
.sk-chain li:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -21px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gold);
  font-family: var(--font-ui);
}
.sk-chain b { display: block; font-family: 'Gentium Plus', var(--font-body); font-weight: 400; font-size: 1.08rem; color: var(--color-gold-light); }
.sk-chain span { font-family: var(--font-ui); font-size: 0.78rem; line-height: 1.4; color: var(--color-text-muted); display: block; }
.sk-chain-seer { border-color: rgba(247, 236, 233, 0.6) !important; }
.sk-chain-seer b { color: var(--sk-seer); }

.sk-six {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 10px;
  margin-bottom: 20px;
  max-width: 760px;
}
@media (max-width: 600px) { .sk-six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sk-six li { border-left: 2px solid var(--sk-seer); padding: 4px 14px; }
.sk-six-deva { display: block; font-family: var(--font-sanskrit) !important; font-size: 1.3rem !important; line-height: 1.5; color: var(--sk-seer) !important; }
.sk-six b { font-style: italic; color: var(--color-gold-light) !important; }
.sk-six-line { max-width: 760px; margin-bottom: 20px; padding: 14px 18px; border: 1px solid rgba(247, 236, 233, 0.4); border-radius: 10px; font-family: var(--font-ui); font-size: 0.86rem; color: var(--color-text-muted); }
.sk-six-line span { display: block; font-family: var(--font-sanskrit); font-size: 1.15rem; line-height: 1.7; color: var(--sk-seer); }
.sk-six-line i { display: block; font-family: 'Gentium Plus', var(--font-body); font-size: 1rem; color: var(--color-gold-light); margin-bottom: 4px; }
.sk-deva { font-family: var(--font-sanskrit); font-size: 14px; fill: var(--color-gold); opacity: 0.85; }
.sk-deva-big { font-size: 17px; fill: var(--color-gold-light); opacity: 1; }
.sk-purusha .sk-deva-big { fill: var(--sk-seer); }
.sk-col-title .sk-deva { font-size: 13px; }
.sk-six b { display: block; font-family: 'Gentium Plus', var(--font-body); font-weight: 400; font-size: 1.1rem; color: var(--sk-seer); }
.sk-six span { font-family: var(--font-ui); font-size: 0.8rem; color: var(--color-text-muted); }
/* Cinzel has no ṃ/ṇ/ṛ, so headings that carry IAST use the transliteration face. */
.sk-page .lang-hero h1,
.sk-page .lang-block-title { font-family: 'Gentium Plus', var(--font-body); font-weight: 400; letter-spacing: 0.3px; }
.sk-page .lang-block-title { font-size: 1.7rem; }
.sk-swipe-hint { display: none; font-family: var(--font-ui); font-size: 0.76rem; color: var(--color-text-muted); margin-bottom: 6px; }
@media (max-width: 840px) { .sk-swipe-hint { display: block; } }
