/*
  SECTION PROJETS (V3)
  Le titre de section (.projects, .section-title) reste dans index.html.
  Les variables (--ink, --paper, --joker, --grey-*, --card, --wrap) viennent de :root.
*/

/* ---------- Carrousel ---------- */
.carousel {
  display: flex;
  align-items: stretch;
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px calc((var(--wrap) - var(--card)) / 2) 12px;
  scroll-padding-inline: calc((var(--wrap) - var(--card)) / 2);
  scrollbar-width: none;
  position: relative;
  scroll-behavior: auto;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel:focus-visible { outline: 2px solid var(--joker); outline-offset: -2px; }

/* Desktop : plusieurs projets visibles, sans centrage forcé du premier */
@media (min-width: 900px) {
  .carousel {
    gap: 40px;
    padding: 4px 0 20px;
    scroll-padding-inline: 0;
  }
  .project-info { padding-top: 22px; }
  .project-title { font-size: 1.55rem; }
  .project-text { font-size: 1.02rem; line-height: 1.65; }
}

/* ---------- Carte : toutes identiques ---------- */
.project {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--card);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  margin: 0;
}

/* ---------- Média : poster + vidéo optionnelle ---------- */
.media {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #1c1c1c;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Poster manquant : placeholder propre, avec le titre */
.media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(135deg, #202020, #161616);
}
.media--placeholder span {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--grey-line);
}

.media[data-video] { cursor: pointer; }
.media[data-video]:focus-visible,
.media .media-link:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.media .preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.media .preview.on { opacity: 1; }
/* Vidéos verticales (9:16) : lues en pleine hauteur, avec des bandes noires sur les côtés */
.media .preview.tall { object-fit: contain; background: #000; }
.media .media-link { position: absolute; inset: 0; display: block; }
.media .hover-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s ease;
}
.media:hover .hover-img,
.media:focus-within .hover-img { opacity: 1; }
.play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(18, 18, 18, .6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--paper);
  pointer-events: none;
  transition: opacity .3s ease;
}
.play-badge svg { width: 16px; height: 16px; margin-left: 2px; }
.media.playing .play-badge { opacity: 0; }

/* ---------- Texte de la carte ---------- */
.project-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 4px 0;
}

.project-title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
}
/* Pastilles du format : une par mot-clé */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.pills li {
  max-width: 100%;
  padding: 3px 11px 4px;
  border: 1px solid rgba(255, 246, 238, .32);
  border-radius: 999px;
  font-size: .75rem;
  line-height: 1.35;
  letter-spacing: .03em;
  color: var(--paper);
}
.project-text { font-size: 1.02rem; line-height: 1.65; }
}

/* ---------- Carte : toutes identiques ---------- */
.project {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--card);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  margin: 0;
}

/* ---------- Média : poster + vidéo optionnelle ---------- */
.media {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #1c1c1c;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Poster manquant : placeholder propre, avec le titre */
.media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(135deg, #202020, #161616);
}
.media--placeholder span {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--grey-line);
}

.media[data-video] { cursor: pointer; }
.media[data-video]:focus-visible,
.media .media-link:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.media .preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.media .preview.on { opacity: 1; }
/* Vidéos verticales (9:16) : lues en pleine hauteur, avec des bandes noires sur les côtés */
.media .preview.tall { object-fit: contain; background: #000; }
.media .media-link { position: absolute; inset: 0; display: block; }
.media .hover-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s ease;
}
.media:hover .hover-img,
.media:focus-within .hover-img { opacity: 1; }
.play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(18, 18, 18, .6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--paper);
  pointer-events: none;
  transition: opacity .3s ease;
}
.play-badge svg { width: 16px; height: 16px; margin-left: 2px; }
.media.playing .play-badge { opacity: 0; }

/* ---------- Texte de la carte ---------- */
.project-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 4px 0;
}

.project-title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
}
/* Une seule pastille : le format */
.pill {
  align-self: flex-start;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 3px 11px 4px;
  border: 1px solid rgba(255, 246, 238, .32);
  border-radius: 999px;
  font-size: .75rem;
  line-height: 1.35;
  letter-spacing: .03em;
  color: var(--paper);
}
.project-text {
  margin: 12px 0 0;
  font-size: .92rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--grey-soft);
}
/* Crédits : la ligne la plus petite et la plus discrète, toujours à la même distance du texte */
.credits {
  margin: 18px 0 0;
  font-size: .75rem;
  line-height: 1.5;
  color: var(--grey-line);
}
.credits .micro {
  display: block;
  margin: 0 0 4px;
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--grey-line);
}

/* ---------- Lecteur vidéo : grande fenêtre par-dessus la page ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.lightbox.open { display: flex; }
.lightbox-window {
  position: relative;
  width: min(100%, 1280px, calc((100vh - 48px) * var(--ar, 1.7778)));
  aspect-ratio: var(--ar, 1.7778);
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.lightbox video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 246, 238, .5);
  border-radius: 50%;
  background: rgba(18, 18, 18, .6);
  color: var(--paper);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(18, 18, 18, .9); }
.lightbox-close:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .media .preview,
  .media .hover-img,
  .play-badge { transition: none; }
}
