/* ============================================================
   MAIRIE DE NDONDOL — Système d'ambiance visuelle
   Palette : couleurs nationales en sobriété + ocres du Baol
   ============================================================ */
:root {
  /* Couleurs nationales — usage institutionnel sobre */
  --vert: #0b7a3b;
  --vert-fonce: #085c2d;
  --jaune: #e8b429;
  --rouge: #b93a2b;

  /* Tons du Baol */
  --ocre: #c97b3d;
  --terre: #8c5a2b;
  --sable: #ede0c8;
  --sable-clair: #faf6ee;

  /* Neutres */
  --encre: #26211a;
  --encre-douce: #57503f;
  --blanc: #ffffff;

  /* Lumière sahélienne */
  --sunset-haut: #f9d9a3;
  --sunset-bas: #ef9f56;

  --font-display: 'Marcellus', Georgia, serif;
  --font-text: 'Public Sans', system-ui, -apple-system, sans-serif;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(38, 33, 26, 0.10);
  --shadow-hover: 0 18px 44px rgba(38, 33, 26, 0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-text);
  color: var(--encre);
  background: var(--sable-clair);
  line-height: 1.65;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; display: block; }

/* ============ PRÉLOADER ============ */
#preloader {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(180deg, var(--sunset-haut), var(--sunset-bas));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  transition: opacity 0.8s ease, visibility 0.8s;
}
#preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-baobab { width: 130px; height: 130px; color: var(--encre); }
.baobab-path, .baobab-crown {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw 2.2s ease forwards;
}
.baobab-crown { animation-delay: 0.9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.preloader-text {
  font-family: var(--font-display);
  font-size: 1.15rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--encre);
}
.preloader-bar {
  width: 180px; height: 3px; background: rgba(38,33,26,0.2); border-radius: 3px; overflow: hidden;
}
#preloader-progress {
  display: block; height: 100%; width: 0%;
  background: var(--encre); border-radius: 3px;
  transition: width 0.3s ease;
}
@media (prefers-reduced-motion: reduce) {
  .baobab-path, .baobab-crown { animation: none; stroke-dashoffset: 0; }
}

/* ============ NAVIGATION ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 48px);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.nav.scrolled {
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 18px rgba(38,33,26,0.08);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--encre);
  font-family: var(--font-display); font-size: 1.05rem;
}
.nav-flag { display: inline-flex; width: 24px; height: 16px; border-radius: 2px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.nav-flag i { flex: 1; }
.nav-flag i:nth-child(1) { background: var(--vert); }
.nav-flag i:nth-child(2) { background: var(--jaune); }
.nav-flag i:nth-child(3) { background: var(--rouge); }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 30px); }
.nav-links a {
  text-decoration: none; color: var(--encre); font-weight: 500; font-size: 0.95rem;
  position: relative;
}
.nav-links a:not(.nav-cta)::after {
  content: ''; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 2px; background: var(--vert);
  transform: scaleX(0); transform-origin: right; transition: transform 0.35s ease;
}
.nav-links a:not(.nav-cta):hover::after,
.nav-links a:not(.nav-cta):focus-visible::after { transform: scaleX(1); transform-origin: left; }
.nav-cta {
  background: var(--vert); color: var(--blanc) !important;
  padding: 9px 20px; border-radius: 999px;
  transition: background 0.3s ease, transform 0.3s ease;
}
.nav-cta:hover { background: var(--vert-fonce); transform: translateY(-1px); }
.nav-burger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-burger span {
  display: block; width: 24px; height: 2px; background: var(--encre);
  margin: 5px 0; transition: transform 0.3s, opacity 0.3s;
}

@media (max-width: 760px) {
  .nav-burger { display: block; }
  .nav-links {
    position: fixed; inset: 0; background: var(--sable-clair);
    flex-direction: column; justify-content: center; gap: 30px;
    font-size: 1.3rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
  }
  .nav-links.open { transform: translateX(0); }
  .nav-burger { z-index: 110; }
  .nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-burger.open span:nth-child(2) { opacity: 0; }
  .nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ============ SCÈNE HÉROÏQUE 3D ============ */
.scene-track { height: 320vh; position: relative; }
.scene-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sunset-haut), var(--sunset-bas));
}
#scene3d { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-fallback { position: absolute; inset: 0; display: none; }
.scene-fallback .fallback-art { width: 100%; height: 100%; }
body.no-webgl #scene3d { display: none; }
body.no-webgl .scene-fallback { display: block; }
body.no-webgl .scene-track { height: 100vh; }

.hero-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 clamp(20px, 7vw, 110px);
  pointer-events: none;
}
.hero-overlay > * { pointer-events: auto; }
.hero-kicker {
  font-size: 0.85rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--encre); font-weight: 600; margin-bottom: 14px;
  background: rgba(250,246,238,0.55); padding: 6px 14px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  line-height: 1.04; color: var(--encre);
  max-width: 12ch;
  text-shadow: 0 2px 24px rgba(250, 246, 238, 0.5);
}
.hero-sub {
  margin-top: 20px; font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--encre); max-width: 46ch;
  background: rgba(250,246,238,0.45); padding: 10px 16px; border-radius: 10px;
  backdrop-filter: blur(4px);
}
.hero-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }

.btn {
  display: inline-block; text-decoration: none; font-weight: 600;
  padding: 14px 30px; border-radius: 999px; font-size: 1rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, background 0.3s;
  will-change: transform;
}
.btn-primary { background: var(--vert); color: var(--blanc); box-shadow: 0 8px 24px rgba(11,122,59,0.35); }
.btn-primary:hover { background: var(--vert-fonce); box-shadow: 0 12px 32px rgba(11,122,59,0.45); }
.btn-ghost {
  background: rgba(250,246,238,0.65); color: var(--encre);
  border: 1.5px solid var(--encre); backdrop-filter: blur(4px);
}
.btn-ghost:hover { background: var(--sable-clair); }

.hero-scroll-hint {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--encre); opacity: 0.75;
}
.scroll-line {
  width: 2px; height: 44px; background: rgba(38,33,26,0.25);
  position: relative; overflow: hidden; border-radius: 2px;
}
.scroll-line::after {
  content: ''; position: absolute; top: -50%; left: 0; width: 100%; height: 50%;
  background: var(--encre);
  animation: scrollPulse 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes scrollPulse { 0% { top: -50%; } 100% { top: 110%; } }
@media (prefers-reduced-motion: reduce) { .scroll-line::after { animation: none; top: 25%; } }

/* ============ SECTIONS COMMUNES ============ */
.section { padding: clamp(70px, 12vh, 130px) 0; position: relative; }
.container { width: min(1160px, 92%); margin: 0 auto; }
.container.narrow { width: min(820px, 92%); }
.section-kicker {
  font-size: 0.8rem; letter-spacing: 0.24em; text-transform: uppercase;
  font-weight: 700; color: var(--ocre); margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  line-height: 1.12; margin-bottom: 22px; color: var(--encre);
}
.section-lead { font-size: clamp(1rem, 2vw, 1.15rem); color: var(--encre-douce); max-width: 62ch; margin-bottom: 40px; }

/* ============ MOT DU MAIRE ============ */
.section-maire { background: var(--encre); color: var(--sable-clair); text-align: center; }
.section-maire .section-kicker { color: var(--jaune); }
.maire-quote {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  line-height: 1.4; color: var(--sable-clair);
}
.maire-signature { margin-top: 24px; color: var(--jaune); letter-spacing: 0.08em; font-weight: 600; }

/* ============ IDENTITÉ / STATS ============ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px; margin-top: 20px;
}
.stat-card {
  background: var(--blanc); border-radius: var(--radius); padding: 30px 24px;
  box-shadow: var(--shadow); border-top: 4px solid var(--vert);
}
.stat-card:nth-child(2) { border-top-color: var(--jaune); }
.stat-card:nth-child(3) { border-top-color: var(--ocre); }
.stat-card:nth-child(4) { border-top-color: var(--rouge); }
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3rem); color: var(--encre);
}
.stat-unit { font-family: var(--font-display); font-size: 1.6rem; color: var(--ocre); }
.stat-card p { color: var(--encre-douce); margin-top: 6px; font-size: 0.95rem; }
.stats-note { margin-top: 18px; font-size: 0.8rem; color: var(--encre-douce); font-style: italic; }

/* ============ SERVICES ============ */
.section-services { background: var(--sable); }
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}
.card {
  background: var(--blanc); border-radius: var(--radius); padding: 32px 26px;
  box-shadow: var(--shadow);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.35s;
  will-change: transform;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-icon { font-size: 2rem; margin-bottom: 14px; }
.card h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 10px; }
.card p { color: var(--encre-douce); font-size: 0.95rem; margin-bottom: 16px; }
.card-link { color: var(--vert); font-weight: 600; text-decoration: none; font-size: 0.95rem; }
.card-link:hover { text-decoration: underline; }
.services-hours {
  margin-top: 36px; padding: 18px 24px; border-radius: var(--radius);
  background: rgba(11,122,59,0.08); border-left: 4px solid var(--vert);
  font-size: 0.95rem;
}
.services-hours em { color: var(--encre-douce); font-size: 0.85rem; }

/* ============ PROJETS / TIMELINE ============ */
.timeline { position: relative; margin-top: 30px; padding-left: 34px; }
.timeline::before {
  content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(var(--vert), var(--jaune), var(--ocre));
}
.timeline-item { position: relative; padding-bottom: 42px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: -34px; top: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--sable-clair); border: 4px solid var(--vert);
}
.timeline-item:nth-child(2) .timeline-marker { border-color: var(--jaune); }
.timeline-item:nth-child(3) .timeline-marker { border-color: var(--ocre); }
.timeline-item:nth-child(4) .timeline-marker { border-color: var(--rouge); }
.timeline-content h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 6px; }
.timeline-content p { color: var(--encre-douce); max-width: 58ch; }

/* ============ ATTRACTIVITÉ ============ */
.section-attractivite {
  background: linear-gradient(180deg, var(--sable-clair) 0%, var(--sable) 100%);
}
.attract-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px; margin-top: 10px;
}
.attract-card {
  background: var(--blanc); border-radius: var(--radius); padding: 30px 26px;
  box-shadow: var(--shadow);
  border-bottom: 4px solid var(--ocre);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.attract-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.attract-card h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 10px; }
.attract-card p { color: var(--encre-douce); font-size: 0.95rem; }

/* ============ CONTACT ============ */
.section-contact { background: var(--vert-fonce); color: var(--sable-clair); }
.section-contact .section-kicker { color: var(--jaune); }
.section-contact .section-title { color: var(--blanc); }
.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 26px; margin: 34px 0;
}
.contact-block h3 {
  font-family: var(--font-display); font-size: 1.1rem;
  color: var(--jaune); margin-bottom: 10px;
}
.contact-block p { font-size: 0.95rem; color: rgba(250,246,238,0.88); }
.contact-block em { color: rgba(250,246,238,0.6); }
.contact-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.section-contact .btn-primary { background: var(--jaune); color: var(--encre); box-shadow: 0 8px 24px rgba(232,180,41,0.3); }
.section-contact .btn-primary:hover { background: #d9a41f; }
.section-contact .btn-ghost { border-color: var(--sable-clair); color: var(--sable-clair); background: transparent; }
.section-contact .btn-ghost:hover { background: rgba(250,246,238,0.1); }

/* ============ FOOTER ============ */
.footer { background: var(--encre); color: rgba(250,246,238,0.8); padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.footer-inner p { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.footer-motto { font-family: var(--font-display); letter-spacing: 0.1em; color: var(--jaune); }

/* ============ ÉTATS D'ANIMATION (JS les active) ============ */
.reveal-chars .char, .reveal-lines { will-change: transform, opacity; }
body.js-anim .reveal-lines { opacity: 0; transform: translateY(26px); }
body.js-anim .reveal-chars .char { opacity: 0; display: inline-block; transform: translateY(0.6em); }

@media (prefers-reduced-motion: reduce) {
  body.js-anim .reveal-lines,
  body.js-anim .reveal-chars .char { opacity: 1 !important; transform: none !important; }
  .card, .attract-card, .btn { transition: none; }
}
