/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {
  --rouge: #b33a3a;
  --vert: #3a7f5c;
  --jaune: #e6c75f;
  --gris-clair: #e5e5e5;
  --texte: #222;
}


/* =========================================================
   2. RESET & BASE
   ========================================================= */

* {
  box-sizing: border-box;
  forced-color-adjust: none;
}

html {
  color-scheme: light;
}

html, body {
  background-color: white !important;
  color-scheme: light;
}

body {
  margin: 0;
  font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--texte);
  background: white;
}


/* =========================================================
   3. TYPOGRAPHIE
   ========================================================= */

h1, h2, h3, h4, nav a, .card-name, button {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
}

nav a {
  text-transform: uppercase;
  font-size: 0.95rem;
}

h2 {
  margin-top: 3.5rem;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  scroll-margin-top: 50px;
}

h1, h2, h3{
  padding-left: 0.8rem;
  border-left: 6px solid var(--vert);
}

.hero h1,
.hero h2{
  padding-left: 0;
  border-left: 0;
}

.overlay h2{
  margin-top: 0.5rem;
}

h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
  color: var(--vert);
}

ul {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

ul li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

/* Table des matières */
.toc {
  background: var(--gris-clair);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  margin: 2.5rem 0;
}

.toc h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

/* Liste */
.toc ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.toc li {
  margin: 0.5rem 0;
}

/* Liens */
.toc a {
  text-decoration: none;
  color: var(--rouge);
  font-weight: 600;
  position: relative;
  padding-left: 1.1rem;
}

/* Petite flèche élégante */
.toc a::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--vert);
}

/* Hover discret */
.toc a:hover {
  text-decoration: underline;
}

/* Texte d'intro programme */
.container > p {
  max-width: 65ch;
}

.container p,
.container ul {
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

body.programme h2 {
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

body.programme h3 {
  max-width: 55ch;
  margin-left: auto;
  margin-right: auto;
}

.link a {
  text-decoration: none;
  color: var(--rouge);
  font-weight: 600;
}

.link a:hover {
  text-decoration: underline;
}

.contact p {
  max-width: 1200px;
}

/* =========================================================
   4. HEADER & NAV
   ========================================================= */

header {
  position: relative;
  background: white;
  border-bottom: 3px solid var(--vert);
  z-index: 1000;
}

header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: white;
  z-index: -1;
}

.header-inner {
  position: relative;
  background: white;
  z-index: 1;
  max-width: 1200px;
  margin: auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  max-width: 200px;
}

.no-wrap {
  white-space: nowrap;
}

nav a {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--rouge);
  font-weight: bold;
}

nav a:hover {
  text-decoration: underline;
}


/* =========================================================
   5. HERO
   ========================================================= */

.hero {
  position: relative;
  background: url('images/bandeau.jpg') center / cover no-repeat;
  color: white;
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.20);
}

.hero * {
  position: relative;
}

.hero h1 {
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  font-size: 2.8rem;
  line-height: 1.2;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.hero-inner {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

.hero-text {
  display: inline-block;
  padding: 0.5rem 2.5rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 48px;
  backdrop-filter: blur(6px);
  max-width: 900px;
  flex: 1.3;
}

.hero-news {
  display: flex;
  flex-direction: column;
  flex: 0.7;
  justify-content: center;
  padding: 1.3rem 2rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 40px;
  color: white;
  max-width: 320px;
  backdrop-filter: blur(6px);
}

.hero-news a {
  text-decoration: none;
  color: var(--jaune);
}

.hero-news a:hover {
  text-decoration: underline;
}

.hero-news h2 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1.33rem;
  color: var(--jaune);
}

.hero-news p {
  margin-top: 0;
}


/* =========================================================
   6. LAYOUT
   ========================================================= */

.container {
  max-width: 1200px;
  margin: auto;
  padding: 0.5rem 1rem;
}


/* =========================================================
   7. BLOCKS (PAGE ACCUEIL)
   ========================================================= */

.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  padding: 1rem 0.1rem;
  gap: 1.5rem;
}

.block {
  background: var(--gris-clair);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.block strong {
  color: var(--rouge);
}

.block img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.block div {
  padding: 1rem;
}

.block:hover {
  transform: translateY(-3px);
}


/* =========================================================
   8. MOSAÏQUE & CARTES
   ========================================================= */

.mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
}

body.municipalite .mosaic {
  max-width: 720px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--gris-clair);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
}

.card img {
  width: 100%;
  display: block;
}

.card-image {
  position: relative;
}

.card-plus {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--vert);
  color: white;
  font-weight: bold;
  font-size: 1.5rem;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.card-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: 0 0.5rem;
  font-weight: bold;
  color: var(--texte);
  text-align: center;
}


/* =========================================================
   9. OVERLAY CANDIDATS
   ========================================================= */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  padding-top: 5rem;
  z-index: 2000;
}

.overlay-content {
  background: white;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  padding: 2rem;
  display: flex;
  gap: 2rem;
  border-radius: 20px;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.overlay-content img {
  width: 30%;
  border-radius: 20px;
  object-fit: contain;
  align-self: flex-start;
}

.overlay-text {
  flex: 1;
  overflow-y: auto;
  padding-right: 1rem;
  -webkit-overflow-scrolling: touch;
}

.close {
  position: absolute;
  top: 0;
  right: 1rem;
  background: none;
  border: none;
  padding: 0.3rem;
  font-size: 1.6rem;
  color: #000;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}


/* =========================================================
   10. FORMULAIRES & BOUTONS
   ========================================================= */

form label {
  display: block;
  margin-top: 1rem;
}

form input,
form textarea {
  width: 100%;
  padding: 0.5rem;
}

button {
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  background: var(--vert);
  color: white;
  border: none;
  cursor: pointer;
}


/* =========================================================
   11. RÉSEAUX SOCIAUX
   ========================================================= */

.social-links {
  margin-top: 1.5rem;
}

.social {
  display: inline-block;
  margin-right: 1rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: bold;
  border-radius: 20px;
  color: white;
}

.social.facebook {
  background: #3b5998;
}

.social.instagram {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.social:hover {
  opacity: 0.85;
}


/* =========================================================
   12. FOOTER
   ========================================================= */

footer {
  background: var(--gris-clair);
  padding: 1rem;
  text-align: center;
  margin-top: 3rem;
}

.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-social-link {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--rouge);
  opacity: 0.7;
  margin-left: 0.5rem;
}

.footer-social-link:hover {
  opacity: 1;
  text-decoration: underline;
}


/* =========================================================
   13. RESPONSIVE (MOBILE)
   ========================================================= */

@media (max-width: 700px) {

  body {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .logo {
    max-width: 160px;
  }

  .hero {
    padding: 4.5rem 1rem 4rem;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero-text {
    padding: 1rem 1.5rem;
    border-radius: 28px;
  }

  .hero-news {
    max-width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 24px;
  }

  .hero-inner {
    flex-direction: column;
  }

  .overlay-content {
    flex-direction: column;
    max-height: 95vh;
    padding: 1.5rem;
  }

  .overlay-content img {
    width: 100%;
    max-height: 35vh;
  }

  .mosaic {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .card-name {
    font-size: 0.85rem;
    padding: 0.5rem 0.3rem;
  }

  .card-plus {
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
  }

  body.municipalite .mosaic {
    max-width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}
