/* ============================================================
   National Youth Platform Chad — Design System
   Part 1: Foundation (Colors, Typography, Spacing, Shadows)
   ============================================================ */

@import url('preloader.css');

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');

/* ── Chad Flag Palette ───────────────────────────────────── */
:root {
  --chad-blue: #002664;
  --chad-blue-light: #003d99;
  --chad-blue-dark: #001a42;
  --chad-yellow: #fecb00;
  --chad-yellow-light: #ffe566;
  --chad-yellow-dark: #c9a300;
  --chad-red: #c60c30;
  --chad-red-light: #e83555;
  --chad-red-dark: #9a0825;

  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --navy: #0a1628;
  --soft-black: #0f172a;

  /* Semantic */
  --color-primary: var(--chad-blue);
  --color-primary-hover: var(--chad-blue-light);
  --color-accent: var(--chad-yellow);
  --color-danger: var(--chad-red);
  --color-success: #059669;
  --color-warning: #d97706;
  --color-info: #0284c7;

  --bg-body: var(--gray-50);
  --bg-surface: var(--white);
  --bg-elevated: var(--white);
  --bg-muted: var(--gray-100);
  --text-primary: var(--soft-black);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --text-inverse: var(--white);
  --border-color: var(--gray-200);
  --border-strong: var(--gray-300);

  /* Typography */
  --font-ar: 'Tajawal', 'Segoe UI', sans-serif;
  --font-en: 'Inter', 'Segoe UI', sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Tajawal', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-sm: 0 2px 8px rgba(10, 22, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(10, 22, 40, 0.08);
  --shadow-lg: 0 8px 32px rgba(10, 22, 40, 0.1);
  --shadow-xl: 0 16px 48px rgba(10, 22, 40, 0.12);
  --shadow-focus: 0 0 0 3px rgba(0, 38, 100, 0.2);

  /* Layout */
  --header-height: 72px;
  --container-max: 1280px;
  --sidebar-width: 280px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Chad flag stripe (decorative) */
  --flag-stripe: linear-gradient(
    90deg,
    var(--chad-blue) 0%,
    var(--chad-blue) 33.33%,
    var(--chad-yellow) 33.33%,
    var(--chad-yellow) 66.66%,
    var(--chad-red) 66.66%,
    var(--chad-red) 100%
  );
}

/* ── Dark Mode ───────────────────────────────────────────── */
[data-theme='dark'] {
  --bg-body: #0c1222;
  --bg-surface: #111827;
  --bg-elevated: #1a2332;
  --bg-muted: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #2d3a4f;
  --border-strong: #3d4f66;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-focus: 0 0 0 3px rgba(254, 203, 0, 0.25);
  --color-primary-hover: #1a4d99;
}

/* ── Base Reset & Typography ─────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-ar);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-body);
  transition: background-color var(--duration-normal) var(--ease-out),
    color var(--duration-normal) var(--ease-out);
}

[lang='en'],
[lang='fr'],
body.lang-fr,
.font-en {
  font-family: var(--font-en);
}

html[lang='fr'] h1,
html[lang='fr'] h2,
html[lang='fr'] h3,
html[lang='fr'] h4,
html[lang='fr'] h5,
html[lang='fr'] h6,
html[lang='fr'] .h1,
html[lang='fr'] .h2,
html[lang='fr'] .h3,
html[lang='fr'] .h4,
html[lang='fr'] .h5,
html[lang='fr'] .h6 {
  font-family: var(--font-display);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-top: 0;
}

h1, .h1 { font-size: clamp(2rem, 5vw, var(--text-5xl)); }
h2, .h2 { font-size: clamp(1.75rem, 4vw, var(--text-4xl)); }
h3, .h3 { font-size: var(--text-3xl); }
h4, .h4 { font-size: var(--text-2xl); }
h5, .h5 { font-size: var(--text-xl); font-weight: 700; }
h6, .h6 { font-size: var(--text-lg); font-weight: 700; }

.display-1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lead {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* Type scale utilities */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fw-extrabold { font-weight: 800; }

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-hover);
}

/* Container */
.nyp-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 575.98px) {
  .nyp-container {
    padding-inline: var(--space-4);
  }
}

/* Section spacing */
.section {
  padding-block: var(--space-16);
}

.section-sm {
  padding-block: var(--space-10);
}

/* Chad flag accent bar */
.flag-bar {
  height: 4px;
  background: var(--flag-stripe);
  width: 100%;
}

.flag-bar-thin {
  height: 3px;
}

/* Focus visible (a11y) */
:focus-visible {
  outline: 2px solid var(--chad-yellow);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--chad-yellow);
  color: var(--navy);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-muted);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-full);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}

/* Icon base (Phosphor) */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon svg {
  width: 1em;
  height: 1em;
}

.icon-sm { font-size: 1rem; }
.icon-md { font-size: 1.25rem; }
.icon-lg { font-size: 1.5rem; }
.icon-xl { font-size: 2rem; }

/* Utility colors */
.text-chad-blue { color: var(--chad-blue); }
.text-chad-yellow { color: var(--chad-yellow-dark); }
.text-chad-red { color: var(--chad-red); }
.bg-chad-blue { background-color: var(--chad-blue); }
.bg-navy { background-color: var(--navy); }

/* Spacing utilities */
.gap-section { gap: var(--space-8); }

/* Reduced motion */
@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;
  }
}
