/* ==========================================================================
   css/styles.css — "Mahabharata: The Living Epic" design system
   --------------------------------------------------------------------------
   Tailwind (Play CDN) supplies small utilities; everything structural lives
   here so the site still looks right if the CDN is unavailable.

   PALETTE (contrast verified by tools/contrast.js — WCAG AA):
     --indigo-deep  #0e1433   night sky / nav / hero
     --indigo       #1b2559   primary ink on light, button text on saffron
     --indigo-soft  #2c3a7a
     --saffron      #e8892b   accents, CTA background (with indigo text)
     --saffron-ink  #9a4a06   saffron used as TEXT on cream (AA)
     --gold         #d4a537   ornaments only (never text on light)
     --gold-light   #f0cf7a   text accent on dark
     --cream        #fbf5e9   page background
     --parchment    #f3e7cf   cards / panels
     --ink          #2a2118   body text
     --muted        #5a4e3c   secondary text on cream/parchment
     --forest       #2f5d4a   subtle green accents
   MODES: <html data-mode="kids|explorer|scholar"> switches tokens below.
   ========================================================================== */
:root {
  --indigo-deep: #0e1433; --indigo: #1b2559; --indigo-soft: #2c3a7a;
  --saffron: #e8892b; --saffron-ink: #9a4a06; --gold: #d4a537; --gold-light: #f0cf7a;
  --cream: #fbf5e9; --parchment: #f3e7cf; --parchment-2: #eadbbd;
  --ink: #2a2118; --muted: #5a4e3c; --forest: #2f5d4a; --forest-soft: #e3efe8;
  --on-dark: #fbf5e9; --on-dark-muted: #cfcbe3;
  --radius: 14px; --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(14,20,51,.06), 0 8px 24px -12px rgba(14,20,51,.25);
  --shadow-lg: 0 2px 4px rgba(14,20,51,.08), 0 24px 48px -20px rgba(14,20,51,.45);
  --font-display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --font-body: "Source Serif 4", "Lora", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --base-size: 17px;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
html[data-mode="kids"] { --base-size: 18.5px; --radius: 22px; --radius-lg: 30px; --cream: #fff6e6; --parchment: #fde9c9; }
html[data-mode="scholar"] { --base-size: 16.5px; --radius: 8px; --radius-lg: 12px; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-body); font-size: var(--base-size); line-height: 1.65;
  color: var(--ink); background: var(--cream);
  background-image: radial-gradient(circle at 10% 0%, rgba(212,165,55,.07), transparent 40%),
                    radial-gradient(circle at 90% 30%, rgba(47,93,74,.05), transparent 40%);
  min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--indigo); text-underline-offset: 3px; }
a:hover { color: var(--saffron-ink); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--indigo); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
.ui { font-family: var(--font-ui); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 820px; }

/* ---------- Focus: visible, high-contrast, works on light & dark ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(232,137,43,.55); border-radius: 6px; }
.on-dark :focus-visible, .site-header :focus-visible, .hero :focus-visible, .site-footer :focus-visible { outline-color: var(--gold-light); box-shadow: 0 0 0 6px rgba(232,137,43,.45); }
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--saffron); color: var(--indigo); padding: .7rem 1.1rem; font: 600 .95rem var(--font-ui); border-radius: 10px; text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(14,20,51,.96); color: var(--on-dark); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(240,207,122,.18); }
.site-header .bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: .6rem 1.25rem; max-width: 1320px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--on-dark); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--gold-light); }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand .t1 { font: 600 1.25rem/1 var(--font-display); letter-spacing: .02em; display: block; }
.brand .t2 { font: 500 .7rem/1.2 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-light); display: block; margin-top: 3px; }
.main-nav { display: none; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .15rem; }
.main-nav a { display: block; padding: .5rem .6rem; border-radius: 10px; color: var(--on-dark-muted); text-decoration: none; font: 500 .9rem var(--font-ui); transition: color .2s, background .2s; position: relative; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.main-nav a[aria-current="page"] { color: var(--gold-light); }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: .2rem; height: 2px; background: var(--saffron); border-radius: 2px; }
.main-nav .soon { font-size: .62rem; color: var(--on-dark-muted); opacity: .8; margin-left: .25rem; vertical-align: super; }
@media (min-width: 1120px) { .main-nav { display: block; } .menu-btn { display: none !important; } }
@media (min-width: 768px) { .site-header .bar { flex-wrap: nowrap; } }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid rgba(240,207,122,.25); background: rgba(255,255,255,.04); color: var(--on-dark); cursor: pointer; font: 500 .85rem var(--font-ui); padding: 0 .7rem; transition: background .2s, border-color .2s; }
.icon-btn:hover { background: rgba(255,255,255,.1); border-color: var(--gold-light); }
.icon-btn svg { width: 20px; height: 20px; }

/* Search (combobox) */
.search { position: relative; order: 10; flex: 1 1 100%; }
@media (min-width: 768px) { .search { order: 0; flex: 0 1 270px; min-width: 170px; } }
.search input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid rgba(240,207,122,.3); background: rgba(255,255,255,.07); color: #fff; font: 400 .95rem var(--font-ui); padding: 0 2.6rem 0 2.4rem; transition: background .2s, border-color .2s; }
.search input::placeholder { color: var(--on-dark-muted); }
.search input:focus { background: rgba(255,255,255,.12); border-color: var(--gold-light); }
.search .s-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--on-dark-muted); pointer-events: none; }
.search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); font: 500 .72rem var(--font-ui); color: var(--on-dark-muted); border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 1px 6px; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--cream); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-lg); max-height: min(70vh, 480px); overflow: auto; padding: .35rem; margin: 0; list-style: none; z-index: 60; border: 1px solid var(--parchment-2); }
@media (min-width: 768px) { .search-results { min-width: 420px; } }
.search-results[hidden] { display: none; }
.search-results li { display: flex; gap: .7rem; align-items: center; padding: .55rem .65rem; border-radius: 10px; cursor: pointer; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--parchment); }
.search-results .r-type { font: 600 .66rem var(--font-ui); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); min-width: 74px; }
.search-results .r-title { font: 600 .98rem var(--font-ui); color: var(--indigo); }
.search-results .r-sub { font: 400 .82rem var(--font-ui); color: var(--muted); }
.search-results .r-empty { color: var(--muted); font: .9rem var(--font-ui); cursor: default; }

/* Journey chip + popover */
.journey { position: relative; }
.journey-chip svg.jring { width: 26px; height: 26px; transform: rotate(-90deg); }
.journey-chip .ring-bg { stroke: rgba(255,255,255,.18); }
.journey-chip .ring-fg { stroke: var(--gold-light); transition: stroke-dashoffset .6s var(--ease); }
.journey-pop { position: absolute; right: 0; top: calc(100% + 8px); width: min(340px, 92vw); background: var(--cream); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 1.1rem 1.2rem; z-index: 60; border: 1px solid var(--parchment-2); }
.journey-pop[hidden] { display: none; }
.journey-pop h2 { font-size: 1.35rem; margin-bottom: .2rem; }
.meter { margin: .8rem 0; }
.meter .lbl { display: flex; justify-content: space-between; font: 500 .85rem var(--font-ui); color: var(--ink); }
.meter .track { height: 9px; background: var(--parchment-2); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.meter .fill { height: 100%; background: linear-gradient(90deg, var(--forest), var(--saffron)); border-radius: 99px; transition: width .6s var(--ease); }
.link-btn { background: none; border: 0; padding: .3rem 0; color: var(--indigo); text-decoration: underline; cursor: pointer; font: 500 .85rem var(--font-ui); }

/* Mode strip */
.mode-strip { background: linear-gradient(180deg, rgba(27,37,89,.98), rgba(14,20,51,.98)); border-top: 1px solid rgba(255,255,255,.05); }
.mode-strip .inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .35rem 1.25rem; max-width: 1320px; margin: 0 auto; flex-wrap: wrap; }
.mode-strip .hint { font: 400 .78rem var(--font-ui); color: var(--on-dark-muted); }
.mode-toggle { display: inline-flex; border: 1px solid rgba(240,207,122,.3); border-radius: 999px; padding: 3px; background: rgba(255,255,255,.04); margin: 0; }
.mode-toggle legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mode-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-toggle label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; padding: .35rem .85rem; min-height: 36px; border-radius: 999px; font: 500 .82rem var(--font-ui); color: var(--on-dark-muted); transition: background .25s var(--ease), color .25s; white-space: nowrap; }
.mode-toggle label small { font-size: .7rem; opacity: .85; }
.mode-toggle input:checked + label { background: var(--saffron); color: var(--indigo); font-weight: 650; }
.mode-toggle input:focus-visible + label { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.mode-toggle label:hover { color: #fff; }
.mode-toggle input:checked + label:hover { color: var(--indigo); }

/* Mobile menu */
.mobile-nav { background: var(--indigo-deep); border-top: 1px solid rgba(255,255,255,.08); }
.mobile-nav[hidden] { display: none; }
.mobile-nav ul { list-style: none; margin: 0; padding: .5rem 1rem 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: .25rem; }
.mobile-nav a { display: block; padding: .8rem .9rem; color: var(--on-dark); text-decoration: none; border-radius: 10px; font: 500 .95rem var(--font-ui); }
.mobile-nav a:hover, .mobile-nav a[aria-current="page"] { background: rgba(255,255,255,.08); color: var(--gold-light); }

/* ---------- Main & transitions ---------- */
main { flex: 1; outline: none; }
.view { animation: viewIn .5s var(--ease) both; }
.view.leaving { animation: viewOut .18s ease-in both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-6px); } }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* Boot loader / inline loader */
.boot { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--indigo-deep); color: var(--on-dark); transition: opacity .6s ease, visibility .6s; }
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot .lotus { width: 92px; height: 92px; animation: breathe 2.4s ease-in-out infinite; }
.boot p { font: 500 .8rem var(--font-ui); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-light); margin-top: 1rem; text-align: center; }
@keyframes breathe { 0%,100% { transform: scale(.94); opacity: .75; } 50% { transform: scale(1.04); opacity: 1; } }
.loading-inline { display: grid; place-items: center; padding: 6rem 1rem; color: var(--muted); font: 500 .9rem var(--font-ui); }
.loading-inline svg { width: 56px; height: 56px; animation: breathe 2s ease-in-out infinite; margin-bottom: .8rem; }
.skeleton { background: linear-gradient(90deg, var(--parchment) 0%, var(--cream) 50%, var(--parchment) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; color: var(--on-dark); background: radial-gradient(ellipse at 50% 120%, #3a2a5a 0%, transparent 55%), radial-gradient(ellipse at 80% 10%, rgba(232,137,43,.25), transparent 45%), linear-gradient(180deg, #0b1030 0%, #141c48 60%, #1d2257 100%); min-height: min(88vh, 820px); display: flex; align-items: center; isolation: isolate; }
.hero .layer { position: absolute; pointer-events: none; will-change: transform; }
.hero .stars { inset: 0; background-image: radial-gradient(1px 1px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 20%, #fff6, transparent), radial-gradient(1.5px 1.5px at 40% 70%, #fff5, transparent), radial-gradient(1px 1px at 85% 60%, #fff7, transparent), radial-gradient(1px 1px at 10% 80%, #fff5, transparent), radial-gradient(1.5px 1.5px at 55% 15%, #fff6, transparent); }
.hero .mandala-big { width: min(900px, 140vw); right: -18%; top: -20%; opacity: .14; color: var(--gold-light); }
.hero .mandala-sm { width: 360px; left: -120px; bottom: -120px; opacity: .1; color: var(--saffron); }
.hero .horizon { left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, transparent, rgba(232,137,43,.18) 70%, rgba(232,137,43,.28)); }
.hero-inner { position: relative; z-index: 2; padding: 5rem 1.25rem 4rem; max-width: 1000px; margin: 0 auto; text-align: center; }
.eyebrow { font: 600 .78rem var(--font-ui); letter-spacing: .28em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 1rem; display: inline-flex; align-items: center; gap: .7rem; }
.eyebrow::before, .eyebrow::after { content: ""; width: 34px; height: 1px; background: currentColor; opacity: .6; }
.hero h1 { color: #fff; font-size: clamp(2.6rem, 7vw, 5.2rem); font-weight: 600; letter-spacing: .01em; margin-bottom: .2em; }
.hero .tagline { font: italic 400 clamp(1.15rem, 2.4vw, 1.6rem)/1.4 var(--font-display); color: var(--on-dark); max-width: 720px; margin: 0 auto 1.2rem; }
.hero .sub { color: var(--on-dark-muted); max-width: 640px; margin: 0 auto 2rem; font-size: 1.02rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 48px; padding: .75rem 1.5rem; border-radius: 999px; font: 600 1rem var(--font-ui); text-decoration: none; cursor: pointer; border: 0; transition: transform .2s var(--ease), box-shadow .25s, background .2s; }
.btn-primary { background: var(--saffron); color: var(--indigo); box-shadow: 0 10px 30px -10px rgba(232,137,43,.7); }
.btn-primary:hover { transform: translateY(-2px); color: var(--indigo); box-shadow: 0 16px 34px -12px rgba(232,137,43,.85); background: #f0973c; }
.btn-ghost { background: transparent; color: var(--on-dark); border: 1px solid rgba(240,207,122,.45); }
.btn-ghost:hover { color: var(--gold-light); border-color: var(--gold-light); transform: translateY(-2px); }
.btn-light { background: var(--parchment); color: var(--indigo); border: 1px solid var(--parchment-2); }
.btn-light:hover { background: var(--parchment-2); color: var(--indigo); }
.btn svg { width: 18px; height: 18px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: -3.5rem; position: relative; z-index: 3; }
.tile { display: flex; flex-direction: column; gap: .4rem; padding: 1.3rem 1.3rem 1.2rem; background: var(--cream); border: 1px solid var(--parchment-2); border-radius: var(--radius-lg); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(232,137,43,.18), transparent 70%); transition: transform .5s var(--ease); }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold); color: var(--ink); }
.tile:hover::after { transform: scale(1.6); }
.tile .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--indigo); color: var(--gold-light); }
.tile .ic svg { width: 24px; height: 24px; }
.tile h3 { margin: .4rem 0 0; font-size: 1.3rem; }
.tile p { margin: 0; color: var(--muted); font-size: .93rem; }
.tile .go { font: 600 .82rem var(--font-ui); color: var(--saffron-ink); margin-top: auto; padding-top: .4rem; }
.badge-soon { display: inline-block; font: 600 .66rem var(--font-ui); letter-spacing: .06em; text-transform: uppercase; background: var(--forest-soft); color: var(--forest); padding: .15rem .5rem; border-radius: 99px; vertical-align: middle; }

/* ---------- Sections ---------- */
.section { padding: 4.5rem 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; }
.section-head p { color: var(--muted); max-width: 640px; margin: 0; }
.kicker { font: 600 .74rem var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--saffron-ink); margin-bottom: .5rem; display: block; }
.ornament { display: flex; align-items: center; justify-content: center; gap: .8rem; color: var(--gold); margin: 2.5rem 0; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 90px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 22px; height: 22px; }
.panel { background: var(--parchment); border: 1px solid var(--parchment-2); border-radius: var(--radius-lg); padding: 1.5rem; }
.panel-dark { background: var(--indigo); color: var(--on-dark); border-radius: var(--radius-lg); padding: 2rem; position: relative; overflow: hidden; }
.panel-dark h2, .panel-dark h3 { color: #fff; }
.panel-dark p { color: var(--on-dark-muted); }
.modes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.mode-card { background: rgba(255,255,255,.05); border: 1px solid rgba(240,207,122,.2); border-radius: var(--radius); padding: 1.2rem; }
.mode-card h3 { font-size: 1.3rem; color: var(--gold-light) !important; }
.mode-card button { margin-top: .6rem; }

/* ---------- Character cards ---------- */
.filters { display: grid; grid-template-columns: 1fr; gap: .75rem; background: var(--parchment); border: 1px solid var(--parchment-2); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr repeat(3, 1fr) auto; align-items: end; } }
.field label { display: block; font: 600 .74rem var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.field input, .field select { width: 100%; height: 44px; border-radius: 10px; border: 1px solid #8a7a5c; background: var(--cream); color: var(--ink); font: 400 .95rem var(--font-ui); padding: 0 .75rem; }
.field input:focus, .field select:focus { border-color: var(--indigo); }
.result-count { font: 500 .88rem var(--font-ui); color: var(--muted); margin: 0 0 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1.25rem; list-style: none; padding: 0; margin: 0; }
.char-card { height: 100%; display: flex; flex-direction: column; background: var(--cream); border: 1px solid var(--parchment-2); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; position: relative; }
.char-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--gold); color: var(--ink); }
.char-card .portrait { aspect-ratio: 4 / 3.4; }
.char-card .body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.char-card .names { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.char-card h3 { margin: 0; font-size: 1.45rem; }
.char-card .tagline { font: italic 500 1rem/1.35 var(--font-display); color: var(--indigo-soft); margin: 0; }
.char-card .hook { font-size: .9rem; color: var(--muted); margin: .2rem 0 0; }
.char-card .meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .6rem; }
.char-card .visited { position: absolute; top: .7rem; right: .7rem; background: rgba(14,20,51,.82); color: var(--gold-light); font: 600 .68rem var(--font-ui); padding: .25rem .55rem; border-radius: 99px; display: flex; gap: .3rem; align-items: center; z-index: 2; }
.char-card .depth { position: absolute; top: .7rem; left: .7rem; z-index: 2; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font: 600 .7rem var(--font-ui); letter-spacing: .03em; padding: .22rem .6rem; border-radius: 99px; border: 1px solid transparent; white-space: nowrap; }
.pill.f-pandava { background: #e2e7f7; color: #1b2559; border-color: #c4cdeb; }
.pill.f-kaurava { background: #f6e1dc; color: #7a1f2b; border-color: #ebc6be; }
.pill.f-neutral { background: var(--forest-soft); color: var(--forest); border-color: #c4dccf; }
.pill.f-divine  { background: #fbefc8; color: #6b4a00; border-color: #eedc9c; }
.pill.role { background: var(--parchment); color: var(--muted); border-color: var(--parchment-2); }
.pill.full { background: var(--indigo); color: var(--gold-light); }
.pill.summary { background: rgba(251,245,233,.92); color: var(--muted); border-color: var(--parchment-2); }

/* Portrait placeholder */
.portrait { position: relative; overflow: hidden; background: var(--indigo); }
.portrait img, .portrait svg.ph { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--ease); }
.char-card:hover .portrait svg.ph, .char-card:hover .portrait img { transform: scale(1.05); }

/* ---------- Character detail ---------- */
.crumbs { font: 500 .85rem var(--font-ui); color: var(--muted); padding: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.crumbs a { color: var(--indigo); }
.back-ctx { display: inline-flex; align-items: center; gap: .4rem; background: var(--parchment); border: 1px solid var(--parchment-2); padding: .35rem .8rem; border-radius: 99px; text-decoration: none; font: 600 .82rem var(--font-ui); }
.detail-hero { display: grid; gap: 2rem; padding: 1.5rem 0 2rem; align-items: center; }
@media (min-width: 860px) { .detail-hero { grid-template-columns: minmax(280px, 400px) 1fr; } }
.detail-hero .portrait { border-radius: var(--radius-lg); aspect-ratio: 4/4.4; box-shadow: var(--shadow-lg); }
.detail-hero .iast { font: italic 1rem var(--font-body); color: var(--muted); }
.detail-hero .aliases { font: 400 .88rem var(--font-ui); color: var(--muted); margin: .4rem 0 1rem; }
.detail-hero .tagline { font: italic 500 1.45rem/1.35 var(--font-display); color: var(--indigo-soft); margin: .4rem 0 .6rem; }
.detail-hero .hook { font-size: 1.08rem; }
.fnote { font: 400 .85rem var(--font-ui); color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.detail-layout { display: grid; gap: 2.5rem; padding-bottom: 3rem; }
@media (min-width: 1024px) { .detail-layout { grid-template-columns: 220px 1fr; } }
.toc { position: sticky; top: 140px; align-self: start; display: none; }
@media (min-width: 1024px) { .toc { display: block; } }
.toc h2 { font: 600 .74rem var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--parchment-2); }
.toc a { display: block; padding: .3rem .8rem; color: var(--muted); text-decoration: none; font: 500 .88rem var(--font-ui); margin-left: -2px; border-left: 2px solid transparent; }
.toc a:hover, .toc a.active { color: var(--indigo); border-left-color: var(--saffron); }
.dsec { padding: 1.8rem 0; border-top: 1px solid var(--parchment-2); scroll-margin-top: 140px; }
.dsec:first-child { border-top: 0; padding-top: 0; }
.dsec > h2 { display: flex; align-items: center; gap: .6rem; }
.dsec > h2 .num { font: 600 .75rem var(--font-ui); color: var(--saffron-ink); border: 1px solid currentColor; border-radius: 99px; padding: .1rem .5rem; }
.lead { font-size: 1.12rem; line-height: 1.75; }
.cols-2 { display: grid; gap: 1.25rem; }
@media (min-width: 720px) { .cols-2 { grid-template-columns: 1fr 1fr; } }
.list-box { background: var(--parchment); border-radius: var(--radius); padding: 1.1rem 1.25rem; border: 1px solid var(--parchment-2); }
.list-box h3 { font-size: 1.15rem; display: flex; align-items: center; gap: .4rem; }
.list-box ul { margin: 0; padding-left: 1.1rem; }
.list-box li { margin: .3rem 0; }
.list-box.strength { border-left: 4px solid var(--forest); }
.list-box.limit { border-left: 4px solid var(--saffron); }
.list-box.conflict { border-left: 4px solid var(--indigo-soft); }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .75rem; list-style: none; padding: 0; margin: 0; }
.rel { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem; border-radius: var(--radius); background: var(--cream); border: 1px solid var(--parchment-2); text-decoration: none; color: var(--ink); height: 100%; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
a.rel:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.rel .av { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex: none; }
.rel .av svg { width: 100%; height: 100%; }
.rel strong { font: 600 .98rem var(--font-ui); color: var(--indigo); display: block; }
.rel .lbl { font: 600 .7rem var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--saffron-ink); }
.rel p { margin: .15rem 0 0; font-size: .86rem; color: var(--muted); line-height: 1.45; }
.tp-list { list-style: none; margin: 1rem 0 0; padding: 0; position: relative; }
.tp-list::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--gold), var(--parchment-2)); }
.tp { position: relative; padding: 0 0 1.6rem 2.4rem; }
.tp::before { content: ""; position: absolute; left: 4px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--cream); border: 3px solid var(--saffron); }
.tp h3 { margin-bottom: .25rem; }
.tp .tp-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.tp .parva-link { font: 600 .74rem var(--font-ui); color: var(--forest); text-decoration: none; background: var(--forest-soft); padding: .15rem .55rem; border-radius: 99px; }
.tp .parva-link:hover { text-decoration: underline; color: var(--forest); }
.sens { display: inline-flex; align-items: center; gap: .35rem; font: 500 .74rem var(--font-ui); color: #6a3d0a; background: #fbecd6; border: 1px dashed #d9a35e; padding: .15rem .6rem; border-radius: 99px; }
.sens svg { width: 13px; height: 13px; }
.quote { position: relative; margin: 0 0 1rem; padding: 1.2rem 1.4rem 1.1rem 3.2rem; background: var(--parchment); border-radius: var(--radius); border: 1px solid var(--parchment-2); }
.quote::before { content: "“"; position: absolute; left: .9rem; top: -.1rem; font: 600 3.6rem/1 var(--font-display); color: var(--gold); }
.quote p.line { font: italic 500 1.25rem/1.45 var(--font-display); color: var(--indigo); margin-bottom: .4rem; }
.quote .ctx { font-size: .92rem; color: var(--ink); margin-bottom: .35rem; }
.quote footer { font: 500 .78rem var(--font-ui); color: var(--muted); }
.quote .para-tag { font: 700 .62rem var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--forest); background: var(--forest-soft); padding: .1rem .45rem; border-radius: 4px; margin-right: .4rem; }
.term-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.term-table th, .term-table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--parchment-2); vertical-align: top; }
.term-table th { font: 600 .72rem var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.term-table td em { color: var(--indigo); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.gallery figure { margin: 0; background: var(--cream); border: 1px solid var(--parchment-2); border-radius: var(--radius); overflow: hidden; height: 100%; }
.gallery .ph-art { aspect-ratio: 16/10; }
.gallery .ph-art svg { width: 100%; height: 100%; display: block; }
.gallery figcaption { padding: .8rem 1rem 1rem; font-size: .88rem; color: var(--muted); }
.gallery figcaption strong { display: block; font: 600 1.05rem var(--font-display); color: var(--indigo); margin-bottom: .2rem; }
.callout { display: flex; gap: 1rem; align-items: flex-start; padding: 1.2rem 1.3rem; border-radius: var(--radius-lg); background: linear-gradient(135deg, #fff1d6, #fde3b8); border: 1px solid #f1c98a; }
.callout .ic { font-size: 1.8rem; line-height: 1; }
.callout h3 { margin-bottom: .2rem; font-size: 1.2rem; }
.callout p { margin: 0; }
.callout.green { background: linear-gradient(135deg, #eaf4ee, #d9ebe1); border-color: #b5d4c3; }
.note { font: 400 .88rem var(--font-ui); color: var(--muted); background: var(--parchment); border-radius: 10px; padding: .7rem .9rem; border-left: 3px solid var(--gold); }
.scholar-hint { font: 500 .85rem var(--font-ui); color: var(--muted); }
.scholar-hint button { font: inherit; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: .9rem; list-style: none; padding: 0; margin: 0; }
.mini-card { display: flex; gap: .7rem; align-items: center; padding: .7rem; border-radius: var(--radius); background: var(--cream); border: 1px solid var(--parchment-2); text-decoration: none; color: var(--ink); height: 100%; transition: border-color .2s, transform .25s var(--ease); }
.mini-card:hover { border-color: var(--gold); transform: translateY(-2px); color: var(--ink); }
.mini-card .av { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none; }
.mini-card .av svg { width: 100%; height: 100%; }
.mini-card strong { display: block; font: 600 .95rem var(--font-ui); color: var(--indigo); }
.mini-card span { font-size: .8rem; color: var(--muted); }
.mini-card .num-av { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--indigo); color: var(--gold-light); font: 600 1.1rem var(--font-display); flex: none; }

/* Parvas */
.parva-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.parva-card { display: flex; flex-direction: column; height: 100%; padding: 1.2rem; border-radius: var(--radius-lg); background: var(--cream); border: 1px solid var(--parchment-2); text-decoration: none; color: var(--ink); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; position: relative; }
.parva-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold); color: var(--ink); }
.parva-card .n { font: 600 2.4rem/1 var(--font-display); color: var(--gold); }
.parva-card h3 { margin: .3rem 0 0; }
.parva-card .meaning { font: italic 500 1rem var(--font-display); color: var(--indigo-soft); margin: .2rem 0 .5rem; }
.parva-card p { font-size: .9rem; color: var(--muted); margin: 0 0 .6rem; }
.parva-card .meta { margin-top: auto; display: flex; gap: .4rem; flex-wrap: wrap; }

/* Coming soon */
.coming-hero { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--indigo-deep), var(--indigo) 70%); color: var(--on-dark); padding: 4rem 0 3.5rem; }
.coming-hero h1 { color: #fff; }
.coming-hero p { color: var(--on-dark-muted); max-width: 680px; font-size: 1.08rem; }
.coming-hero .mandala { position: absolute; right: -120px; top: -80px; width: 520px; opacity: .12; color: var(--gold-light); }
.phase-tag { display: inline-flex; gap: .4rem; align-items: center; font: 600 .75rem var(--font-ui); letter-spacing: .1em; text-transform: uppercase; background: rgba(240,207,122,.15); color: var(--gold-light); padding: .35rem .8rem; border-radius: 99px; border: 1px solid rgba(240,207,122,.3); margin-bottom: 1rem; }
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.feature-list li { background: var(--parchment); border-radius: var(--radius); padding: 1.1rem 1.2rem; border: 1px solid var(--parchment-2); }
.feature-list strong { display: block; font: 600 1.15rem var(--font-display); color: var(--indigo); margin-bottom: .2rem; }
.feature-list span { font-size: .92rem; color: var(--muted); }
.seed-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.seed-list li { padding: .9rem 1.1rem; background: var(--cream); border: 1px solid var(--parchment-2); border-radius: var(--radius); }
.seed-list li.hl { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(232,137,43,.25); }
.seed-list h3 { font-size: 1.15rem; margin-bottom: .15rem; }
.seed-list p { margin: 0; font-size: .92rem; color: var(--muted); }
.tree-list { font-size: .95rem; }
.tree-list li { padding: .5rem .9rem; }

/* Footer */
.site-footer { background: var(--indigo-deep); color: var(--on-dark-muted); margin-top: 3rem; padding: 3.5rem 0 2rem; font-size: .92rem; position: relative; overflow: hidden; }
.site-footer h2 { color: #fff; font-size: 1.6rem; }
.site-footer h3 { color: var(--gold-light); font: 600 .78rem var(--font-ui); letter-spacing: .14em; text-transform: uppercase; }
.site-footer a { color: var(--on-dark); }
.site-footer a:hover { color: var(--gold-light); }
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 860px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .45rem 0; }
.site-footer .fine { border-top: 1px solid rgba(255,255,255,.1); margin-top: 2.5rem; padding-top: 1.2rem; font-size: .8rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.sources li { line-height: 1.5; }
.sources em { color: var(--on-dark); }

/* Back to top */
.to-top { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 40; width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(240,207,122,.4); background: var(--indigo); color: var(--gold-light); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 22px; height: 22px; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 20px); background: var(--indigo); color: var(--on-dark); font: 500 .9rem var(--font-ui); padding: .7rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .3s, transform .3s var(--ease); z-index: 90; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mode visibility helpers (content written for one mode only) */
html:not([data-mode="scholar"]) .only-scholar { display: none !important; }
html:not([data-mode="kids"]) .only-kids { display: none !important; }
html[data-mode="kids"] .hide-kids { display: none !important; }
html[data-mode="kids"] h1, html[data-mode="kids"] h2, html[data-mode="kids"] h3 { letter-spacing: .005em; }
html[data-mode="kids"] .char-card .hook { font-size: .98rem; color: var(--ink); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hero .layer { transform: none !important; }
}

/* ---------- Print (character & parva views) ---------- */
@media print {
  @page { margin: 16mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .mode-strip, .site-footer, .to-top, .toc, .detail-actions, .skip-link, .boot, .toast, .crumbs, .no-print, .related-sec { display: none !important; }
  .view { animation: none; }
  a { color: #000; text-decoration: none; }
  .detail-hero { grid-template-columns: 160px 1fr !important; gap: 1rem; }
  .detail-hero .portrait { box-shadow: none; aspect-ratio: 1; }
  .dsec { break-inside: avoid-page; padding: .8rem 0; }
  .list-box, .quote, .rel, .callout, .gallery figure { break-inside: avoid; background: #fff !important; border-color: #999 !important; }
  .only-scholar, .hide-kids { display: block !important; }
  h1, h2, h3 { color: #000; }
  .detail-layout { display: block; }
}
