/* ========================================
   PAGE BLOG (/blog)
   Haut de page : styles de la page À propos (a-propos.css, classe about-page sur le body).
   Ici : haut de page agrandi sur tablette et mobile, filtres en pastilles, recherche, article à
   la une, grille de cartes, pagination. Réglages : admin « Page Blog ».
   ======================================== */

/* ---- Haut de page, tablette et mobile : la photo occupe l'essentiel du premier écran ---- */
@media (max-width: 1199px) {
  .blog-list-page .about-hero:has(.about-hero-media) {
    min-height: calc(62vh - var(--site-header-h, 76px));
    min-height: calc(62svh - var(--site-header-h, 76px));
  }
}

/* Fond sombre en fondu derrière le texte du haut de page (ovale qui s'éteint avant ses bords) */
.blog-list-page .about-content {
  position: relative;
}

.blog-list-page .about-hero:has(.about-hero-media) .about-content::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -140px;
  z-index: -1;
  width: min(115%, 1040px);
  height: 160%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.5) 38%, rgba(0, 0, 0, 0.26) 68%, rgba(0, 0, 0, 0.08) 88%, rgba(0, 0, 0, 0) 100%);
  transform: translateY(-50%);
  pointer-events: none;
}

/* ---- Section des articles ---- */
.bl-section {
  position: relative;
  padding: clamp(56px, 6vw, 96px) 0 clamp(72px, 8vw, 120px);
  overflow: hidden;
  background: var(--site-green-deep, #10201a);
  isolation: isolate;
}

/* Le bas de la photo tombe souvent sur une fraction de pixel : la section recouvre cette rangée
   (sinon un fin liseret clair apparaît sous la photo, surtout sur mobile) */
.about-hero + .bl-section {
  margin-top: -1px;
}

.bl-glow {
  position: absolute;
  top: 8%;
  right: -240px;
  z-index: -1;
  width: 700px;
  height: 700px;
  background: radial-gradient(closest-side, rgba(157, 198, 107, 0.1), rgba(157, 198, 107, 0));
  pointer-events: none;
  animation: bl-drift 26s ease-in-out infinite alternate;
}

@keyframes bl-drift {
  to {
    transform: translate(-220px, 220px) scale(1.1);
  }
}

.bl-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
}

/* ---- Barre : catégories et recherche ---- */
.bl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  margin-bottom: clamp(28px, 3vw, 40px);
}

.bl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bl-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 16px;
  font-family: var(--site-sans);
  font-size: 14px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(157, 198, 107, 0.35);
  border-radius: 999px;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Nombre d'articles / de réalisations : petit badge arrondi, centré sur la ligne du texte
   (un simple texte plus petit paraissait remonté) */
.bl-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.bl-pill:hover span {
  color: #fff;
  background: rgba(157, 198, 107, 0.18);
}

.bl-pill:hover {
  color: #fff;
  border-color: var(--site-lime);
}

.bl-pill.is-active {
  color: var(--site-green-deep, #10201a);
  background: var(--site-lime);
  border-color: var(--site-lime);
}

.bl-pill.is-active span {
  color: var(--site-green-deep, #10201a);
  background: rgba(16, 32, 26, 0.14);
}

.bl-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 380px);
  height: 46px;
  background: rgba(23, 44, 35, 0.9);
  border: 1px solid rgba(157, 198, 107, 0.3);
  border-radius: 999px;
  transition: border-color 0.25s ease;
}

.bl-search:focus-within {
  border-color: var(--site-lime);
}

.bl-search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.bl-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 8px 0 44px;
  font-family: var(--site-sans);
  font-size: 14px;
  color: #fff;
  background: transparent;
  border: 0;
  outline: none;
}

.bl-search input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.bl-search button {
  height: 36px;
  margin-right: 5px;
  padding: 0 16px;
  font-family: var(--site-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--site-green-deep, #10201a);
  background: var(--site-lime);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.bl-search button:hover {
  background: #b5d68c;
}

.bl-search button svg {
  display: none;
  width: 16px;
  height: 16px;
}

/* Menu déroulant des catégories : seulement sur tablette et mobile (à la place des pastilles) */
.bl-dropdown {
  display: none;
}

.bl-pill:focus-visible,
.bl-search button:focus-visible,
.bl-page:focus-visible,
.bl-card:focus-visible,
.bl-feature:focus-visible {
  outline: 2px solid var(--site-lime);
  outline-offset: 3px;
}

.blog-list-page .bl-results {
  margin: -12px 0 28px;
  font-family: var(--site-sans);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

.blog-list-page .bl-results strong {
  color: var(--site-lime);
}

.blog-list-page .bl-results a {
  margin-left: 12px;
  color: #fff;
  text-decoration: underline;
}

/* ---- Méta communes ---- */
.blog-list-page .bl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-family: var(--site-sans);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.blog-list-page .bl-category {
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--site-lime);
}

.blog-list-page .bl-excerpt {
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--site-sans);
  font-size: 14.5px;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.blog-list-page .bl-read {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--site-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--site-lime);
}

.bl-read svg {
  width: 16px;
  height: 16px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.bl-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28%;
  max-width: 120px;
  color: var(--site-lime);
  opacity: 0.22;
  transform: translate(-50%, -50%);
}

/* ---- Article à la une : photo à gauche, texte à droite ---- */
.bl-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  margin-bottom: clamp(28px, 3vw, 44px);
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #1c352a 0%, #152a21 60%, #11231b 100%);
  border: 1px solid rgba(157, 198, 107, 0.18);
  border-radius: 20px;
  box-shadow: 0 40px 70px -44px rgba(0, 0, 0, 0.85);
  transition: border-color 0.35s ease;
}

.bl-feature:hover {
  border-color: rgba(157, 198, 107, 0.45);
}

.bl-feature-media {
  position: relative;
  min-height: clamp(300px, 30vw, 440px);
  overflow: hidden;
  background: linear-gradient(145deg, #1f3a2e, #142820);
}

.bl-feature-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.bl-feature:hover .bl-feature-media img {
  transform: scale(1.05);
}

.bl-feature:hover .bl-read svg,
.bl-card:hover .bl-read svg {
  transform: translateX(5px);
}

.bl-feature-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: clamp(28px, 3.4vw, 52px);
}

.blog-list-page .bl-badge {
  align-self: flex-start;
  padding: 5px 12px;
  font-family: var(--site-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--site-green-deep, #10201a);
  background: var(--site-lime);
  border-radius: 999px;
}

.blog-list-page .bl-feature-title {
  font-family: var(--site-serif);
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 600;
  line-height: 1.08;
  color: #fff;
}

.bl-feature .bl-excerpt {
  -webkit-line-clamp: 3;
}

/* ---- Grille des articles ---- */
.bl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 28px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bl-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: #fff;
  background: #152a21;
  border: 1px solid rgba(157, 198, 107, 0.14);
  border-radius: 16px;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.bl-card:hover {
  transform: translateY(-5px);
  border-color: rgba(157, 198, 107, 0.45);
  box-shadow: 0 30px 50px -34px rgba(0, 0, 0, 0.9);
}

.bl-card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(145deg, #1f3a2e, #142820);
}

.bl-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.bl-card:hover .bl-card-media img {
  transform: scale(1.06);
}

.blog-list-page .bl-card-category {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 11px;
  font-family: var(--site-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--site-lime);
  background: rgba(16, 32, 26, 0.82);
  border: 1px solid rgba(157, 198, 107, 0.35);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.bl-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 22px;
}

.blog-list-page .bl-card-title {
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--site-serif);
  font-size: clamp(21px, 1.6vw, 25px);
  font-weight: 600;
  line-height: 1.12;
  color: #fff;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Aucun article ---- */
.bl-empty {
  padding: 56px 20px;
  text-align: center;
  border: 1px dashed rgba(157, 198, 107, 0.3);
  border-radius: 18px;
}

.bl-empty svg {
  width: 64px;
  color: var(--site-lime);
  opacity: 0.4;
}

.blog-list-page .bl-empty p {
  margin: 16px 0 20px;
  font-family: var(--site-sans);
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
}

.bl-empty-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 22px;
  font-family: var(--site-sans);
  font-size: 14px;
  color: #fff;
  border: 1.5px solid rgba(157, 198, 107, 0.75);
  border-radius: 999px;
}

.bl-empty-btn:hover {
  color: var(--site-green-deep, #10201a);
  background: var(--site-lime);
}

/* ---- Pagination ---- */
.bl-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: clamp(36px, 4vw, 56px);
}

.bl-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  font-family: var(--site-sans);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(157, 198, 107, 0.3);
  border-radius: 999px;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.bl-page svg {
  width: 17px;
  height: 17px;
}

.bl-page:hover {
  color: #fff;
  border-color: var(--site-lime);
}

.bl-page.is-active {
  color: var(--site-green-deep, #10201a);
  background: var(--site-lime);
  border-color: var(--site-lime);
}

.bl-page-gap {
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   TABLETTE ET MOBILE
   ======================================== */
@media (max-width: 1199px) {
  .blog-list-page .bl-feature-title {
    font-size: clamp(24px, 3vw, 32px);
  }

  .blog-list-page .bl-card-title {
    font-size: 20px;
  }

  .blog-list-page .bl-excerpt {
    font-size: 14px;
  }
}

@media (max-width: 991px) {
  /* Deux lignes fines : menu des catégories, puis recherche ; pas de pastilles */
  .bl-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    z-index: 6; /* la liste ouverte passe au-dessus des cartes, même pendant leur apparition */
    gap: 10px;
    margin-bottom: 24px;
  }

  .bl-filters {
    display: none;
  }

  .bl-dropdown {
    position: relative;
    display: block;
    z-index: 5;
  }

  .bl-dropdown summary {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 16px;
    font-family: var(--site-sans);
    font-size: 14px;
    color: #fff;
    list-style: none;
    background: rgba(23, 44, 35, 0.9);
    border: 1px solid rgba(157, 198, 107, 0.3);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.25s ease;
  }

  .bl-dropdown summary::-webkit-details-marker {
    display: none;
  }

  .bl-dropdown summary:hover,
  .bl-dropdown[open] summary {
    border-color: var(--site-lime);
  }

  .bl-dropdown summary:focus-visible {
    outline: 2px solid var(--site-lime);
    outline-offset: 3px;
  }

  .blog-list-page .bl-dropdown-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--site-lime);
  }

  .blog-list-page .bl-dropdown-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .blog-list-page .bl-dropdown-value span {
    margin-left: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
  }

  .bl-dropdown summary svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--site-lime);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bl-dropdown[open] summary svg {
    transform: rotate(180deg);
  }

  /* Liste ouverte : panneau sombre aux bords arrondis, sous le menu */
  .bl-dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #142820;
    border: 1px solid rgba(157, 198, 107, 0.3);
    border-radius: 16px;
    box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.8);
    animation: bl-drop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes bl-drop {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
  }

  .bl-dropdown-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    font-family: var(--site-sans);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.88);
    border-radius: 10px;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .bl-dropdown-list a span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
  }

  .bl-dropdown-list a:hover {
    color: #fff;
    background: rgba(157, 198, 107, 0.1);
  }

  .bl-dropdown-list a.is-active {
    color: var(--site-lime);
    background: rgba(157, 198, 107, 0.12);
  }

  .bl-dropdown-list a.is-active span {
    color: var(--site-lime);
  }

  .bl-search {
    width: 100%;
    height: 42px;
  }

  /* Bouton : flèche ronde au lieu du texte */
  .bl-search button {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
  }

  .bl-search-label {
    display: none;
  }

  .bl-search button svg {
    display: block;
  }

  .bl-feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .bl-feature-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .bl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bl-glow {
    width: 480px;
    height: 480px;
  }
}

@media (max-width: 575px) {
  .bl-section {
    padding: 44px 0 64px;
  }

  .bl-search,
  .bl-dropdown summary {
    height: 40px;
  }

  /* 16 px : pas de zoom automatique de la page sur iPhone en touchant le champ */
  .bl-search input {
    font-size: 16px;
  }

  .bl-search input::placeholder {
    font-size: 14px;
  }

  .bl-feature {
    border-radius: 16px;
  }

  .bl-feature-body {
    gap: 10px;
    padding: 20px;
  }

  .blog-list-page .bl-feature-title {
    font-size: 22px;
  }

  .blog-list-page .bl-excerpt {
    font-size: 13.5px;
  }

  .blog-list-page .bl-meta {
    font-size: 11px;
  }

  .bl-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .bl-card {
    border-radius: 14px;
  }

  .bl-card-body {
    padding: 16px 18px 18px;
  }

  .blog-list-page .bl-card-title {
    font-size: 19px;
  }

  .bl-page {
    min-width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bl-glow,
  .bl-dropdown-list {
    animation: none;
  }

  .bl-card,
  .bl-card-media img,
  .bl-feature-media img,
  .bl-read svg {
    transition: none;
  }

  .bl-card:hover {
    transform: none;
  }
}

/* ---- Listes sans rechargement (Blog, Nos réalisations, Books : projects-list.js) ----
   Pendant un changement de filtre, de page ou de recherche, la liste actuelle s'efface en fondu
   (transition posée seulement à ce moment : l'apparition normale des cartes n'est pas touchée) ;
   les nouvelles cartes reprennent l'apparition du site : elles glissent vers le haut, l'une après
   l'autre. La barre de filtres ne bouge pas. */
[data-ajax-list] .bl-wrap.is-leaving > :not(.bl-toolbar) {
  opacity: 0;
  transition: opacity 0.22s ease;
}

@media (prefers-reduced-motion: reduce) {
  [data-ajax-list] .bl-wrap.is-leaving > :not(.bl-toolbar) {
    transition: none;
  }
}
