/* ============================================================
   GLOSTATS DESIGN SYSTEM — shared across all pages
   Load order: this file first, then page-specific styles.
   ============================================================ */

:root {
  /* surfaces & ink */
  --gs-bg: #f4f6fb;
  --gs-surface: #ffffff;
  --gs-ink: #0f172a;
  --gs-ink-2: #334155;
  --gs-muted: #64748b;
  --gs-line: #e2e8f0;

  /* brand */
  --gs-navy: #0b1220;
  --gs-navy-2: #101c3a;
  --gs-brand: #2563eb;
  --gs-brand-deep: #1e3a8a;
  --gs-cyan: #38bdf8;

  /* semantic (live counters) */
  --gs-birth: #0ca30c;
  --gs-death: #d03b3b;
  --gs-male: #2a78d6;
  --gs-female: #d55181;

  /* validated categorical chart palette (fixed order, never cycle) */
  --gs-s1: #2a78d6;
  --gs-s2: #eb6834;
  --gs-s3: #1baf7a;
  --gs-s4: #eda100;
  --gs-s5: #e87ba4;
  --gs-s6: #008300;
  --gs-s7: #4a3aa7;

  --gs-radius: 1rem;
  --gs-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  --gs-shadow-hover: 0 16px 34px rgba(15, 23, 42, 0.14);
  --gs-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--gs-font);
  background: var(--gs-bg);
  color: var(--gs-ink);
}

a { color: var(--gs-brand); }

/* ---------- layout ---------- */
.gs-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.gs-page-wide { max-width: 1400px; }

/* ---------- navbar ---------- */
.gs-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}

.gs-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 58px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gs-brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.gs-brand .gs-brand-accent { color: var(--gs-cyan); }

.gs-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: gs-pulse 1.6s ease-in-out infinite;
}

@keyframes gs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.gs-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gs-links a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.42rem 0.85rem;
  border-radius: 0.55rem;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.gs-links a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.gs-links a.active {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  font-weight: 600;
}

.gs-nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.gs-search {
  width: 210px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: background 0.2s, border-color 0.2s, width 0.25s;
}

.gs-search::placeholder { color: rgba(255, 255, 255, 0.55); }

.gs-search:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--gs-cyan);
  width: 250px;
}

.gs-burger {
  display: none;
  background: none;
  border: none;
  font-size: 1.55rem;
  color: #fff;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.gs-mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--gs-navy);
  border-radius: 0 0 1rem 1rem;
}

.gs-mobile-menu a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.5rem;
}

.gs-mobile-menu a.active { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.gs-mobile-menu .gs-search { width: 100%; margin-top: 0.5rem; }
.gs-mobile-menu.open { display: flex; }

@media (max-width: 860px) {
  .gs-links, .gs-nav-right .gs-search { display: none; }
  .gs-burger { display: block; }
}

/* ---------- hero band ---------- */
.gs-hero {
  background:
    radial-gradient(ellipse 60% 80% at 70% 20%, rgba(56, 189, 248, 0.16), transparent),
    radial-gradient(ellipse 50% 70% at 20% 90%, rgba(37, 99, 235, 0.25), transparent),
    linear-gradient(135deg, #0b1220 0%, #101c3a 55%, #17285c 100%);
  color: #fff;
  padding: 2.6rem 1rem 2.2rem;
  text-align: center;
}

.gs-hero-inner { max-width: 1100px; margin: 0 auto; }

.gs-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 0.35rem;
  letter-spacing: 0.01em;
}

.gs-hero p.gs-hero-sub {
  margin: 0 auto;
  max-width: 640px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.72);
}

/* ---------- live badge ---------- */
.gs-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  text-transform: uppercase;
}

.gs-live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  animation: gs-pulse 1.6s ease-in-out infinite;
}

.card .gs-live-badge, .gs-on-light.gs-live-badge {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

/* ---------- cards ---------- */
.card {
  background: var(--gs-surface);
  border-radius: var(--gs-radius);
  box-shadow: var(--gs-shadow);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-title { font-size: 1.1rem; font-weight: 650; color: var(--gs-ink); }
.card-caption { font-size: 0.85rem; color: var(--gs-muted); }

.gs-hoverable {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gs-hoverable:hover {
  transform: translateY(-3px);
  box-shadow: var(--gs-shadow-hover);
}

/* ---------- stat tiles ---------- */
.gs-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}

.gs-tile {
  background: #f8fafc;
  border: 1px solid var(--gs-line);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
}

.gs-tile .gs-tile-label {
  display: block;
  font-size: 0.72rem;
  color: var(--gs-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gs-tile .gs-tile-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gs-ink);
}

.gs-tile .gs-tile-note { font-size: 0.72rem; color: var(--gs-muted); }

/* ---------- live numbers ---------- */
.gs-num {
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.gs-flash { animation: gs-flash-anim 0.5s ease; }

@keyframes gs-flash-anim {
  0% { color: var(--gs-cyan); }
  100% { color: inherit; }
}

/* ---------- chips / filter buttons ---------- */
.gs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gs-chip {
  border: 1px solid var(--gs-line);
  background: var(--gs-surface);
  color: var(--gs-ink-2);
  font-size: 0.85rem;
  font-weight: 550;
  font-family: var(--gs-font);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.gs-chip:hover { border-color: var(--gs-brand); color: var(--gs-brand); }

.gs-chip.active {
  background: var(--gs-brand);
  border-color: var(--gs-brand);
  color: #fff;
}

/* ---------- buttons ---------- */
.gs-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gs-brand);
  color: #fff;
  border: none;
  font-family: var(--gs-font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 0.6rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s, transform 0.15s;
}

.gs-btn:hover { background: var(--gs-brand-deep); transform: translateY(-1px); }

.gs-btn-ghost {
  background: transparent;
  color: var(--gs-brand);
  border: 1px solid var(--gs-brand);
}

.gs-btn-ghost:hover { background: rgba(37, 99, 235, 0.07); }

/* ---------- skeleton loading ---------- */
.gs-skeleton {
  position: relative;
  overflow: hidden;
  background: #e9edf5;
  border-radius: 0.6rem;
  min-height: 1rem;
}

.gs-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: translateX(-100%);
  animation: gs-shimmer 1.4s infinite;
}

@keyframes gs-shimmer {
  100% { transform: translateX(100%); }
}

/* ---------- insights list under charts ---------- */
.chart-insights {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gs-line);
  font-size: 0.9rem;
  color: var(--gs-ink-2);
}

.chart-insights ul { margin: 0; padding-left: 1.1rem; }
.chart-insights li { margin-bottom: 0.35rem; line-height: 1.45; }

/* ---------- ticker strip ---------- */
.gs-ticker {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.9rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.gs-ticker strong { font-variant-numeric: tabular-nums; }

/* ---------- footer ---------- */
.gs-footer {
  background: var(--gs-navy);
  color: rgba(255, 255, 255, 0.75);
  margin-top: 3rem;
  padding: 2.2rem 1rem 1.6rem;
  font-size: 0.85rem;
}

.gs-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.gs-footer h4 {
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}

.gs-footer a {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  padding: 0.18rem 0;
}

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

.gs-footer-note {
  max-width: 1200px;
  margin: 1.6rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}

/* ---------- misc ---------- */
.gs-flag-sm {
  width: 34px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.gs-section-title {
  font-size: 1.35rem;
  font-weight: 750;
  margin: 2rem 0 1rem;
}

.am5-logo { display: none !important; }
