/**
 * Municipios de México — Design System
 * Aesthetic: Editorial Cartography / Mexican Data Observatory
 * Palette: Cenote Teal + Barro Clay
 */

/* ============================================
   IMPORTS — Distinctive Typography
   Fraunces: baroque warmth, optical sizing
   Source Sans 3: data-optimized body
   IBM Plex Mono: tight tabular figures
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&family=Source+Sans+3:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Cenote + Barro palette */
  --color-primary: #0B525B;
  --color-primary-light: #168A99;
  --color-primary-lighter: #D0F0F6;
  --color-primary-dark: #072E33;
  --color-primary-50: rgba(11, 82, 91, 0.06);
  --color-primary-100: rgba(11, 82, 91, 0.12);

  --color-accent: #C4704B;
  --color-accent-light: #E09A7A;
  --color-accent-dark: #9A5638;

  --color-success: #2D7D46;
  --color-success-light: #E8F5E9;
  --color-warning: #C68A1D;
  --color-warning-light: #FFF8E1;
  --color-danger: #B33A3A;
  --color-danger-light: #FFEBEE;

  /* Neutrals — warm parchment tones */
  --color-bg: #F7F5F2;
  --color-surface: #FFFFFF;
  --color-surface-warm: #FAF8F5;

  --color-text: #1C1917;
  --color-text-secondary: #57534E;
  --color-text-tertiary: #A8A29E;
  --color-text-inverse: #FAFAF9;

  --color-border: #E7E5E4;
  --color-border-strong: #D6D3D1;

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* Spacing — 4px base */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 6px rgba(28, 25, 23, 0.07), 0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 10px 15px rgba(28, 25, 23, 0.08), 0 4px 6px rgba(28, 25, 23, 0.04);
  --shadow-xl: 0 20px 25px rgba(28, 25, 23, 0.10), 0 8px 10px rgba(28, 25, 23, 0.04);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 350ms;

  /* Layout */
  --container-max: 1320px;
  --header-h: 64px;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; }

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: var(--s-6); }
h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.125rem);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--color-border);
  position: relative;
}
h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--color-accent);
}
h3 { font-size: clamp(1.25rem, 2.5vw, 1.625rem); margin-bottom: var(--s-3); }
h4 { font-size: 1.0625rem; margin-bottom: var(--s-2); color: var(--color-text-secondary); }

p { margin-bottom: var(--s-4); color: var(--color-text-secondary); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}
a:hover { color: var(--color-primary-light); }

/* Remove underline pseudo-element globally — cleaner for data site */
a::after { display: none !important; }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--s-6);
}
@media (max-width: 640px) {
  .container { padding: 0 var(--s-4); }
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
  height: var(--header-h);
  box-shadow: 0 2px 12px rgba(7, 46, 51, 0.3);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--s-4);
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--color-text-inverse) !important;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.site-logo span {
  color: var(--color-accent-light);
}

/* Header search */
.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: var(--s-2) var(--s-4) var(--s-2) var(--s-10);
  font-family: var(--font-body);
  font-size: 0.875rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.08);
  color: var(--color-text-inverse);
  transition: all var(--t-base) var(--ease-out);
  outline: none;
}
.header-search input::placeholder { color: rgba(255,255,255,0.45); }
.header-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.header-search-icon {
  position: absolute;
  left: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0.5;
  pointer-events: none;
}
/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + var(--s-2));
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 300;
}
.search-results.active { display: block; }
.search-results a {
  display: block;
  padding: var(--s-3) var(--s-4);
  color: var(--color-text);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--t-fast);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover,
.search-results a.active { background: var(--color-primary-50); }
.search-results a small { display: block; color: var(--color-text-tertiary); font-size: 0.8125rem; }

/* Navigation */
.site-nav {
  display: flex;
  gap: var(--s-1);
  align-items: center;
}
.site-nav a {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7) !important;
  transition: all var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.site-nav a:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.1);
}
.lang-switch {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: 4px;
  font-size: 0.75rem !important;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
  padding: var(--s-1) var(--s-2) !important;
  transition: border-color 0.2s, background 0.2s;
}
.lang-switch img {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
  vertical-align: middle;
}
.lang-switch:hover {
  border-color: rgba(255,255,255,0.6) !important;
  background: rgba(255,255,255,0.15) !important;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-inverse);
  padding: var(--s-2);
}
.menu-toggle svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .header-search { display: none; }
  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-primary-dark);
    flex-direction: column;
    padding: var(--s-8) var(--s-6);
    gap: var(--s-2);
    z-index: 199;
  }
  .site-nav.open { display: flex; }
  .site-nav a {
    font-size: 1.125rem;
    padding: var(--s-3) var(--s-4);
  }
  /* Show search in mobile menu */
  .mobile-search {
    padding: var(--s-4);
    display: none;
  }
  .site-nav.open + .mobile-search,
  .site-nav.open ~ .mobile-search { display: block; }
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--s-3) 0;
}
.breadcrumb-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  align-items: center;
  font-size: 0.8125rem;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.breadcrumb-item:not(:last-child)::after {
  content: '/';
  color: var(--color-text-tertiary);
  margin-left: var(--s-1);
}
.breadcrumb-item a {
  color: var(--color-text-tertiary);
  font-weight: 500;
}
.breadcrumb-item a:hover { color: var(--color-primary); }
.breadcrumb-item.active {
  color: var(--color-text);
  font-weight: 600;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, #0E6B5E 100%);
  color: var(--color-text-inverse);
  padding: var(--s-16) 0 var(--s-12);
  margin: 0 calc(-50vw + 50%) var(--s-12);
  width: 100vw;
  position: relative;
  overflow: hidden;
}
/* Topographic pattern overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(196, 112, 75, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 90% 20%, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}
/* Subtle grid pattern */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  color: var(--color-text-inverse);
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 700;
  margin-bottom: var(--s-4);
  max-width: 700px;
}
.hero p {
  color: rgba(255,255,255,0.8);
  font-size: 1.125rem;
  max-width: 600px;
  margin-bottom: var(--s-8);
  line-height: 1.7;
}
.hero .section-intro { color: rgba(255,255,255,0.8); }

/* Hero search */
.hero-search {
  max-width: 560px;
  position: relative;
  margin-bottom: var(--s-8);
}
.hero-search input {
  width: 100%;
  padding: var(--s-4) var(--s-6) var(--s-4) var(--s-12);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  color: #fff;
  outline: none;
  transition: all var(--t-base) var(--ease-out);
}
.hero-search input::placeholder { color: rgba(255,255,255,0.5); }
.hero-search input:focus {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08);
}
.hero-search-icon {
  position: absolute;
  left: var(--s-4);
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  opacity: 0.5;
  pointer-events: none;
  color: #fff;
}

/* Hero counters */
.hero-counters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
}
.hero-counter {
  text-align: left;
}
.hero-counter-value {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  color: #fff;
  line-height: 1;
  margin-bottom: var(--s-1);
}
.hero-counter-label {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
}

@media (max-width: 640px) {
  .hero { padding: var(--s-10) 0 var(--s-8); }
  .hero-counters { gap: var(--s-6); }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  padding: var(--s-8) 0 var(--s-12);
  min-height: calc(100vh - var(--header-h) - 200px);
}
.section {
  margin-bottom: var(--s-12);
}
.section-intro {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 72ch;
  line-height: 1.7;
  margin-bottom: var(--s-6);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4);
  margin: var(--s-6) 0;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-5) var(--s-4);
  position: relative;
  overflow: hidden;
  transition: all var(--t-base) var(--ease-out);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity var(--t-base);
}
.stat-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.stat-card:hover::before { opacity: 1; }

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--s-2);
}
.stat-card-value {
  font-family: var(--font-mono);
  font-size: clamp(1.625rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--s-1);
  letter-spacing: -0.03em;
}
.stat-card-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  line-height: 1.4;
}

/* Variants */
.stat-card.accent::before { background: var(--color-accent); }
.stat-card.accent .stat-card-value { color: var(--color-accent-dark); }
.stat-card.accent:hover { border-color: var(--color-accent); }

.stat-card.success::before { background: var(--color-success); }
.stat-card.success .stat-card-value { color: var(--color-success); }
.stat-card.success:hover { border-color: var(--color-success); }

.stat-card.warning::before { background: var(--color-warning); }
.stat-card.warning .stat-card-value { color: var(--color-warning); }

.stat-card.danger::before { background: var(--color-danger); }
.stat-card.danger .stat-card-value { color: var(--color-danger); }

/* ============================================
   TABLES — Dense but scannable
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  margin: var(--s-6) 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}
/* Scroll hint on mobile */
.table-wrapper::after {
  content: '';
  position: sticky;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
  display: none;
}
@media (max-width: 768px) {
  .table-wrapper { margin-left: calc(-1 * var(--s-4)); margin-right: calc(-1 * var(--s-4)); border-radius: 0; border-left: none; border-right: none; }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.4;
}
thead { background: var(--color-surface-warm); }
th {
  font-family: var(--font-body);
  font-weight: 700;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  color: var(--color-text);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--color-border-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--color-surface-warm);
  z-index: 2;
}
th.text-right { text-align: right; }

/* Sortable headers */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: color var(--t-fast);
}
th[data-sort]:hover { color: var(--color-primary); }
th[data-sort]::after {
  content: ' ↕';
  font-size: 0.65rem;
  opacity: 0.3;
  font-family: var(--font-body);
}
th[data-sort].sort-asc::after { content: ' ↑'; opacity: 0.8; color: var(--color-primary); }
th[data-sort].sort-desc::after { content: ' ↓'; opacity: 0.8; color: var(--color-primary); }

td {
  padding: var(--s-3) var(--s-4);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--color-primary-50); }
tbody tr:last-child td { border-bottom: none; }

/* Alternate row coloring */
tbody tr:nth-child(even) { background: rgba(247, 245, 242, 0.5); }
tbody tr:nth-child(even):hover { background: var(--color-primary-50); }

td.numeric {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: right;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.highlight {
  font-weight: 600;
  color: var(--color-text);
}

@media (max-width: 768px) {
  th, td { padding: var(--s-2) var(--s-3); font-size: 0.8125rem; }
}

/* Table filter input */
.table-filter {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.table-filter input {
  flex: 1;
  max-width: 320px;
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-body);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--t-fast);
}
.table-filter input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-50); }
.table-filter input::placeholder { color: var(--color-text-tertiary); }
.table-filter-count {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: all var(--t-base) var(--ease-out);
}
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover,
.card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--s-2);
}
.card p:last-child { margin-bottom: 0; }

/* Estado card — enriched */
.estado-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: all var(--t-base) var(--ease-out);
  text-decoration: none;
  display: block;
  color: inherit;
}
.estado-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.estado-card-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--s-3);
}
.estado-card-stats {
  display: flex;
  gap: var(--s-6);
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}
.estado-card-stats strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.9375rem;
}
/* Mini population bar */
.estado-card-bar {
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  margin-top: var(--s-3);
  overflow: hidden;
}
.estado-card-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: 2px;
  transition: width var(--t-slow) var(--ease-out);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9375rem;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary, .btn {
  background: var(--color-primary);
  color: #fff !important;
  border-color: var(--color-primary);
}
.btn-primary:hover, .btn:not(.btn-secondary):not(.btn-accent):hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: #fff !important;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary) !important;
  border-color: var(--color-border-strong);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
  color: var(--color-primary) !important;
}

.btn-accent {
  background: var(--color-accent);
  color: #fff !important;
  border-color: var(--color-accent);
}
.btn-accent:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: #fff !important;
}

.btn-sm {
  padding: var(--s-2) var(--s-3);
  font-size: 0.8125rem;
}
.btn-lg {
  padding: var(--s-4) var(--s-8);
  font-size: 1.0625rem;
}

/* Nav pills (ranking tabs) */
.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.nav-pills .btn {
  font-size: 0.8125rem;
  padding: var(--s-2) var(--s-3);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  gap: var(--s-1);
  justify-content: center;
  align-items: center;
  margin: var(--s-8) 0;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 var(--s-3);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--t-fast) var(--ease-out);
  text-decoration: none;
  background: var(--color-surface);
}
.pagination a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-50);
}
.pagination .active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ============================================
   THEME CARDS — For homepage sections
   ============================================ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
  margin: var(--s-6) 0;
}
.theme-card {
  display: flex;
  gap: var(--s-4);
  padding: var(--s-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  transition: all var(--t-base) var(--ease-out);
  align-items: flex-start;
}
.theme-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.theme-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.theme-card-icon svg { width: 22px; height: 22px; }
.theme-card-icon.teal { background: var(--color-primary); }
.theme-card-icon.clay { background: var(--color-accent); }
.theme-card-icon.green { background: var(--color-success); }
.theme-card-icon.gold { background: var(--color-warning); }
.theme-card-icon.red { background: var(--color-danger); }
.theme-card-icon.dark { background: var(--color-text); }
.theme-card-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--s-1);
}
.theme-card-body p {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin: 0;
  line-height: 1.5;
}

/* ============================================
   GRIDS
   ============================================ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s-4);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}

/* ============================================
   QUICK LINKS (cross-navigation)
   ============================================ */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: var(--s-4) 0;
}
.quick-links a {
  padding: var(--s-2) var(--s-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: all var(--t-fast);
}
.quick-links a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-50);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.7);
  padding: var(--s-12) 0 var(--s-6);
  margin-top: var(--s-16);
}
.footer-content {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}
@media (max-width: 768px) {
  .footer-content { grid-template-columns: 1fr 1fr; gap: var(--s-6); }
}
@media (max-width: 480px) {
  .footer-content { grid-template-columns: 1fr; }
}

.footer-section h4 {
  color: #fff;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-4);
}
.footer-section p { color: rgba(255,255,255,0.55); font-size: 0.875rem; }
.footer-section a { color: rgba(255,255,255,0.65); font-size: 0.875rem; display: block; padding: var(--s-1) 0; }
.footer-section a:hover { color: var(--color-accent-light); }

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: var(--s-3);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--s-6);
  border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
  font-size: 0.8125rem;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--s-2); }
.mt-md { margin-top: var(--s-4); }
.mt-lg { margin-top: var(--s-6); }
.mt-xl { margin-top: var(--s-8); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--s-2); }
.mb-md { margin-bottom: var(--s-4); }
.mb-lg { margin-bottom: var(--s-6); }
.mb-xl { margin-bottom: var(--s-8); }

.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;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeUp 0.5s var(--ease-out) both; }
.fade-in-up-1 { animation-delay: 0.05s; }
.fade-in-up-2 { animation-delay: 0.1s; }
.fade-in-up-3 { animation-delay: 0.15s; }
.fade-in-up-4 { animation-delay: 0.2s; }
.fade-in-up-5 { animation-delay: 0.25s; }
.fade-in-up-6 { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .fade-in-up { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .site-header, .site-footer, .breadcrumb, .hero, .table-filter, .btn,
  .search-results, .menu-toggle, .pagination { display: none; }
  body { background: #fff; color: #000; }
  .main-content { padding: 0; }
  .stat-card, .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  table { font-size: 0.75rem; }
  th, td { padding: 4px 8px; }
}
