/* fx-philo.css : galerie « musée » des engagements (Philanthropie en thème clair, Hermitage et ESS en
   thème sombre avec la classe fx-sombre). Les couleurs passent par des variables, une par thème. */

.fx-galerie {
  --fx-mur: radial-gradient(ellipse 60% 55% at 50% 0%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 70%),
            linear-gradient(180deg, #f5f3ef 0%, #efece6 100%);
  --fx-mur-bord: rgba(0, 0, 0, .06);
  --fx-halo: radial-gradient(ellipse 50% 60% at 50% 0%, rgba(242, 247, 254, .85), rgba(242, 247, 254, 0) 70%);
  --fx-passe: #fbfaf7;
  --fx-toile-fond: #e9e5de;
  --fx-anneau: 0 0 0 1px rgba(0, 0, 0, .10), 0 0 0 6px #1f232b, 0 0 0 7px rgba(0, 0, 0, .25);
  --fx-ombre: 0 34px 48px -26px rgba(22, 26, 36, .55), 0 14px 22px -14px rgba(22, 26, 36, .28);
  --fx-ombre-haut: 0 46px 60px -28px rgba(22, 26, 36, .6), 0 18px 26px -16px rgba(22, 26, 36, .3);
  --fx-ombre-basse: 0 6px 10px -6px rgba(22, 26, 36, .2);
  --fx-nom: #12213b;
  --fx-trait: #1B3A6B;
  --fx-lieu: #465269;

  position: relative;
  background: var(--fx-mur);
  border-top: 1px solid var(--fx-mur-bord);
  border-bottom: 1px solid var(--fx-mur-bord);
  overflow: hidden;   /* les cadres arrivent de loin : aucun débordement horizontal */
}

/* Thème sombre : mur nuit éclairé d'en haut, cadre fin à liseré argent, cartel clair. Aucun doré. */
.fx-galerie.fx-sombre {
  --fx-mur: radial-gradient(ellipse 60% 55% at 50% 0%, rgba(184, 205, 224, .10), rgba(184, 205, 224, 0) 70%),
            linear-gradient(180deg, #0c0c10 0%, #08080b 100%);
  --fx-mur-bord: rgba(255, 255, 255, .07);
  /* halo entièrement contenu dans sa boîte : aucun bord net visible sur un mur sombre */
  --fx-halo: radial-gradient(ellipse 48% 46% at 50% 50%, rgba(232, 237, 243, .09), rgba(232, 237, 243, 0) 100%);
  --fx-passe: #ecebe7;
  --fx-toile-fond: #1a1c22;
  --fx-anneau: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 0 6px #23262e, 0 0 0 7px rgba(201, 211, 222, .38);
  --fx-ombre: 0 34px 48px -26px rgba(0, 0, 0, .85), 0 14px 22px -14px rgba(0, 0, 0, .6);
  --fx-ombre-haut: 0 46px 60px -28px rgba(0, 0, 0, .9), 0 18px 26px -16px rgba(0, 0, 0, .65);
  --fx-ombre-basse: 0 6px 10px -6px rgba(0, 0, 0, .5);
  --fx-nom: #efefef;
  --fx-trait: #c9d3de;
  --fx-lieu: #9898a8;
}

/* Le titre de section passe devant le halo des tableaux */
.fx-galerie h2 { position: relative; z-index: 2; }

/* Le mur s'adapte au nombre de tableaux : rangée centrée, largeurs proportionnées. */
.fx-galerie .fx-mur {
  display: flex;
  justify-content: center;
  align-items: center;          /* accrochés à hauteur d'œil, comme au musée */
  gap: 44px;
  padding: 20px 8px 8px;
}

.fx-galerie .fx-cadre { position: relative; margin: 0; perspective: 1400px; flex: 1.2 1 0; min-width: 0; }
.fx-galerie .fx-cadre:nth-child(1) { --fx-tourne: 10deg; --fx-i: 0; }
.fx-galerie .fx-cadre:nth-child(2) { --fx-tourne: 0deg; --fx-i: 1; flex-grow: .9; }
.fx-galerie .fx-cadre:nth-child(3) { --fx-tourne: -10deg; --fx-i: 2; flex-grow: 1.25; }
/* Deux tableaux seulement : même largeur, ils se font face (rotations opposées) */
.fx-galerie .fx-cadre:first-child:nth-last-child(2),
.fx-galerie .fx-cadre:nth-child(2):last-child { flex-grow: 1; max-width: 300px; }
.fx-galerie .fx-cadre:nth-child(2):last-child { --fx-tourne: -10deg; }

/* Halo de lumière sur le mur, au-dessus du tableau */
.fx-galerie .fx-cadre::before {
  content: ''; position: absolute; left: -12%; right: -12%; top: -18%; height: 70%;
  background: var(--fx-halo);
  pointer-events: none; z-index: 0;
}

.fx-galerie .fx-cadre-lien { position: relative; z-index: 1; display: block; text-decoration: none; color: inherit; }
.fx-galerie .fx-cadre-lien:focus-visible { outline-offset: 10px !important; }

/* Cadre fin, passe-partout clair, ombre douce d'un tableau accroché */
.fx-galerie .fx-cadre-bord {
  display: block;
  padding: 14px;
  background: var(--fx-passe);
  box-shadow: var(--fx-anneau), var(--fx-ombre);
  transition: box-shadow .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
.fx-galerie .fx-toile {
  display: block; position: relative; overflow: hidden;
  aspect-ratio: var(--fx-ar, 4 / 3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  background: var(--fx-toile-fond);
}
.fx-galerie .fx-toile picture { display: contents; }
.fx-galerie .fx-toile img {
  position: absolute; left: 0; top: -7%;
  width: 100%; height: 114%; max-width: none;
  object-fit: cover; display: block;
  transform: translate3d(0, calc(var(--fx-p, 0) * 6%), 0);
  will-change: transform;
}
/* Verre très léger : un reflet oblique sur la toile */
.fx-galerie .fx-toile::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .16) 48%, rgba(255, 255, 255, 0) 62%);
  background-size: 250% 100%;
  background-position: 100% 0;
  transition: background-position 1.2s ease;
}

/* Cartel */
.fx-galerie .fx-cartel {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 26px; padding-left: 2px;
}
.fx-galerie .fx-cartel-nom {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 400; line-height: 1.2; color: var(--fx-nom);
  background: linear-gradient(var(--fx-trait), var(--fx-trait)) 0 100% / 0 1px no-repeat;
  transition: background-size .45s ease;
  align-self: flex-start;
}
.fx-galerie .fx-cartel-lieu { font-size: 14px; color: var(--fx-lieu); letter-spacing: .02em; }

.fx-galerie .fx-cadre-lien:hover .fx-cadre-bord,
.fx-galerie .fx-cadre-lien:focus-visible .fx-cadre-bord {
  transform: translateY(-4px);
  box-shadow: var(--fx-anneau), var(--fx-ombre-haut);
}
.fx-galerie .fx-cadre-lien:hover .fx-toile::after,
.fx-galerie .fx-cadre-lien:focus-visible .fx-toile::after { background-position: 0 0; }
.fx-galerie .fx-cadre-lien:hover .fx-cartel-nom,
.fx-galerie .fx-cadre-lien:focus-visible .fx-cartel-nom { background-size: 100% 1px; }

/* ---------- Apparition avec profondeur (classe posée par fx-philo.js) ---------- */
.fx-galerie.fx-js .fx-cadre-lien {
  opacity: 0;
  transform: translate3d(0, 70px, -160px) rotateX(12deg) rotateY(var(--fx-tourne, 0deg));
  transform-origin: 50% 0;    /* comme pendu à son crochet */
  transition: opacity 1.1s ease, transform 1.6s cubic-bezier(.16, .84, .24, 1);
  transition-delay: calc(var(--fx-i, 0) * 140ms);
}
.fx-galerie.fx-js .fx-cadre-lien .fx-cadre-bord { box-shadow: var(--fx-anneau), var(--fx-ombre-basse); }
.fx-galerie.fx-js .fx-cadre::before { opacity: 0; transition: opacity 1.4s ease .5s; }

.fx-galerie.fx-js .fx-cadre.fx-accroche .fx-cadre-lien { opacity: 1; transform: none; }
.fx-galerie.fx-js .fx-cadre.fx-accroche::before { opacity: 1; }
.fx-galerie.fx-js .fx-cadre.fx-accroche .fx-cadre-bord {
  box-shadow: var(--fx-anneau), var(--fx-ombre);
  transition: box-shadow 1.4s ease .35s, transform .5s cubic-bezier(.2, .7, .2, 1);
}
.fx-galerie.fx-js .fx-cadre.fx-accroche .fx-cadre-lien:hover .fx-cadre-bord,
.fx-galerie.fx-js .fx-cadre.fx-accroche .fx-cadre-lien:focus-visible .fx-cadre-bord {
  box-shadow: var(--fx-anneau), var(--fx-ombre-haut);
  transition: box-shadow .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Tablette et téléphone ---------- */
@media (max-width: 900px) {
  .fx-galerie .fx-mur { gap: 36px; }
}
@media (max-width: 767px) {
  .fx-galerie .fx-mur { flex-direction: column; align-items: stretch; gap: 52px; padding: 12px 10px 0; }
  .fx-galerie .fx-cadre,
  .fx-galerie .fx-cadre:first-child:nth-last-child(2),
  .fx-galerie .fx-cadre:nth-child(2):last-child { perspective: none; flex: none; max-width: none; }
  /* Trois tableaux : celui du milieu, plus petit, centré */
  .fx-galerie .fx-cadre:nth-child(2):not(:last-child) { max-width: 74%; align-self: center; }
  .fx-galerie .fx-cadre-bord { padding: 10px; }
  /* Apparition simple, sans rotation ni parallaxe */
  .fx-galerie.fx-js .fx-cadre-lien { transform: translate3d(0, 34px, 0); transition-delay: 0s; }
  .fx-galerie .fx-toile img { transform: none; top: 0; height: 100%; }
}

/* ---------- Mouvement réduit et lecture calme : tout est visible, rien ne bouge ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-galerie.fx-js .fx-cadre-lien,
  .fx-galerie.fx-js .fx-cadre::before { opacity: 1 !important; transform: none !important; transition: none !important; }
  .fx-galerie .fx-toile img { transform: none !important; top: 0; height: 100%; }
  .fx-galerie .fx-cadre-bord, .fx-galerie .fx-toile::after, .fx-galerie .fx-cartel-nom { transition: none !important; }
  .fx-galerie .fx-cadre-lien:hover .fx-cadre-bord { transform: none; }
}
html.fx-calm .fx-galerie.fx-js .fx-cadre-lien,
html.fx-calm .fx-galerie.fx-js .fx-cadre::before { opacity: 1 !important; transform: none !important; transition: none !important; }
html.fx-calm .fx-galerie .fx-toile img { transform: none !important; top: 0; height: 100%; }
html.fx-calm .fx-galerie .fx-cadre-bord, html.fx-calm .fx-galerie .fx-toile::after, html.fx-calm .fx-galerie .fx-cartel-nom { transition: none !important; }
html.fx-calm .fx-galerie .fx-cadre-lien:hover .fx-cadre-bord { transform: none; }
