/* =========================================================
   Club Facebook Feed Pro – carrousel
   Personnalisez les couleurs via les variables ci-dessous.
   ========================================================= */
.tpv-fb {
  --tpv-fb-accent: #1877f2;
  --tpv-fb-bg: #ffffff;
  --tpv-fb-text: #1c1e21;
  --tpv-fb-muted: #65676b;
  --tpv-fb-border: #e4e6eb;
  --tpv-fb-bubble: #f0f2f5;
  --tpv-fb-radius: 12px;
  --tpv-fb-gap: 20px;
  --tpv-fb-per-view: 1;
  position: relative;
  /* Empêche le bloc de s'élargir dans une colonne flex/grid (Kadence, Elementor…) */
  width: 100%;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  font-family: inherit;
  /* Le nombre de cartes dépend de la largeur réelle du bloc, pas de l'écran */
  container-type: inline-size;
  container-name: tpv-fb;
}
@container tpv-fb (min-width: 600px) { .tpv-fb__track { --tpv-fb-per-view: 2; } }
@container tpv-fb (min-width: 950px) { .tpv-fb__track { --tpv-fb-per-view: 3; } }
@container tpv-fb (max-width: 420px) {
  .tpv-fb__track { --tpv-fb-gap: 12px; }
  .tpv-fb-card { font-size: 14px; }
  .tpv-fb-card__head, .tpv-fb-card__text { padding-left: 12px; padding-right: 12px; }
}

.tpv-fb *, .tpv-fb *::before, .tpv-fb *::after { box-sizing: border-box; }
.tpv-fb svg { width: 1em; height: 1em; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.tpv-fb a { text-decoration: none; }

/* ---------- Piste du carrousel ---------- */
.tpv-fb__track {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--tpv-fb-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 8px;
  outline: none;
}
.tpv-fb__track::-webkit-scrollbar { display: none; }
.tpv-fb__track:focus-visible { box-shadow: 0 0 0 2px var(--tpv-fb-accent); border-radius: var(--tpv-fb-radius); }

/* ---------- Carte ---------- */
.tpv-fb-card {
  flex: 0 0 calc((100% - (var(--tpv-fb-per-view) - 1) * var(--tpv-fb-gap)) / var(--tpv-fb-per-view));
  min-width: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--tpv-fb-bg);
  color: var(--tpv-fb-text);
  border: 1px solid var(--tpv-fb-border);
  border-radius: var(--tpv-fb-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
}

/* En-tête : nom de la page + date */
.tpv-fb-card__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.tpv-fb-card__avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; border: 1px solid var(--tpv-fb-border); }
.tpv-fb-card__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tpv-fb-card__name { color: var(--tpv-fb-text) !important; font-weight: 700; font-size: 15px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpv-fb-card__name:hover { text-decoration: underline; }
.tpv-fb-card__date { color: var(--tpv-fb-muted) !important; font-size: 13px; }
.tpv-fb-card__date:hover { text-decoration: underline; }
.tpv-fb-card__fb { color: var(--tpv-fb-accent) !important; font-size: 22px; line-height: 0; }

/* Galerie */
.tpv-fb-gallery { display: grid; gap: 2px; background: var(--tpv-fb-border); }
.tpv-fb .tpv-fb-gallery__item {
  position: relative; display: block; width: 100%; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: #000; cursor: pointer; overflow: hidden;
  aspect-ratio: 1 / 1; box-shadow: none;
}
.tpv-fb-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease, opacity .2s; }
.tpv-fb-gallery__item:hover img, .tpv-fb-gallery__item:focus-visible img { transform: scale(1.04); opacity: .92; }
.tpv-fb .tpv-fb-gallery__item:focus-visible { outline: 3px solid var(--tpv-fb-accent); outline-offset: -3px; }

.tpv-fb-gallery--n1 .tpv-fb-gallery__item { aspect-ratio: 4 / 3; }
.tpv-fb-gallery--n2,
.tpv-fb-gallery--n3,
.tpv-fb-gallery--n4 { grid-template-columns: 1fr 1fr; }
.tpv-fb-gallery--n2 .tpv-fb-gallery__item { aspect-ratio: 2 / 3; }
.tpv-fb-gallery--n3 .tpv-fb-gallery__item:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }

.tpv-fb-gallery__more {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 30px; font-weight: 700; pointer-events: none;
}

/* Description complète */
.tpv-fb-card__text { padding: 12px 14px 4px; white-space: normal; overflow-wrap: anywhere; }
.tpv-fb-card__text a { color: var(--tpv-fb-accent) !important; }
.tpv-fb-card__text a:hover { text-decoration: underline; }

/* Interactions */
.tpv-fb-card__stats {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 8px 14px 0; padding: 8px 0; border-bottom: 1px solid var(--tpv-fb-border);
  color: var(--tpv-fb-muted) !important; font-size: 14px;
}
.tpv-fb-card__stats:empty { display: none; }
.tpv-fb-card__reactions { display: inline-flex; align-items: center; gap: 5px; }
.tpv-fb-card__reactions svg { font-size: 18px; }
.tpv-fb-card__stats:hover .tpv-fb-card__counts { text-decoration: underline; }

/* Commentaires */
.tpv-fb-comments { list-style: none; margin: 10px 0 0; padding: 0 14px; }
.tpv-fb-comment { margin: 0 0 8px; padding: 0; }
.tpv-fb-comment::before { content: none; }
.tpv-fb-comment__bubble { display: inline-block; max-width: 100%; background: var(--tpv-fb-bubble); border-radius: 16px; padding: 7px 12px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.tpv-fb-comment__author { display: block; font-size: 13px; font-weight: 700; }
.tpv-fb-comment__time { display: block; margin: 2px 0 0 12px; font-size: 12px; color: var(--tpv-fb-muted); }
.tpv-fb-comments__more { display: block; padding: 0 14px 4px; font-size: 14px; font-weight: 600; color: var(--tpv-fb-muted) !important; }
.tpv-fb-comments__more:hover { text-decoration: underline; }

/* Bouton Facebook */
.tpv-fb-card__cta {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px; border-top: 1px solid var(--tpv-fb-border);
  color: var(--tpv-fb-accent) !important; font-weight: 600; font-size: 14px; transition: background .2s;
}
.tpv-fb-comments + .tpv-fb-card__cta, .tpv-fb-comments__more + .tpv-fb-card__cta { margin-top: 10px; }
.tpv-fb-card__stats + .tpv-fb-card__cta { margin-top: 12px; }
.tpv-fb-card__cta svg { font-size: 18px; }
.tpv-fb-card__cta:hover { background: var(--tpv-fb-bubble); }

/* ---------- Contrôles ---------- */
.tpv-fb__controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.tpv-fb--static .tpv-fb__controls { display: none; }
.tpv-fb .tpv-fb__nav {
  width: 42px; height: 42px; padding: 0; margin: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--tpv-fb-border); background: var(--tpv-fb-bg); color: var(--tpv-fb-text);
  font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); transition: background .2s, opacity .2s;
}
.tpv-fb .tpv-fb__nav:hover:not(:disabled) { background: var(--tpv-fb-accent); color: #fff; border-color: var(--tpv-fb-accent); }
.tpv-fb .tpv-fb__nav:disabled { opacity: .35; cursor: default; }
.tpv-fb__dots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tpv-fb .tpv-fb__dot {
  width: 10px; height: 10px; min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: var(--tpv-fb-border); cursor: pointer; transition: background .2s, transform .2s;
}
.tpv-fb .tpv-fb__dot.is-active { background: var(--tpv-fb-accent); transform: scale(1.25); }

.tpv-fb-error, .tpv-fb-empty { text-align: center; color: #65676b; }

/* ---------- Visionneuse (lightbox) ---------- */
.tpv-fb-lb {
  position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .92); padding: 50px 60px;
}
.tpv-fb-lb[hidden] { display: none; }
.tpv-fb-lb__fig { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; max-height: 100%; }
.tpv-fb-lb__img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; display: block; border-radius: 4px; user-select: none; }
.tpv-fb-lb__caption { display: flex; gap: 18px; align-items: center; margin-top: 12px; color: #ddd; font-size: 14px; }
.tpv-fb-lb__link { color: #fff !important; font-weight: 600; text-decoration: underline !important; }
.tpv-fb-lb button {
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; box-shadow: none;
}
.tpv-fb-lb button:hover { background: rgba(255, 255, 255, .25); }
.tpv-fb-lb__close { top: 14px; right: 14px; }
.tpv-fb-lb__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.tpv-fb-lb__next { right: 10px; top: 50%; transform: translateY(-50%); }
.tpv-fb-lb--single .tpv-fb-lb__prev, .tpv-fb-lb--single .tpv-fb-lb__next { display: none; }
@media (max-width: 600px) {
  .tpv-fb-lb { padding: 60px 8px; }
  .tpv-fb-lb__prev, .tpv-fb-lb__next { top: auto !important; bottom: 12px; transform: none !important; }
}
html.tpv-fb-lb-open { overflow: hidden; }
