/* ── DESIGN TOKENS (canonical source for all pages) ─────────────────────────── */
:root {
  --ink: #0a0804;
  --paper: #f5f0e8;
  --aged: #e8e0cc;
  --muted: #6b5f4e;
  --accent: #c0171b;
  --bjp: #e8640a;
  --tmc: #1a7a3c;
  --gold: #b8860b;

  /* status colours */
  --watching: #8a7a6a;
  --announced: #1565c0;
  --in-progress: #d97706;
  --delivered: #166534;
  --delayed: #b45309;
  --broken: #c0171b;
  --evaded: #7b3f6e;
}

/*
 * shared.css — The Bengal Reader
 * Common styles shared across all pages.
 * Page-specific styles remain inline in each HTML file.
 */

/* ── SITE NAV ──────────────────────────────────────────────────────────────── */
.site-nav {
  background: #050403;
  border-bottom: 1px solid rgb(255 255 255 / 6%);
  padding: 9px 0;
  position: relative;
  z-index: 10000;
}

.site-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.site-nav-brand {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgb(245 240 232 / 35%);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-links {
  display: flex;
}

.site-nav-link {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgb(245 240 232 / 45%);
  text-decoration: none;
  padding: 3px 14px;
  border-left: 1px solid rgb(255 255 255 / 7%);
  transition: color 0.2s;
}

.site-nav-link:first-child {
  border-left: none;
}

.site-nav-link:hover,
.site-nav-link.active {
  color: rgb(245 240 232 / 90%);
}

/* ── SCROLL PROGRESS BAR ───────────────────────────────────────────────────── */
#scroll-prog {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--ink, #2c2416);
  width: 0%;
  z-index: 9999;
  pointer-events: none;
  will-change: width;
}

/* ── PAGE FADE-IN ──────────────────────────────────────────────────────────── */
body {
  animation: pg-fade 0.4s ease both;
}

@keyframes pg-fade {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── INTERACTIVE MICRO-FEEDBACK ────────────────────────────────────────────── */
button:active,
.filter-btn:active,
.theme-toggle:active,
.sort-btn:active,
.audience-tab:active,
.filter-tab:active {
  transform: scale(0.95);
}

/* ── REDUCED MOTION ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── NAV HAMBURGER ─────────────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid rgb(255 255 255 / 15%);
  cursor: pointer;
  padding: 5px 9px;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-hamburger-bar {
  display: block;
  width: 16px;
  height: 1.5px;
  background: rgb(245 240 232 / 60%);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-hamburger[aria-expanded="true"] .nav-hamburger-bar:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav-hamburger[aria-expanded="true"] .nav-hamburger-bar:nth-child(2) {
  opacity: 0;
}

.nav-hamburger[aria-expanded="true"] .nav-hamburger-bar:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ── MOBILE NAV ────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .site-nav { position: relative; }

  .site-nav-inner {
    padding: 0 1rem;
    flex-wrap: nowrap;
  }

  .site-nav-brand {
    font-size: 8px;
  }

  .nav-hamburger {
    display: flex;
    margin-left: auto;
  }

  .site-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    grid-template-columns: 1fr 1fr;
    background: #050403;
    border-top: 1px solid rgb(255 255 255 / 8%);
    border-bottom: 1px solid rgb(255 255 255 / 8%);
    z-index: 9999;
    padding: 0.25rem 0;
  }

  .site-nav-links.open {
    display: grid;
  }

  .site-nav-link {
    border-left: none;
    border-bottom: 1px solid rgb(255 255 255 / 5%);
    padding: 11px 1.5rem;
    font-size: 9px;
    letter-spacing: 0.18em;
  }

  .site-nav-link:last-child,
  .site-nav-link:nth-last-child(2) {
    border-bottom: none;
  }

  .site-nav-link.active {
    border-left: 2px solid var(--bjp, #e8640a);
    padding-left: calc(1.5rem - 2px);
  }
}

/* ── SHARED DARK MODE (Playfair/Crimson pages) ─────────────────────────────── */

/* Applied to pages that use --ink / --paper variables but lack [data-theme=dark] */
[data-theme='dark'] {
  --ink: #f0ece3 !important;
  --paper: #141210 !important;
  --aged: #2a2520 !important;
  --muted: #9a9085 !important;
  --ink-soft: #b8b2a8 !important;
  --ink-faint: #706a62 !important;
}

[data-theme='dark'] body {
  background: #141210;
  color: #f0ece3;
}

[data-theme='dark'] .masthead,
[data-theme='dark'] .controls-bar,
[data-theme='dark'] .filter-bar {
  background: #141210 !important;
  border-color: rgb(255 255 255 / 10%) !important;
}

[data-theme='dark'] p,
[data-theme='dark'] .article-lead {
  color: #c8c0b4 !important;
}

[data-theme='dark'] .how-card,
[data-theme='dark'] .case-card,
[data-theme='dark'] .pledge-card,
[data-theme='dark'] .mla-row:hover {
  background: #1e1b18 !important;
  border-color: rgb(255 255 255 / 8%) !important;
}

[data-theme='dark'] table th {
  background: #1e1b18 !important;
  border-color: rgb(255 255 255 / 8%) !important;
}

[data-theme='dark'] table td {
  border-color: rgb(255 255 255 / 6%) !important;
}

[data-theme='dark'] input,
[data-theme='dark'] select {
  background: #1e1b18 !important;
  color: #f0ece3 !important;
  border-color: rgb(255 255 255 / 15%) !important;
}

/* ── SHARE BUTTON BAR ──────────────────────────────────────────────────────── */
.share-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 1rem 0;
  align-items: center;
}

.share-label {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted, #6b5f4e);
  margin-right: 4px;
}

.share-btn {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid var(--aged, #e8e0cc);
  background: transparent;
  color: var(--ink, #0a0804);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.share-btn:active {
  transform: scale(0.95);
}

.share-btn:hover {
  background: var(--ink, #0a0804);
  color: var(--paper, #f5f0e8);
}

.share-btn.whatsapp {
  border-color: #25d366;
  color: #1a8c49;
}

.share-btn.whatsapp:hover {
  background: #25d366;
  color: #fff;
}

.share-btn.twitter {
  border-color: #1da1f2;
  color: #1da1f2;
}

.share-btn.twitter:hover {
  background: #1da1f2;
  color: #fff;
}

/* ── RSS / SUBSCRIBE STRIP ─────────────────────────────────────────────────── */
.subscribe-strip {
  background: var(--ink, #0a0804);
  color: var(--paper, #f5f0e8);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.subscribe-strip-text {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(245 240 232 / 60%);
}

.subscribe-strip-text strong {
  color: rgb(245 240 232 / 90%);
}

.subscribe-strip-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.subscribe-link {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(245 240 232 / 50%);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgb(245 240 232 / 15%);
  transition: color 0.2s, border-color 0.2s;
}

.subscribe-link:hover {
  color: rgb(245 240 232 / 90%);
  border-color: rgb(245 240 232 / 40%);
}

/* ── LANGUAGE TOGGLE ───────────────────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  gap: 0;
}

.lang-btn {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border: 1px solid var(--aged, #e8e0cc);
  background: transparent;
  color: var(--muted, #6b5f4e);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lang-btn + .lang-btn {
  border-left: none;
}

.lang-btn:active {
  transform: scale(0.95);
}

.lang-btn.active {
  background: var(--ink, #0a0804);
  color: var(--paper, #f5f0e8);
  border-color: var(--ink, #0a0804);
}

/* ── DATA FRESHNESS BADGE ──────────────────────────────────────────────────── */
.freshness-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--muted, #6b5f4e);
}

.freshness-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ── MOBILE BOTTOM NAV ─────────────────────────────────────────────────────── */
.mobile-btm-nav {
  display: none;
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-btm-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #050403;
    border-top: 1px solid rgb(255 255 255 / 10%);
    z-index: 9998;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-btm-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 7px;
    text-decoration: none;
    color: rgb(245 240 232 / 30%);
    font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
    font-size: 0.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-btm-item:hover,
  .mobile-btm-item.active {
    color: rgb(245 240 232 / 92%);
    background: rgb(255 255 255 / 4%);
  }

  .mobile-btm-icon {
    font-size: 1.05rem;
    line-height: 1;
  }
}

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: #050403;
  color: rgb(245 240 232 / 35%);
  padding: 2rem;
  margin-top: 4rem;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-footer-brand {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgb(245 240 232 / 50%);
  margin-bottom: 0.4rem;
}

.site-footer-tagline {
  color: rgb(245 240 232 / 25%);
  line-height: 1.7;
}

.site-footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-footer-link {
  color: rgb(245 240 232 / 30%);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer-link:hover {
  color: rgb(245 240 232 / 70%);
}

/* ── SOURCE CITATION TOOLTIPS ──────────────────────────────────────────────── */

/* Usage: <cite data-cite="ECI Affidavit, 2024" data-cite-url="https://...">¹</cite>
   or:    <span data-cite="ECI Affidavit, 2024">some text</span>              */
[data-cite] {
  cursor: help;
  text-decoration: underline dotted 1px currentcolor;
  text-underline-offset: 2px;
}

cite[data-cite] {
  font-style: normal;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62em;
  vertical-align: super;
  line-height: 0;
  color: var(--muted, #6b5f4e);
}

.bengal-cite-tip {
  position: fixed;
  z-index: 99998;
  max-width: 280px;
  background: var(--ink, #0a0804);
  color: var(--paper, #f5f0e8);
  border-radius: 3px;
  padding: 7px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 12px rgb(0 0 0 / 35%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.bengal-cite-tip.visible {
  opacity: 1;
  pointer-events: auto;
}

.bengal-cite-tip a {
  color: #5cb87a;
  text-decoration: none;
  display: block;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bengal-cite-tip a:hover {
  text-decoration: underline;
}

/* ── VIEW TRANSITIONS ──────────────────────────────────────────────────────── */
@keyframes vt-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes vt-fade-out {
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

::view-transition-old(root) {
  animation: 160ms ease-in vt-fade-out both;
}

::view-transition-new(root) {
  animation: 220ms ease-out vt-fade-in both;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ── PWA INSTALL BANNER ────────────────────────────────────────────────────── */
#bengal-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #050403;
  color: rgb(245 240 232 / 80%);
  padding: 10px 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  z-index: 99990;
  border-top: 1px solid rgb(255 255 255 / 8%);
}

#bengal-install-banner span {
  flex: 1;
}

#bengal-install-btn {
  background: var(--bjp, #e8640a);
  color: #fff;
  border: none;
  padding: 5px 14px;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  white-space: nowrap;
}

#bengal-install-dismiss {
  background: transparent;
  border: none;
  color: rgb(245 240 232 / 40%);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 6px;
  line-height: 1;
}

#bengal-install-dismiss:hover {
  color: rgb(245 240 232 / 80%);
}

/* ── GLOBAL RESETS (shared baseline so pages don't repeat it) ─────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ── PAGE NOISE TEXTURE ─────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ── LAYOUT CONTAINER ───────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── MASTHEAD (page header block used across editorial pages) ────────────────── */
.masthead {
  border-bottom: 4px double var(--ink);
  padding: 1.5rem 2rem 1rem;
  text-align: center;
  background: var(--paper);
}

.masthead-overline {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0.3rem 0;
  margin-bottom: 1rem;
}

.masthead h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.masthead h1 em {
  font-style: italic;
  color: var(--accent);
}

.masthead-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--muted);
  margin-top: 0.5rem;
}

.masthead-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-top: 1rem;
  border-top: 1px solid var(--aged);
  padding-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── STATS HERO (full-bleed dark stats bar) ──────────────────────────────────── */
.stats-hero {
  background: var(--ink);
  color: var(--paper);
  padding: 2.5rem 2rem;
  text-align: center;
}

.stats-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.stat-cell {
  padding: 1.2rem 2rem;
  border-right: 1px solid rgb(255 255 255 / 10%);
}

.stat-cell:last-child {
  border-right: none;
}

.stat-big {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
}

.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8a8070;
  margin-top: 0.3rem;
}

.stats-disclaimer {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: #6a6050;
  margin-top: 1.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ── FILTER BAR (sticky section navigation bar) ──────────────────────────────── */
.filter-bar {
  border-bottom: 1px solid var(--aged);
  background: var(--paper);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.filter-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  overflow-x: auto;
}

.filter-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 1.2rem;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ── CONTROLS BAR (sticky search + filter row used in data tables) ───────────── */
.controls-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--aged);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--aged);
  background: var(--paper);
  color: var(--ink);
  flex: 1;
  min-width: 180px;
  outline: none;
}

.search-input:focus {
  border-color: var(--ink);
}

.filter-select {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--aged);
  background: var(--paper);
  color: var(--muted);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--ink);
}

.result-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
  margin-left: auto;
}

/* ── SECTION HEADER (divider with label + title for content sections) ────────── */
.section-header {
  border-top: 4px solid var(--ink);
  padding-top: 0.5rem;
  margin: 3rem 0 1.5rem;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
}

/* ── CALLOUT BOX ────────────────────────────────────────────────────────────── */
.callout {
  border-left: 5px solid var(--muted);
  background: var(--aged);
  padding: 1.2rem 1.5rem;
  margin: 2rem 0;
}

.callout-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* ── TABLE WRAPPER ──────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap thead th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--ink);
  text-align: left;
  background: var(--paper);
  white-space: nowrap;
}

.table-wrap tbody tr {
  border-bottom: 1px solid var(--aged);
  transition: background 0.15s;
}

.table-wrap tbody tr:hover {
  background: #fdfaf4;
}

.table-wrap td {
  padding: 0.6rem 0.8rem;
  vertical-align: middle;
}

/* ── DARK MODE ADDITIONS FOR SHARED COMPONENTS ────────────────────────────── */
[data-theme='dark'] .stats-hero {
  background: #080605;
}

[data-theme='dark'] .filter-bar,
[data-theme='dark'] .controls-bar {
  background: #141210 !important;
  border-color: rgb(255 255 255 / 10%) !important;
}

[data-theme='dark'] .callout {
  background: #1e1b18 !important;
  border-color: rgb(255 255 255 / 15%) !important;
}

[data-theme='dark'] .table-wrap tbody tr:hover {
  background: #1e1b18 !important;
}

[data-theme='dark'] .search-input,
[data-theme='dark'] .filter-select {
  background: #1e1b18 !important;
  color: #f0ece3 !important;
  border-color: rgb(255 255 255 / 15%) !important;
}

/* ── STATUS BADGE SYSTEM ────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-watching {
  background: rgb(138 122 106 / 12%);
  color: var(--watching);
  border: 1px solid rgb(138 122 106 / 25%);
}

.badge-announced,
.badge-in-progress {
  background: rgb(217 119 6 / 10%);
  color: var(--in-progress);
  border: 1px solid rgb(217 119 6 / 25%);
}

.badge-delivered {
  background: rgb(22 101 52 / 10%);
  color: var(--delivered);
  border: 1px solid rgb(22 101 52 / 25%);
}

.badge-delayed {
  background: rgb(180 83 9 / 10%);
  color: var(--delayed);
  border: 1px solid rgb(180 83 9 / 25%);
}

.badge-broken {
  background: rgb(192 23 27 / 10%);
  color: var(--broken);
  border: 1px solid rgb(192 23 27 / 25%);
}

.badge-evaded {
  background: rgb(123 63 110 / 10%);
  color: var(--evaded);
  border: 1px solid rgb(123 63 110 / 25%);
}

/* ── PARTY COLOUR DOTS ──────────────────────────────────────────────────────── */
.party-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}

.party-dot.bjp { background: var(--bjp); }
.party-dot.tmc { background: var(--tmc); }
.party-dot.cpim { background: #e53935; }
.party-dot.inc { background: #1976d2; }
.party-dot.isf { background: #00897b; }
.party-dot.ajup { background: #7b1fa2; }
.party-dot.none { background: var(--muted); }

/* ── RESPONSIVE BREAKPOINTS FOR SHARED COMPONENTS ───────────────────────────── */

/* Tablet (≤900px) */
@media (max-width: 900px) {
  .container {
    padding: 0 1.5rem;
  }

  .stats-grid {
    gap: 0;
  }

  .stat-cell {
    padding: 1rem 1.2rem;
  }

  .masthead {
    padding: 1.2rem 1.5rem 0.8rem;
  }
}

/* Mobile (≤640px) */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  /* Stats hero: stack cells vertically */
  .stats-hero {
    padding: 1.5rem 1rem;
  }

  .stats-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-cell {
    border-right: none;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
  }

  .stat-cell:last-child {
    border-bottom: none;
  }

  .stat-big {
    font-size: 2rem;
    flex-shrink: 0;
  }

  .stat-label {
    margin-top: 0;
  }

  /* Masthead */
  .masthead {
    padding: 1rem 1rem 0.8rem;
  }

  .masthead h1 {
    font-size: clamp(1.8rem, 8vw, 3rem);
  }

  .masthead-meta {
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.58rem;
  }

  /* Filter bar: scrollable horizontally */
  .filter-bar {
    padding: 0 1rem;
  }

  .filter-btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.58rem;
  }

  /* Controls bar: stack vertically */
  .controls-bar {
    padding: 0.75rem 1rem;
  }

  .controls-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-input {
    width: 100%;
    min-width: unset;
  }

  .filter-select {
    width: 100%;
  }

  .result-count {
    margin-left: 0;
  }

  /* Section header */
  .section-header {
    margin: 2rem 0 1rem;
  }

  /* Callout */
  .callout {
    padding: 1rem 1rem;
  }

  /* Table: allow horizontal scroll */
  .table-wrap {
    padding: 0 1rem 2rem;
  }
}

/* Extra small (≤400px) */
@media (max-width: 400px) {
  .container {
    padding: 0 0.75rem;
  }

  .stat-big {
    font-size: 1.7rem;
  }

  .filter-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.55rem;
    letter-spacing: 0.08em;
  }

  .masthead-overline {
    font-size: 0.58rem;
    letter-spacing: 0.18em;
  }
}

/* ── RESPONSIVE FIXES FOR SPECIFIC PAGE PATTERNS ────────────────────────────── */

/* Dark mode table hover */
[data-theme='dark'] .table-wrap tbody tr:hover {
  background: #1e1b18 !important;
}

/* Prevent horizontal scroll bleed on narrow screens */
@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  /* Share bar wraps gracefully */
  .share-bar {
    gap: 6px;
  }

  .share-btn {
    padding: 5px 10px;
    font-size: 0.58rem;
  }

  /* Lang toggle stays compact */
  .lang-btn {
    padding: 4px 8px;
  }

  /* Footer stacks */
  .site-footer-inner {
    flex-direction: column;
    gap: 1rem;
  }
}
