/* ===========================================================
   all_actualites.css – palette MCinspir
   (basé sur l’ancien all_actualites.css, adapté à global.css)
=========================================================== */

/* =============================
   STYLE GLOBAL
============================= */
body {
  margin: 0;
  padding: 0;
  font-family: 'Source Sans Pro', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

/* =============================
   CONTAINER PRINCIPAL
============================= */
.all-actualites-container {
  width: 532px; /* largeur type plan-du-site.php */
  max-width: 100%;
  margin: 2rem auto;
  padding: 1rem;
  background-color: #fff;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Titre principal */
.all-actualites-container h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

/* Ligne horizontale personnalisée */
hr.custom-line {
  border: none;
  border-top: 2px dashed var(--gold);
  margin: 2rem 0;
}

/* =============================
   ILLUSTRATION
============================= */
.illustration {
  text-align: center;
  margin: 2rem 0;
}
.illustration img {
  max-width: 100%;
  height: auto;
  width: 25%;
}

/* =============================
   FORMULAIRE DE FILTRE
============================= */
.tag-year-filter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.tag-year-filter-form label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  color: var(--text);
}
.tag-year-filter-form select {
  padding: 0.5rem;
  border: 2px solid var(--gold);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}
.tag-year-filter-form button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--gold);
  background-color: var(--gold);
  color: #fff;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.tag-year-filter-form button:hover {
  background-color: #b58e4f;
}

/* =============================
   LISTE DES ACTUALITÉS
============================= */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.news-list li {
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--beige);
  margin-bottom: 1rem;
}
.news-list li:last-child {
  border-bottom: none;
}

/* =============================
   METADATA
============================= */
.news-meta {
  display: flex;
  align-items: center; /* parfait centrage vertical */
  gap: 0.8rem;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.news-date {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.95rem;
}

.news-tag {
  font-size: 0.9rem;
  color: var(--text-light);
  background-color: var(--beige);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

/* =============================
   IMAGE
============================= */
.news-image {
  margin: 0.75rem 0;
}
.news-image-preview {
  max-width: 260px;
  border: 2px solid var(--beige);
  border-radius: 6px;
  display: block;
  cursor: pointer;
  transition: transform 0.25s ease;
}
.news-image-preview:hover {
  transform: scale(1.03);
}

/* Desktop encore plus large */
@media (min-width: 992px) {
  .news-image-preview {
    max-width: 300px;
  }
}

/* =============================
   TITRE & CONTENU
============================= */
.news-title {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.news-excerpt {
  margin: 0.5rem 0 0;
  line-height: 1.4;
  color: var(--text-light);
  word-wrap: break-word;
}

/* =============================
   POPUP IMAGE
============================= */
.popup {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.8);
  justify-content: center;
  align-items: center;
  padding: 4vw;
}
.popup-inner {
  position: relative;
  max-width: 94vw;
  max-height: 86vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
.popup-content {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  z-index: 1101;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  transition: transform 0.3s ease;
  animation: pulseClose 1.5s infinite ease-in-out;
}
@keyframes pulseClose {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

/* =============================
   RESPONSIVE
============================= */
@media (max-width: 576px) {
  .all-actualites-container {
    width: auto;
    max-width: 95vw;
    margin: 1rem auto;
    padding: 1rem;
  }
  .illustration img {
    width: 28%;
  }
  .news-image-preview {
    max-width: 100%;
    height: auto;
  }
  .popup { padding: 5vw; }
  .popup-inner { max-width: 96vw; max-height: 82vh; }
  .popup-close { top: 8px; right: 12px; font-size: 30px; }
}

/* =============================
   VARIANTE PINNED (À LA UNE)
============================= */
.news-tag.pinned {
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e9e6df 45%, #dcd7ca 100%);
  color: #444;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
  box-shadow:
    0 0 6px rgba(255, 255, 255, 0.6),
    inset 0 0 6px rgba(255, 255, 255, 0.4),
    0 0 12px rgba(212,170,102,0.4);
  animation: diamondShine 3.5s infinite ease-in-out;
  backdrop-filter: blur(3px);
}

/* Icône diamant doré-blanc responsive */
.pinned-icon {
  display: block;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  filter:
    drop-shadow(0 0 4px rgba(255,255,255,0.8))
    drop-shadow(0 0 8px rgba(212,170,102,0.4));
}

/* Taille ajustée selon l’écran */
@media (min-width: 768px) {
  .pinned-icon { width: 34px; height: 34px; }
}
@media (min-width: 1200px) {
  .pinned-icon { width: 38px; height: 38px; }
}

/* Effet scintillant diamant */
@keyframes diamondShine {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(255,255,255,0.6),
      inset 0 0 6px rgba(255,255,255,0.4),
      0 0 12px rgba(212,170,102,0.4);
  }
  50% {
    box-shadow:
      0 0 12px rgba(255,255,255,0.9),
      inset 0 0 8px rgba(255,255,255,0.6),
      0 0 20px rgba(212,170,102,0.7);
  }
}

/* =============================
   Bannière d’épingle isolée (alignée à gauche partout)
============================= */
.news-pinned-banner {
  display: flex;
  justify-content: flex-start;  /* alignement gauche desktop + mobile */
  margin-bottom: 0.35rem;       /* espace léger avant .news-meta */
}

.news-pinned-banner .news-tag.pinned {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  width: auto;
  line-height: 1.2;
}

/* Petit espace entre bannière et meta */
.news-meta {
  margin-top: 0.2rem;
}

/* Ajustement mobile : garde aligné à gauche */
@media (max-width: 576px) {
  .news-pinned-banner {
    justify-content: flex-start; /* plus de centrage */
  }
  .news-meta {
    align-items: flex-start;     /* date et tag restent bien à gauche */
  }
}

/* === Correction finale pour popup image adaptative === */
.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  padding: 2vw;
  overflow: auto; /* permet de scroller si l’image dépasse quand même */
  backdrop-filter: blur(3px);
}

.popup-inner {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: auto;
}

#popup-img {
  max-width: 95vw;      /* jamais plus large que l’écran */
  max-height: 90vh;     /* jamais plus haut que l’écran */
  width: auto;
  height: auto;
  object-fit: contain;  /* garde les proportions sans couper */
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 25px rgba(0,0,0,0.5);
  display: block;
  margin: auto;
}

/* Bouton fermer */
.popup-close {
  position: fixed;
  top: 16px;
  right: 26px;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  z-index: 3000;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.popup-close:hover {
  transform: scale(1.15);
  opacity: 0.85;
}

/* ===========================================================
   ✅ Amélioration popup – Compatibilité mobile & laptop
=========================================================== */

/* 1. Le fond couvre tout et bloque le menu derrière */
.popup {
  position: fixed;
  inset: 0;
  z-index: 9999; /* + haut que ton menu */
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 4vw;
  backdrop-filter: blur(3px);
}

/* 2. Zone intérieure parfaitement centrée */
.popup-inner {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 3. Image adaptative (PC + mobile) */
.popup-content {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 0 25px rgba(0,0,0,0.5);
  background: #fff;
  object-fit: contain;
}

/* 4. Croix visible sur tout écran */
.popup-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  z-index: 10000;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.popup-close:hover {
  transform: scale(1.2);
  opacity: 0.8;
}

/* 5. Amélioration tactile mobile (clic fond ferme mieux) */
@media (max-width: 768px) {
  .popup {
    align-items: center;
    justify-content: center;
    padding: 5vw;
    touch-action: none;
  }
}

/* Animation douce d’ouverture/fermeture popup */
.popup {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.popup.visible {
  opacity: 1;
}

/* ✅ Correction clic souris sur fond popup (PC + tactile)
   Permet de fermer même en cliquant sur la bordure autour de l’image */
.popup-inner {
  pointer-events: none; /* laisse passer les clics */
}

.popup-content,
.popup-close {
  pointer-events: auto; /* garde l’interactivité sur l’image et la croix */
}
