/* ==========================================================================
   LA GNAQUE — feuille de style
   1. Base
   2. En-tête et logo
   3. Accueil (cartes des membres)
   4. Page membre (infos, tri, projets)
   5. Page projet
   6. Câble et arrivée sur la page membre
   7. Accessibilité
   8. Mobile
   ========================================================================== */


/* 1. BASE ------------------------------------------------------------------ */

body {
  margin: 0;
  font-family: "Outfit", sans-serif;
  background-color: #000;
  color: #fff;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 6px;
}

/* texte lu par les moteurs de recherche, invisible à l'écran */
.cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* 2. EN-TÊTE ET LOGO ------------------------------------------------------- */

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 40px;
}

.logo {
  height: 300px;
  margin-right: 20px;
}

/* pages membre et projet : logo plus petit, nom au centre */
header:not(.header-accueil) .logo {
  height: 90px;
}

/* accueil : logo centré */
.header-accueil {
  display: flex;
  justify-content: center;
}


/* 3. ACCUEIL : CARTES DES MEMBRES ------------------------------------------ */

.membres {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 40px;
}

.carte {
  position: relative;
  display: block;
  width: 280px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}

.carte img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition: filter 0.4s, transform 0.6s;
}

.carte:hover img {
  filter: grayscale(1) brightness(0.45);
  transform: scale(1.05);
}

.carte p {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s;
  text-align: center;
  text-transform: uppercase;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 8px;
}

.carte:hover p {
  opacity: 1;
}

/* texte de présentation sous les cartes */
.intro {
  max-width: 60ch;
  margin: 20px auto 80px;
  padding: 0 40px;
  text-align: center;
}

.intro p {
  margin: 0 0 20px;
  font-size: 1.2rem;
  font-weight: 200;
  line-height: 1.8;
  color: #ddd;
}

/* 4. PAGE MEMBRE ----------------------------------------------------------- */

.fiche {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 60px;
  padding: 40px 60px 40px 160px;
  max-width: 2100px;
  margin: 0 auto;
}

.contenu {
  min-width: 0;
}

/* colonne de gauche : rôle, bio, liens */
#infos {
  position: sticky;
  top: 40px;
  align-self: start;
}

#infos p {
  margin: 0 0 20px;
  line-height: 1.7;
  color: #ccc;
}

#infos .role {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.liens {
  list-style: none;
  padding: 0;
  margin: 0;
}

.liens li {
  margin-bottom: 12px;
}

.liens a {
  color: #fff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-decoration: none;
  border-bottom: 1px solid #fff;
}

/* boutons de tri des projets */
.tri {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.tri button {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 4px;
  color: #888;
  font: inherit;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}

.tri button:hover,
.tri button.actif {
  color: #fff;
  border-bottom-color: #fff;
}

/* grille des projets */
.projets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.projet {
  position: relative;
  display: block;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}

.projet img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: filter 0.4s, transform 0.6s;
}

.projet:hover img {
  filter: grayscale(1) brightness(0.45);
  transform: scale(1.05);
}

.projet span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  text-transform: uppercase;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 4px;
  opacity: 0;
  transition: opacity 0.4s;
}

.projet:hover span {
  opacity: 1;
}


/* 5. PAGE PROJET ----------------------------------------------------------- */

.projet-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px;
}

.projet-page iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.projet-page img {
  width: 100%;
}

#retour {
  display: inline-block;
  margin-bottom: 24px;
  color: #fff;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-decoration: none;
}

#retour:hover {
  text-decoration: underline;
}

#media {
  margin-bottom: 40px;
}

#details p {
  margin: 0 0 20px;
  max-width: 65ch;
  line-height: 1.7;
  color: #ccc;
}

#details p:first-child {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 3px;
}

.equipe {
  list-style: none;
  padding: 0;
}

.equipe li {
  margin-bottom: 10px;
  color: #ccc;
}

.equipe a {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-decoration: none;
  border-bottom: 1px solid #fff;
}


/* 6. CÂBLE ET ARRIVÉE SUR LA PAGE MEMBRE ----------------------------------- */

/* le câble lumineux (accueil → page membre) */
#cable {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#cable-trait {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px #fff);
}

#cable-point {
  fill: #fff;
  filter: drop-shadow(0 0 10px #fff);
  opacity: 0;
}

/* à l'arrivée : tout est dans le noir, puis s'allume au passage de l'onde
   (classes ajoutées et retirées par arrivee.js) */
.noir {
  opacity: 0;
  transition: opacity 0.7s;
}

.noir.allume {
  opacity: 1;
}

/* petit flash lumineux autour d'un carré quand l'onde l'atteint */
.projet.allume {
  animation: eclair 1.2s ease-out;
}

@keyframes eclair {
  0%   { box-shadow: 0 0 60px 10px rgba(255, 255, 255, 0.6); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* GRAIN ---------------------------------------------------------------- */

/* voile de bruit qui vibre légèrement sur tout le site, sous le câble */
body::after {
  content: "";
  position: fixed;
  inset: -100px;
  z-index: 5;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(1) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-40px, 30px); }
  20%  { transform: translate(30px, -50px); }
  30%  { transform: translate(-60px, -20px); }
  40%  { transform: translate(50px, 40px); }
  50%  { transform: translate(-20px, 60px); }
  60%  { transform: translate(60px, -30px); }
  70%  { transform: translate(-50px, 10px); }
  80%  { transform: translate(20px, -60px); }
  90%  { transform: translate(-30px, 50px); }
}

/* 7. ACCESSIBILITÉ --------------------------------------------------------- */

/* écrans tactiles : pas de survol, les titres restent visibles en bas des images */
@media (hover: none) {
  .carte p {
    opacity: 1;
    align-items: flex-end;
    padding-bottom: 20px;
    background: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.85));
  }

  .projet span {
    opacity: 1;
    align-items: flex-end;
    background: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.85));
  }
}

/* navigation au clavier : contour visible */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* personnes qui demandent moins d'animations */
@media (prefers-reduced-motion: reduce) {
  .carte img,
  .projet img,
  .noir {
    transition: none;
  }

  .carte:hover img,
  .projet:hover img {
    transform: none;
  }

  .projet.allume {
    animation: none;
  }
}


/* 8. MOBILE ---------------------------------------------------------------- */
@media (max-width: 1250px) {
  .fiche {
    grid-template-columns: 240px 1fr;
    gap: 40px;
    padding: 40px;
  }

  .projets {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1000px) {
  .projets {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .membres {
    flex-wrap: wrap;
  }

  .fiche {
    grid-template-columns: 1fr;
    padding: 40px;
  }

  .projets {
    grid-template-columns: repeat(2, 1fr);
  }

  .logo {
    height: 160px;
  }
}

@media (max-width: 700px) {
  header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
    padding: 20px;
  }

  h1 {
    font-size: 1.3rem;
    letter-spacing: 4px;
    text-align: center;
  }

  .logo {
    height: 140px;
    margin-right: 0;
  }

  .membres {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 20px;
  }

  .carte {
    width: 100%;
    max-width: 320px;
  }

  .carte p {
    font-size: 1.3rem;
    letter-spacing: 4px;
  }

  .fiche {
    padding: 20px;
  }

  #infos {
    position: static;
  }

  .projet span {
    font-size: 1rem;
    letter-spacing: 3px;
  }

  .projet-page {
    padding: 20px;
  }
}