@import url("../fonts/fonts.css");

/* ───────────────────────────── Jetons ───────────────────────────── */
:root {
  --noir: #0a0b0e;
  --noir-carte: #14161b;
  --blanc: #f2f3f5;
  --blanc-pur: #fafbfc;
  --encre: #111318;
  --accent: #ff4d00; /* surchargé en ligne depuis data/contenu.json */

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Recalculés en JS selon le viewport */
  --carte-w: 56vw;
  --gap: 28px;
  --piste-x: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--noir);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: var(--blanc);
  font-family: "Instrument Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lecture-seule {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────── Barre du haut ─────────────────────────── */
.barre {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 26px 40px;
  background: var(--noir);
}

.marque {
  flex: none;
  margin: 0;
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
  -webkit-text-stroke: 1.2px #fff;
}

.nav {
  flex: 1;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-lien {
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 68;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #fff;
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap; /* « à propos » ne doit jamais se couper en deux lignes */
}

.nav-lien:hover,
.nav-lien[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.nav-lien[aria-current="page"] {
  cursor: default;
}

/* ───────────────────────────── Fond ambiant ───────────────────────────── */
.fond {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.fond-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  filter: brightness(0.4) saturate(0.85);
  opacity: 0;
  transition: opacity 1.1s ease;
}

.fond-media.est-actif {
  opacity: 1;
}

.fond-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(10, 11, 14, 0.55) 0%,
    rgba(10, 11, 14, 0.9) 100%
  );
}

/* ───────────────────────────── Carrousel ───────────────────────────── */
/* overflow: hidden est indispensable ici : la piste est plus large que l'écran,
   et sur mobile un débordement horizontal élargit le viewport de référence —
   la barre de navigation et le titre se retrouvent alors hors de l'écran. */
.carrousel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  z-index: 10;
}

.piste {
  display: flex;
  align-items: center;
  gap: var(--gap);
  will-change: transform;
  transform: translate3d(var(--piste-x), 0, 0);
  transition: transform 0.65s var(--ease);
}

.carte {
  flex: none;
  position: relative;
  width: var(--carte-w);
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--noir-carte);
  border: 0;
  padding: 0;
  cursor: pointer;
  transform: scale(0.82);
  opacity: 0.28;
  transition: transform 0.6s var(--ease), opacity 0.6s ease;
}

.carte.est-active {
  transform: scale(1);
  opacity: 1;
}

.carte-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carte-affiche {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.4s ease;
}

/* Le poster s'efface une fois que la vidéo a des images à montrer */
.carte.a-demarre .carte-affiche {
  opacity: 0;
}

.carte-voile {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 11, 14, 0) 40%,
    rgba(10, 11, 14, 0.45) 100%
  );
  opacity: 0;
  transition: opacity 0.6s ease;
}

.carte:not(.est-active) .carte-voile {
  opacity: 1;
}

/* Pastille « regarder » — seulement sur la carte active et lisible */
.carte-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.carte.est-active:not(.est-absente) .carte-badge {
  opacity: 1;
}

.carte-badge span {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--blanc-pur);
  color: var(--encre);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.carte:hover .carte-badge span {
  transform: scale(1.12);
}

.carte-badge b {
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 66;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  line-height: 1;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 3px;
}

/* Fichier introuvable */
.carte-absente {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: rgba(242, 243, 245, 0.45);
  background: repeating-linear-gradient(
      45deg,
      transparent 0 16px,
      rgba(242, 243, 245, 0.04) 16px 32px
    ),
    var(--noir-carte);
}

.carte.est-absente .carte-absente {
  display: flex;
}

.carte.est-absente .carte-media,
.carte.est-absente .carte-affiche {
  display: none;
}

.carte-absente small {
  color: rgba(242, 243, 245, 0.3);
  font-size: 12px;
}

/* ─────────────────────── Titre du projet actif ─────────────────────── */
.titre-bloc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 52px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  pointer-events: none;
  padding: 0 24px;
}

.titre {
  margin: 0;
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: clamp(44px, 7vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-transform: lowercase;
  -webkit-text-stroke: 1.5px var(--blanc);
  text-shadow: 0 4px 40px rgba(10, 11, 14, 0.9);
}

.sous-titre {
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 68;
  font-weight: 500;
  font-size: clamp(17px, 1.6vw, 24px);
  color: rgba(242, 243, 245, 0.85);
  text-transform: lowercase;
  text-shadow: 0 2px 20px rgba(10, 11, 14, 0.9);
}

@keyframes monteeFondu {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.titre-bloc.anime .titre,
.titre-bloc.anime .sous-titre {
  animation: monteeFondu 0.7s var(--ease) both;
}

/* ───────────────────────── Mobilier du bas ───────────────────────── */
.indice,
.compteur {
  position: fixed;
  bottom: 24px;
  z-index: 30;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(242, 243, 245, 0.4);
}

.indice {
  left: 36px;
}

.compteur {
  right: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compteur-valeur {
  font-variant-numeric: tabular-nums;
}

@keyframes rec {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.point-rec {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: rec 2s steps(1) infinite;
}

.progression {
  position: fixed;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 30;
  transition: width 0.5s var(--ease);
}

/* ─────────────────────────── Calques ─────────────────────────── */
.calque {
  position: fixed;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

/* !important : sans lui, la règle display:flex de #lecteur (sélecteur d'id,
   donc plus spécifique) laisserait le calque affiché malgré l'attribut hidden. */
[hidden] {
  display: none !important;
}

#apropos {
  z-index: 60;
  background: rgba(10, 11, 14, 0.97);
}

#lecteur {
  z-index: 70;
  background: rgba(5, 6, 8, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
}

.fermer {
  position: fixed;
  top: 22px;
  right: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blanc);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 8px;
  z-index: 2;
}

.fermer:hover {
  color: var(--accent);
}

/* ──────────────────────── À propos ──────────────────────── */
.apropos-contenu {
  max-width: 920px;
  margin: 0 auto;
  padding: 120px 36px 80px;
}

.apropos-titre {
  margin: 0 0 40px;
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: clamp(36px, 5vw, 64px);
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 0.95;
  -webkit-text-stroke: 1.2px var(--blanc);
}

.apropos-titre i {
  color: var(--accent);
  font-style: normal;
}

.apropos-grille {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: start;
}

.apropos-bio {
  font-size: 17px;
  line-height: 1.65;
  color: rgba(242, 243, 245, 0.85);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.apropos-bio p {
  margin: 0;
}

.apropos-liens {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.apropos-liens a {
  color: var(--blanc);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.apropos-liens a:hover {
  color: var(--accent);
}

.competences {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(242, 243, 245, 0.25);
}

.competences li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(242, 243, 245, 0.12);
  font-weight: 500;
  font-size: 15px;
}

.competences span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: rgba(242, 243, 245, 0.45);
  letter-spacing: 0.05em;
  text-align: right;
}

/* ──────────────────────── Visionneuse ──────────────────────── */
.lecteur-boite {
  width: min(1200px, 100%);
}

.lecteur-boite video {
  width: 100%;
  max-height: 76vh;
  border-radius: 6px;
  background: #000;
  display: block;
}

.lecteur-cadre {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.lecteur-cadre iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}

.lecteur-secours a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-family: "Archivo", sans-serif;
  font-variation-settings: "wdth" 68;
  font-weight: 600;
  font-size: 14px;
  color: rgba(242, 243, 245, 0.7);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.lecteur-secours a:hover {
  color: var(--blanc);
}

.lecteur-legende {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.lecteur-cat {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
}

.lecteur-titre {
  font-family: "Archivo", sans-serif;
  font-weight: 650;
  font-size: 20px;
}

/* ───────────────────────── Vide (aucun projet) ───────────────────────── */
.vide {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(242, 243, 245, 0.45);
}

/* ───────────────────────────── Réactif ───────────────────────────── */
@media (max-width: 820px) {
  .barre {
    padding: 18px 20px;
    gap: 14px;
  }

  .marque {
    font-size: 17px;
    -webkit-text-stroke-width: 0.8px;
  }

  .nav {
    gap: 14px;
    justify-content: flex-end;
  }

  .nav-lien {
    font-size: 13px;
  }

  .titre-bloc {
    bottom: 44px;
  }

  .indice,
  .compteur {
    font-size: 10px;
    bottom: 18px;
  }

  .indice {
    left: 20px;
  }

  .compteur {
    right: 20px;
  }

  .apropos-grille {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .apropos-contenu {
    padding: 96px 24px 64px;
  }

  .fermer {
    right: 20px;
  }

  #lecteur {
    padding: 20px;
  }

  .carte-badge span {
    width: 76px;
    height: 76px;
  }

  .carte-badge b {
    font-size: 14px;
  }
}

/* Sur les écrans étroits, la barre du haut doit tenir sur une seule ligne */
@media (max-width: 560px) {
  .marque {
    font-size: 14px;
    -webkit-text-stroke-width: 0.6px;
  }

  .nav {
    gap: 12px;
  }

  .nav-lien {
    font-size: 12.5px;
  }

  .indice,
  .compteur {
    font-size: 9.5px;
  }

  .compteur-lieu {
    display: none;
  }
}

/* Très petits écrans (iPhone SE et assimilés) : la barre ne tient plus à trois
   liens. « travaux » n'est qu'un indicateur de section — le carrousel est déjà
   la page travaux — c'est donc lui qui saute. */
@media (max-width: 430px) {
  .barre {
    padding: 16px 16px;
  }

  .marque {
    font-size: 12.5px;
  }

  .nav {
    gap: 16px;
  }

  .nav-lien[aria-current="page"] {
    display: none;
  }

  .indice {
    left: 16px;
  }

  .compteur {
    right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .piste {
    transition: transform 0.001s linear;
  }

  .carte,
  .fond-media,
  .progression,
  .carte-voile,
  .carte-affiche {
    transition-duration: 0.001s;
  }

  .titre-bloc.anime .titre,
  .titre-bloc.anime .sous-titre {
    animation: none;
  }

  .point-rec {
    animation: none;
  }

  .carte:hover .carte-badge span {
    transform: none;
  }
}
