/* BharatInfo — INTERACTIVE look: design tokens, base, layout and components.
 * (The original look is preserved, unchanged, in classic.css for the Classic mode.)
 *
 * Colour roles are validated with the dataviz validator (all-pairs, light and dark — see
 * docs/plans/2026-11-29-chakra-redesign-plan.md): elected / administrative / institution always
 * appear WITH their glyph (● ■ ◆), never colour alone. Dark values are declared twice: for the OS
 * preference (unless the viewer picked light) and for the header toggle.
 */
:root {
  color-scheme: light;
  --page: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --surface-3: #f2efe7;
  --ink: #1b1f2a;
  --ink-2: #5f6675;
  --ink-3: #868c98;
  --line: #e7e2d7;
  --line-2: #d6cfbf;
  --focus: #1d4ed8;

  --elected: #c2410c;  --elected-soft: #fdf0e7;
  --admin: #1d4ed8;    --admin-soft: #edf2fe;
  --body: #047857;     --body-soft: #e7f6ef;
  --tier-local: #818cf8; --tier-state: #4f46e5; --tier-union: #312e81;

  --wheel-line: rgba(27, 31, 42, .10);
  --wheel-line-2: rgba(27, 31, 42, .22);
  --scrim: rgba(12, 15, 28, .42);
  --shadow-1: 0 1px 2px rgba(23, 26, 38, .05), 0 1px 3px rgba(23, 26, 38, .05);
  --shadow-2: 0 18px 40px -18px rgba(23, 26, 38, .30);

  --muted: var(--ink-2);          /* alias used by shared inline styles */
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --dur-fast: 120ms;
  --dur: 240ms;
  --dur-slow: 650ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b1020; --surface: #111831; --surface-2: #151d3a; --surface-3: #1a2446;
    --ink: #eef1f8; --ink-2: #a3acbf; --ink-3: #7b849a;
    --line: #222b4b; --line-2: #313c64; --focus: #8ab4ff;
    --elected: #f0701f; --elected-soft: rgba(240, 112, 31, .15);
    --admin: #4f8ff7;   --admin-soft: rgba(79, 143, 247, .16);
    --body: #10a37a;    --body-soft: rgba(16, 163, 122, .16);
    --tier-local: #4f46e5; --tier-state: #818cf8; --tier-union: #c7d2fe;
    --wheel-line: rgba(199, 210, 254, .12); --wheel-line-2: rgba(199, 210, 254, .28);
    --scrim: rgba(2, 4, 12, .62);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 18px 44px -18px rgba(0, 0, 0, .75);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1020; --surface: #111831; --surface-2: #151d3a; --surface-3: #1a2446;
  --ink: #eef1f8; --ink-2: #a3acbf; --ink-3: #7b849a;
  --line: #222b4b; --line-2: #313c64; --focus: #8ab4ff;
  --elected: #f0701f; --elected-soft: rgba(240, 112, 31, .15);
  --admin: #4f8ff7;   --admin-soft: rgba(79, 143, 247, .16);
  --body: #10a37a;    --body-soft: rgba(16, 163, 122, .16);
  --tier-local: #4f46e5; --tier-state: #818cf8; --tier-union: #c7d2fe;
  --wheel-line: rgba(199, 210, 254, .12); --wheel-line-2: rgba(199, 210, 254, .28);
  --scrim: rgba(2, 4, 12, .62);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 18px 44px -18px rgba(0, 0, 0, .75);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
}
a { color: var(--admin); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
::selection { background: color-mix(in srgb, var(--admin) 24%, transparent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em;
  background: var(--surface-3); padding: 1px 5px; border-radius: 5px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 10px clamp(16px, 3vw, 28px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {               /* the three branch colours — the site's encoding, as an accent */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--elected), var(--admin) 50%, var(--body));
  opacity: .8;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex: none; color: var(--ink); }
.brand-mark .bm-elected { fill: var(--elected); }
.brand-mark .bm-admin { fill: var(--admin); }
.brand-mark .bm-body { fill: var(--body); }
.brand-mark .bm-dot { stroke: var(--surface); stroke-width: 1.3; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand-tag { font-weight: 500; font-size: 11.5px; color: var(--ink-2); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  white-space: nowrap; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 7px 12px; border-radius: 999px; transition: background var(--dur-fast), color var(--dur-fast);
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }
.mode-switch {
  display: inline-flex; flex: none; padding: 3px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line); font-size: 13px; font-weight: 650;
}
.mode-switch a, .mode-switch span { padding: 5px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-2); }
.mode-switch a:hover { color: var(--ink); }
.mode-switch [aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.icon { display: block; width: 18px; height: 18px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background var(--dur-fast);
}
.icon-btn:hover { background: var(--surface-3); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
@media (max-width: 900px) {
  .nav {
    order: 3; flex-basis: 100%; margin-left: 0;
    /* fade the right edge: the pill row scrolls sideways on narrow screens */
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
    padding-right: 24px;
  }
  .mode-switch { margin-left: auto; }
}
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .brand-tag { display: none; }
  .brand-name { font-size: 16px; }
  .mode-switch { font-size: 12px; }
  .mode-switch a, .mode-switch span { padding: 4px 8px; }
  .icon-btn { width: 34px; height: 34px; }
}

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px clamp(16px, 3vw, 28px) 80px; }
.crumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head { margin: 4px 0 22px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.025em; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 72ch; font-size: 16px; }
.section-title { font-size: 20px; margin: 32px 0 12px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}

/* Landing hero + doorway cards */
.hero { text-align: center; padding: 34px 0 6px; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); margin: 0 0 12px; letter-spacing: -.035em; }
.hero p { color: var(--ink-2); max-width: 62ch; margin: 0 auto; font-size: 17px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 30px; }
.card-link {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur);
}
.card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.card-link.feature { grid-column: 1 / -1; border-color: var(--line-2); }
.card-link h2 { margin: 0 0 8px; font-size: 20px; }
.card-link p { margin: 0; color: var(--ink-2); font-size: 14px; }
.tag {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; background: var(--surface-3); color: var(--ink);
}
.tag.elected { background: var(--elected-soft); }
.tag.admin { background: var(--admin-soft); }
.tag.tax, .tag.body { background: var(--body-soft); }

/* ---------- Glyphs (● elected · ■ administrative · ◆ institution) ---------- */
.glyph { display: inline-block; width: .72em; height: .72em; flex: none; }
.glyph-elected { background: var(--elected); border-radius: 50%; }
.glyph-admin { background: var(--admin); border-radius: 2px; }
.glyph-body { background: var(--body); border-radius: 1px; transform: rotate(45deg) scale(.82); }

/* ---------- Callouts, hints, notices ---------- */
.callout {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--elected);
  border-radius: var(--radius-sm); padding: 15px 18px; box-shadow: var(--shadow-1); margin: 16px 0;
}
.callout h3 { margin: 0 0 6px; font-size: 16px; }
.callout p { margin: 0; color: var(--ink-2); font-size: 14px; }
.callout li { color: var(--ink-2); font-size: 14px; margin: 4px 0; }
.callout-resolved { border-left-color: var(--admin); }
.hint, .notice {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--admin);
  color: var(--ink-2); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px;
}
.notice { border-left-color: var(--ink-2); color: var(--ink); }
.overlap-note { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }

/* ---------- Controls ---------- */
.controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-1); margin-bottom: 18px;
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 30;
}
.controls .grow { flex: 1; min-width: 200px; }
input[type="search"], select, button { font: inherit; }
input[type="search"] {
  width: 100%; padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14.5px; background: var(--surface-2); color: var(--ink);
}
input[type="search"]::placeholder { color: var(--ink-3); }
input[type="search"]:focus { background: var(--surface); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { background: var(--surface-3); }
.btn[aria-pressed="true"], .btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
select.btn { padding-right: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-union { background: var(--tier-union); }
.dot-state { background: var(--tier-state); }
.dot-local { background: var(--tier-local); }
.dot-shared { background: var(--ink-3); }
.search-status { font-size: 13px; color: var(--ink-2); margin: 0 2px 10px; min-height: 1.2em; }

/* ---------- Subject bar & chips ---------- */
.subject-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-1); margin-bottom: 18px;
}
.subject-bar-label { margin-right: 4px; }
.subjects { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; line-height: 1.4;
  padding: 4px 11px; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: var(--surface-3); color: var(--ink); border: 1px solid transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.chip:hover { border-color: var(--line-2); }
.chip.hot, .chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.chip-static { cursor: default; }
.chip-static:hover { border-color: transparent; }

/* ---------- Levels, tree & nodes (List view) ---------- */
.level { margin: 28px 0; }
.level > h2 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-2);
  margin: 0 0 12px; display: flex; align-items: center; gap: 10px;
}
.level > h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tree { display: flex; flex-direction: column; gap: 10px; }
.node {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); overflow: hidden; transition: box-shadow var(--dur);
}
.node .node { margin: 0 12px 12px 30px; border-radius: 12px; box-shadow: none; background: var(--surface-2); }
.node-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
  border: 0; background: none; color: inherit; text-align: left;
}
button.node-head { cursor: pointer; }
button.node-head:hover { background: color-mix(in srgb, var(--surface-3) 55%, transparent); }
.twist { width: 16px; color: var(--ink-3); transition: transform var(--dur-fast); flex: none; font-size: 11px; }
.node.open > .node-head .twist { transform: rotate(90deg); }
.node-main { display: block; min-width: 0; }
.node-title { display: block; font-weight: 700; font-size: 15px; }
.node-sub { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.node-main .node-sub { display: block; }
.node-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--ink);
}
.pill.branch { background: var(--surface-3); }
.pill.elected-in { background: var(--elected-soft); }
.pill.appointed { background: var(--admin-soft); }
.pill.count { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.node-body { padding: 0 18px 16px 46px; display: none; }
.node.open > .node-body { display: block; animation: bi-fade var(--dur) var(--ease); }
@keyframes bi-fade { from { opacity: 0; transform: translateY(-3px); } }
.row { margin: 9px 0; }
.row .k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.row .v { font-size: 14px; }
.node-body ul, .node-body ol { margin: 4px 0 0; padding-left: 18px; }
.node-body li { margin: 4px 0; font-size: 14px; }
.node.subject-hit { box-shadow: 0 0 0 2px var(--ink), var(--shadow-1); }
/* dim only the node itself, so a highlighted child inside a dimmed parent stays fully visible */
.node.dimmed > .node-head, .node.dimmed > .node-body { opacity: .4; }
.overlap-cols { grid-template-columns: 1fr 1fr; align-items: start; }
.col-elected, .col-admin { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 10px; }
.col-elected::before, .col-admin::before { content: ""; width: 11px; height: 11px; flex: none; }
.col-elected::before { background: var(--elected); border-radius: 50%; }
.col-admin::before { background: var(--admin); border-radius: 2px; }
@media (max-width: 680px) { .overlap-cols { grid-template-columns: 1fr; } }

/* Escalation steps (List view of the finder) */
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin: 8px 0; font-size: 14px; }
ul.steps { list-style: none; padding-left: 0; }
ol.steps li::marker { color: var(--ink-2); font-weight: 700; }
.steps .pill { margin-right: 6px; }

/* ---------- Tables ---------- */
.tblwrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--ink);
}
.badge.direct { background: var(--admin-soft); }
.badge.indirect { background: var(--elected-soft); }
.badge.union { background: color-mix(in srgb, var(--tier-union) 20%, var(--surface)); }
.badge.state { background: color-mix(in srgb, var(--tier-state) 20%, var(--surface)); }
.badge.local { background: color-mix(in srgb, var(--tier-local) 24%, var(--surface)); }
.badge.shared { background: var(--surface-3); }

/* ---------- Drawer (side sheet) ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--dur) var(--ease); }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(470px, 100%); overflow-y: auto;
  display: flex; flex-direction: column; background: var(--surface); outline: none;
  box-shadow: -24px 0 60px -24px rgba(0, 0, 0, .45);
  transform: translateX(100%); transition: transform var(--dur) var(--ease);
}
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.drawer-title { margin: 0; flex: 1; font-size: 19px; }
.drawer-body { padding: 16px 20px 30px; }
html.drawer-open { overflow: hidden; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 120; max-width: 300px; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 8px 11px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow-2);
}
.tooltip[hidden] { display: none; }
.tooltip strong { display: block; font-size: 13.5px; }
.tooltip .tt-sub { opacity: .78; }

/* ---------- Footer ---------- */
footer {
  color: var(--ink-2); font-size: 13px; text-align: center;
  padding: 30px clamp(16px, 3vw, 28px); border-top: 1px solid var(--line); margin-top: 40px;
}
.disclaimer { max-width: 72ch; margin: 0 auto; }

/* ---------- Print ---------- */
@media print {
  .topbar, footer, .controls, .subject-bar, .drawer, .tooltip { display: none !important; }
  body { background: #fff; color: #000; }
  .node, .callout, .tblwrap { box-shadow: none; }
}
