/* Page /new-astre — grille archive, filtres, intro */

.new-astre-page {
  --new-astre-grid-radius: 9999px;
  --new-astre-grid-gap-col: 0.5rem;
  --new-astre-grid-gap-row: 3rem;
  --new-astre-cell-height: 13rem;
  --new-astre-cell-padding-y: 4rem;
  --new-astre-cell-font-size: var(--text-4xl, 2.4rem);
  --new-astre-cell-line-height: 1.28;
  --new-astre-desc-size: var(--text-xl, 1.25rem);
  --new-astre-desc-leading: var(--text-xl--line-height, 1.25);
  --new-astre-filters-grid-gap: 7.5rem;
  --new-astre-filter-font-family: "David", serif;
  color: var(--new-astre-text, inherit);
}

/* Introduction : pas de padding latéral en plus (aligné logo / filtres / grille) */
.new-astre-intro {
  width: 100%;
}

.new-astre-intro .layout-section {
  padding-top: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.new-astre-intro .layout-section:not(:last-child) {
  padding-bottom: 2rem !important;
}

.new-astre-intro .layout-section:last-child {
  padding-bottom: 2.5rem !important;
}

.new-astre-intro .layout-grid,
.new-astre-intro .layout-grid.max-w-6xl,
.new-astre-intro .kirby-inner-grid {
  max-width: none !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.new-astre-intro .max-w-copy {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Filtres : 1fr + 3fr (même ratio 1:3) ; bord droit description = bord droit grille */
.new-astre-page .new-astre-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) !important;
  column-gap: var(--new-astre-grid-gap-col);
  row-gap: var(--new-astre-filters-grid-gap);
  width: 100%;
  align-items: start;
}

/* display:contents → évite la grille 12 col. de main.css sur .ressources-theme-filters-grid */
.new-astre-page .new-astre-filters-row.ressources-theme-filters-grid {
  display: contents;
}

.new-astre-page .new-astre-filters-row .ressources-theme-filter-col {
  grid-column: 1 !important;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}

.new-astre-page .new-astre-filters-row .new-astre-category-desc-col {
  grid-column: 2 !important;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  max-width: none;
  padding-right: 0;
}

.new-astre-page .new-astre-filters-row .ressources-dropdown {
  width: 100%;
}

/* Liste déroulée dans le flux : pousse la grille sans chevauchement */
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  margin-top: 0 !important;
}

.new-astre-page .ressources-dropdown[open] .ressources-dropdown-list {
  display: block;
}

/* Filtres : David (priorité Caliste dans main.css) */
.new-astre-page .new-astre-filters-row .ressources-dropdown,
.new-astre-page .new-astre-filters-row .ressources-dropdown-summary,
.new-astre-page .new-astre-filters-row .ressources-dropdown-label,
.new-astre-page .new-astre-filters-row .ressources-dropdown-arrow,
.new-astre-page .new-astre-filters-row .ressources-dropdown-list,
.new-astre-page .new-astre-filters-row .ressources-dropdown-list li,
.new-astre-page .new-astre-filters-row .ressources-dropdown-list li button,
.new-astre-page .new-astre-filters-row .ressources-dropdown-list li a {
  font-family: var(--new-astre-filter-font-family) !important;
  letter-spacing: var(--tracking-tight, -0.025em);
  text-wrap: balance;
}

/* Filtres : fond panel (token filtre) ; texte = couleur page bg + logique d’opacité (aligné annonces) */
.new-astre-page [data-new-astre-filters] .ressources-dropdown-label,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list {
  background: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
  background-color: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
  border-color: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
  opacity: 1 !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-label {
  color: var(--page-bg, #ffffff) !important;
  -webkit-text-fill-color: var(--page-bg, #ffffff) !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow {
  color: var(--page-bg, #ffffff) !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow svg,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow svg path {
  fill: var(--page-bg, #ffffff) !important;
  color: inherit !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a {
  color: var(--page-bg, #ffffff) !important;
  -webkit-text-fill-color: var(--page-bg, #ffffff) !important;
  opacity: 0.55 !important;
  background-color: transparent !important;
  border-color: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
  transition: opacity 160ms ease, color 160ms ease, background-color 120ms ease;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li button,
.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li a {
  color: var(--page-bg, #ffffff) !important;
  -webkit-text-fill-color: var(--page-bg, #ffffff) !important;
  background-color: transparent !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button:hover,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a:hover,
.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li button:hover,
.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li a:hover {
  opacity: 1 !important;
  color: var(--page-bg, #000000) !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: var(--page-bg, #000000) !important;
  border-color: #ffffff !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a::after,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button::after {
  background-image: none !important;
  background-color: currentColor !important;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2229%22%20height%3D%2221%22%20viewBox%3D%220%200%2029%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M28%2013V14H29V13H28ZM0.292893%2012.2929C-0.0976311%2012.6834%20-0.0976311%2013.3166%200.292893%2013.7071L6.65685%2020.0711C7.04738%2020.4616%207.68054%2020.4616%208.07107%2020.0711C8.46159%2019.6805%208.46159%2019.0474%208.07107%2018.6569L2.41421%2013L8.07107%207.34315C8.46159%206.95262%208.46159%206.31946%208.07107%205.92893C7.68054%205.53841%207.04738%205.53841%206.65685%205.92893L0.292893%2012.2929ZM28%200H27V13H28H29V0H28ZM28%2013V12H1V13V14H28V13Z%22%20fill%3D%22black%22/%3E%3C/svg%3E") !important;
  mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2229%22%20height%3D%2221%22%20viewBox%3D%220%200%2029%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M28%2013V14H29V13H28ZM0.292893%2012.2929C-0.0976311%2012.6834%20-0.0976311%2013.3166%200.292893%2013.7071L6.65685%2020.0711C7.04738%2020.4616%207.68054%2020.4616%208.07107%2020.0711C8.46159%2019.6805%208.46159%2019.0474%208.07107%2018.6569L2.41421%2013L8.07107%207.34315C8.46159%206.95262%208.46159%206.31946%208.07107%205.92893C7.68054%205.53841%207.04738%205.53841%206.65685%205.92893L0.292893%2012.2929ZM28%200H27V13H28H29V0H28ZM28%2013V12H1V13V14H28V13Z%22%20fill%3D%22black%22/%3E%3C/svg%3E") !important;
  -webkit-mask-repeat: no-repeat !important;
  mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  mask-position: center !important;
  -webkit-mask-size: contain !important;
  mask-size: contain !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a:hover::after,
.new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button:hover::after {
  opacity: 1 !important;
  background-color: currentColor !important;
}

/* Description : couleur du texte d’intro (--new-astre-text), pas celle des cellules */
.new-astre-page .new-astre-category-desc-col,
.new-astre-page .new-astre-category-desc,
.new-astre-page .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc__text p,
.new-astre-page .new-astre-category-desc__text li {
  color: var(--new-astre-text, inherit) !important;
}

/* Descriptions de catégorie : plus petit que le libellé du filtre (text-xl) */
.new-astre-page .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc__text p,
.new-astre-page .new-astre-category-desc__text li {
  font-size: var(--new-astre-desc-size) !important;
  line-height: var(--new-astre-desc-leading) !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow svg {
  width: 15px;
  height: auto;
}

.new-astre-page .new-astre-category-desc-col {
  display: block;
  max-width: none;
  padding-left: 0;
}

.new-astre-page .new-astre-category-desc,
.new-astre-page .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc__text p {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.new-astre-page .new-astre-category-desc.copy,
.new-astre-page .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc__text p {
  text-align: left;
  text-wrap: wrap !important;
  text-transform: none !important;
}

@media (max-width: 1023px) {
  .new-astre-page .new-astre-filters-row .new-astre-category-desc-col {
    grid-column: 2 !important;
  }
}

@media (max-width: 639px) {
  .new-astre-page .new-astre-body {
    grid-template-columns: 1fr !important;
    row-gap: 1.25rem;
  }

  .new-astre-page .new-astre-filters-row .ressources-theme-filter-col,
  .new-astre-page .new-astre-filters-row .new-astre-category-desc-col {
    grid-column: 1 !important;
  }

  .new-astre-page .new-astre-filters-row .new-astre-category-desc-col {
    grid-row: 2;
    padding-top: 0.75rem;
  }

  .new-astre-page .new-astre-grid {
    grid-column: 1 / -1 !important;
    grid-row: auto;
    margin-top: 0;
  }

  .new-astre-page .ressources-dropdown-list {
    width: 100% !important;
  }
}

/* Description : occupe toute la colonne (pas de balance / max-width copy) */
.new-astre-page .new-astre-category-desc.copy {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
}

.new-astre-page .new-astre-category-desc.copy > .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc.copy > div {
  width: 100% !important;
  max-width: 100% !important;
}

.new-astre-page .new-astre-category-desc__text,
.new-astre-page .new-astre-category-desc__text p,
.new-astre-page .new-astre-category-desc__text li,
.new-astre-page .new-astre-category-desc.copy > h2 {
  margin: 0;
  color: inherit;
}

.new-astre-page .new-astre-category-desc.has-indent .new-astre-category-desc__text p,
.new-astre-page .new-astre-category-desc.has-indent > .new-astre-category-desc__text:first-child p,
.new-astre-page .new-astre-category-desc.has-indent .new-astre-category-desc__text > p:first-child {
  text-indent: 15%;
}

/* Surcharge Caliste : main.css L1519 / L1599 */
.new-astre-page.ressources-page-custom [data-new-astre-filters] .ressources-dropdown-label,
.new-astre-page.ressources-page-custom [data-new-astre-filters] .ressources-dropdown-summary,
.new-astre-page.ressources-page-custom [data-new-astre-filters] .ressources-dropdown-list li button,
.new-astre-page.ressources-page-custom [data-new-astre-filters] .ressources-dropdown-list li a {
  font-family: "David", serif !important;
  text-transform: lowercase !important;
}

.new-astre-page .new-astre-category-desc__text p + p {
  margin-top: 0.75em;
}

.new-astre-page .new-astre-category-desc:empty {
  display: none;
}

.new-astre-page .new-astre-category-desc-col:has(.new-astre-category-desc:empty) {
  display: none;
}

/* Grille : toutes les cellules à la même hauteur */
.new-astre-page .new-astre-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: var(--new-astre-cell-height);
  column-gap: var(--new-astre-grid-gap-col);
  row-gap: var(--new-astre-grid-gap-row);
  width: 100%;
  align-items: stretch;
  margin-top: 0;
}

@media (max-width: 1023px) {
  .new-astre-page .new-astre-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .new-astre-page .new-astre-grid {
    grid-column: 1;
    grid-template-columns: 1fr;
  }
}

.new-astre-page .new-astre-grid__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  height: 100%;
  min-height: var(--new-astre-cell-height);
  text-align: center;
  padding: var(--new-astre-cell-padding-y) 1.5rem;
  box-sizing: border-box;
  text-decoration: none;
  background: var(--new-astre-grid-bg, #000);
  color: var(--new-astre-grid-text, #fff);
  border: 0;
  font-size: var(--new-astre-cell-font-size) !important;
  line-height: var(--new-astre-cell-line-height) !important;
  white-space: normal;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
  transition:
    background-color 0s,
    border-radius var(--astre-btn-shape-duration, 0s);
}

.new-astre-page .new-astre-grid__cell-title {
  display: block;
  max-width: 11ch;
  margin-inline: auto;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
  font-size: inherit;
  line-height: inherit;
}

.new-astre-page .new-astre-grid__cell--span-2 .new-astre-grid__cell-title {
  max-width: 20ch;
}

@media (max-width: 767px) {
  .new-astre-page {
    --new-astre-cell-font-size: clamp(1.72rem, 8.6vw, 2.35rem);
    --new-astre-grid-gap-col: 0;
    --new-astre-grid-gap-row: 0.5rem;
  }

  .new-astre-page .new-astre-body {
    row-gap: 1.25rem;
  }

  .new-astre-page .new-astre-grid {
    gap: var(--new-astre-grid-gap-row) 0 !important;
    margin-top: 0;
  }

  .new-astre-page .new-astre-grid__cell + .new-astre-grid__cell {
    margin-top: 0;
  }

  /* Intro : titres moyens David (h3 / 4XL) → text-2xl mobile (aligné blocs Texte) */
  .new-astre-page .new-astre-intro h3.tablo-heading__tag.text-4xl,
  .new-astre-page .new-astre-intro h3.tablo-heading__tag.text-4xl :is(p, span, strong, em) {
    --tablo-text-fs: var(--text-2xl);
    --tablo-text-lh: var(--text-2xl--line-height);
    font-size: var(--tablo-text-fs) !important;
    line-height: var(--tablo-text-lh) !important;
  }

  /* Intro : boutons à libellé long — interligne réduit */
  .new-astre-page .new-astre-intro a.button.header-nav-button,
  .new-astre-page .new-astre-intro a.archived-event-btn,
  .new-astre-page .new-astre-intro .action-download__label {
    line-height: 1.1 !important;
  }

  .new-astre-page .new-astre-grid__cell {
    padding-inline: 1rem;
  }

  .new-astre-page .new-astre-grid__cell-title {
    max-width: 14ch;
  }

  .new-astre-page .new-astre-grid__cell--span-2 .new-astre-grid__cell-title {
    max-width: 26ch;
  }
}

.new-astre-grid__cell--rounded {
  border-radius: var(--new-astre-grid-radius);
}

.new-astre-grid__cell--square {
  border-radius: 0;
}

.new-astre-grid__cell:hover {
  background: var(--new-astre-grid-hover-bg, var(--new-astre-grid-bg, #000));
}

.new-astre-grid__cell--rounded:hover {
  border-radius: 0;
}

.new-astre-grid__cell--square:hover {
  border-radius: var(--new-astre-grid-radius);
}

/* N&B : cellules grille — noir / blanc ; survol = fond blanc, texte noir, contour noir */
body[data-contrast-mode="bw"] .new-astre-page .new-astre-grid__cell {
  background-color: #000000 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border: 2px solid #000000 !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}

body[data-contrast-mode="bw"] .new-astre-page .new-astre-grid__cell .new-astre-grid__cell-title {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body[data-contrast-mode="bw"] .new-astre-page .new-astre-grid__cell:hover {
  background-color: #ffffff !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
  border: 2px solid #000000 !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}

body[data-contrast-mode="bw"] .new-astre-page .new-astre-grid__cell:hover .new-astre-grid__cell-title {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

/* N&B : filtres — fond noir ; texte blanc atténué, 100 % au survol */
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-label,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-list {
  background-color: #000000 !important;
  border-color: #000000 !important;
  opacity: 1 !important;
}

body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-label,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow svg,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow svg path {
  fill: #ffffff !important;
  color: #ffffff !important;
}

body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li button,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li a {
  background-color: transparent !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: #000000 !important;
  opacity: 0.55 !important;
}

body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-list li button:hover,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown-list li a:hover,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li button:hover,
body[data-contrast-mode="bw"] .new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list li a:hover {
  background-color: #ffffff !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
  border-color: #ffffff !important;
  opacity: 1 !important;
}

/* Filtre catégories : bandeau en grille, flèche carrée (largeur = hauteur) — aligné annonces / ressources */
.new-astre-page [data-new-astre-filters] .ressources-dropdown-summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: stretch !important;
  width: 100% !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-label {
  grid-column: 1;
  flex: unset !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: var(--theme-filter-label-padding-block) 1rem var(--theme-filter-label-padding-block) 26px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown-arrow {
  grid-column: 2;
  align-self: stretch !important;
  width: auto !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  flex: none !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Menu ouvert : un seul bloc (fond commun, pas de trait entre bandeau et liste) */
.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
  overflow: hidden;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-summary {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: var(--new-astre-filter-bg, var(--new-astre-grid-bg, #000)) !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] :is(
  .ressources-dropdown-label,
  .ressources-dropdown-arrow,
  .ressources-dropdown-list,
  .ressources-dropdown-list > li,
  .ressources-dropdown-list li :is(a, button)
) {
  border: 0 !important;
  border-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list {
  margin-top: -1px !important;
  padding-top: 0 !important;
  padding-bottom: calc(var(--theme-filter-label-padding-block) - var(--theme-filter-row-padding-block)) !important;
}

.new-astre-page [data-new-astre-filters] .ressources-dropdown[open] .ressources-dropdown-list > li:not([hidden]) :is(a, button) {
  border-top: 0 !important;
}
