/* ──────────────────────────────────────────────
   Triguṇa — design tokens

   The page travels through four temperatures of light:
     dawn (sattva)  →  ember (rajas)  →  night (tamas)  →  daylight (gunātīta)
   Each section is its own visual register; the type itself
   teaches which guṇa is dominant before any text is read.
   ────────────────────────────────────────────── */

:root {
  /* Sattva — luminous, dawn paper */
  --sattva-paper:    #f5efe1;
  --sattva-paper-2:  #ede5d2;
  --sattva-ink:      #221d12;
  --sattva-ink-soft: #6b5e3f;
  --sattva-glow:     #c08a2a;
  --sattva-rule:     #cdbf99;

  /* Rajas — ember, forge interior */
  --rajas-paper:     #1d0a05;
  --rajas-paper-2:   #2a100a;
  --rajas-ink:       #f3d8be;
  --rajas-ink-soft:  #c79680;
  --rajas-flame:     #e84e1c;
  --rajas-ember:     #f59446;
  --rajas-rule:      #5c2716;

  /* Tamas — heavy night */
  --tamas-paper:     #0a0a13;
  --tamas-paper-2:   #11111d;
  --tamas-ink:       #6e6e8a;
  --tamas-ink-soft:  #3f3f55;
  --tamas-glow:      #2a2a44;
  --tamas-rule:      #1d1d2e;

  /* Gunātīta — clear daylight, witnessing */
  --witness-paper:   #efece4;
  --witness-paper-2: #e6e2d6;
  --witness-ink:     #181613;
  --witness-ink-soft:#5b554a;
  --witness-rule:    #c2bcae;

  /* Page-level (used for body wrapper) */
  --bg:    var(--sattva-paper);
  --ink:   var(--sattva-ink);

  /* Type */
  --serif: "Fraunces", "Iowan Old Style", "Cambria", Georgia, serif;
  --deva:  "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", "Sanskrit Text", serif;
  --mono:  "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  /* Rhythm */
  --measure: 36rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --rule: 1px;

  /* Easing */
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ──────────────────────────────────────────────
   Reset + base
   ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-feature-settings: "ss01", "ss02", "kern", "liga";
  font-variation-settings: "opsz" 14, "SOFT" 30;
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(255,255,255,0.18); }

/* The Devanagari script needs a different optical
   feel — slightly lighter, more line-height, never italicised */
[lang="sa"], .deva, .verse__deva, .guna__deva, .cell__deva,
.masthead__deva, .gunatita__deva {
  font-family: var(--deva);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
}

/* ──────────────────────────────────────────────
   Masthead — fixed, minimal, mode-aware
   ────────────────────────────────────────────── */
.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  /* Match the .page max-width so the mark and the leftmost
     content of any section align to the same vertical line. */
  padding: .85rem max(var(--gutter), calc((100vw - 80rem) / 2));
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  transition: background .8s var(--ease), color .8s var(--ease);
  border-bottom: var(--rule) solid color-mix(in srgb, currentColor 12%, transparent);
}
.masthead a { text-decoration: none; }
.masthead__mark {
  display: inline-flex;
  gap: .55rem;
  align-items: baseline;
}
.masthead__deva {
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}
.masthead__lat {
  opacity: .68;
}
.masthead__nav {
  display: flex;
  gap: clamp(.7rem, 2vw, 1.6rem);
}
.masthead__nav a {
  position: relative;
  opacity: .66;
  transition: opacity .25s var(--ease);
}
.masthead__nav a:hover,
.masthead__nav a.is-active { opacity: 1; }
.masthead__nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -.5rem; height: 1px;
  background: currentColor;
}

/* ──────────────────────────────────────────────
   Section scaffolding
   ────────────────────────────────────────────── */
main > section {
  padding: clamp(5rem, 12vh, 9rem) var(--gutter);
  position: relative;
  isolation: isolate;
}
main > section::before {
  /* Subtle grain — barely visible, gives each mode tactility */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: -1;
}

/* ──────────────────────────────────────────────
   .page — the typographic frame.
   Each section's content lives inside .page so that the
   reading width is bounded and the right column can carry
   verses, signs, marginalia. The section's bg / grain extends
   edge to edge; .page is the inhabited part of it.
   ────────────────────────────────────────────── */
.page {
  max-width: 80rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(2.5rem, 5.5vw, 5rem);
  /* Tighter row rhythm: head, bind, body, signs read as one composition,
     not three floating fragments separated by air. */
  row-gap: clamp(1.5rem, 3vw, 2.4rem);
  align-items: start;
}
.page--wide {
  max-width: 102rem;
  display: block; /* matrix manages its own grid */
}
@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    row-gap: 1.8rem;
  }
}

.kicker {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: 0 0 1.6rem;
  color: color-mix(in srgb, currentColor 60%, transparent);
}

/* ──────────────────────────────────────────────
   Overture
   ────────────────────────────────────────────── */
.overture {
  background: var(--sattva-paper);
  color: var(--sattva-ink);
  padding-top: clamp(7rem, 16vh, 12rem) !important;
}
/* Overture grid:
     row 1   kicker ─────────── (full)
     row 2   title ─────────── (full, the chapter index)
     row 3   lede            verse (BG 14.5)
     row 4   pivot ─────────── (full, italic, soft)              */
.overture .kicker        { grid-column: 1 / -1; margin-bottom: 0; }
.overture__title         { grid-column: 1 / -1; grid-row: 2; margin: 0; }
.overture__lede          { grid-column: 1; grid-row: 3; max-width: 36rem; margin: 0; }
.overture__verse         { grid-column: 2; grid-row: 3; align-self: start; margin: 0; max-width: 100%; }
.overture__pivot         { grid-column: 1 / -1; grid-row: 4; max-width: 52rem; margin: 0; }

@media (max-width: 860px) {
  .overture__title,
  .overture__verse,
  .overture__lede,
  .overture__pivot { grid-column: 1; grid-row: auto; }
}

/* The hero is a chapter index.  Each row pairs a giant Devanagari
   word (left, full per-guṇa register) with a small editorial caption
   (right: index numeral, Latin name, gloss).  A hairline rule
   separates the rows — the page reads like the front matter of a
   bound edition rather than three floating words.

   Per-guṇa register applies twice in each row: once on the
   Devanagari (color + faux-bold for tamas) and once on the small
   Latin name in the meta column (SOFT/WONK axes), so the typographic
   instruction is doubled — the reader feels each guṇa twice before
   reading what it is. */
.overture__title {
  margin: 0;
  padding: 0;
  display: grid;
  /* Top rule mirrors the row borders so the table feels closed at top */
  border-top: 1px solid color-mix(in srgb, var(--sattva-ink) 18%, transparent);
}
.overture__row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  column-gap: clamp(1rem, 3vw, 3rem);
  padding: clamp(1rem, 2.4vw, 2.4rem) 0 clamp(.9rem, 1.8vw, 1.8rem);
  border-bottom: 1px solid color-mix(in srgb, var(--sattva-ink) 18%, transparent);
}
.overture__row [lang="sa"] {
  grid-column: 1;
  font-family: var(--deva);
  font-style: normal;
  font-size: clamp(2.8rem, 9.5vw, 8.5rem);
  line-height: 1;
  letter-spacing: 0;
}
.overture__meta {
  grid-column: 2;
  justify-self: end;
  text-align: right;
  display: grid;
  gap: .25rem;
  padding-bottom: clamp(.4rem, 1vw, 1rem);
}
.overture__num {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sattva-ink-soft);
}
.overture__name {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  line-height: 1;
  font-variation-settings: "opsz" 144, "wght" 360, "SOFT" 50;
  color: var(--sattva-ink);
}
.overture__gloss {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--sattva-ink-soft);
}

/* Per-guṇa register — Devanagari (left) */
.overture__title .t-sattva {
  /* Light, airy — softer ink, slight optical lift. */
  color: color-mix(in srgb, var(--sattva-ink) 78%, var(--sattva-paper));
  font-size: clamp(2.6rem, 9vw, 8rem);
}
.overture__title .t-rajas {
  /* Heat — the only coloured word.  Italic for forward lean. */
  color: var(--rajas-flame);
  font-style: italic;
}
.overture__title .t-tamas {
  /* Heaviest — full ink, slight downward sink, faux-bold via
     a same-colour text-shadow stack to thicken the strokes
     since Tiro Devanagari has no heavier weight. */
  color: var(--sattva-ink);
  font-size: clamp(2.95rem, 10vw, 8.9rem);
  text-shadow:
     0.02em 0 0 var(--sattva-ink),
    -0.02em 0 0 var(--sattva-ink),
     0 0.015em 0 var(--sattva-ink);
  transform: translateY(.04em);
}

/* Per-guṇa register — Latin name (right meta column) */
.overture__name--sattva {
  font-variation-settings: "opsz" 144, "wght" 320, "SOFT" 100;
  letter-spacing: .04em;
}
.overture__name--rajas {
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 700, "SOFT" 40, "WONK" 1;
  letter-spacing: -.005em;
  color: var(--rajas-flame);
}
.overture__name--tamas {
  font-variation-settings: "opsz" 144, "wght" 880, "SOFT" 0, "WONK" 0;
  letter-spacing: -.025em;
}

@media (max-width: 720px) {
  .overture__row {
    grid-template-columns: 1fr;
    align-items: start;
    row-gap: .5rem;
    padding: clamp(.9rem, 2vw, 1.6rem) 0;
  }
  .overture__meta {
    grid-column: 1;
    justify-self: start;
    text-align: left;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    gap: .8rem;
    align-items: baseline;
    padding-bottom: 0;
  }
  .overture__row [lang="sa"] {
    font-size: clamp(2.4rem, 14vw, 5rem);
  }
}

.overture__lede,
.overture__pivot {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.2vw + .6rem, 1.32rem);
  line-height: 1.55;
  font-variation-settings: "opsz" 18, "wght" 380;
}
.overture__pivot {
  color: var(--sattva-ink-soft);
  font-style: italic;
}

/* ──────────────────────────────────────────────
   Verse — the philosophical anchor.
   Devanagari leads, transliteration whispers under,
   translation stays prose. Same component reused everywhere.
   ────────────────────────────────────────────── */
.verse {
  margin: 0;
  padding: 1.6rem 0 1.6rem 1.6rem;
  border-left: 2px solid currentColor;
  border-color: color-mix(in srgb, currentColor 22%, transparent);
}
.verse__deva {
  font-family: var(--deva);
  font-size: clamp(1.25rem, 1.4vw + 1rem, 1.7rem);
  line-height: 1.85;
  margin: 0 0 1rem;
  letter-spacing: 0;
}
.verse__iast {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(.95rem, .5vw + .85rem, 1.05rem);
  line-height: 1.7;
  opacity: .75;
  margin: 0 0 1.1rem;
  font-variation-settings: "opsz" 14, "wght" 380;
}
.verse__iast .danda {
  font-style: normal;
  opacity: .5;
  padding: 0 .15em;
}
.verse__cap {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
  font-variation-settings: "opsz" 14, "wght" 400;
  margin-top: .25rem;
}
.verse__cap cite {
  display: block;
  margin-top: .5rem;
  font-style: normal;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .55;
}
.verse--quiet { border-left-color: color-mix(in srgb, currentColor 30%, transparent); }
.verse--coda  { margin-top: 4rem; }

/* ──────────────────────────────────────────────
   Guṇa section — generic shell

   Grid placement (desktop):
     row 1   head ─────────────── (full width)
     row 2   bind ─────────────── (full width, max-width-capped)
     row 3   body              verse
     row 4   signs             analogy
   Two columns of paired prose, each row roughly balanced because
   both sides are typographic content. No images — no risk of
   one column dictating a tall row that strands the other.
   On mobile, .page collapses to a single column and the
   children fall back into HTML order.
   ────────────────────────────────────────────── */
.guna__head    { grid-column: 1 / -1; grid-row: 1; }
.guna__bind    { grid-column: 1 / -1; grid-row: 2; }
.guna__body    { grid-column: 1;      grid-row: 3; align-self: start; }
.guna .verse   { grid-column: 2;      grid-row: 3; align-self: start; margin: 0; }
.guna .signs   { grid-column: 1;      grid-row: 4; align-self: start; }
.guna .analogy { grid-column: 2;      grid-row: 4; align-self: start; margin: 0; }

@media (max-width: 860px) {
  .guna__head, .guna__bind, .guna__body,
  .guna .verse, .guna .analogy, .guna .signs {
    grid-column: 1; grid-row: auto;
  }
}

/* Section head — a clustered title block, not three orphans across
   the page width.  The index hangs in a narrow gutter at left like
   a chapter numeral; the name dominates; the gloss tucks under as a
   subtitle, baseline-anchored to the bottom of the rule.  A single
   horizontal rule at the bottom closes the cluster as a unit. */
.guna__head {
  display: grid;
  grid-template-columns: minmax(2rem, auto) 1fr;
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: clamp(1rem, 2.2vw, 2rem);
  row-gap: .5rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  padding-bottom: 1.5rem;
}
.guna__index {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  font-family: var(--mono);
  font-size: .82rem;
  letter-spacing: .14em;
  margin: 0;
  /* The numeral sits at the Latin baseline.  A small pad-bottom
     prevents it from kissing the descenders of the title above. */
  padding-bottom: .55rem;
  opacity: .6;
}
.guna__name {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  line-height: .98;
}
.guna__deva {
  font-size: clamp(2rem, 3.6vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: 0;
}
.guna__lat {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: .95;
  letter-spacing: -.02em;
}
.guna__gloss {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin: 0;
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .55;
  padding-bottom: 0;
  white-space: normal;
}

/* The same English sentence appears at the top of each guṇa,
   set in three different typographic moods. This IS the hook —
   the reader feels each guṇa's register before reading what it is. */
.guna__bind {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  line-height: 1.2;
  margin: 0;
  max-width: 32rem;
}

.guna__body {
  font-size: clamp(1.08rem, .55vw + .92rem, 1.22rem);
  line-height: 1.62;
  margin: 0;
  max-width: 38rem;
}
.guna__body p { margin: 0; }
.guna__body em { font-style: italic; opacity: .9; }
.guna__body strong { font-weight: 600; }

.analogy {
  border-top: 1px dashed color-mix(in srgb, currentColor 35%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, currentColor 35%, transparent);
  padding: 1.4rem 0;
  margin: 0;
  max-width: 38rem;
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1.2rem;
  align-items: start;
}
.analogy__label {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin: .25rem 0 0;
  opacity: .55;
}
.analogy__body {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.12rem;
  line-height: 1.55;
  margin: 0;
  font-variation-settings: "opsz" 18, "wght" 400;
}
.analogy__body em { font-style: normal; }

.signs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
}
.signs li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: .8rem;
  align-items: baseline;
  padding-bottom: .8rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent);
}
.signs__num {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  opacity: .55;
}

/* ──────────────────────────────────────────────
   Sattva — luminous, airy, generous space.
   The word breathes. Letters lean light.
   ────────────────────────────────────────────── */
.guna--sattva {
  background: var(--sattva-paper-2);
  color: var(--sattva-ink);
}
.guna--sattva .guna__bind {
  font-style: normal;
  font-variation-settings: "opsz" 144, "wght" 320, "SOFT" 100, "WONK" 0;
  letter-spacing: .015em;
  color: var(--sattva-ink);
}
.guna--sattva .guna__lat {
  font-variation-settings: "opsz" 144, "wght" 360, "SOFT" 100;
  letter-spacing: .04em;
  color: var(--sattva-ink);
}
.guna--sattva .guna__deva { color: var(--sattva-glow); }
.guna--sattva .guna__index { color: var(--sattva-glow); }
.guna--sattva .verse { border-left-color: var(--sattva-glow); }

/* ──────────────────────────────────────────────
   Rajas — heat, density, italic forward-lean.
   Words press against the page.
   ────────────────────────────────────────────── */
.guna--rajas {
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--rajas-flame) 14%, var(--rajas-paper)), var(--rajas-paper) 55%),
    var(--rajas-paper);
  color: var(--rajas-ink);
}
.guna--rajas .guna__bind {
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 700, "SOFT" 40, "WONK" 1;
  letter-spacing: -.005em;
  color: var(--rajas-ember);
}
.guna--rajas .guna__lat {
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 720, "SOFT" 40, "WONK" 1;
  letter-spacing: -.015em;
  color: var(--rajas-ink);
}
.guna--rajas .guna__deva { color: var(--rajas-flame); }
.guna--rajas .guna__index { color: var(--rajas-ember); }
.guna--rajas .verse { border-left-color: var(--rajas-flame); }
.guna--rajas .guna__head { border-bottom-color: var(--rajas-rule); }
.guna--rajas .signs li { border-bottom-color: var(--rajas-rule); }
.guna--rajas .analogy { border-color: var(--rajas-rule); }

/* ──────────────────────────────────────────────
   Tamas — heavy, condensed, sinking.
   Letters press downward into the page.
   ────────────────────────────────────────────── */
.guna--tamas {
  background:
    radial-gradient(ellipse at 0% 100%, color-mix(in srgb, var(--tamas-glow) 60%, var(--tamas-paper)), var(--tamas-paper) 70%),
    var(--tamas-paper);
  color: var(--tamas-ink);
}
.guna--tamas .guna__bind {
  font-style: normal;
  font-variation-settings: "opsz" 144, "wght" 880, "SOFT" 0, "WONK" 0;
  letter-spacing: -.025em;
  /* Lift the bind well above the night so the heaviness reads as
     density, not absence — earlier value (#6e6e8a 80% mix) read as
     a ghost on the dark paper. */
  color: color-mix(in srgb, var(--tamas-ink) 35%, #e8e6f2);
  line-height: 1.1;
}
.guna--tamas .guna__lat {
  font-variation-settings: "opsz" 144, "wght" 900, "SOFT" 0, "WONK" 0;
  letter-spacing: -.04em;
  color: color-mix(in srgb, var(--tamas-ink) 30%, #ece9f3);
}
.guna--tamas .guna__deva { color: color-mix(in srgb, var(--tamas-ink) 45%, #d6d4e2); opacity: 1; }
.guna--tamas .guna__index { color: color-mix(in srgb, var(--tamas-ink) 40%, #c8c4d4); opacity: 1; }
.guna--tamas .guna__gloss { color: color-mix(in srgb, var(--tamas-ink) 60%, #b6b3c2); opacity: 1; }
.guna--tamas .verse { border-left-color: var(--tamas-ink); }
.guna--tamas .guna__head { border-bottom-color: var(--tamas-rule); }
.guna--tamas .signs li { border-bottom-color: var(--tamas-rule); }
.guna--tamas .analogy { border-color: var(--tamas-rule); }
.guna--tamas .guna__body { color: color-mix(in srgb, var(--tamas-ink) 92%, white); }

/* ──────────────────────────────────────────────
   Matrix — Krishna's central pedagogical move.
   Six domains × three guṇas. The reader can dim two columns
   and read just one — the matrix becomes a meditation tool.
   ────────────────────────────────────────────── */
.matrix {
  background: var(--witness-paper);
  color: var(--witness-ink);
  padding-top: clamp(6rem, 14vh, 10rem) !important;
  padding-bottom: clamp(6rem, 14vh, 10rem) !important;
}
.matrix .page--wide { width: 100%; }
.matrix__head {
  max-width: 64rem;
  margin: 0 0 4rem;
}
.matrix__title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: .96;
  letter-spacing: -.022em;
  margin: 0 0 1.4rem;
  font-variation-settings: "opsz" 144, "wght" 380, "SOFT" 50;
}
.matrix__title br { display: block; }
.matrix__lede {
  font-size: clamp(1rem, .5vw + .9rem, 1.18rem);
  line-height: 1.6;
  max-width: var(--measure);
  margin: 0 0 2rem;
  color: var(--witness-ink-soft);
}
.matrix__filter {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.4rem;
}
.matrix__filter button {
  appearance: none;
  background: transparent;
  color: var(--witness-ink);
  border: 1px solid color-mix(in srgb, var(--witness-ink) 22%, transparent);
  padding: .5rem 1rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.matrix__filter button:hover {
  border-color: var(--witness-ink);
}
.matrix__filter button[aria-pressed="true"] {
  background: var(--witness-ink);
  color: var(--witness-paper);
  border-color: var(--witness-ink);
}

.matrix__grid {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) repeat(3, 1fr);
  border-top: 1px solid color-mix(in srgb, var(--witness-ink) 22%, transparent);
}
.matrix__row {
  display: contents;
}
.matrix__row > .cell {
  padding: 1.5rem 1.2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--witness-ink) 14%, transparent);
  font-size: 1rem;
  line-height: 1.5;
}
.matrix__row--header > .cell {
  border-bottom: 1px solid color-mix(in srgb, var(--witness-ink) 30%, transparent);
  padding-top: .9rem;
  padding-bottom: .9rem;
}

.cell--aspect {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  background: var(--witness-paper-2);
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .04em;
}
.matrix__row--header .cell--aspect {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .7rem;
}
.cell__deva {
  font-family: var(--deva);
  font-size: 1.4rem;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: none;
  color: var(--witness-ink);
}
.cell__name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-variation-settings: "opsz" 18, "wght" 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--witness-ink);
}
.cell__ref {
  font-family: var(--mono);
  font-size: .68rem;
  opacity: .55;
  letter-spacing: .1em;
  margin-top: .3rem;
}

/* Per-column type registers — even inside the witness mode,
   each guṇa keeps its voice. */
.cell--head { font-family: var(--mono); font-size: .8rem; letter-spacing: .14em; text-transform: none; }
.cell--head[data-col="sattva"] {
  color: var(--sattva-glow);
}
.cell--head[data-col="rajas"] {
  color: var(--rajas-flame);
  font-style: italic;
}
.cell--head[data-col="tamas"] {
  color: color-mix(in srgb, var(--witness-ink) 75%, transparent);
  font-weight: 700;
}
.cell--head[data-col] span[lang="sa"] {
  font-family: var(--deva);
  font-size: 1.15rem;
  letter-spacing: 0;
  display: inline-block;
  margin-bottom: .25rem;
  color: var(--witness-ink);
  opacity: .85;
}

.cell[data-col="sattva"] {
  font-variation-settings: "opsz" 14, "wght" 360, "SOFT" 100;
  background: color-mix(in srgb, var(--sattva-paper) 35%, var(--witness-paper));
}
.cell[data-col="rajas"] {
  font-variation-settings: "opsz" 14, "wght" 480, "WONK" 1;
  font-style: italic;
  background: color-mix(in srgb, var(--rajas-flame) 6%, var(--witness-paper));
  color: color-mix(in srgb, var(--rajas-flame) 38%, var(--witness-ink));
}
.cell[data-col="tamas"] {
  font-variation-settings: "opsz" 14, "wght" 620, "SOFT" 0;
  letter-spacing: -.005em;
  background: color-mix(in srgb, var(--witness-ink) 6%, var(--witness-paper));
  color: color-mix(in srgb, var(--witness-ink) 85%, transparent);
}

/* Filter behaviour — non-active columns recede */
.matrix.is-filter-sattva .cell[data-col="rajas"],
.matrix.is-filter-sattva .cell[data-col="tamas"],
.matrix.is-filter-rajas  .cell[data-col="sattva"],
.matrix.is-filter-rajas  .cell[data-col="tamas"],
.matrix.is-filter-tamas  .cell[data-col="sattva"],
.matrix.is-filter-tamas  .cell[data-col="rajas"] {
  opacity: .18;
  filter: saturate(.4);
  transition: opacity .35s var(--ease), filter .35s var(--ease);
}

.matrix__foot {
  max-width: var(--measure);
  margin: 3rem 0 0;
  font-style: italic;
  color: var(--witness-ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ──────────────────────────────────────────────
   Gunātīta — quiet daylight. Neither bright nor dark.
   Type recedes; only the witness remains.
   ────────────────────────────────────────────── */
.gunatita {
  background: var(--witness-paper);
  color: var(--witness-ink);
  border-top: 1px solid color-mix(in srgb, var(--witness-ink) 14%, transparent);
}
/* Gunātīta grid:
     row 1   kicker ─────────── (full)
     row 2   title           art (witness sky)
     row 3   lede            verse (BG 14.20)
     row 4   sub ─────────────── (full)
     row 5   witness list ────── (full, max-width-capped)
     row 6   close ─────────── (full)
     row 7   coda verse (BG 14.26) (full, max-width-capped)         */
/* Gunātīta grid:
     row 1   kicker ─────────── (full)
     row 2   title           verse (BG 14.20)
     row 3   lede ─────────── (full, max-width-capped)
     row 4   sub ───────────── (full)
     row 5   witness list ──── (full, max-width-capped)
     row 6   close ─────────── (full)
     row 7   coda verse ────── (full, max-width-capped)             */
/* Gunātīta — the title pairs with the verse but anchors at the top
   of the row, not the bottom. Both align-self: end produced a giant
   void above the title; both align-self: start lets the row breathe
   downward instead, into the lede that follows. */
.gunatita .kicker         { grid-column: 1 / -1; margin-bottom: 0; }
.gunatita__title          { grid-column: 1; grid-row: 2; margin: 0; align-self: start; }
.gunatita .verse--quiet   { grid-column: 2; grid-row: 2; align-self: start; margin: 0; }
.gunatita__lede           { grid-column: 1 / -1; grid-row: 3; max-width: 56rem; margin: 0; }
.gunatita__sub            { grid-column: 1 / -1; grid-row: 4; margin: 0; }
.witness                  { grid-column: 1 / -1; grid-row: 5; margin: 0; max-width: 60rem; }
.gunatita__close          { grid-column: 1 / -1; grid-row: 6; max-width: 56rem; margin: 0; }
.gunatita .verse--coda    { grid-column: 1 / -1; grid-row: 7; max-width: 60rem; margin: 0; }

@media (max-width: 860px) {
  .gunatita__title,
  .gunatita .verse--quiet,
  .gunatita__lede,
  .gunatita__sub,
  .witness,
  .gunatita__close,
  .gunatita .verse--coda { grid-column: 1; grid-row: auto; }
}

.gunatita__title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6.5vw, 5.4rem);
  line-height: 1;
  letter-spacing: -.02em;
  font-variation-settings: "opsz" 144, "wght" 340, "SOFT" 80;
  display: grid;
  gap: .35rem;
}
.gunatita__deva {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}
.gunatita__lat {
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 380;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  letter-spacing: 0;
  color: var(--witness-ink-soft);
}
.gunatita__lede,
.gunatita__close {
  font-family: var(--serif);
  font-size: clamp(1.05rem, .55vw + .9rem, 1.22rem);
  line-height: 1.6;
}
.gunatita__close {
  border-top: 1px solid color-mix(in srgb, var(--witness-ink) 16%, transparent);
  padding-top: 2rem;
  color: var(--witness-ink);
  font-style: italic;
  font-variation-settings: "opsz" 18, "wght" 380;
}
.gunatita__sub {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .82rem;
  color: var(--witness-ink-soft);
}

.witness {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.1rem;
  counter-reset: w;
}
.witness li {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1.2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--witness-ink) 12%, transparent);
}
.witness__count {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  font-variation-settings: "opsz" 18, "wght" 420;
  color: var(--witness-ink-soft);
  padding-top: .15rem;
}
.witness p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.55;
}
.witness em { font-style: italic; }
.witness .ref {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--witness-ink-soft);
  margin-left: .5rem;
}

/* ──────────────────────────────────────────────
   Colophon
   ────────────────────────────────────────────── */
.colophon {
  background: var(--witness-paper-2);
  color: var(--witness-ink-soft);
  padding: 4rem var(--gutter) 5rem;
  border-top: 1px solid color-mix(in srgb, var(--witness-ink) 14%, transparent);
}
.colophon .page {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.6rem 3rem;
}
.colophon .page > * { grid-column: auto; grid-row: auto; }
@media (max-width: 720px) {
  .colophon .page { grid-template-columns: 1fr; }
}
.colophon__line {
  font-family: var(--serif);
  font-size: .95rem;
  font-style: italic;
  line-height: 1.6;
  max-width: var(--measure);
  margin: 0;
}
.colophon__mark {
  font-family: var(--deva);
  font-size: 1.3rem;
  letter-spacing: 0;
  margin: 0;
  color: var(--witness-ink);
  opacity: .65;
}

/* ──────────────────────────────────────────────
   Mode-aware masthead
   The fixed masthead recolours with the section in view,
   so it never fights the underlying tone.
   ────────────────────────────────────────────── */
body.in-overture { --bg: var(--sattva-paper);  --ink: var(--sattva-ink); }
body.in-sattva   { --bg: var(--sattva-paper-2);--ink: var(--sattva-ink); }
body.in-rajas    { --bg: var(--rajas-paper);   --ink: var(--rajas-ink); }
body.in-tamas    { --bg: var(--tamas-paper);   --ink: var(--tamas-ink); }
body.in-matrix,
body.in-gunatita { --bg: var(--witness-paper); --ink: var(--witness-ink); }
body { transition: background .8s var(--ease), color .8s var(--ease); }
.masthead { color: var(--ink); }

/* ──────────────────────────────────────────────
   Reveal — verses fade in slightly when entering view.
   Subtle. The point is reading, not animation.
   ────────────────────────────────────────────── */
/* No reveal-on-scroll dance — everything renders at full
   opacity from the start.  The reading experience is the
   animation; the page itself doesn't need to perform. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ──────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .masthead {
    font-size: .65rem;
    padding: .65rem 1rem;
    gap: .8rem;
  }
  .masthead__nav { gap: .8rem; }
  .masthead__lat { display: none; }

  .guna__head {
    grid-template-columns: 1fr;
    gap: .4rem;
  }
  .guna__gloss { justify-self: start; padding-bottom: 0; }
  .analogy {
    grid-template-columns: 1fr;
    gap: .6rem;
  }
  .matrix__grid {
    grid-template-columns: 1fr;
  }
  .matrix__row {
    display: grid;
    grid-template-columns: 1fr;
    border-bottom: 2px solid color-mix(in srgb, var(--witness-ink) 25%, transparent);
    margin-bottom: 1.5rem;
  }
  .matrix__row--header { display: none; }
  .matrix__row > .cell {
    border-bottom: 1px solid color-mix(in srgb, var(--witness-ink) 10%, transparent);
  }
  .cell[data-col]::before {
    display: block;
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    margin-bottom: .35rem;
    opacity: .65;
  }
  .cell[data-col="sattva"]::before { content: "sattva"; color: var(--sattva-glow); }
  .cell[data-col="rajas"]::before  { content: "rajas";  color: var(--rajas-flame); }
  .cell[data-col="tamas"]::before  { content: "tamas";  color: var(--witness-ink); }
}

