/* ==========================================================================
   Vidéothèque — cartes vidéo, section « Nos vidéos » (page Actualités),
   page /videotheque/ et fenêtre de lecture.
   ========================================================================== */

.bgfi-videos-head { text-align: center; max-width: 760px; margin: 0 auto 40px; }
.bgfi-videos-head h2 { margin: 6px 0 12px; }
/* Accueil : l'en-tête de section gère déjà l'espacement. */
body.is-front .bgfi-videos-section .section-head + .bgfi-vgrid { margin-top: 0; }

.bgfi-vgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 36px;
}
@media (max-width: 1024px) { .bgfi-vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; } }
@media (max-width: 640px)  { .bgfi-vgrid { grid-template-columns: 1fr; gap: 20px; } }

.bgfi-vcard {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border, #e6e1d7);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(20, 48, 40, .06);
  transition: transform .3s ease, box-shadow .3s ease;
}
.bgfi-vcard:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(20, 48, 40, .12); }

.bgfi-vcard__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b1b33;
  cursor: pointer;
}
.bgfi-vcard__media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s ease, opacity .3s ease;
}
.bgfi-vcard__media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .45) 100%);
  pointer-events: none;
}
.bgfi-vcard:hover .bgfi-vcard__media img { transform: scale(1.05); }

.bgfi-vcard__play {
  position: absolute; top: 50%; left: 50%; z-index: 2;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--navy, #143028);
  font-size: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  transition: transform .3s ease, background .3s ease, color .3s ease;
}
.bgfi-vcard__play i { margin-left: 4px; }
.bgfi-vcard__media:hover .bgfi-vcard__play,
.bgfi-vcard__media:focus-visible .bgfi-vcard__play {
  transform: scale(1.1);
  background: var(--sage, #7a8b6e);
  color: #fff;
}
.bgfi-vcard__media:focus-visible { outline: 3px solid var(--sage, #7a8b6e); outline-offset: -3px; }

.bgfi-vcard__duration {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}

.bgfi-vcard__body { padding: 20px 22px 24px; }
.bgfi-vcard__meta {
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--sage, #7a8b6e);
  margin-bottom: 8px;
}
.bgfi-vcard__title {
  margin: 0 0 8px;
  font-size: 1.12rem; line-height: 1.35;
  color: var(--navy, #143028);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bgfi-vcard__text {
  margin: 0;
  font-size: .93rem; line-height: 1.6;
  color: #5b6470;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.bgfi-videos-empty {
  max-width: 760px; margin: 0 auto; padding: 18px 22px;
  border: 2px dashed var(--sage, #7a8b6e); border-radius: 12px;
  background: #fff; text-align: center; color: #3c4650; line-height: 1.6;
}
.bgfi-videos-empty a { font-weight: 600; margin-left: 6px; }
.bgfi-videos-empty small { display: block; color: #7a8590; margin-top: 4px; }

.bgfi-videos-more { display: flex; justify-content: center; margin-top: 40px; }
.bgfi-videos-back { text-align: center; margin: 40px 0 0; }
.bgfi-videos-back a { color: var(--navy, #143028); font-weight: 600; text-decoration: none; }
.bgfi-videos-back a:hover { color: var(--sage, #7a8b6e); }
.bgfi-videos-back i { margin-right: 6px; }

/* ---------- Fenêtre de lecture ---------- */
.bgfi-vmodal[hidden] { display: none; }
.bgfi-vmodal {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.bgfi-vmodal__backdrop {
  position: absolute; inset: 0;
  background: rgba(6, 14, 26, .97);
  animation: bgfiVFade .25s ease;
}
.bgfi-vmodal__box {
  position: relative;
  width: min(1100px, 100%);
  animation: bgfiVZoom .3s ease;
}
.bgfi-vmodal__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 220px);
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.bgfi-vmodal__frame iframe,
.bgfi-vmodal__frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  background: #000;
}
.bgfi-vmodal .bgfi-vmodal__title {
  margin: 14px 4px 0;
  color: #fff !important;
  font-weight: 600;
  font-size: 1.05rem;
  text-align: center;
}
.bgfi-vmodal__close {
  position: absolute; top: -48px; right: 0;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background .2s ease;
}
.bgfi-vmodal__close:hover,
.bgfi-vmodal__close:focus-visible { background: rgba(255, 255, 255, .3); }

.bgfi-vmodal__info { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; }
.bgfi-vmodal__desc[hidden] { display: none; }
.bgfi-vmodal .bgfi-vmodal__desc {
  margin: 8px 4px 0;
  max-height: 22vh;
  overflow-y: auto;
  color: rgba(255, 255, 255, .88) !important;
  font-size: .95rem; line-height: 1.6;
  text-align: center;
  white-space: pre-line;
}
.bgfi-vcard__text { white-space: normal; }

body.bgfi-vmodal-open { overflow: hidden; }

@keyframes bgfiVFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bgfiVZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .bgfi-vmodal { padding: 12px; }
  .bgfi-vmodal__close { top: -46px; }
  .bgfi-vcard__play { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
}
@media (prefers-reduced-motion: reduce) {
  .bgfi-vcard, .bgfi-vcard__media img, .bgfi-vmodal__backdrop, .bgfi-vmodal__box { transition: none; animation: none; }
}
