/* ===========================================================
   Kiiraay — Mamadou Niakh · Loul Sessène
   =========================================================== */

:root {
  --navy-950: #0a1e38;
  --navy-900: #0d2b4a;
  --navy-800: #143a63;
  --navy-700: #1c4c7e;
  --red-700: #a91620;
  --red-600: #c8202d;
  --red-500: #e0303d;
  --teal-600: #1c7a9c;
  --gold-500: #dba43c;
  --cream-50: #faf7f1;
  --cream-100: #f3ede1;
  --ink-900: #16202c;
  --ink-700: #3a4756;
  --ink-500: #647082;
  --line: #e7e0d2;
  --white: #ffffff;

  --font-display: "Poppins", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;

  --shadow-sm: 0 2px 8px rgba(10, 30, 56, 0.08);
  --shadow-md: 0 12px 32px rgba(10, 30, 56, 0.14);
  --shadow-lg: 0 24px 60px rgba(10, 30, 56, 0.22);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--cream-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; color: var(--navy-950); }
p { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-600);
  margin-bottom: 0.9em;
}
.eyebrow.center { display: block; text-align: center; }
.center { text-align: center; }

.section { padding: 88px 0; }
.section-lead {
  max-width: 620px;
  margin: 0 auto 3rem;
  color: var(--ink-700);
  font-size: 1.05rem;
}
.section h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85em 1.6em;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--red-600), var(--red-700));
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
/* Sur fond clair (ex. dans le modal), le style ghost blanc-sur-blanc est
   invisible : on l'inverse en sombre-sur-clair. */
.modal-panel .btn-ghost {
  border-color: var(--line);
  color: var(--navy-900);
}
.modal-panel .btn-ghost:hover { background: var(--cream-100); }
.btn-outline {
  background: var(--white);
  border-color: var(--line);
  color: var(--navy-900);
  font-size: 0.88rem;
  padding: 0.7em 1.3em;
}
.btn-outline:hover { border-color: var(--navy-700); }
.btn-lg { padding: 1em 2em; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 241, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px;
  object-fit: contain;
  background: var(--white);
  border-radius: 50%;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-display); font-size: 1rem; color: var(--navy-950); }
.brand-text small { color: var(--ink-500); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }

.site-nav { display: flex; gap: 28px; }
.site-nav a {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink-700);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover { color: var(--red-600); border-color: var(--red-600); }

.header-actions { display: flex; align-items: center; gap: 14px; }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--navy-950); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--navy-950);
  padding-top: 40px;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.28;
  filter: saturate(1.1);
}
.hero-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 60% at 78% 20%, rgba(200,32,45,0.25), transparent 60%),
    linear-gradient(115deg, var(--navy-950) 42%, rgba(10,30,56,0.55) 78%, rgba(10,30,56,0.15));
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 40px;
  padding-top: 60px;
  padding-bottom: 60px;
  min-height: 640px;
}
.hero-copy { color: var(--white); }
.hero-copy .eyebrow { color: var(--gold-500); }
.hero h1 {
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  margin-bottom: 0.35em;
}
.hero h1 span { color: #0a86d7; }
.hero-tagline {
  font-size: 1.15rem;
  color: rgba(255,255,255,0.85);
  max-width: 520px;
  margin-bottom: 1.8em;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 2.6em; }

.hero-stats { display: flex; gap: 36px; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--white); }
.hero-stats span { font-size: 0.8rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.05em; }

.hero-portrait { position: relative; display: flex; justify-content: center; }
.portrait-frame {
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 9 / 13;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 4px solid rgba(255,255,255,0.15);
}
.portrait-frame::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(200deg, transparent 55%, rgba(10,20,35,0.55));
  pointer-events: none;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.portrait-badge {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px; height: 84px;
  object-fit: contain;
  background: var(--white);
  border-radius: 50%;
  padding: 10px;
  box-shadow: var(--shadow-md);
}

/* ---------- Engagement / Lettre ---------- */
.engagement-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 56px;
  align-items: start;
}
.engagement-media { position: sticky; top: 110px; }
.engagement-media img {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  aspect-ratio: 4/5;
  object-fit: cover;
}
.engagement-media figcaption {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--ink-500);
  font-style: italic;
}
.engagement-copy h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.letter {
  border-left: 3px solid var(--red-600);
  padding-left: 24px;
  margin: 1.6em 0;
}
.letter p { color: var(--ink-700); font-size: 1.02rem; }
.letter-closing {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy-950) !important;
  font-size: 1.1rem !important;
}
.signature { font-family: var(--font-display); font-weight: 700; color: var(--navy-950); }
.signature small { display: block; font-weight: 500; color: var(--ink-500); font-size: 0.8rem; margin-top: 2px; }

/* ---------- Programme cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 3rem;
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: transparent; }
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: rgba(28,122,156,0.1);
  color: var(--teal-600);
  margin-bottom: 16px;
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 1.05rem; margin-bottom: 0.4em; }
.card p { color: var(--ink-700); font-size: 0.92rem; margin: 0; }
.card-accent { background: var(--navy-950); border-color: var(--navy-950); }
.card-accent h3, .card-accent p { color: var(--white); }
.card-accent .card-icon { background: rgba(255,255,255,0.12); color: var(--gold-500); }

/* ---------- Villages ---------- */
.villages { background: var(--cream-100); }
.village-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 780px;
  margin: 0 auto;
}
.village-chips li {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--navy-900);
}

/* ---------- Galerie ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  gap: 16px;
  margin-top: 2.5rem;
}
.gallery-item {
  position: relative;
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.gallery-wide { grid-column: span 2; grid-row: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 16px;
  background: linear-gradient(0deg, rgba(10,20,35,0.85), transparent);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 500;
}
.gallery-item figcaption span { display: block; font-weight: 400; opacity: 0.7; font-size: 0.72rem; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(120deg, var(--navy-950), var(--navy-800)); padding: 64px 0; }
.cta-band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-band h2 { color: var(--white); margin-bottom: 0.3em; font-size: 1.7rem; }
.cta-band p { color: rgba(255,255,255,0.75); margin: 0; max-width: 480px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); padding: 40px 0; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { width: 42px; height: 42px; object-fit: contain; background: var(--white); border-radius: 50%; padding: 4px; }
.footer-brand p { margin: 0; color: rgba(255,255,255,0.75); font-size: 0.85rem; }
.footer-meta p { margin: 0 0 4px; color: rgba(255,255,255,0.45); font-size: 0.78rem; text-align: right; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.is-open { display: block; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 20, 35, 0.6);
  backdrop-filter: blur(3px);
}
.modal-panel {
  position: relative;
  width: min(92vw, 460px);
  max-height: 90vh;
  overflow-y: auto;
  margin: 5vh auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-lg);
  animation: modal-pop 0.25s ease;
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--cream-100);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-700);
}
.modal-lead { color: var(--ink-700); font-size: 0.95rem; }

/* ---------- Form ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: var(--navy-950);
}
.field input[type="text"],
.field input[type="tel"],
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--cream-50);
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--teal-600);
}
.field.has-error input, .field.has-error select { border-color: var(--red-600); }
.field-error {
  display: block;
  color: var(--red-600);
  font-size: 0.78rem;
  margin-top: 5px;
  min-height: 1em;
}
.field-hint { font-size: 0.78rem; color: var(--ink-500); margin: 6px 0 0; }

.photo-upload { display: flex; gap: 16px; align-items: center; }
.photo-preview {
  width: 76px; height: 76px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cream-100);
  border: 1.5px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.photo-preview span { font-size: 0.68rem; color: var(--ink-500); text-transform: uppercase; }
.photo-preview.has-image span { display: none; }
#f-photo { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ---------- Loading step ---------- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 0 28px;
}
.loading-ring {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  padding: 6px;
  margin-bottom: 26px;
  background: conic-gradient(from 0deg, var(--red-600), var(--gold-500), var(--teal-600), var(--red-600));
  animation: loading-spin 1.3s linear infinite;
}
.loading-ring img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: var(--cream-100);
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}
.loading-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy-950);
  margin-bottom: 6px;
}
.loading-sub {
  color: var(--ink-500);
  font-size: 0.9rem;
  margin: 0;
  animation: loading-pulse 1.6s ease-in-out infinite;
}
@keyframes loading-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---------- Result step ---------- */
.result-canvas-wrap {
  display: flex;
  justify-content: center;
  background: var(--cream-100);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 1em 0;
}
/* Hauteur plafonnée pour que le bouton "Télécharger" reste visible sans
   scroller, quelle que soit la hauteur de la fenêtre : l'aperçu se
   redimensionne, l'image téléchargée conserve elle sa pleine résolution
   (1080×1920), indépendante de cet affichage. */
#militant-canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 38vh;
  border-radius: 12px;
  display: block;
}
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-status { text-align: center; font-size: 0.82rem; color: var(--ink-500); margin: 10px 0 0; min-height: 1.2em; }

/* ---------- Reveal-on-scroll ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; text-align: left; padding-top: 20px; }
  .hero-portrait { order: -1; margin-bottom: 12px; }
  .portrait-frame { max-width: 280px; margin: 0 auto; }
  .engagement-grid { grid-template-columns: 1fr; }
  .engagement-media { position: static; max-width: 420px; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; }
  .gallery-wide { grid-column: span 2; grid-row: span 1; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .header-actions .btn-primary { padding: 0.65em 1.1em; font-size: 0.85rem; }
  .hero-stats { gap: 22px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .cta-band-inner { flex-direction: column; text-align: center; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-meta p { text-align: center; }
}

@media (max-width: 520px) {
  .section { padding: 60px 0; }
  .cards-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .modal-panel { padding: 28px 20px 24px; }
}

/* ---------- Mobile nav drawer ---------- */
@media (max-width: 720px) {
  .site-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 76px; left: 0; right: 0;
    background: var(--cream-50);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
    gap: 4px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .site-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .site-nav a { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
