/* ==========================================================================
   EqualEarthMap.in - Core Design System & Global Styles
   Cartographic Editorial Aesthetic | Ultra-Fast | Shared-Hosting Ready
   ========================================================================== */

:root {
  /* Color Palette - Modern Dark Theme (Obsidian & Electric Cyan) */
  --bg-primary: #07090e;
  --bg-secondary: #0d111a;
  --bg-card: rgba(16, 22, 34, 0.78);
  --bg-card-hover: rgba(24, 33, 50, 0.88);
  --bg-elevated: #151d2d;
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-subtle: rgba(255, 255, 255, 0.05);
  --surface-glow: rgba(56, 189, 248, 0.25);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #07090e;

  /* Cartographic Accents - Modern Electric Colors */
  --accent-cyan: #38bdf8;
  --accent-cyan-hover: #00d2ff;
  --accent-cyan-subtle: rgba(56, 189, 248, 0.15);
  --accent-cyan-glow: rgba(0, 210, 255, 0.35);
  --accent-indigo: #818cf8;
  --accent-gold: #fbbf24;
  --accent-gold-subtle: rgba(251, 191, 36, 0.15);
  --accent-emerald: #34d399;
  --accent-rose: #fb7185;

  /* Map Specific Tones - Deep Midnight Abyss & Electric Active Highlights */
  --map-ocean-bg: #090e17;
  --map-land-default: #172033;
  --map-land-hover: #22314d;
  --map-land-active: #00d2ff;
  --map-land-secondary: #fbbf24;
  --map-stroke: rgba(255, 255, 255, 0.12);
  --map-stroke-active: #ffffff;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Modern Layered Elevations */
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.45), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.55), 0 4px 10px -2px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 24px 38px -8px rgba(0, 0, 0, 0.65), 0 8px 16px -4px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.25);

  /* Transitions */
  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 240ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --max-width: 1200px;
  --header-height: 68px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* Modern Light Theme (Clean Alabaster Ceramic & Vibrant Azure) */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --bg-elevated: #ffffff;
  --surface-border: #e2e8f0;
  --surface-border-subtle: #edf2f7;
  --surface-glow: rgba(2, 132, 199, 0.2);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Map Light Mode: Modern Apple Maps / Mapbox style luminous azure ocean + ceramic stone land */
  --map-ocean-bg: #dbeafe;
  --map-land-default: #ffffff;
  --map-land-hover: #e0f2fe;
  --map-land-active: #0284c7;
  --map-stroke: #cbd5e1;
  --map-stroke-active: #ffffff;

  --accent-cyan: #0284c7;
  --accent-cyan-hover: #0369a1;
  --accent-cyan-subtle: rgba(2, 132, 199, 0.12);
  --accent-cyan-glow: rgba(2, 132, 199, 0.28);
  --accent-indigo: #4f46e5;
  --accent-gold: #d97706;
  --accent-gold-subtle: rgba(217, 119, 6, 0.12);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 30px -6px rgba(0, 0, 0, 0.09), 0 8px 12px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.2);
}

/* Theme Toggle Button (44px Accessible Touch Target) */
.theme-toggle-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
  padding: 0;
  touch-action: manipulation;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Global Subtle Theme Transitions (~150ms) */
html, body, .site-header, .site-footer, .card, .btn, .search-bar, .country-drawer, .map-tooltip {
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-cyan-hover);
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select {
  font: inherit;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.container-wide {
  width: 100%;
  max-width: 1560px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border-subtle);
  display: flex;
  align-items: center;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo:hover {
  text-decoration: none;
  color: var(--accent-cyan);
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b0f19;
  font-size: 1rem;
}

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

.nav-link {
  font-size: 0.938rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 0.35rem 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.938rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--accent-cyan);
  color: #0b0f19;
  border-color: var(--accent-cyan);
}

.btn-primary:hover {
  background-color: #7dd3fc;
  border-color: #7dd3fc;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--surface-border);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--surface-border);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.813rem;
  border-radius: var(--radius-sm);
}

.btn-gold {
  background-color: var(--accent-gold);
  color: #0b0f19;
}

.btn-gold:hover {
  background-color: #fcd34d;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-full);
  background-color: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-gold {
  background-color: var(--accent-gold-subtle);
  color: var(--accent-gold);
  border-color: rgba(251, 191, 36, 0.2);
}

/* Typography Headings */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.75rem; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.125rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); margin-bottom: 1rem; }

/* Compact Hero Bar for Maximum Map Prominence */
.map-hero-bar {
  padding: 0.85rem 0 0.5rem;
}

.map-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.map-hero-text {
  flex: 1 1 540px;
  min-width: 0;
  max-width: 100%;
}

.comparison-teaser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.map-hero-title {
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.map-hero-subtitle {
  font-weight: 600;
  color: var(--text-secondary);
}

.map-hero-sep {
  color: var(--surface-border);
}

.badge-compact {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  font-weight: 600;
}

.map-hero-desc {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0;
  max-width: 680px;
}

.map-hero-quick-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  background-color: var(--bg-card);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.quick-link-pill:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Standalone Hero Section (Used on secondary pages if needed) */
.hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.hero-content {
  max-width: 840px;
  margin: 0 auto;
}

.hero-badge-wrapper {
  margin-bottom: 1rem;
}

.hero-lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* Cards & Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--accent-cyan);
}

.card-interactive {
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.card-interactive:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

/* Sections */
.section {
  padding: 4rem 0;
  border-top: 1px solid var(--surface-border-subtle);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.section-subtitle {
  font-size: 1.063rem;
  color: var(--text-secondary);
}

/* Reserved Ad Container - Non-shifting */
.ad-slot-placeholder {
  width: 100%;
  min-height: 100px;
  background-color: var(--bg-secondary);
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-md);
  margin: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs a:hover {
  color: var(--accent-cyan);
}

.breadcrumbs-separator {
  color: var(--surface-border);
}

/* Stat Box */
.stat-pill {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border-subtle);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

/* Table Styling */
.table-responsive {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.938rem;
}

.data-table th {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--surface-border);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface-border-subtle);
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: rgba(56, 189, 248, 0.03);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--surface-border);
  padding: 3.5rem 0 2rem;
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.813rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Quiz & Interactive Choices */
.quiz-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background-color: var(--bg-card);
  border: 2px solid var(--surface-border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.quiz-choice-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.quiz-choice-flag {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.quiz-choice-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.quiz-choice-continent {
  font-size: 0.813rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quiz-mode-selector {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.quiz-mode-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-border);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-mode-btn.active {
  background-color: var(--accent-cyan);
  color: #0b0f19;
  border-color: var(--accent-cyan);
}

/* Responsive Breakpoints & Mobile Optimization */
@media (max-width: 960px) {
  .nav-links {
    display: none;
  }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--surface-border);
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    gap: 1.25rem;
    z-index: 100;
  }
  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .grid-4, .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .comparison-teaser-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .header-explore-btn {
    display: none !important;
  }
  .brand-logo {
    font-size: 1.05rem;
    gap: 0.4rem;
    white-space: nowrap;
  }
  .brand-icon {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }
  .container,
  .container-wide {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .map-hero-bar {
    padding: 0.5rem 0 0.35rem;
  }
  .map-hero-content {
    gap: 0.65rem;
  }
  .map-hero-title {
    font-size: 1.25rem;
    gap: 0.35rem;
  }
  .map-hero-subtitle {
    font-size: 0.95rem;
  }
  .map-hero-sep {
    display: none;
  }
  .map-hero-desc {
    font-size: 0.82rem;
    line-height: 1.4;
  }
  .map-hero-quick-links {
    gap: 0.35rem;
  }
  .quick-link-pill {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }
  .hero-cta-group .btn {
    width: 100%;
  }
}
