/* ── Showreel — section accueil ── */

.showreel-head {
  max-width: min(44rem, 100%);
  margin-inline: auto;
  margin-bottom: clamp(36px, 5vw, 52px);
  padding-bottom: clamp(20px, 3vw, 26px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
}

.showreel-head h2 {
  max-width: 14em;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.showreel-intro {
  max-width: none;
  margin-top: clamp(16px, 2.2vw, 20px);
  font-family: var(--font-body);
  font-size: clamp(0.9375rem, 1.35vw, 1rem);
  font-weight: 300;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.72);
}

.showreel.section {
  padding-top: clamp(44px, 6.5vw, 72px);
}

.showreel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: clamp(36px, 5vw, 52px);
}

.showreel-card {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.showreel-card__media {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  transition:
    transform 300ms ease,
    box-shadow 300ms ease;
}

.showreel-card--player .showreel-card__media {
  aspect-ratio: 16 / 9;
}

.showreel-card__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  vertical-align: middle;
}

/* Masquer le bouton fullscreen natif (Chrome / Edge / Safari) */
.showreel-card__video::-webkit-media-controls-fullscreen-button,
.showreel-lightbox__video::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

.showreel-card__expand {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(10, 10, 10, 0.55);
  color: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transform: scale(0.94);
  cursor: pointer;
  transition:
    opacity 250ms ease,
    transform 250ms ease,
    background 250ms ease;
}

.showreel-card__expand svg {
  display: block;
  width: 16px;
  height: 16px;
}

.showreel-card__expand:hover {
  background: rgba(10, 10, 10, 0.72);
}

@media (hover: hover) and (pointer: fine) {
  .showreel-card--player:hover .showreel-card__media,
  .showreel-card--player:focus-within .showreel-card__media {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38);
  }

  .showreel-card--player:hover .showreel-card__expand,
  .showreel-card--player:focus-within .showreel-card__expand {
    opacity: 1;
    transform: scale(1);
  }
}

@media (hover: none) {
  .showreel-card__expand {
    opacity: 1;
    transform: scale(1);
  }
}

/* Overlay agrandi — jamais de fullscreen navigateur */

.showreel-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 5vw, 48px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.showreel-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Fermé : aucun enfant ne doit intercepter les clics du lecteur normal */
.showreel-lightbox:not(.is-open),
.showreel-lightbox:not(.is-open) * {
  pointer-events: none !important;
}

.showreel-lightbox[hidden] {
  display: none !important;
}

.showreel-lightbox__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.showreel-lightbox__panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(90vw, 100%);
  max-width: 90vw;
  max-height: 90vh;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 300ms ease, transform 300ms ease;
  /* Laisse passer les taps hors vidéo vers le fond (fermeture) */
  pointer-events: none;
}

.showreel-lightbox.is-open .showreel-lightbox__panel {
  opacity: 1;
  transform: scale(1);
}

.showreel-lightbox__video {
  position: relative;
  z-index: 2;
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  /* Contrôles natifs HTML5 — interactions tactiles libres */
  pointer-events: auto;
  touch-action: manipulation;
}

.showreel-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.78);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: background 200ms ease;
}

.showreel-lightbox__close:hover {
  background: rgba(10, 10, 10, 0.92);
}

.showreel-lightbox__rotate {
  display: none;
}

body.showreel-lightbox-open {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .showreel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .showreel-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .showreel-lightbox__close {
    top: 8px;
    right: 8px;
  }
}

/* Rotation overlay — mobile uniquement */
@media (max-width: 768px) and (hover: none) {
  .showreel-lightbox__rotate {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(64px, calc(env(safe-area-inset-right, 0px) + 56px));
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.78);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    transition: background 200ms ease, transform 200ms ease;
  }

  .showreel-lightbox__rotate:hover,
  .showreel-lightbox__rotate:active {
    background: rgba(10, 10, 10, 0.92);
  }

  .showreel-lightbox__rotate[hidden] {
    display: none !important;
  }

  .showreel-lightbox__close {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 4;
  }

  .showreel-lightbox.is-rotated {
    padding: 0;
  }

  .showreel-lightbox.is-rotated .showreel-lightbox__panel {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
  }

  .showreel-lightbox.is-open.is-rotated .showreel-lightbox__panel {
    transform: none;
  }

  .showreel-lightbox.is-rotated .showreel-lightbox__video {
    width: min(90vh, calc(90vw * 16 / 9));
    height: auto;
    max-width: none;
    max-height: none;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    transform: rotate(90deg);
    transform-origin: center center;
  }

  .showreel-lightbox.is-rotated .showreel-lightbox__rotate {
    transform: rotate(90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .showreel-card__media,
  .showreel-card__expand,
  .showreel-lightbox,
  .showreel-lightbox__panel,
  .showreel-lightbox__video,
  .showreel-lightbox__rotate {
    transition: none !important;
  }
}
