/* ==========================================================================
   SomaliaStats — shared design system
   Fonts: Playfair Display (headings), DM Sans (body), DM Mono (labels)
   ========================================================================== */

:root {
  --ink: #0d1b2a;
  --muted: #516070;
  --surface: #f5f8fb;
  --card: #ffffff;
  --border: #d4e3ee;
  --sky: #0a5c91;
  --sky-light: #1e7ab8;
  --sky-pale: #dbeeff;
  --sand: #e8d5a3;
  --sand-dark: #b89b5e;

  /* theme accent colors */
  --theme-people: #2e6880;
  --theme-economy: #8a6c2e;
  --theme-state: #9e3a35;
  --theme-diaspora: #2e7a50;
  --theme-infrastructure: #5a5a68;
  --theme-territory: #6b5b95;
  --theme-science: #3a7d7d;
}

* , *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-weight: 900; }
h2 { font-weight: 700; }
h3 { font-weight: 700; }

p { margin: 0 0 1em; }

a { color: var(--sky); }

.eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.mono { font-family: 'DM Mono', monospace; }

/* ---------------------------------------------------------------------- */
/* Header / nav                                                          */
/* ---------------------------------------------------------------------- */

header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.08rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo .star { color: var(--sand); }

nav.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav.site-nav a {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
nav.site-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
nav.site-nav a.active { color: #fff; background: rgba(255,255,255,0.12); }

/* ---------------------------------------------------------------------- */
/* Footer                                                                 */
/* ---------------------------------------------------------------------- */

footer.site-footer {
  text-align: center;
  padding: 40px 24px 48px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--card);
}
footer.site-footer p { margin: 0 0 6px; }
footer.site-footer .fine {
  text-transform: none;
  letter-spacing: normal;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  opacity: 0.85;
}

/* ---------------------------------------------------------------------- */
/* Layout helpers                                                        */
/* ---------------------------------------------------------------------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

section.page-section { padding: 56px 0; }
section.page-section + section.page-section { border-top: 1px solid var(--border); }

.section-head { margin-bottom: 28px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.section-head .source-tag { margin-top: 6px; }

.source-tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.source-tag::before { content: 'Source: '; opacity: 0.7; }

/* ---------------------------------------------------------------------- */
/* Card                                                                   */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.card.accent-top { border-top: 3px solid var(--accent, var(--sky)); }
.card-pad { padding: 22px 24px; }

/* ---------------------------------------------------------------------- */
/* KPI strip / stat cards                                                 */
/* ---------------------------------------------------------------------- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.kpi-tile {
  background: var(--card);
  padding: 20px 18px;
}
.kpi-tile .label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.kpi-tile .value {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.7rem;
  color: var(--ink);
  line-height: 1.1;
}
.kpi-tile .sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent, var(--sky));
  border-radius: 12px;
  padding: 20px 22px;
}
.stat-card .stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-card .stat-value {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 2rem;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card .stat-context {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-card .source-tag { display: block; }

/* ---------------------------------------------------------------------- */
/* Insight callout                                                        */
/* ---------------------------------------------------------------------- */

.insight {
  border-left: 3px solid var(--accent, var(--sky));
  background: color-mix(in srgb, var(--accent, var(--sky)) 7%, var(--card));
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: 0.92rem;
  color: var(--ink);
}
.insight strong { color: var(--accent, var(--sky)); }
.insight .insight-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent, var(--sky));
  margin-bottom: 6px;
}

/* ---------------------------------------------------------------------- */
/* Chart containers                                                       */
/* ---------------------------------------------------------------------- */

.chart-card { padding: 20px 22px 14px; }
.chart-card h3 {
  font-size: 1rem;
  margin-bottom: 2px;
}
.chart-card .chart-unit {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-card canvas { max-width: 100%; }
.chart-card .source-tag { display: block; margin-top: 10px; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

/* ---------------------------------------------------------------------- */
/* Hero (home page)                                                       */
/* ---------------------------------------------------------------------- */

.hero {
  background: linear-gradient(180deg, var(--ink) 0%, #132a3f 100%);
  color: #fff;
  padding: 88px 24px 76px;
  text-align: center;
}
.hero .eyebrow { color: rgba(255,255,255,0.55); }
.hero h1 {
  color: #fff;
  font-size: clamp(2.4rem, 6vw, 4rem);
  max-width: 760px;
  margin: 14px auto 18px;
}
.hero h1 .accent { color: var(--sand); }
.hero p.lede {
  max-width: 560px;
  margin: 0 auto;
  color: rgba(255,255,255,0.78);
  font-size: 1.05rem;
}

/* ---------------------------------------------------------------------- */
/* Link cards (home page section links)                                   */
/* ---------------------------------------------------------------------- */

.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.link-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent, var(--sky));
  border-radius: 12px;
  padding: 26px 24px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.link-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(13,27,42,0.1);
}
.link-card .eyebrow { color: var(--accent, var(--sky)); }
.link-card h3 { margin: 8px 0 6px; font-size: 1.25rem; }
.link-card p { color: var(--muted); font-size: 0.88rem; margin: 0; }
.link-card .go {
  display: inline-block;
  margin-top: 14px;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, var(--sky));
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                             */
/* ---------------------------------------------------------------------- */

@media (max-width: 640px) {
  section.page-section { padding: 40px 0; }
  .nav-inner { padding: 12px 16px; }
  nav.site-nav { gap: 2px; }
  nav.site-nav a { padding: 7px 9px; font-size: 0.66rem; }
  .hero { padding: 64px 18px 52px; }
}
