/* ============================================
   IRNEWS — Enterprise News Platform
   Design: Reuters/BBC/ISW editorial aesthetic
   ============================================ */

/* --- 1. Design Tokens --- */
:root {
  /* Background */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f1f3;
  --bg-nav: #0d1117;
  --bg-nav-hover: #161b22;
  --bg-banner: #b91c1c;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --text-inverse: #f9fafb;
  --text-link: #1d4ed8;

  /* Brand & Status */
  --brand-red: #dc2626;
  --brand-dark: #0d1117;
  --navy: #1e3a5f;

  --status-alive: #059669;
  --status-alive-bg: #ecfdf5;
  --status-alive-border: #a7f3d0;
  --status-killed: #dc2626;
  --status-killed-bg: #fef2f2;
  --status-killed-border: #fecaca;
  --status-uncertain: #d97706;
  --status-uncertain-bg: #fffbeb;
  --status-uncertain-border: #fde68a;
  --status-disputed: #2563eb;
  --status-disputed-bg: #eff6ff;
  --status-disputed-border: #bfdbfe;
  --status-unverified: #6b7280;
  --status-unverified-bg: #f3f4f6;
  --status-unverified-border: #d1d5db;

  /* Borders */
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --border-dark: #9ca3af;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-fa: 'Vazirmatn', 'Tahoma', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);

  /* Layout */
  --max-width: 1280px;
  --nav-height: 52px;
}


/* --- 2. Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* Tabular numbers for data */
.tabular { font-variant-numeric: tabular-nums; }


/* --- 3. Typography --- */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.025em; color: var(--text-primary); }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; color: var(--text-primary); }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; color: var(--text-primary); }
h4 { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--text-primary); }

.subhead {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 640px;
}

.label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.fa-text { display: none; }
.en-text { display: inline; }
[data-lang="fa"] .fa-text { display: inline; }
[data-lang="fa"] .en-text { display: none; }
[data-lang="fa"] .fa-block { display: block !important; }
[data-lang="fa"] .en-block { display: none !important; }
.fa-block { display: none; }
.en-block { display: block; }

[data-lang="fa"] body,
[dir="rtl"] body {
  font-family: var(--font-fa);
}


/* --- 4. Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.page-content {
  padding: var(--space-8) 0 var(--space-12);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }


/* --- 5. Breaking Banner --- */
.breaking-banner {
  background: var(--bg-banner);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-6);
  overflow: hidden;
  font-size: 0.8125rem;
}

.breaking-label {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.25);
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.breaking-scroll { overflow: hidden; flex: 1; direction: ltr; }

.breaking-text {
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  animation: scroll-text 70s linear infinite;
}

@keyframes scroll-text {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Farsi ticker: enters from left, exits right (Persian TV convention) */
[data-lang="fa"] .breaking-text { animation: scroll-text-fa 70s linear infinite; }
@keyframes scroll-text-fa {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- 6. Navigation --- */
.site-nav {
  background: var(--bg-nav);
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-inverse);
}

.nav-brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--brand-red);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-inverse);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  height: var(--nav-height);
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover {
  color: rgba(255,255,255,0.95);
  text-decoration: none;
}

.nav-links a.active {
  color: #ffffff;
  border-bottom-color: var(--brand-red);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-updated {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.4);
}

.lang-toggle {
  display: flex;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-btn {
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  background: transparent;
  border: none;
  transition: all 0.15s;
}

.lang-btn:hover { color: rgba(255,255,255,0.8); }
.lang-btn.active { background: var(--brand-red); color: white; }


/* --- 7. Page Header --- */
.page-header {
  padding: var(--space-10) 0 var(--space-8);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-8);
}

.page-header h1 { margin-bottom: var(--space-2); }
.page-header .subhead { margin-top: var(--space-2); }

.page-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 2px;
}

.badge-live {
  background: var(--status-killed-bg);
  color: var(--status-killed);
  border: 1px solid var(--status-killed-border);
}

.badge-live .pulse {
  width: 6px;
  height: 6px;
  background: var(--status-killed);
  border-radius: 50%;
  animation: pulse 1.5s ease infinite;
}

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


/* --- 8. Stat Cards --- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--bg-primary);
  padding: var(--space-5) var(--space-6);
}

.stat-card .label { margin-bottom: var(--space-1); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-value.red { color: var(--status-killed); }
.stat-value.green { color: var(--status-alive); }
.stat-value.amber { color: var(--status-uncertain); }
.stat-value.blue { color: var(--status-disputed); }
.stat-value.navy { color: var(--navy); }

.stat-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}


/* --- 9. Sections --- */
.section {
  margin-bottom: var(--space-10);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--text-primary);
  margin-bottom: var(--space-5);
}

.section-head h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-head h2::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--brand-red);
  border-radius: 1px;
  flex-shrink: 0;
}

.section-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* --- 10. Status Badges --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.alive { background: var(--status-alive-bg); color: var(--status-alive); border: 1px solid var(--status-alive-border); }
.status-badge.alive::before { background: var(--status-alive); }
.status-badge.killed { background: var(--status-killed-bg); color: var(--status-killed); border: 1px solid var(--status-killed-border); }
.status-badge.killed::before { background: var(--status-killed); }
.status-badge.uncertain { background: var(--status-uncertain-bg); color: var(--status-uncertain); border: 1px solid var(--status-uncertain-border); }
.status-badge.uncertain::before { background: var(--status-uncertain); }
.status-badge.disputed { background: var(--status-disputed-bg); color: var(--status-disputed); border: 1px solid var(--status-disputed-border); }
.status-badge.disputed::before { background: var(--status-disputed); }
.status-badge.unverified { background: var(--status-unverified-bg); color: var(--status-unverified); border: 1px solid var(--status-unverified-border); }
.status-badge.unverified::before { background: var(--status-unverified); }


/* --- 11. Filter Bar --- */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--text-inverse);
}


/* --- 12. Officials Table --- */
.officials-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.officials-table thead {
  position: sticky;
  top: var(--nav-height);
  z-index: 10;
}

.officials-table th {
  background: var(--bg-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.officials-table th:hover { color: var(--text-primary); }

.officials-table th .sort-arrow {
  margin-left: 4px;
  font-size: 0.625rem;
  opacity: 0.4;
}

.officials-table th.sorted .sort-arrow { opacity: 1; color: var(--brand-red); }

.officials-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.officials-table tbody tr {
  transition: background 0.1s;
}

.officials-table tbody tr:hover {
  background: var(--bg-secondary);
}

.officials-table tbody tr.killed-row {
  color: var(--text-tertiary);
}

.officials-table tbody tr.killed-row .name-cell .name-en {
  text-decoration: line-through;
  text-decoration-color: var(--status-killed);
  text-decoration-thickness: 1px;
}

.name-cell {
  min-width: 180px;
}

.name-cell .name-en {
  font-weight: 600;
  color: var(--text-primary);
}

.name-cell .name-fa {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-family: var(--font-fa);
  margin-top: 1px;
}

.role-cell {
  color: var(--text-secondary);
  max-width: 280px;
}

.date-cell {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.tier-cell {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.conf-dots {
  display: flex;
  gap: 2px;
}

.conf-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-light);
}

.conf-dot.filled { background: var(--text-secondary); }
.conf-dot.filled.high { background: var(--status-alive); }
.conf-dot.filled.low { background: var(--status-uncertain); }


/* --- 13. Officials Cards (alternative view) --- */
.officials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.official-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.official-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.official-card.status-alive { border-left: 3px solid var(--status-alive); }
.official-card.status-killed { border-left: 3px solid var(--status-killed); }
.official-card.status-uncertain { border-left: 3px solid var(--status-uncertain); }
.official-card.status-disputed { border-left: 3px solid var(--status-disputed); }

.official-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.card-header-text { flex: 1; min-width: 0; }

.official-card .card-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.official-card .card-name-fa {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-family: var(--font-fa);
}

.official-card .card-role {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: var(--space-3);
}

.official-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.official-card.is-killed {
  opacity: 0.7;
}

.official-card.is-killed .card-name {
  text-decoration: line-through;
  text-decoration-color: var(--status-killed);
}


/* --- 14. Category Groups --- */
.category-group {
  margin-bottom: var(--space-8);
}

.category-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-4);
}


/* --- 15. View Toggle --- */
.view-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle button {
  padding: 5px 10px;
  background: var(--bg-primary);
  border: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: all 0.15s;
}

.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.active { background: var(--bg-secondary); color: var(--text-primary); font-weight: 600; }

.search-input {
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  width: 220px;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-red);
}

.search-input::placeholder { color: var(--text-tertiary); }


/* --- 16. Charts --- */
.chart-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-card h3 { margin-bottom: 2px; }

.chart-subtitle {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-subtitle::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chart-accent, var(--status-killed));
  opacity: 0.6;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  height: 280px;
}


/* --- 17. Collapse Index --- */
.collapse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.collapse-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.collapse-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.collapse-card .label { margin-bottom: var(--space-3); }

.progress-bar {
  background: var(--border-light);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin-bottom: var(--space-2);
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill.red { background: linear-gradient(90deg, var(--status-killed), #ef4444); }
.progress-fill.amber { background: linear-gradient(90deg, var(--status-uncertain), #f59e0b); }
.progress-fill.blue { background: linear-gradient(90deg, var(--status-disputed), #3b82f6); }
.progress-fill.green { background: linear-gradient(90deg, var(--status-alive), #10b981); }

.collapse-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.collapse-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  line-height: 1.4;
}


/* --- 18. Timeline --- */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-light);
}

.timeline-item {
  position: relative;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.timeline-item.type-killed::before { background: var(--status-killed); }
.timeline-item.type-event::before { background: var(--status-uncertain); }
.timeline-item.type-collapse::before { background: var(--brand-red); }

.timeline-date {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.timeline-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.timeline-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: var(--space-2);
}


/* --- 19. Proxy Cards --- */
.proxy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.proxy-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.proxy-card h4 { margin-bottom: var(--space-2); }

.proxy-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.proxy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.proxy-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}


/* --- 20. Tier Methodology --- */
.methodology-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.tier-item {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.tier-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.tier-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}


/* --- 21. Command Chain --- */
.chain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.chain-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.chain-card h4 { margin-bottom: var(--space-3); }

.chain-entry {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: 0.8125rem;
}

.chain-entry + .chain-entry {
  border-top: 1px solid var(--border-light);
}

.chain-arrow {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}


/* --- 22. Footer --- */
.site-footer {
  background: var(--bg-nav);
  color: rgba(255,255,255,0.5);
  padding: var(--space-10) 0;
  margin-top: var(--space-12);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-8);
}

.footer-brand {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-inverse);
  margin-bottom: var(--space-2);
}

.footer-desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  max-width: 400px;
}

.footer-links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.footer-links a {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover { color: rgba(255,255,255,0.8); text-decoration: none; }

.footer-disclaimer {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.3);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.08);
  line-height: 1.6;
}


/* --- 23. RTL Overrides --- */
[dir="rtl"] .section-head h2::before { order: 1; }
[dir="rtl"] .official-card { border-left: none; }
[dir="rtl"] .official-card.status-alive { border-right: 3px solid var(--status-alive); }
[dir="rtl"] .official-card.status-killed { border-right: 3px solid var(--status-killed); }
[dir="rtl"] .official-card.status-uncertain { border-right: 3px solid var(--status-uncertain); }
[dir="rtl"] .official-card.status-disputed { border-right: 3px solid var(--status-disputed); }
[dir="rtl"] .timeline { padding-left: 0; padding-right: 24px; }
[dir="rtl"] .timeline::before { left: auto; right: 5px; }
[dir="rtl"] .timeline-item::before { left: auto; right: -23px; }
[dir="rtl"] .officials-table th { text-align: right; }


/* --- 24. Responsive --- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --nav-height: 48px; }

  .container { padding: 0 var(--space-4); }
  .page-header { padding: var(--space-6) 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .officials-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-updated { display: none; }
  .footer-inner { flex-direction: column; }
  .footer-links { flex-direction: column; gap: var(--space-3); }

  .officials-table-wrap { overflow-x: auto; }
  .officials-table { min-width: 700px; }

  .page-header h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .collapse-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
}


/* --- 25. Print --- */
@media print {
  .site-nav, .breaking-banner, .lang-toggle, .filter-bar, .view-controls { display: none !important; }
  body { font-size: 12px; color: #000; }
  .page-content { padding: 0; }
  .official-card, .chart-card, .proxy-card { break-inside: avoid; }
  .site-footer { display: none; }
}


/* --- 26. Utility --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.hidden { display: none !important; }


/* --- 27. Official Avatars --- */
.official-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.official-avatar.large {
  width: 56px;
  height: 56px;
}

.official-avatar .avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: #fff;
  user-select: none;
}

.official-avatar.large .avatar-initials { font-size: 0.9375rem; }

.official-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.official-avatar.status-alive .avatar-initials    { background: var(--status-alive); }
.official-avatar.status-killed .avatar-initials   { background: var(--status-killed); }
.official-avatar.status-uncertain .avatar-initials { background: var(--status-uncertain); }
.official-avatar.status-disputed .avatar-initials  { background: var(--status-disputed); }

.name-with-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* --- 28. Effectiveness Chart --- */
.effectiveness-chart-wrap {
  position: relative;
  height: 380px;
  direction: ltr;
}

.effectiveness-legend {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

.legend-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-line-swatch {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  position: relative;
}

.legend-line-swatch::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: inherit;
}


/* --- 29. Control Index Chart --- */
.control-chart-wrap {
  position: relative;
  height: 420px;
  margin: 8px 8px 0 0;
}

.control-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
}

.control-index-callout {
  flex-shrink: 0;
}

.control-index-number {
  font-size: 3rem;
  font-weight: 900;
  color: var(--brand-red);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  text-shadow: 0 1px 2px rgba(220,38,38,0.1);
}

.control-index-sublabel {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.control-index-change {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.control-chart-formula {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  max-width: 520px;
  line-height: 1.55;
  text-align: right;
}

.formula-line { margin-bottom: 2px; }

[dir="rtl"] .control-chart-formula { text-align: left; }
