/* ============================================================
   MAIN.CSS — Design System OUH Haiti
   Organisation de l'Union Haïtienne
   ============================================================ */

/* ── Google Fonts Import ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400;1,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,400&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600;1,700&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Couleurs — bleu marine dominant */
  --color-primary:        #00007A;
  --color-primary-dark:   #000055;
  --color-primary-light:  #0A0FA8;
  --color-navy-mid:       #001A80;
  --color-navy-deep:      #00004F;
  --color-secondary:      #F59E0B;   /* or/ambre — couleurs du logo */
  --color-secondary-dark: #D97706;
  --color-gold:           #F59E0B;
  --color-gold-dark:      #D97706;
  --color-gold-light:     #FCD34D;
  --color-accent:         #4169E1;
  --color-dark:           #04041A;
  --color-light:          #F0F2FA;   /* légèrement bleuté */
  --color-surface:        #FFFFFF;
  --color-muted:          #5A6080;
  --color-border:         #D8DCF0;   /* bordure bleutée */
  --color-success:        #16A34A;
  --color-error:          #DC2626;
  --color-warning:        #D97706;

  /* Gradients — bleu dominant, rouge absent du hero */
  --gradient-hero:   linear-gradient(135deg, #00007A 0%, #000055 45%, #04041A 100%);
  --gradient-hero-alt: linear-gradient(160deg, #0A0FA8 0%, #00007A 50%, #000040 100%);
  --gradient-card:   linear-gradient(160deg, rgba(0,0,122,0.06) 0%, rgba(0,0,80,0.03) 100%);
  --gradient-accent: linear-gradient(90deg, #4169E1, #60A5FA);
  --gradient-blue:   linear-gradient(135deg, #00007A 0%, #0A0FA8 100%);

  /* Typographie */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-ui:      'DM Sans', system-ui, sans-serif;
  --font-quote:   'Cormorant Garamond', Georgia, serif;

  /* Tailles de police */
  --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;
  --text-6xl:  4rem;

  /* Espacement */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Bordures et rayons */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-2xl:  36px;
  --radius-full: 9999px;

  /* Ombres */
  --shadow-sm:   0 1px 3px rgba(10,14,26,0.08), 0 1px 2px rgba(10,14,26,0.06);
  --shadow-md:   0 4px 16px rgba(10,14,26,0.10), 0 2px 6px rgba(10,14,26,0.06);
  --shadow-lg:   0 10px 40px rgba(10,14,26,0.14), 0 4px 12px rgba(10,14,26,0.08);
  --shadow-card: 0 2px 20px rgba(0,63,136,0.10);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Layout */
  --container-max: 1280px;
  --navbar-height: 80px;
}

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

html {
  font-size: 20px; /* +25 % — lisible sans être trop gros (base d'origine : 16px) */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-dark);
  background-color: var(--color-surface);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Toutes les photos du site (data-img-key) s'adaptent
   à leur conteneur sans débordement ni distorsion */
img[data-img-key] {
  object-fit: cover;
  object-position: center;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 700;
}

/* ── Typography Scale ── */
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }
.text-4xl  { font-size: var(--text-4xl); }
.text-5xl  { font-size: var(--text-5xl); }
.text-6xl  { font-size: var(--text-6xl); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }
.font-ui      { font-family: var(--font-ui); }
.font-quote   { font-family: var(--font-quote); }

.font-light    { font-weight: 300; }
.font-regular  { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-black    { font-weight: 900; }

.italic { font-style: italic; }

.text-primary   { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent    { color: var(--color-accent); }
.text-dark      { color: var(--color-dark); }
.text-light     { color: var(--color-light); }
.text-muted     { color: var(--color-muted); }
.text-white     { color: #fff; }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* ── Layout Utilities ── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-24) 0;
}

.section-sm {
  padding: var(--space-16) 0;
}

.section-lg {
  padding: calc(var(--space-24) * 1.5) 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  color: var(--color-muted);
  margin-bottom: var(--space-12);
  max-width: 640px;
}

.section-header {
  margin-bottom: var(--space-12);
}

.section-header.centered {
  text-align: center;
}

.section-header.centered .section-subtitle {
  margin-left: auto;
  margin-right: auto;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary-light);
  margin-bottom: var(--space-3);
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

/* ── Grid System ── */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-auto-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── Flex Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Spacing Utilities ── */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-normal);
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 1; }

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(0,63,136,0.3);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,63,136,0.35);
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}

.btn-secondary:hover {
  background: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245,158,11,0.45);
}

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

.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
}

.btn-outline-white {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}

.btn-outline-white:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(0,0,122,0.08);
}

.btn-accent {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px rgba(65,105,225,0.4);
}

.btn-accent:hover {
  background: #3357C5;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(65,105,225,0.5);
}

.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: var(--text-lg);
}

/* ── Badges / Tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-blue {
  background: rgba(0,63,136,0.1);
  color: var(--color-primary);
}

.badge-red {
  background: rgba(14,116,144,0.1);
  color: #0e7490;
}

.badge-gold {
  background: rgba(65,105,225,0.12);
  color: #1a3fa8;
}

.badge-green {
  background: rgba(22,163,74,0.1);
  color: var(--color-success);
}

.badge-gray {
  background: rgba(107,114,128,0.1);
  color: var(--color-muted);
}

/* ── Divider ── */
.divider {
  width: 60px;
  height: 4px;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
  margin: var(--space-4) 0;
}

.divider.centered { margin: var(--space-4) auto; }

/* ── Decorative line under headings ── */
.heading-decorated {
  position: relative;
  padding-bottom: var(--space-4);
}

.heading-decorated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

.heading-decorated.centered::after {
  left: 50%;
  transform: translateX(-50%);
}

/* ── Background utilities ── */
.bg-primary  { background-color: var(--color-primary); }
.bg-secondary{ background-color: var(--color-secondary); }
.bg-dark     { background-color: var(--color-dark); }
.bg-light    { background-color: var(--color-light); }
.bg-surface  { background-color: var(--color-surface); }
.bg-gradient-hero { background: var(--gradient-hero); }

/* ── Visible hidden ── */
.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;
}

/* ── Toast container ── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: all;
  animation: slideInRight 0.3s ease forwards;
  max-width: 360px;
  border-left: 4px solid;
}

.toast.success { border-color: var(--color-success); color: var(--color-success); }
.toast.error   { border-color: var(--color-error);   color: var(--color-error); }
.toast.warning { border-color: var(--color-warning); color: var(--color-warning); }
.toast.info    { border-color: var(--color-primary); color: var(--color-primary); }
.toast.dismissing { animation: slideOutRight 0.3s ease forwards; }

/* ── Page loader ── */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  margin-bottom: 0;
  animation: heartbeat 1.1s ease-in-out infinite;
}

.loader-logo img {
  width: 220px !important;
  height: 220px !important;
  border-radius: 32px;
  background: rgba(255,255,255,0.06);
  padding: 12px;
}

.loader-bar {
  display: none;
}

.loader-bar-fill {
  display: none;
}

/* ── Back to top ── */
#back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: all var(--transition-normal);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background: var(--color-primary-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ── Skeleton loading ── */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child { width: 75%; }

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}
