/* ============================================================
   SAMA MAIRIE — Global Design System
   Commune de Biscuiterie, Dakar
   ============================================================ */

/* --- Design Tokens ------------------------------------------ */
:root {
  /* Palette sénégalaise officielle */
  --sn-green: #00853F;
  --sn-green-dark: #006830;
  --sn-green-light: #1BA259;
  --sn-gold: #FDEF42;
  --sn-red: #E31B23;
  --sn-white: #FFFFFF;
  --sn-black: #1A1A2E;
  --sn-gray: #F8F9FA;
  --sn-gold-premium: #C9A84C;
  --sn-gold-soft: #E8D181;

  /* Surfaces */
  --surface-0: #FFFFFF;
  --surface-1: #FAFAFB;
  --surface-2: #F1F3F5;
  --surface-3: #E9ECEF;
  --surface-dark-0: #0F1020;
  --surface-dark-1: #1A1A2E;
  --surface-dark-2: #23253F;
  --surface-dark-3: #2E3150;

  /* Texte */
  --text-primary: #0F1020;
  --text-secondary: #4A4E69;
  --text-muted: #8A8FA3;
  --text-inverse: #FFFFFF;
  --text-gold: #C9A84C;

  /* Bordures */
  --border-subtle: rgba(15, 16, 32, 0.08);
  --border-medium: rgba(15, 16, 32, 0.15);
  --border-strong: rgba(15, 16, 32, 0.25);
  --border-gold: rgba(201, 168, 76, 0.4);

  /* Ombres premium */
  --shadow-xs: 0 1px 2px rgba(15, 16, 32, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 16, 32, 0.06), 0 1px 2px rgba(15, 16, 32, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 16, 32, 0.08), 0 2px 4px rgba(15, 16, 32, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 16, 32, 0.12), 0 4px 8px rgba(15, 16, 32, 0.06);
  --shadow-xl: 0 24px 64px rgba(15, 16, 32, 0.18), 0 8px 16px rgba(15, 16, 32, 0.08);
  --shadow-gold: 0 8px 24px rgba(201, 168, 76, 0.25);
  --shadow-green: 0 8px 24px rgba(0, 133, 63, 0.25);

  /* Rayons */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Échelle typographique */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.25rem;
  --fs-5xl: 4rem;
  --fs-6xl: 5.5rem;

  /* Espacements */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 180ms var(--ease-out);
  --t-base: 280ms var(--ease-out);
  --t-slow: 480ms var(--ease-out);

  /* Gradients signature */
  --grad-senegal: linear-gradient(135deg, #00853F 0%, #1BA259 100%);
  --grad-gold: linear-gradient(135deg, #C9A84C 0%, #FDEF42 100%);
  --grad-night: linear-gradient(135deg, #1A1A2E 0%, #23253F 100%);
  --grad-hero: linear-gradient(135deg, #00853F 0%, #1A1A2E 65%, #C9A84C 100%);
  --grad-subtle: linear-gradient(180deg, #FAFAFB 0%, #F1F3F5 100%);

  /* Layout */
  --container-xs: 640px;
  --container-sm: 768px;
  --container-md: 1024px;
  --container-lg: 1280px;
  --container-xl: 1440px;
}

/* --- Reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* --- Typographie utilitaire ---------------------------------- */
.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); }
.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-md { font-size: var(--fs-md); }
.t-lg { font-size: var(--fs-lg); }
.t-xl { font-size: var(--fs-xl); }
.t-2xl { font-size: var(--fs-2xl); }
.t-3xl { font-size: var(--fs-3xl); }
.t-4xl { font-size: var(--fs-4xl); }
.t-5xl { font-size: var(--fs-5xl); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.t-muted { color: var(--text-muted); }
.t-secondary { color: var(--text-secondary); }
.t-green { color: var(--sn-green); }
.t-gold { color: var(--sn-gold-premium); }
.t-red { color: var(--sn-red); }
.t-inverse { color: var(--text-inverse); }

.t-center { text-align: center; }
.t-right { text-align: right; }
.t-upper { text-transform: uppercase; letter-spacing: 0.08em; }
.t-wide { letter-spacing: 0.04em; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h1 { font-size: clamp(2.25rem, 4vw, var(--fs-5xl)); }
h2 { font-size: clamp(1.75rem, 3vw, var(--fs-4xl)); }
h3 { font-size: clamp(1.5rem, 2.2vw, var(--fs-3xl)); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p { max-width: 68ch; }
.lead { font-size: var(--fs-md); color: var(--text-secondary); line-height: 1.7; }

/* --- Layout helpers ------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
.container-xl { max-width: var(--container-xl); }
.container-md { max-width: var(--container-md); }
.section { padding: var(--sp-24) 0; }
.section-sm { padding: var(--sp-16) 0; }

.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* --- Boutons ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 14px 26px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-base), color var(--t-base);
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad-senegal);
  color: var(--text-inverse);
  box-shadow: var(--shadow-green);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(0,133,63,0.35); }

.btn-gold {
  background: var(--grad-gold);
  color: var(--sn-black);
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover { box-shadow: 0 12px 32px rgba(201,168,76,0.4); }

.btn-dark {
  background: var(--sn-black);
  color: var(--text-inverse);
}
.btn-dark:hover { background: #2E3150; }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn-ghost:hover { border-color: var(--sn-green); color: var(--sn-green); }

.btn-link {
  background: transparent;
  color: var(--sn-green);
  padding: 8px 4px;
  border-radius: 0;
}
.btn-link:hover { color: var(--sn-green-dark); }

.btn-sm { padding: 10px 18px; font-size: var(--fs-xs); }
.btn-lg { padding: 18px 34px; font-size: var(--fs-base); }

/* --- Cards --------------------------------------------------- */
.card {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  border: 1px solid var(--border-subtle);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-gold);
}
.card-lg { padding: var(--sp-8); border-radius: var(--radius-xl); }
.card-dark {
  background: var(--surface-dark-1);
  border-color: rgba(255,255,255,0.08);
  color: var(--text-inverse);
}
.card-dark:hover { border-color: var(--sn-gold-premium); }

/* --- Badges -------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-green { background: rgba(0,133,63,0.1); color: var(--sn-green); }
.badge-gold { background: rgba(201,168,76,0.15); color: var(--sn-gold-premium); }
.badge-red { background: rgba(227,27,35,0.1); color: var(--sn-red); }
.badge-dark { background: var(--sn-black); color: var(--text-inverse); }
.badge-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* --- Inputs -------------------------------------------------- */
.input, .select, .textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  font-size: var(--fs-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  color: var(--text-primary);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--sn-green);
  box-shadow: 0 0 0 4px rgba(0,133,63,0.12);
}
.input::placeholder { color: var(--text-muted); }
.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-2);
  color: var(--text-primary);
}
.field { margin-bottom: var(--sp-5); }
.help { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }

/* --- Eyebrow / Section intros -------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sn-green);
}
.eyebrow::before {
  content: ''; width: 32px; height: 2px; background: var(--sn-gold-premium);
}

/* --- Divider avec drapeau ------------------------------------ */
.flag-divider {
  display: inline-flex;
  height: 4px;
  border-radius: var(--radius-full);
  overflow: hidden;
  width: 80px;
}
.flag-divider span { flex: 1; }
.flag-divider span:nth-child(1) { background: var(--sn-green); }
.flag-divider span:nth-child(2) { background: var(--sn-gold); }
.flag-divider span:nth-child(3) { background: var(--sn-red); }

/* --- Animations --------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(201,168,76,0.35); } 50% { box-shadow: 0 0 0 12px rgba(201,168,76,0); } }

.fade-in { animation: fadeIn 0.6s var(--ease-out) both; }
.fade-in-up { animation: fadeInUp 0.8s var(--ease-out) both; }
.animate-float { animation: floaty 4s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* --- Scrollbar premium --------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--sn-green); }

/* --- Selection ---------------------------------------------- */
::selection { background: var(--sn-gold); color: var(--sn-black); }

/* --- Focus visible ------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--sn-green);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* --- Stats block -------------------------------------------- */
.stat { display: flex; flex-direction: column; gap: var(--sp-2); }
.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { font-size: var(--fs-sm); color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

/* --- Kbd ---------------------------------------------------- */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-medium);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-primary);
}

/* --- 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: 0;
}
.hidden { display: none !important; }
.relative { position: relative; }
.absolute { position: absolute; }
.w-full { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }

/* --- Print --------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  .page-break { page-break-after: always; }
}

/* --- Confidentialité & Sama Gox Bars --- */
.confidential-bar {
  background: linear-gradient(90deg, #1A1A2E 0%, #4A0E17 50%, #1A1A2E 100%);
  border-bottom: 2px solid #E31B23;
  color: #FFFFFF;
  text-align: center;
  padding: 10px 24px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  z-index: 10000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.confidential-bar svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}
@media print {
  .confidential-bar {
    background: #fff !important;
    color: #E31B23 !important;
    border-bottom: 2px solid #E31B23 !important;
  }
}

.sama-gox-bar {
  background: linear-gradient(90deg, #00853F 0%, #006830 100%);
  border-bottom: 2px solid #FDEF42;
  color: #FFFFFF;
  text-align: center;
  padding: 8px 24px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  z-index: 9999;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.sama-gox-bar .sama-gox-title {
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #FDEF42;
  text-transform: uppercase;
}
.sama-gox-bar .sama-gox-sep {
  opacity: 0.4;
}
.sama-gox-bar .sama-gox-neighborhoods strong {
  color: #FDEF42;
  font-weight: 700;
}
@media print {
  .sama-gox-bar {
    background: #fff !important;
    color: #00853F !important;
    border-bottom: 2px solid #FDEF42 !important;
  }
  .sama-gox-bar .sama-gox-title, .sama-gox-bar .sama-gox-neighborhoods strong {
    color: #006830 !important;
  }
}

