/* The Journey In Library: hub page and guide overview pages (shares the look of /learn). */
body { padding-bottom: 40px; }
.gTop { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 92%, var(--accent)); border-bottom: 1px solid var(--line); }
.gTop a.back { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; }
.gWrap { max-width: 820px; margin: 0 auto; padding: 16px; }
h1 { font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; margin: .2em 0; }
.gSec { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; margin: 0 0 18px; }
.gSec h2 { margin-top: 0; }
.gSec p, .gSec li { line-height: 1.65; }
.gSec ul { padding-left: 20px; }
.gSec li { margin: 6px 0; }
.answer { border-left: 3px solid var(--accent2); padding: 12px 16px; background: var(--glow); border-radius: 0 12px 12px 0; margin: 14px 0 22px; line-height: 1.65; }

.libAccess { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 22px; font-size: .9rem; color: var(--muted); }
.libBadge { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-right: 4px; vertical-align: 1px; }
.libBadge.free { background: var(--glow); color: var(--ink); border: 1px solid var(--accent); }
.libBadge.paid { background: var(--accent2); color: var(--onAccent2, #1a1206); }
.libList { display: grid; gap: 16px; }
.libCard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.libCard h2 { margin: 0; font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; line-height: 1.15; }
.libCard h2 a { color: inherit; text-decoration: none; }
.libCard .subtitle { color: var(--muted); margin: 0; }
.libCard p { line-height: 1.6; margin: 0; }
.libMeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.libActions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.libActions a, .libActions button { min-height: 42px; display: inline-flex; align-items: center; text-decoration: none; font: inherit; cursor: pointer; }
.libActions .ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; }
.libActions .goldLine { color: var(--accent); background: transparent; border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 999px; padding: 9px 16px; font-weight: 500; }
.libActions .goldLine:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.libActions .soon { color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 9px 16px; background: transparent; cursor: default; }
.libEmpty { text-align: center; padding: 32px 22px; }
.libBox { border: 1px solid var(--accent); }
@media (max-width: 720px) { .gSec, .libCard { padding: 16px; } h1 { font-size: 1.9rem; } }
.libSeries { font-family: 'Cormorant Garamond', serif; font-size: 1.7rem; margin: 18px 0 0; }
.libSeries:first-child { margin-top: 0; }

/* ---------- Sanctuary (Nov 2026): the Library as a temple library, sacred texts as manuscripts ---------- */
.kicker { letter-spacing: .18em; text-transform: uppercase; font-size: .74rem; color: var(--muted); margin: var(--s2) 0 0; }
.gWrap > h1, article > h1 { position: relative; }
.gWrap > h1::before { content: ""; position: absolute; z-index: -1; left: -12px; top: -60px; width: 220px; height: 220px; pointer-events: none;
  background: var(--accent); opacity: .12; -webkit-mask: var(--yantra) center / contain no-repeat; mask: var(--yantra) center / contain no-repeat; }

/* Each tradition keeps its own colours. */
[data-tradition="vedanta"] { --tr: #d39a3c; --tr2: #f0c46a; }
[data-tradition="yoga"] { --tr: #c99a3a; --tr2: #7f95d6; }
[data-tradition="buddhist"] { --tr: #a8343f; --tr2: #e0a33a; }
[data-tradition="bhakti"] { --tr: #c95b82; --tr2: #e9b4c6; }

/* Manuscript pages */
.ms .gWrap { max-width: 760px; }
.ms article > h1 { font-size: clamp(2.3rem, 6vw, 3.2rem); line-height: 1.05; margin-top: var(--s1); }
.ms article > h1::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 300px; height: 300px; transform: translate(-30%, -50%); pointer-events: none;
  background: var(--tr); opacity: .12; -webkit-mask: var(--yantra) center / contain no-repeat; mask: var(--yantra) center / contain no-repeat; }
.ms .kicker { color: var(--tr); }
.ms .sub { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.25rem; margin: 0; }
.lineage { display: flex; align-items: center; gap: var(--s2); margin: var(--s3) 0 var(--s4); font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.lineage::before, .lineage::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tr) 60%, transparent), transparent); }
.lineage span { text-align: center; }

.verse { position: relative; margin: 0 0 var(--s4); padding: var(--s4) var(--s4) var(--s3) var(--s5); border-radius: 4px;
  background: linear-gradient(color-mix(in srgb, var(--tr) 7%, var(--surface)), color-mix(in srgb, var(--tr) 3%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--tr) 30%, transparent); box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--bg) 70%, transparent), inset 0 0 0 6px color-mix(in srgb, var(--tr) 22%, transparent); }
.vNum { position: absolute; left: var(--s2); top: var(--s4); writing-mode: vertical-rl; transform: rotate(180deg); font: 600 .72rem Inter, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--tr); }
.deva { font-family: "Tiro Devanagari Sanskrit", serif; font-size: clamp(1.3rem, 3.6vw, 1.7rem); line-height: 1.8; margin: 0 0 var(--s2); color: var(--ink); }
.iast { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.08rem; line-height: 1.5; color: var(--muted); margin: 0 0 var(--s3); }
.vEn { font-family: "Cormorant Garamond", serif; font-size: 1.3rem; line-height: 1.45; margin: 0; padding-top: var(--s2); border-top: 1px solid color-mix(in srgb, var(--tr) 25%, transparent); }

.ms .answer { border-left-color: var(--tr); background: color-mix(in srgb, var(--tr) 8%, transparent); }
.ms .gSec:not(.libBox) { background: none; border: 0; border-radius: 0; padding: var(--s3) 0 0; margin: 0 0 var(--s3); }
.ms .gSec:not(.libBox) > h2 { text-align: center; font-size: 1.6rem; margin-bottom: var(--s3); }
.ms .gSec:not(.libBox)::before { content: ""; display: block; width: 160px; height: 20px; margin: 0 auto var(--s2); background: var(--tr); opacity: .7;
  -webkit-mask: var(--ornament) center / contain no-repeat; mask: var(--ornament) center / contain no-repeat; }
.ms .libBox { border-color: color-mix(in srgb, var(--tr) 45%, transparent); }
.ms .opening p { font-family: "Cormorant Garamond", serif; font-size: 1.24rem; line-height: 1.6; }
.ms .opening p:first-of-type::first-letter { float: left; font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 4.2em; line-height: .82;
  padding: .06em .1em 0 0; color: var(--tr); text-shadow: 0 0 18px color-mix(in srgb, var(--tr) 35%, transparent); }
.ms .gSec ol { padding-left: 0; list-style: none; counter-reset: ch; }
.ms .gSec ol li { counter-increment: ch; padding: var(--s1) 0 var(--s1) var(--s5); position: relative; border-bottom: 1px dotted var(--line); }
.ms .gSec ol li::before { content: counter(ch, upper-roman); position: absolute; left: 0; width: 40px; text-align: right; font-family: "Cormorant Garamond", serif; font-weight: 600; color: var(--tr); }
@media (max-width: 600px) { .verse { padding: var(--s3) var(--s3) var(--s3) var(--s4); } .vNum { left: 6px; top: var(--s3); } }

/* The shelf: sacred texts as book spines, each in its tradition's colour. */
.shelfIntro { color: var(--muted); margin: 4px 0 var(--s3); }
.shelf { display: flex; gap: 8px; align-items: flex-end; overflow-x: auto; padding: var(--s3) var(--s2) 0; margin: 0 0 var(--s3); scrollbar-width: thin;
  border-bottom: 6px solid color-mix(in srgb, var(--accent) 40%, var(--bg)); border-radius: 14px 14px 4px 4px;
  background: linear-gradient(transparent 70%, color-mix(in srgb, var(--accent) 7%, transparent)); }
.spine { flex: none; position: relative; width: 62px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 8px;
  padding: var(--s2) 0; text-decoration: none; color: #fbf3e2; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 18%, rgba(255,255,255,.08) 50%, transparent 82%, rgba(0,0,0,.32)), var(--tr);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 6px 16px rgba(0,0,0,.25); transition: transform .25s ease, box-shadow .25s ease; }
.spine:nth-child(3n+1) { height: 236px; } .spine:nth-child(3n+2) { height: 214px; } .spine:nth-child(3n) { height: 252px; }
.spine:hover, .spine:focus-visible { transform: translateY(-10px); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 14px 26px rgba(0,0,0,.32), 0 0 22px color-mix(in srgb, var(--tr) 45%, transparent); }
.spine::before, .spine::after { content: ""; position: absolute; left: 8px; right: 8px; height: 2px; background: var(--tr2); opacity: .8; }
.spine::before { top: 30px; } .spine::after { bottom: 34px; }
.spT { writing-mode: vertical-rl; transform: rotate(180deg); font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 1.08rem; letter-spacing: .04em; line-height: 1; flex: 1; text-align: center; padding: 30px 0 10px; }
.spL { font-size: .56rem; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.spine .spDot { width: 6px; height: 6px; border-radius: 50%; background: var(--tr2); }
.texts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-bottom: var(--s4); }
.textRow { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--tr); border-radius: 4px 14px 14px 4px; }
.textRow h3 { margin: 0; font-size: 1.3rem; line-height: 1.15; } .textRow h3 a { color: inherit; text-decoration: none; }
.textRow .lin { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.textRow .libActions { margin-top: auto; }
.textRow .libActions a { min-height: 38px; padding: 7px 14px; font-size: .88rem; }
@media (max-width: 720px) { .texts { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .spine { transition: none; } }

/* ---------- Online reader (Bhagavad Gita) ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rBar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: var(--s3) 0 var(--s4); padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.rPick { flex: 1 1 220px; min-width: 0; }
.rPick select { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
#rIast[aria-pressed="true"] { border-color: var(--tr); color: var(--tr); }
.rVerse { position: relative; margin: 0; padding: var(--s3) 0 var(--s3) 64px; border-bottom: 1px dotted var(--line); scroll-margin-top: 80px; }
.rVerse .deva { font-size: clamp(1.15rem, 3.2vw, 1.45rem); line-height: 1.75; margin: 0 0 6px; }
.rVerse .deva span, .rVerse .iast span { display: block; }
.rVerse .spk { font-size: .78em; color: var(--tr); letter-spacing: .02em; }
.rVerse .iast { display: none; font-size: 1.02rem; margin: 0 0 8px; }
.showIast .rVerse .iast { display: block; }
.rVerse .vEn { font-size: 1.2rem; border-top: 0; padding-top: 2px; }
.rNum { position: absolute; left: 0; top: calc(var(--s3) + 2px); min-width: 50px; min-height: 32px; display: flex; align-items: center; justify-content: flex-end; gap: 3px; padding: 0 4px 0 0; box-sizing: border-box;
  font: 600 .78rem Inter, sans-serif; letter-spacing: .06em; color: var(--tr); text-decoration: none; border-radius: 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rNum::after { content: ""; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid currentColor; opacity: .6; transition: transform .2s; }
.rVerse.open .rNum::after { transform: rotate(180deg); }
.rNum:hover, .rNum:focus-visible, .rVerse.open .rNum { background: color-mix(in srgb, var(--tr) 14%, transparent); }
.rAct { display: none; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rAct .ghost { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: transparent; font: inherit; font-size: .85rem; cursor: pointer; }
.rVerse.open .rAct { display: flex; }
.rVerse.open { background: color-mix(in srgb, var(--tr) 5%, transparent); }
.rVerse.hl { animation: rHl 2.4s ease-out; }
@keyframes rHl { 0% { background: color-mix(in srgb, var(--tr) 22%, transparent); } 100% { background: transparent; } }
.rColophon { margin: var(--s4) 0 0; text-align: center; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.08rem; color: var(--muted); }
.rLoading { padding: var(--s5) 0; text-align: center; }
.rGate { margin: var(--s5) 0; padding: var(--s4); text-align: center; border: 1px solid color-mix(in srgb, var(--tr) 45%, transparent); border-radius: 16px;
  background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--tr) 14%, transparent), transparent 70%), var(--surface); }
.rGate h2 { margin: 6px 0 8px; font-size: 1.7rem; }
.rGate p { max-width: 520px; margin: 0 auto var(--s3); color: var(--muted); }
.rGate .libActions { justify-content: center; }
.rGateMark { color: var(--tr); font-size: 1.4rem; }
.rNav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: var(--s5) 0 var(--s4); }
.rNav a { text-decoration: none; min-height: 44px; }
.rNav .ghost { color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; background: transparent; }
.libActions .readBtn { margin-right: 4px; }
@media (max-width: 600px) { .rVerse { padding-left: 48px; } .rNum { min-width: 42px; font-size: .7rem; } .rNav a { flex: 1 1 100%; } }

/* ---------- The reader as an old scroll: weathered parchment between two rolled ends ---------- */
.reader .gWrap { max-width: 800px; padding-left: 22px; padding-right: 22px; }
.scroll { position: relative; margin: var(--s3) 0 var(--s5); filter: drop-shadow(0 18px 30px rgba(0,0,0,.55)) drop-shadow(0 0 60px rgba(226,182,94,.10)); }
.sheet {
  /* parchment ink: iron-gall browns with vermilion rubrics */
  --ink: #2f1d0d; --muted: #6c5235; --line: rgba(90,56,20,.24); --surface: rgba(255,246,222,.45); --bg: #e2d0a6;
  --tr: #9c2f1a; --tr2: #b07a26;
  position: relative; color: var(--ink); margin: 0 6px; padding: 30px 34px 34px;
  background-color: #e6d5ad;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .33 0 0 0 0 .2 0 0 0 0 .07 0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(closest-side, rgba(128,78,26,.20), transparent),
    radial-gradient(closest-side, rgba(120,72,24,.15), transparent),
    radial-gradient(closest-side, rgba(255,246,220,.35), transparent),
    radial-gradient(closest-side, rgba(110,66,20,.13), transparent),
    radial-gradient(ellipse at 18% 12%, rgba(120,72,24,.16), transparent 28%),
    radial-gradient(ellipse at 84% 46%, rgba(110,64,20,.12), transparent 24%),
    radial-gradient(ellipse at 30% 78%, rgba(120,70,22,.14), transparent 26%),
    linear-gradient(90deg, rgba(110,70,30,.28), transparent 9%, transparent 91%, rgba(110,70,30,.28)),
    linear-gradient(180deg, #ecdcb6, #e3cfa3 40%, #e8d7b0 70%, #dcc596);
  background-size: 260px 260px, 380px 520px, 300px 760px, 460px 640px, 220px 980px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-position: 0 0, 40px 90px, 210px 400px, 120px 30px, 330px 650px, 0 0, 0 0, 0 0, 0 0, 0 0;
  background-repeat: repeat, repeat, repeat, repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  box-shadow: inset 0 0 70px rgba(92,52,14,.42), inset 0 0 14px rgba(70,38,8,.45), inset 0 26px 22px -16px rgba(60,34,10,.55), inset 0 -26px 22px -16px rgba(60,34,10,.55);
  clip-path: var(--edge, none);
}
.sheet h1 { color: #2a170a; text-shadow: 0 1px 0 rgba(255,245,215,.5); }
.sheet .kicker, .sheet .spk, .sheet .rNum { color: var(--tr); }
.sheet .sub { color: var(--muted); }
.sheet .deva { color: #2a160a; }
.sheet .vEn { color: #36230f; }
.sheet .iast { color: #6f5232; }
.ms .sheet > h1::before { display: none; }
.sheet .rBar { top: var(--topH, 64px); flex-wrap: nowrap; background: rgba(226,206,160,.97); border-radius: 0 0 10px 10px; border-bottom-color: var(--line); margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; backdrop-filter: none; }
.sheet .rPick select { background: rgba(255,248,228,.6); color: var(--ink); border-color: rgba(90,56,20,.35); }
.sheet .ghost, .sheet .rAct .ghost, .sheet .rNav .ghost { color: var(--ink); border-color: rgba(90,56,20,.38); background: rgba(255,248,228,.35); }
.sheet .rVerse { border-bottom: 0; }
.sheet .rVerse + .rVerse::before { content: "❦"; position: absolute; top: -.7em; left: 50%; transform: translateX(-50%); font-size: .8rem; color: rgba(156,47,26,.45); }
.sheet .rVerse.open { background: rgba(156,47,26,.06); }
.sheet .rColophon { color: #5d4428; }
.sheet .rGate { background: radial-gradient(circle at 50% 0, rgba(156,47,26,.10), transparent 70%), rgba(255,246,222,.4); border-color: rgba(156,47,26,.35); }
.sheet .rGate p { color: var(--muted); }
.sheet ::selection { background: rgba(156,47,26,.22); }

/* The rolled ends, with turned wooden handles */
.roll { position: relative; z-index: 2; height: 30px; border-radius: 15px;
  background: linear-gradient(180deg, #5a3d1a 0%, #b4935e 14%, #ead8ad 34%, #f3e5c2 44%, #cdb07a 62%, #94703e 82%, #4c3214 100%);
  box-shadow: 0 6px 10px -4px rgba(0,0,0,.55), inset 0 0 0 1px rgba(70,44,14,.35); }
.roll.top { margin-bottom: -8px; }
.roll.bottom { margin-top: -8px; }
.roll::before, .roll::after { content: ""; position: absolute; top: 50%; width: 18px; height: 40px; transform: translateY(-50%); border-radius: 7px;
  background: linear-gradient(180deg, #2c1606, #7a4a1e 25%, #b37a3e 45%, #6b3f17 70%, #241104);
  box-shadow: 0 3px 6px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,220,160,.12); }
.roll::before { left: -14px; }
.roll::after { right: -14px; }
@media (max-width: 600px) {
  .reader .gWrap { padding-left: 18px; padding-right: 18px; }
  .sheet { padding: 22px 18px 26px; margin: 0 2px; }
  .roll { height: 24px; }
  .roll::before, .roll::after { width: 12px; height: 32px; }
  .roll::before { left: -10px; } .roll::after { right: -10px; }
}

/* Reader parts shared by every scripture: speakers, notes, introductions, section headings, prose texts */
.rTitleSa { margin: 6px 0 -4px; font-size: 1.35rem; color: var(--tr); }
.rIntro { margin: 0 0 var(--s3); padding: 0 6px; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.12rem; line-height: 1.55; color: var(--muted); text-align: center; }
.rIntro p { margin: 0 0 8px; }
.rSub { margin: var(--s4) 0 var(--s2); text-align: center; font-family: Inter, sans-serif; font-size: .78rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--tr); }
.rSub::before, .rSub::after { content: "—"; margin: 0 10px; opacity: .55; }
.rWho { margin: 0 0 4px; font: 600 .74rem Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--tr); }
.rVerse .vEn + .vEn { margin-top: 8px; }
.vNote { margin: 10px 0 0; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--tr) 35%, transparent); font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.04rem; line-height: 1.5; color: var(--muted); }
.rVerse .deva.prose { display: block; font-size: clamp(1.05rem, 2.9vw, 1.28rem); line-height: 1.8; margin: 0 0 8px; }
.rVerse .iast.prose { font-size: 1rem; }
.showIast .rVerse .iast.prose { display: block; }
.rColophon .deva { font-size: 1.15rem; font-style: normal; margin: 0 0 6px; }
.rColophon p { margin: 0 0 6px; }
