/* =====================================================
   Mon Multivers — galeries, dossiers média et lightbox
   ===================================================== */

/* ==================== Grille galerie ==================== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  overscroll-behavior: contain;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%);
  border-radius: 16px;
  border: 1.5px solid var(--accent);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  padding-bottom: 18px;
  position: relative;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.gallery-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.gallery-item figcaption {
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5em;
}


/* =====================================================
   ===== Tuiles des dossiers ouverts : par univers ======
   ===================================================== */

/*
 * Même principe que pour les tuiles de dossiers et le fond du carrousel :
 * on garde une base presque blanche et on ajoute seulement une brume
 * très légère dans la couleur de l'univers.
 */
#conferences-area {
  --media-card-rgb: 2, 132, 199;
  --media-card-color: #0284c7;
}

#photos-area {
  --media-card-rgb: 219, 39, 119;
  --media-card-color: #db2777;
}

#videos-area {
  --media-card-rgb: 220, 76, 63;
  --media-card-color: #dc4c3f;
}

/*
 * Les miniatures restent neutres.
 * Seuls le fond visible autour / sous l'image, la bordure et l'ombre
 * prennent l'atmosphère de la rubrique.
 */
#conferences-area .gallery-item,
#photos-area .gallery-item {
  background:
    radial-gradient(
      ellipse 115% 88% at 12% 0%,
      rgba(var(--media-card-rgb), .030) 0%,
      rgba(var(--media-card-rgb), .008) 42%,
      transparent 74%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,254,255,.995) 100%
    );

  border-color: rgba(var(--media-card-rgb), .10);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    0 1px 2px rgba(15,23,42,.018),
    0 7px 18px rgba(var(--media-card-rgb), .018);
}

#conferences-area .gallery-item:hover,
#photos-area .gallery-item:hover {
  background:
    radial-gradient(
      ellipse 120% 92% at 12% 0%,
      rgba(var(--media-card-rgb), .050) 0%,
      rgba(var(--media-card-rgb), .014) 45%,
      transparent 76%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,253,254,.995) 100%
    );

  border-color: rgba(var(--media-card-rgb), .18);

  box-shadow:
    0 2px 4px rgba(15,23,42,.025),
    0 9px 22px rgba(var(--media-card-rgb), .035);
}

/* Le texte reste sobre ; seul un très léger rappel de couleur apparaît. */
#conferences-area .gallery-item figcaption,
#photos-area .gallery-item figcaption {
  color: #526173;
}

#conferences-area .gallery-item:hover figcaption,
#photos-area .gallery-item:hover figcaption {
  color: var(--media-card-color);
}


/*
 * Vidéos : même traitement atmosphérique que les miniatures Photos /
 * Conférences, mais avec le rouge doux de l'univers Vidéos.
 *
 * Le lecteur vidéo reste neutre/noir : seule la carte qui l'entoure
 * prend la teinte de la rubrique.
 */
#videos-area .video-card {
  background:
    radial-gradient(
      ellipse 115% 88% at 12% 0%,
      rgba(var(--media-card-rgb), .030) 0%,
      rgba(var(--media-card-rgb), .008) 42%,
      transparent 74%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,254,255,.995) 100%
    );

  border-color: rgba(var(--media-card-rgb), .10);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.90),
    0 1px 2px rgba(15,23,42,.018),
    0 7px 18px rgba(var(--media-card-rgb), .018);

  transition:
    transform .12s ease,
    box-shadow .20s ease,
    border-color .18s ease,
    background .18s ease;
}

#videos-area .video-card:hover {
  transform: translateY(-2px);

  background:
    radial-gradient(
      ellipse 120% 92% at 12% 0%,
      rgba(var(--media-card-rgb), .050) 0%,
      rgba(var(--media-card-rgb), .014) 45%,
      transparent 76%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,253,254,.995) 100%
    );

  border-color: rgba(var(--media-card-rgb), .18);

  box-shadow:
    0 2px 4px rgba(15,23,42,.025),
    0 9px 22px rgba(var(--media-card-rgb), .035);
}

#videos-area .video-card-caption,
#videos-area .video-card p {
  color: #526173;
}

#videos-area .video-card:hover .video-card-caption,
#videos-area .video-card:hover p {
  color: var(--media-card-color);
}


/* =====================================================
   =============== Folder grid (Carousels) ===============
   ===================================================== */

/*
 * Carrousel des dossiers — version modernisée.
 *
 * Le comportement reste le même :
 * - défilement horizontal ;
 * - scroll-snap ;
 * - survol / clic / sélection ;
 * - navigation clavier.
 *
 * On retravaille seulement la finition visuelle.
 */
.folder-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 22vw);
  grid-template-rows: repeat(3, 1fr);
  gap: 16px;

  /*
   * Plus d'air en bas pour que les cartes ne semblent plus
   * collées à la barre de défilement.
   */
  padding: 18px 24px 30px;

  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x mandatory;
  scroll-padding-inline: 24px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;

  scrollbar-width: thin;
  scrollbar-color: rgba(58, 123, 213, .48) transparent;
}

/* Barre de défilement plus fine, douce et intégrée à la palette du site. */
.folder-grid::-webkit-scrollbar {
  height: 10px;
}

.folder-grid::-webkit-scrollbar-track {
  background: transparent;
  margin-inline: 18px;
}

.folder-grid::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      rgba(0, 210, 255, .56),
      rgba(58, 123, 213, .60)
    )
    padding-box;
}

.folder-grid::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(
      90deg,
      rgba(0, 210, 255, .76),
      rgba(58, 123, 213, .78)
    )
    padding-box;
}

.folder {
  appearance: none;
  -webkit-appearance: none;

  scroll-snap-align: center;

  min-height: 140px;
  padding: 22px 14px;

  text-align: center;
  font: inherit;
  color: var(--text);

  cursor: pointer;

  border: 1px solid rgba(15, 23, 42, .085);
  border-radius: 17px;

  /*
   * Blanc légèrement froid plutôt qu'un aplat parfaitement blanc :
   * la carte reste sobre mais paraît moins "bloc posé".
   */
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(250,254,255,.985) 100%
    );

  /*
   * Ombre plus naturelle :
   * une petite ombre de contact + une ombre diffuse très légère.
   */
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .035),
    0 7px 18px rgba(31, 73, 91, .055);

  position: relative;
  z-index: 1;

  transition:
    transform .18s ease,
    box-shadow .20s ease,
    border-color .18s ease,
    color .18s ease;
}

/*
 * Survol : petite élévation + brume turquoise très légère.
 * Le motif reste volontairement diffus.
 */
.folder:hover {
  transform: translateY(-2px);

  border-color: rgba(25, 198, 209, .30);

  background:
    radial-gradient(
      ellipse 100% 85% at 20% 0%,
      rgba(0, 210, 255, .105) 0%,
      rgba(0, 210, 255, .035) 38%,
      transparent 72%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(248,253,255,.99) 100%
    );

  box-shadow:
    0 2px 4px rgba(15, 23, 42, .045),
    0 12px 28px rgba(31, 82, 105, .10);
}

/* Sensation de pression au clic sans effet brutal. */
.folder:active {
  transform: translateY(0) scale(.992);

  border-color: rgba(58, 123, 213, .36);

  background:
    radial-gradient(
      ellipse 110% 90% at 18% 4%,
      rgba(0, 210, 255, .14) 0%,
      rgba(58, 123, 213, .045) 46%,
      transparent 76%
    ),
    linear-gradient(
      180deg,
      #fbffff 0%,
      #f3fbff 100%
    );

  box-shadow:
    0 1px 2px rgba(15, 23, 42, .04),
    0 6px 16px rgba(31, 82, 105, .075);

  color: #1976d2;
}

/* Focus clavier : visible mais cohérent avec le reste du site. */
.folder:focus-visible {
  outline: none;

  border-color: rgba(58, 123, 213, .50);

  background:
    radial-gradient(
      ellipse 100% 85% at 20% 0%,
      rgba(0, 210, 255, .11) 0%,
      rgba(0, 210, 255, .035) 40%,
      transparent 72%
    ),
    linear-gradient(
      180deg,
      #ffffff 0%,
      #f7fcff 100%
    );

  box-shadow:
    0 0 0 3px rgba(58, 123, 213, .14),
    0 8px 20px rgba(31, 82, 105, .08);

  color: #1976d2;
}

.folder-icon {
  /*
   * Icône nue, sans petit cartouche autour :
   * elle reste discrète et sert seulement de repère visuel.
   */
  width: auto;
  height: auto;
  margin: 0 auto 6px;

  display: block;

  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;

  /* Cache l'ancien 📁 généré par le JS. */
  font-size: 0;
  line-height: 1;

  transition:
    transform .18s ease,
    filter .18s ease;
}

.folder-icon::before {
  display: inline-block;
  font-size: 1.16rem;
  line-height: 1;
}

/* Icônes adaptées à chaque univers.
 *
 * On n'utilise plus les emojis système : les trois pictogrammes sont
 * de vrais SVG injectés par folder-carousels.js. Leur dessin reste donc
 * identique sur Android, iOS, Windows et macOS.
 */
#conferences-folders .folder-icon::before,
#photos-folders .folder-icon::before,
#videos-folders .folder-icon::before {
  content: none;
}

#conferences-folders .folder-icon,
#photos-folders .folder-icon,
#videos-folders .folder-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 7px;
  display: grid;
  place-items: center;
  color: var(--folder-theme);
}

#conferences-folders .folder-icon-svg,
#photos-folders .folder-icon-svg,
#videos-folders .folder-icon-svg {
  display: block;
  width: 32px;
  height: 32px;
  overflow: visible;
  color: inherit;
}

#conferences-folders .folder-icon-svg {
  filter: drop-shadow(0 2px 3px rgba(2, 132, 199, .08));
}

#photos-folders .folder-icon-svg {
  filter: drop-shadow(0 2px 3px rgba(219, 39, 119, .08));
}

#videos-folders .folder-icon-svg {
  filter: drop-shadow(0 2px 3px rgba(220, 76, 63, .08));
}

@media (max-width: 768px) {
  #conferences-folders .folder-icon,
  #photos-folders .folder-icon,
  #videos-folders .folder-icon {
    width: 27px;
    height: 27px;
  }

  #conferences-folders .folder-icon-svg,
  #photos-folders .folder-icon-svg,
  #videos-folders .folder-icon-svg {
    width: 27px;
    height: 27px;
  }
}

.folder:hover .folder-icon,
.folder:focus-visible .folder-icon {
  transform: translateY(-1px) scale(1.025);
  filter: drop-shadow(0 2px 4px rgba(31, 82, 105, .07));
}

/* =====================================================
   ===== Atmosphère colorée propre à chaque univers =====
   ===================================================== */

/*
 * Même familles chromatiques que le menu hamburger :
 * Conférences = bleu
 * Photos       = rose
 * Vidéos       = rouge doux
 *
 * Les opacités restent volontairement très faibles :
 * on cherche une ambiance, pas un aplat coloré.
 */
#conferences-folders {
  --folder-theme-rgb: 2, 132, 199;
  --folder-theme: #0284c7;
}

#photos-folders {
  --folder-theme-rgb: 219, 39, 119;
  --folder-theme: #db2777;
}

#videos-folders {
  --folder-theme-rgb: 220, 76, 63;
  --folder-theme: #dc4c3f;
}

#conferences-folders .folder,
#photos-folders .folder,
#videos-folders .folder {
  border-color: rgba(var(--folder-theme-rgb), .075);

  background:
    radial-gradient(
      ellipse 115% 95% at 14% 0%,
      rgba(var(--folder-theme-rgb), .028) 0%,
      rgba(var(--folder-theme-rgb), .007) 42%,
      transparent 74%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,254,255,.995) 100%
    );
}

#conferences-folders .folder:hover,
#photos-folders .folder:hover,
#videos-folders .folder:hover {
  border-color: rgba(var(--folder-theme-rgb), .14);

  background:
    radial-gradient(
      ellipse 118% 100% at 14% 0%,
      rgba(var(--folder-theme-rgb), .050) 0%,
      rgba(var(--folder-theme-rgb), .014) 44%,
      transparent 75%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,253,254,.995) 100%
    );

  box-shadow:
    0 2px 4px rgba(15,23,42,.025),
    0 10px 24px rgba(var(--folder-theme-rgb), .035);
}

#conferences-folders .folder:focus-visible,
#photos-folders .folder:focus-visible,
#videos-folders .folder:focus-visible {
  border-color: rgba(var(--folder-theme-rgb), .22);

  background:
    radial-gradient(
      ellipse 118% 100% at 14% 0%,
      rgba(var(--folder-theme-rgb), .058) 0%,
      rgba(var(--folder-theme-rgb), .015) 44%,
      transparent 75%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.995) 0%,
      rgba(255,253,254,.995) 100%
    );

  box-shadow:
    0 0 0 3px rgba(var(--folder-theme-rgb), .055),
    0 8px 20px rgba(var(--folder-theme-rgb), .03);

  color: var(--folder-theme);
}

#conferences-folders .folder:active,
#photos-folders .folder:active,
#videos-folders .folder:active {
  border-color: rgba(var(--folder-theme-rgb), .20);

  background:
    radial-gradient(
      ellipse 122% 104% at 14% 0%,
      rgba(var(--folder-theme-rgb), .065) 0%,
      rgba(var(--folder-theme-rgb), .018) 46%,
      transparent 76%
    ),
    linear-gradient(
      180deg,
      rgba(255,255,255,.99) 0%,
      rgba(247,251,252,.99) 100%
    );

  color: var(--folder-theme);
}

#conferences-folders .folder.selected,
#photos-folders .folder.selected,
#videos-folders .folder.selected {
  border-color: rgba(var(--folder-theme-rgb), .18);

  background:
    radial-gradient(
      ellipse 125% 108% at 12% 0%,
      rgba(var(--folder-theme-rgb), .065) 0%,
      rgba(var(--folder-theme-rgb), .018) 46%,
      transparent 76%
    ),
    radial-gradient(
      ellipse 86% 80% at 96% 100%,
      rgba(var(--folder-theme-rgb), .014) 0%,
      transparent 72%
    ),
    linear-gradient(
      180deg,
      #ffffff 0%,
      #f8fbfc 100%
    );

  box-shadow:
    0 2px 4px rgba(15,23,42,.020),
    0 8px 20px rgba(var(--folder-theme-rgb), .030),
    inset 0 0 0 1px rgba(var(--folder-theme-rgb), .025);

  color: var(--folder-theme);
}

#conferences-folders .folder.selected .folder-name,
#photos-folders .folder.selected .folder-name,
#videos-folders .folder.selected .folder-name {
  color: var(--folder-theme);
}

/* =====================================================
   ===== Titre du dossier sélectionné : icône accordée ==
   ===================================================== */

/*
 * Les icônes de dossiers sont maintenant de vrais SVG injectés par
 * folder-carousels.js. On n'ajoute donc plus d'emoji via ::before :
 * cela évite les doublons et les différences de rendu entre appareils.
 */

.folder-name {
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}


/* =====================================================
   ===== Conférences : icône et titres bien alignés =====
   ===================================================== */

/*
 * Les noms des dossiers de Conférences sont souvent longs.
 *
 * Plutôt que de centrer verticalement tout le contenu selon le nombre
 * de lignes, on réserve deux vraies rangées dans chaque tuile :
 *
 *   rangée 1 : l'icône de conférence, toujours à la même hauteur ;
 *   rangée 2 : le titre, qui commence toujours au même niveau.
 *
 * Le titre reste centré horizontalement : la tuile ne paraît donc
 * ni décalée vers la gauche, ni "déséquilibrée".
 */
#conferences-folders .folder {
  display: grid;
  grid-template-rows: 30px auto;
  align-content: start;
  justify-items: center;

  /* Un peu moins d'espace en haut : l'icône est clairement ancrée. */
  padding-top: 15px;
}

#conferences-folders .folder-icon {
  grid-row: 1;

  align-self: start;
  justify-self: center;

  margin: 0;

  /* Empêche le bloc de l'icône de varier selon les métriques du bouton. */
  width: 30px;
  height: 30px;

  text-align: center;
  line-height: 1;
}

#conferences-folders .folder-name {
  grid-row: 2;

  display: block;
  align-self: start;
  justify-self: stretch;

  width: 100%;
  margin: 0;
  padding-top: 8px;

  text-align: center;
  line-height: 1.30;

  /*
   * Sur les navigateurs récents, les retours à la ligne sont un peu
   * mieux équilibrés sans raccourcir ni tronquer le titre.
   */
  text-wrap: balance;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  #conferences-folders .folder {
    grid-template-rows: 25px auto;
    padding-top: 8px;
  }

  #conferences-folders .folder-icon {
    width: 27px;
    height: 27px;
    line-height: 1;
  }

  #conferences-folders .folder-name {
    padding-top: 5px;
    line-height: 1.22;
  }
}

/*
 * Dossier actuellement sélectionné :
 * plus de gros anneau bleu intérieur.
 * On utilise une brume claire, une bordure bleutée et une ombre douce.
 */
.folder.selected {
  color: #1976d2;
  font-weight: 700;
  z-index: 5;

  border-color: rgba(58, 123, 213, .38);

  background:
    radial-gradient(
      ellipse 120% 100% at 12% 0%,
      rgba(0, 210, 255, .155) 0%,
      rgba(0, 210, 255, .055) 40%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 90% 90% at 92% 100%,
      rgba(58, 123, 213, .080) 0%,
      transparent 68%
    ),
    linear-gradient(
      180deg,
      #ffffff 0%,
      #f5fbff 100%
    );

  box-shadow:
    0 2px 4px rgba(15, 23, 42, .035),
    0 10px 24px rgba(31, 82, 105, .09),
    inset 0 0 0 1px rgba(0, 210, 255, .10);
}

.folder.selected .folder-name {
  color: #1976d2;
}

/*
 * Sur ordinateur/tablette, le carrousel reçoit une surface très légère,
 * comme une brume blanche/turquoise. Cela rassemble visuellement les cartes
 * sans créer un nouvel "encadré" lourd dans le panneau.
 */
@media (min-width: 769px) {
  /*
   * Le fond du carrousel reprend désormais la couleur de son univers,
   * exactement comme les tuiles, mais avec une intensité encore plus faible.
   *
   * Même disposition et même effet brumeux qu'avant :
   * seule la teinte change selon Conférences / Photos / Vidéos.
   */
  #conferences-folders,
  #photos-folders,
  #videos-folders {
    margin: 2px 0 20px;

    border-radius: 20px;

    background:
      radial-gradient(
        ellipse 70% 85% at 8% 0%,
        rgba(var(--folder-theme-rgb), .045) 0%,
        rgba(var(--folder-theme-rgb), .016) 42%,
        transparent 68%
      ),
      radial-gradient(
        ellipse 75% 95% at 96% 100%,
        rgba(var(--folder-theme-rgb), .028) 0%,
        transparent 72%
      ),
      rgba(251, 253, 254, .54);

    box-shadow:
      inset 0 0 0 1px rgba(var(--folder-theme-rgb), .060);
  }
}

/* Réduction des mouvements si l'utilisateur le demande. */
@media (prefers-reduced-motion: reduce) {
  .folder,
  .folder-icon {
    transition: none;
  }

  .folder:hover,
  .folder:active,
  .folder:focus-visible {
    transform: none;
  }
}


/* =====================================================
   ======================== Lightbox =====================
   ===================================================== */

/* Masquage selon aria-hidden */
.lightbox[aria-hidden="true"] {
  display: none;
}

.lightbox[aria-hidden="false"],
.lightbox.open {
  display: flex;
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 200;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 18px;
  padding: 38px;
  overflow: auto;
  backdrop-filter: blur(6px);
  box-sizing: border-box;
}

/* Contour lumineux */
.lightbox::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 4px solid transparent;
  pointer-events: none;
  z-index: 1;
  border-image: linear-gradient(90deg, var(--turq-a), var(--turq-b)) 1;
}

/* Contenu interne */
.lightbox > * {
  position: relative;
  z-index: 2;
}

/* Boutons navigation / fermeture */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  transition: 0.2s;
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
}

/* Positionnement des boutons */
.lightbox-close {
  top: 20px;
  right: 20px;
  font-size: 1.3rem;
}

.lightbox-prev {
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
}

.lightbox-next {
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
}

/* Hover */
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:hover {
  background: #fff;
}

/* Frame globale */
.lightbox-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: none;
}

/* Image agrandie */
.lightbox-img {
  max-width: 92vw;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: 14px;
  background: #fff;
}

/* Captions */
.lightbox-caption-box {
  margin: 28px auto 0;
  padding: 12px 20px;
  max-width: 80vw;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  color: #222;
  font-size: 1.08rem;
  font-weight: 400;
  border: 1px solid rgba(255,255,255,0.18);
  text-align: center;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

/* Like button à l’intérieur du caption */
.lightbox-caption .like-btn {
  margin: 18px auto 12px;
}

/* Petites animations */
@keyframes captionFadeIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Version vidéo */
.lightbox-frame.lightbox-video {
  width: 700px;
  max-width: 700px;
  min-width: 700px;
}

.lightbox-frame.lightbox-video .lightbox-caption-box {
  width: 100%;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
  max-height: 180px;
  overflow-y: auto;
}

/* === Lightbox: Pinch-to-zoom in-place === */

/* On gère les gestes nous-mêmes en JS */
.lightbox-img {
  touch-action: none;      /* bloque le pan/zoom natif, on fait du in-place */
  cursor: grab;
  will-change: transform;  /* perf */
  transform-origin: center center;
  transition: transform 0.06s linear; /* léger lissage */
}

/* Quand zoomée (scale > 1) */
.lightbox-img.is-zoomed {
  cursor: grabbing;
}



/* =====================================================
   ========================== Footer ====================
   ===================================================== */

.site-footer {
  padding: 16px;

  /*
   * Le footer vient directement au contact du fond de la page.
   * L'ancien margin-top: 24px laissait apparaître le fond du body
   * (blanc en clair / gris en sombre) entre l'accueil et le bandeau.
   */
  margin-top: 0;

  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* =====================================================
   ================== Responsive Mobile 1 ===============
   ===================================================== */

@media (max-width: 600px) {
  .lightbox-caption-box {
    font-size: 0.98em;
    padding: 0.7em 0.5em;
    max-width: 98vw;
  }

  .like-bubble {
    font-size: 0.95em;
    padding: 0.4em 0.8em;
  }
}



/* Les dossiers sont des boutons natifs : conserver exactement l'apparence des anciennes tuiles. */
button.folder {
  font: inherit;
  color: inherit;
}




@media (max-width: 768px) {
  .folder-icon {
    margin-bottom: 4px;
  }

  .folder-icon::before {
    font-size: 1.02rem;
  }
}

/* =====================================================
   ===== Lightbox claire / turquoise — version 2026 =====
   ===================================================== */

@property --lightbox-wave-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Sécurité : un SVG de tuile ne doit jamais reprendre sa taille native. */
#conferences-folders .folder-icon > svg,
#photos-folders .folder-icon > svg,
#videos-folders .folder-icon > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.lightbox {
  --lightbox-wave-angle: 0deg;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  padding: 28px 72px 34px;
  border-radius: 0;
  overflow: auto;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.76), transparent 25%),
    radial-gradient(circle at 80% 18%, rgba(167,243,250,.24), transparent 31%),
    radial-gradient(circle at 72% 82%, rgba(186,230,253,.22), transparent 32%),
    linear-gradient(145deg, rgba(232,247,249,.78), rgba(222,238,244,.66));
  backdrop-filter: blur(10px) saturate(110%);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
}

/* L'ancien border-image ne respectait pas correctement les arrondis. */
.lightbox::before {
  display: none;
}

.lightbox-frame,
.lightbox-frame.lightbox-video,
.lightbox-frame.is-image,
.lightbox-frame.is-video {
  width: min(96vw, 1660px);
  max-width: 1660px;
  min-width: 0;
  margin: auto;
  padding: 10px 10px 14px;
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 2px solid transparent;
  border-radius: 26px;
  background:
    linear-gradient(rgba(255,255,255,.66), rgba(248,253,255,.58)) padding-box,
    linear-gradient(105deg, var(--turq-a), var(--turq-b), var(--turq-a)) border-box;
  box-shadow:
    0 18px 54px rgba(39,76,96,.14),
    0 0 34px rgba(0,210,255,.055),
    inset 0 1px 0 rgba(255,255,255,.78);
  box-sizing: border-box;
}

@supports (background: conic-gradient(from 0deg, #000, #fff)) {
  .lightbox-frame,
  .lightbox-frame.lightbox-video,
  .lightbox-frame.is-image,
  .lightbox-frame.is-video {
    background:
      linear-gradient(rgba(255,255,255,.68), rgba(248,253,255,.60)) padding-box,
      conic-gradient(
        from var(--lightbox-wave-angle),
        var(--turq-a) 0deg,
        var(--turq-a) 74deg,
        var(--turq-b) 128deg,
        #78e5eb 176deg,
        var(--turq-a) 242deg,
        var(--turq-b) 304deg,
        var(--turq-a) 360deg
      ) border-box;
  }

  .lightbox.open .lightbox-frame {
    animation: lightbox-color-wave 18s linear infinite;
  }
}

@keyframes lightbox-color-wave {
  to { --lightbox-wave-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox.open .lightbox-frame {
    animation: none;
  }
}

/* La photo reste la vraie vedette : presque tout le viewport lui est réservé. */
.lightbox-img,
.lightbox-video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(94vw, 1600px);
  max-height: 82vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 21px;
  border: 1px solid rgba(69,144,171,.12);
  background: rgba(240,248,250,.56);
  box-shadow:
    0 12px 34px rgba(35,70,87,.12),
    0 2px 8px rgba(35,70,87,.055);
}

.lightbox-caption {
  width: min(88vw, 980px);
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}

/* Légende volontairement secondaire par rapport à l'image. */
.lightbox-caption-box,
.lightbox-frame.lightbox-video .lightbox-caption-box {
  width: auto;
  max-width: min(86vw, 900px);
  max-height: 18vh;
  margin: 0;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.42);
  color: rgba(45,67,77,.78);
  border: 1px solid rgba(104,173,190,.14);
  box-shadow: none;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  font-size: .92rem;
  font-weight: 450;
  line-height: 1.45;
  text-align: center;
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.lightbox-caption .like-btn {
  margin: 0 auto;
  justify-self: center;
}

/* Commandes légères et lumineuses. */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(78,169,190,.22);
  border-radius: 50%;
  background: rgba(255,255,255,.72);
  color: #287f91;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow:
    0 8px 22px rgba(39,90,104,.11),
    inset 0 1px 0 rgba(255,255,255,.88);
  transition:
    transform .16s ease,
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease;
}

.lightbox-close {
  top: 18px;
  right: 18px;
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }

.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:hover,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible,
.lightbox-close:focus-visible {
  background: rgba(255,255,255,.94);
  border-color: rgba(25,198,209,.42);
  color: #197f91;
  box-shadow:
    0 10px 26px rgba(39,90,104,.14),
    0 0 0 4px rgba(25,198,209,.07);
  outline: none;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  transform: translateY(-1px) scale(1.03);
}

.lightbox-prev:hover,
.lightbox-prev:focus-visible {
  transform: translateY(-50%) translateX(-1px) scale(1.03);
}

.lightbox-next:hover,
.lightbox-next:focus-visible {
  transform: translateY(-50%) translateX(1px) scale(1.03);
}



/* =====================================================
   == Lightbox : composition équilibrée + légende dock ==
   ===================================================== */

/* La légende et le like flottent : ils ne changent plus la hauteur du cadre. */
.lightbox-frame,
.lightbox-frame.lightbox-video,
.lightbox-frame.is-image,
.lightbox-frame.is-video {
  position: relative;
  padding: 10px;
  gap: 0;
}

/* L'image peut reprendre un peu plus de place maintenant que la légende
   ne consomme plus de hauteur sous elle. */
.lightbox-img,
.lightbox-video {
  max-height: 84vh;
}

/* Un seul dock léger au lieu de deux cartouches empilés. */
.lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  width: auto;
  max-width: min(78vw, 920px);
  margin: 0;
  padding: 7px 8px 7px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(244, 252, 253, .70);
  border: 1px solid rgba(63, 170, 190, .18);
  box-shadow:
    0 7px 22px rgba(39, 90, 104, .09),
    inset 0 1px 0 rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px) saturate(125%);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  pointer-events: none;
}

/* La légende n'est plus un cartouche indépendant : juste du texte doux. */
.lightbox-caption-box,
.lightbox-frame.lightbox-video .lightbox-caption-box {
  width: auto;
  max-width: min(62vw, 720px);
  max-height: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: rgba(42, 76, 84, .74);
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Le bouton s'intègre au dock, sans second gros volume visuel. */
.lightbox-caption .like-btn {
  flex: 0 0 auto;
  min-height: 34px;
  margin: 0;
  padding: .36rem .68rem;
  gap: .38rem;
  border-color: rgba(47, 160, 181, .16);
  background: rgba(255, 255, 255, .54);
  box-shadow: none;
  pointer-events: auto;
}

.lightbox-caption .like-btn:hover:not(:disabled),
.lightbox-caption .like-btn:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, .86);
  border-color: rgba(25, 198, 209, .30);
  box-shadow: 0 5px 14px rgba(39, 90, 104, .08);
}

.lightbox-caption .like-counter {
  background: rgba(25, 198, 209, .07);
}


/* =====================================================
   == Lightbox : cadre photo ajusté + légende extérieure ==
   ===================================================== */

/*
 * Le cadre turquoise appartient désormais uniquement au média.
 * Il se rétracte sur la largeur réelle de l'image/vidéo et conserve
 * exactement la même respiration sur les quatre côtés.
 */
.lightbox-frame,
.lightbox-frame.lightbox-video,
.lightbox-frame.is-image,
.lightbox-frame.is-video {
  position: relative;
  width: fit-content;
  max-width: calc(100vw - 144px);
  min-width: 0;
  padding: 8px;
  gap: 0;
  margin: auto;
  justify-items: center;
  box-sizing: border-box;
}

.lightbox-img,
.lightbox-video {
  width: auto;
  height: auto;
  max-width: calc(100vw - 164px);
  max-height: min(82vh, calc(100vh - 155px));
  margin: 0;
}

/*
 * La légende sort du cadre : elle ne modifie donc plus ses proportions.
 * Pas de cartouche blanc : traitement "légende de galerie", secondaire.
 */
.lightbox-caption {
  position: absolute;
  left: 50%;
  top: calc(100% + 13px);
  bottom: auto;
  z-index: 5;
  width: min(760px, calc(100vw - 150px));
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  transform: translateX(-50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

/* Petit repère turquoise, beaucoup plus léger qu'un cartouche. */
.lightbox-caption::before {
  content: "";
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--turq-a), var(--turq-b));
  opacity: .55;
}

.lightbox-caption-box,
.lightbox-frame.lightbox-video .lightbox-caption-box {
  width: auto;
  max-width: 100%;
  max-height: none;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: rgba(39, 78, 88, .72);
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.38;
  text-align: center;
  white-space: normal;
  overflow: visible;
  display: block;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255,255,255,.72);
  pointer-events: none;
}

/* Le J'aime reste sous la légende et réellement centré. */
.lightbox-caption .like-btn {
  justify-self: center;
  align-self: center;
  margin: 1px auto 0;
  min-height: 34px;
  padding: .36rem .72rem;
  background: rgba(255,255,255,.52);
  border-color: rgba(47,160,181,.16);
  box-shadow: 0 4px 14px rgba(39,90,104,.055);
  pointer-events: auto;
}

.lightbox-caption .like-btn:hover:not(:disabled),
.lightbox-caption .like-btn:focus-visible:not(:disabled) {
  background: rgba(255,255,255,.82);
  border-color: rgba(25,198,209,.28);
  box-shadow: 0 6px 17px rgba(39,90,104,.075);
}

/* Le cadre peut rester légèrement remonté pour équilibrer visuellement
   l'ensemble cadre + légende extérieure, sans réduire la photo. */
@media (min-width: 769px) {
  .lightbox-frame {
    transform: translateY(-24px);
  }

  .lightbox-prev,
  .lightbox-next {
    margin-top: -24px;
  }
}


/* =====================================================
   Légende de lightbox : surface neutre autour du J'aime
   ===================================================== */
.lightbox-caption:hover,
.lightbox-caption:focus-within {
  background: transparent;
  border: 0;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* =====================================================
   ========== Photos : bouton J'aime compact ============
   ===================================================== */
/*
 * Uniquement dans les tuiles de la grille Photos.
 * La lightbox conserve son bouton J'aime actuel.
 */
#photos-area .gallery-item > .like-btn {
  min-height: 30px;
  padding: .28rem .62rem;
  gap: .32rem;
  margin-top: 3px;
  margin-bottom: 0;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1;
  box-shadow: 0 3px 9px rgba(39, 90, 104, .05);
}

#photos-area .gallery-item > .like-btn .like-btn__icon {
  width: .82rem;
  height: .82rem;
}

#photos-area .gallery-item > .like-btn .like-counter {
  min-width: 1.45em;
  padding: .02rem .27rem;
  font-size: .67rem;
  line-height: 1.35;
}

#photos-area .gallery-item > .like-btn:hover:not(:disabled),
#photos-area .gallery-item > .like-btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(39, 90, 104, .075);
}


/* =====================================================
   ===== Photos : légendes et likes parfaitement alignés =====
   ===================================================== */
#photos-area .gallery-item {
  display: flex;
  flex-direction: column;
}

#photos-area .gallery-item figcaption {
  box-sizing: border-box;
  width: 100%;
  height: 3.45rem;
  min-height: 3.45rem;
  margin: 0;
  padding: 7px 10px 5px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.25;
  text-align: center;
}

#photos-area .gallery-item > .like-btn {
  margin-top: auto;
  align-self: center;
}


/* =====================================================
   ===== Vidéos : légendes et likes compacts / alignés ==
   ===================================================== */
/*
 * Même logique que pour Photos :
 * - la carte est une colonne flex ;
 * - deux lignes sont réservées à la légende ;
 * - le bouton J'aime reste au même niveau sur chaque tuile.
 */
#videos-area .video-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#videos-area .video-card .video-card-caption,
#videos-area .video-card > p.video-card-caption {
  box-sizing: border-box;
  width: 100%;
  height: 3.45rem;
  min-height: 3.45rem;
  margin: 0;
  padding: 7px 10px 5px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.25;
  text-align: center;
}

#videos-area .video-card > .like-btn {
  min-height: 30px;
  padding: .28rem .62rem;
  gap: .32rem;
  margin-top: auto;
  margin-bottom: 0;
  align-self: center;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  line-height: 1;
  box-shadow: 0 3px 9px rgba(39, 90, 104, .05);
}

#videos-area .video-card > .like-btn .like-btn__icon {
  width: .82rem;
  height: .82rem;
}

#videos-area .video-card > .like-btn .like-counter {
  min-width: 1.45em;
  padding: .02rem .27rem;
  font-size: .67rem;
  line-height: 1.35;
}

#videos-area .video-card > .like-btn:hover:not(:disabled),
#videos-area .video-card > .like-btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(39, 90, 104, .075);
}

/* =====================================================
   Dossiers média — icônes Material
   ===================================================== */
#conferences-folders .folder-icon::before,
#photos-folders .folder-icon::before,
#videos-folders .folder-icon::before {
  content: none;
}

#conferences-folders .folder-icon,
#photos-folders .folder-icon,
#videos-folders .folder-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: visible;
}

#conferences-folders .folder-icon > svg,
#photos-folders .folder-icon > svg,
#videos-folders .folder-icon > svg,
#conferences-folders .folder-icon-svg,
#photos-folders .folder-icon-svg,
#videos-folders .folder-icon-svg {
  display: block;
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  overflow: visible;
  flex: 0 0 34px;
  filter: none;
}

/* Les noms longs des conférences restent alignés malgré l'icône un peu plus haute. */
#conferences-folders .folder {
  grid-template-rows: 34px auto;
}

#conferences-folders .folder-icon {
  width: 34px;
  height: 34px;
}

.folder:hover .folder-icon,
.folder:focus-visible .folder-icon {
  transform: translateY(-1px) scale(1.045);
  filter: saturate(1.06) brightness(1.015);
}

@media (max-width: 768px) {
  #conferences-folders .folder {
    grid-template-rows: 29px auto;
  }

  #conferences-folders .folder-icon,
  #photos-folders .folder-icon,
  #videos-folders .folder-icon,
  #conferences-folders .folder-icon > svg,
  #photos-folders .folder-icon > svg,
  #videos-folders .folder-icon > svg,
  #conferences-folders .folder-icon-svg,
  #photos-folders .folder-icon-svg,
  #videos-folders .folder-icon-svg {
    width: 29px;
    height: 29px;
    max-width: 29px;
    max-height: 29px;
    flex-basis: 29px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .folder:hover .folder-icon,
  .folder:focus-visible .folder-icon {
    transform: none;
  }
}

/* =====================================================
   Grilles médias — structure et dimensions
   ===================================================== */

#photos-area.gallery-grid,
#conferences-area.gallery-grid,
#videos-area.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
  justify-items: stretch;
  width: 100%;
  max-width: none;
}

#videos-area.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

#photos-area > .gallery-item,
#conferences-area > .gallery-item {
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
}

#videos-area > .video-card {
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
  align-self: start;
  box-sizing: border-box;
}

#videos-area .video-card-player,
#videos-area .video-card video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 190px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  border-radius: 12px;
}

#videos-area .video-card-caption,
#videos-area .video-card p {
  width: 100%;
  margin: 8px 0 0;
  text-align: center;
  overflow-wrap: anywhere;
}

#photos-area .gallery-item img,
#conferences-area .gallery-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

@media (max-width: 700px) {
  #photos-area.gallery-grid,
  #conferences-area.gallery-grid,
  #videos-area.gallery-grid,
  #videos-area.video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #videos-area .video-card-player,
  #videos-area .video-card video {
    max-height: 220px;
  }
}

@media (max-width: 420px) {
  #photos-area.gallery-grid,
  #conferences-area.gallery-grid,
  #videos-area.gallery-grid,
  #videos-area.video-grid {
    grid-template-columns: 1fr;
  }
}

/* Accessibilité : interactions sans animation en mode mouvement réduit. */
@media (prefers-reduced-motion: reduce) {
  .folder,
  .folder-icon { transition: none !important; }
  .folder:hover,
  .folder:active,
  .folder:focus-visible { transform: none !important; }
  .lightbox.open .lightbox-frame { animation: none !important; }
}
