﻿:root {
  --ink: #173042;
  --blue: #155b86;
  --green: #278b63;
  --orange: #e9914b;
  --mist: #f4f8f7;
  --line: #dbe7e4;
  --white: #ffffff;
  --shadow: rgba(18, 54, 70, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--mist);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select {
  font: inherit;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.2rem max(5vw, 1.25rem);
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  min-height: 92px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  padding: 0.2rem 0.4rem;
}

.brand-logo {
  width: 130px;
  height: 74px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 18px rgba(21, 91, 134, 0.12);
  padding: 0.15rem;
}

.nav-links {
  display: flex;
  gap: 1.6rem;
  align-items: center;
  font-size: 0.98rem;
  font-weight: 600;
}

.nav-links a {
  color: #4d6975;
  padding: 0.6rem 0.2rem;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--green);
  font-weight: 800;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-dropdown-toggle {
  border: 0;
  background: transparent;
  color: #4d6975;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
}

.nav-dropdown-toggle:hover {
  color: var(--green);
}

.nav-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 2;
  display: none;
  min-width: 230px;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(18, 54, 70, 0.12);
}

.nav-submenu a {
  display: block;
  padding: 0.65rem 0.75rem;
}

.nav-dropdown:hover .nav-submenu,
.nav-dropdown.open .nav-submenu {
  display: flex;
}

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  font-size: 1.8rem;
  color: var(--blue);
  cursor: pointer;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem max(5vw, 1.25rem);
}

.eyebrow, .tag {
  display: inline-block;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 4rem;
  min-height: 70vh;
}

.hero h1 {
  margin: 1rem 0;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  line-height: 1.03;
}

.hero p,
.intro {
  font-size: 1.12rem;
  line-height: 1.7;
  color: #5d7178;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.35rem;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(21, 91, 134, 0.18);
}

.button.alt {
  background: var(--orange);
}

.hero-visual {
  min-height: 390px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(21, 91, 134, 0.25), rgba(39, 139, 99, 0.1)), url('images/reunion-communautaire.jpg') center/cover;
  box-shadow: 20px 20px 0 #d9ebdf;
}

.page-head {
  margin-bottom: 2.2rem;
}

.page-head h1 {
  margin: 0.75rem 0 0.25rem;
  font-size: clamp(2.1rem, 4vw, 3.5rem);
}

/* Titre principal affiché comme la petite ligne verte (page Blog) */
.page-head h1.eyebrow {
  margin: 0;
  font-family: inherit;
  font-size: 0.72rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.panel,
.publication-card,
.admin-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 16px 35px var(--shadow);
}

.panel {
  padding: 1.6rem;
}

.panel h2 {
  margin: 0.7rem 0 0.5rem;
  font-size: 1.7rem;
}

.panel p {
  color: #5c6d75;
  line-height: 1.7;
  margin: 0;
}

.dynamic-carousel-section {
  margin: 3rem 0;
}

.dynamic-carousel-shell {
  position: relative;
  width: min(1200px, 100%);
  margin: 0 auto;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(10, 62, 86, 0.12);
  border: 1px solid rgba(17, 83, 116, 0.12);
  background: #eaf4f5;
}

.dynamic-carousel-shell::before,
.dynamic-carousel-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  z-index: 2;
  pointer-events: none;
}

.dynamic-carousel-shell::before {
  left: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.95), transparent);
}

.dynamic-carousel-shell::after {
  right: 0;
  background: linear-gradient(270deg, rgba(255,255,255,0.95), transparent);
}

.dynamic-carousel-track {
  display: flex;
  width: max-content;
  gap: 1rem;
  padding: 1rem 0 1rem 1rem; /* marge gauche seule : -50% = exactement une copie des 6 images, boucle sans saut */
  animation: drift-right 30s linear infinite;
}

.dynamic-slide {
  flex: 0 0 auto;
  width: min(26vw, 340px);
  min-width: 240px;
  height: 260px;
  border-radius: 22px;
  overflow: hidden;
  background: #dfeff2;
  box-shadow: 0 12px 24px rgba(20, 60, 75, 0.12);
  border: 1px solid rgba(21, 91, 134, 0.08);
}

.dynamic-slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Défilement de la gauche vers la droite (la piste contient 2 copies des images) */
@keyframes drift-right {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

.publication-card {
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.publication-card img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.publication-body {
  padding: 1.4rem;
}

.publication-body small {
  display: block;
  margin-top: 0.6rem;
  color: #6d7d82;
}

.publication-body h2 {
  margin: 0.75rem 0;
  font-size: 1.5rem;
}

.publication-body p {
  color: #566a72;
  line-height: 1.7;
}

.publication-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 0.8rem;
}

.publication-action {
  background: #edf5fa;
  color: #1a5678;
  border: 1px solid #d9e7ef;
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.publication-action strong {
  margin-left: 0.2rem;
}

.comment-form {
  display: none;
  gap: 0.75rem;
  margin-top: 1rem;
}

.comment-form.open {
  display: flex;
}

.comment-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
}

.comment-form button {
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: var(--white);
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  font-weight: 700;
}

.comments {
  margin-top: 1rem;
}

.comments p {
  background: #f3f9f8;
  border: 1px solid #e4f0ed;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin: 0.5rem 0;
}

.admin-form {
  display: grid;
  gap: 1rem;
}

[hidden] {
  display: none !important;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #fff;
}

.admin-form textarea {
  resize: vertical;
  min-height: 150px;
}

.notice {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: #edf9f1;
  color: #1b6d47;
  border: 1px solid #d4efdd;
}

.notice.error {
  background: #fff0f0;
  color: #9e2a2a;
  border-color: #f3caca;
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem max(5vw, 1.25rem) 3rem;
  color: #566a72;
}

.site-footer-inner strong {
  color: var(--ink);
}

.site-footer-inner a {
  color: var(--green);
  font-weight: 700;
}

.empty-state {
  padding: 1rem 1.2rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: #60757d;
  background: rgba(255,255,255,0.4);
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 700px) {
  .menu-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 1.1rem;
    right: 1.1rem;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(255,255,255,0.98);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 18px 30px rgba(0,0,0,0.08);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links > .nav-dropdown,
  .nav-dropdown-trigger {
    width: 100%;
  }

  .nav-submenu {
    position: static;
    min-width: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 0 1rem;
  }

  .nav-dropdown:hover .nav-submenu {
    display: none;
  }

  .nav-dropdown.open .nav-submenu {
    display: flex;
  }

  .dynamic-slide {
    width: min(60vw, 320px);
    min-width: 180px;
    height: 200px;
  }

  .dynamic-carousel-track {
    animation-duration: 22s;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Animations ===== */

/* Navigation : compacte avec ombre au défilement, soulignement animé */
.site-nav { transition: min-height 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease; }
.site-nav.scrolled { min-height: 70px; padding-top: 0.5rem; padding-bottom: 0.5rem; box-shadow: 0 10px 30px rgba(18, 54, 70, 0.12); }
.brand-logo { transition: width 0.3s ease, height 0.3s ease, transform 0.3s ease; }
.site-nav.scrolled .brand-logo { width: 100px; height: 56px; }
.brand:hover .brand-logo { transform: rotate(-3deg) scale(1.04); }
.nav-links a { position: relative; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.2rem;
  height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links.open { animation: menu-drop 0.25s ease; }

/* Accueil : entrée en cascade du titre, du texte et des boutons */
.hero > div > * { animation: fade-up 0.8s ease both; }
.hero > div > *:nth-child(2) { animation-delay: 0.12s; }
.hero > div > *:nth-child(3) { animation-delay: 0.24s; }
.hero > div > *:nth-child(4) { animation-delay: 0.36s; }
.hero-visual { animation: fade-in-right 1s ease 0.3s both, float 6s ease-in-out 1.3s infinite; }

/* Apparition au défilement (classes ajoutées par site-common.js) */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Survols */
.panel, .publication-card { transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.7s ease; }
.panel:hover, .publication-card:hover { transform: translateY(-6px); box-shadow: 0 24px 45px rgba(18, 54, 70, 0.16); }
.publication-card img, .dynamic-slide img { transition: transform 0.6s ease; }
.publication-card:hover img, .dynamic-slide:hover img { transform: scale(1.06); }
.dynamic-carousel-shell:hover .dynamic-carousel-track { animation-play-state: paused; }
.button:active, .publication-action:active { transform: scale(0.96); }
.publication-action { transition: background 0.2s ease, transform 0.15s ease; }
.publication-action:hover { background: #dcecf6; }
.comment-form.open { animation: fade-up 0.3s ease; }

@keyframes fade-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade-in-right { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translateY(-12px); } }
@keyframes menu-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Respect du réglage « réduire les animations » du système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
