* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #0f0f0f;
  color: white;
  font-family: Arial, sans-serif;
}

/* HEADER : AU-DESSUS DE LA VIDÉO */
.header-galerie {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;
  padding: 20px 35px;

  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.45),
    transparent
  );
}

.logo-galerie {
  display: block;
  width: 90px;
  height: auto;
}

.bouton-retour {
  display: inline-flex;
  align-items: center;
  gap: 12px;

  padding: 15px 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;

  background: rgba(27, 26, 48, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  color: white;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.bouton-retour:hover {
  background: rgba(27, 26, 48, 0.65);
}

/* PLUS DE CONTENEUR ÉTROIT AUTOUR DE LA PAGE */
.galerie {
  width: 100%;
  margin: 0;
}

/* BANDEAU PLEINE LARGEUR */
.banniere-membre {
  position: relative;
  isolation: isolate;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: clamp(320px, 45svh, 560px);
  padding: 25px 20px;
  overflow: hidden;
  background: #0f0f0f;
}

/* La vidéo remplit le bandeau, derrière le contenu. */
.video-banniere {
  position: absolute;
  inset: 0;
  z-index: -2;

  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Assombrissement discret pour lire le nom. */
.banniere-membre::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;

  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* ENCADREMENT CENTRAL */
.contenu-banniere {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: min(340px, 75%);
  height: 100%;
  padding: 20px;

  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}

#nom-membre {
  margin: 0;
  font-size: clamp(30px, 3vw, 54px);
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.descendre-galerie {
  display: inline-flex;
  margin-top: 25px;
  padding: 8px;
  color: white;
}

/* PORTRAITS : TROIS COLONNES */
.grille-personnages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;

  width: min(1300px, 90%);
  margin: 0 auto;
  padding-bottom: 60px;
}

.carte-personnage {
  position: relative;
  min-width: 0;
  overflow: hidden;

  border-radius: 8px;
  background: #17151c;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);

  transition: transform 0.3s ease;
}

.portrait-personnage {
  width: 100%;
  aspect-ratio: 3 / 5;
}

.portrait-personnage img {
  display: block;
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  transition: transform 0.35s ease;
}

/* Dégradé derrière le nom du personnage. */
.carte-personnage::after {
  content: "";
  position: absolute;
  inset: 50% 0 0;

  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 0, 0, 0.85)
  );

  pointer-events: none;
}

.carte-personnage h2 {
  position: absolute;
  right: 10px;
  bottom: 18px;
  left: 10px;
  z-index: 1;

  margin: 0;

  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(18px, 2vw, 30px);
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (hover: hover) {
  .carte-personnage:hover {
    transform: translateY(-4px);
  }

  .carte-personnage:hover img {
    transform: scale(1.035);
  }
}

.bouton-retour:focus-visible,
.descendre-galerie:focus-visible,
.header-galerie a:focus-visible {
  outline: 2px solid #fff9c8;
  outline-offset: 4px;
}

@media (max-width: 600px) {
  .header-galerie {
    padding: 16px 20px;
  }

  .logo-galerie {
    width: 70px;
  }

  .bouton-retour {
    padding: 12px 18px;
    font-size: 14px;
  }

  .grille-personnages {
    width: 96%;
    gap: 5px;
  }

  .carte-personnage h2 {
    font-size: clamp(13px, 3.3vw, 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .carte-personnage,
  .portrait-personnage img {
    transition: none;
  }

  .carte-personnage:hover,
  .carte-personnage:hover img {
    transform: none;
  }
}


/* Un bandeau légèrement plus généreux. */
.banniere-membre {
  height: clamp(360px, 52svh, 620px);
  padding: 90px 24px 60px;
}

/* La vidéo se fond progressivement dans le fond de la page. */
.banniere-membre::after {
  background: linear-gradient(
    to bottom,
    rgba(22, 22, 22, 0.3) 0%,
    rgba(22, 22, 22, 0.12) 40%,
    rgba(22, 22, 22, 0.5) 75%,
    #0f0f0f 100%
  );
}

/* Encadrement plus compact et légèrement translucide. */
.contenu-banniere {
  width: min(380px, 85%);
  height: auto;
  min-height: 230px;
  padding: 40px 24px;

  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;

  background: rgba(10, 12, 18, 0.16);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#nom-membre {
  font-size: clamp(34px, 4vw, 62px);
  font-weight: 800;
  letter-spacing: 3px;

  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.descendre-galerie {
  margin-top: 22px;
  opacity: 0.85;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.descendre-galerie:hover {
  opacity: 1;
  transform: translateY(5px);
}

/* Les cartes remontent légèrement sur la transition du bandeau. */
.grille-personnages {
  position: relative;
  z-index: 2;

  width: min(1200px, 90%);
  margin: -22px auto 0;
  gap: 22px;
  padding-bottom: 80px;
}

/* Portraits moins étirés, avec un contour discret. */
.carte-personnage {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;

  box-shadow:
    0 18px 35px rgba(0, 0, 0, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.2);

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.portrait-personnage {
  aspect-ratio: 3 / 4;
}

.portrait-personnage img {
  transition:
    transform 0.4s ease,
    filter 0.4s ease;
}

/* Le nom reste intégré au portrait. */
.carte-personnage::after {
  inset: 40% 0 0;

  background: linear-gradient(
    to bottom,
    transparent,
    rgba(5, 5, 10, 0.35) 55%,
    rgba(5, 5, 10, 0.9)
  );
}

.carte-personnage h2 {
  right: 20px;
  bottom: 24px;
  left: 20px;

  font-size: clamp(20px, 2vw, 30px);
  letter-spacing: 1px;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

@media (hover: hover) {
  .carte-personnage:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 26px 50px rgba(0, 0, 0, 0.45);
  }

  .carte-personnage:hover img {
    transform: scale(1.045);
    filter: brightness(1.05);
  }
}

@media (max-width: 600px) {
  .banniere-membre {
    height: 360px;
    padding: 95px 20px 45px;
  }

  .contenu-banniere {
    min-height: 200px;
    padding: 28px 18px;
  }

  .grille-personnages {
    width: 96%;
    gap: 7px;
    margin-top: -12px;
  }

  .carte-personnage {
    border-radius: 8px;
  }

  .carte-personnage h2 {
    right: 6px;
    bottom: 14px;
    left: 6px;

    font-size: clamp(14px, 3.3vw, 20px);
    letter-spacing: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .descendre-galerie,
  .carte-personnage,
  .portrait-personnage img {
    transition: none;
  }

  .descendre-galerie:hover,
  .carte-personnage:hover,
  .carte-personnage:hover img {
    transform: none;
  }
}



/* La vidéo occupe 80 % de la hauteur de la fenêtre. */
.banniere-membre {
  height: 80svh;
  min-height: 520px;
}

/* Espace entre le bas du bandeau et les portraits. */
.grille-personnages {
  margin: 80px auto 0;
}

@media (max-width: 600px) {
  .banniere-membre {
    height: 70svh;
    min-height: 400px;
  }

  .grille-personnages {
    margin: 48px auto 0;
  }
}









.barre-galerie {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;

  width: min(1200px, 90%);
  margin: 60px auto 24px;
}

.barre-galerie button {
  cursor: pointer;
}

.barre-galerie [hidden] {
  display: none !important;
}

#etat-galerie {
  width: min(1200px, 90%);
  margin: 0 auto 24px;

  color: #bec3ce;
  line-height: 1.6;
}

#etat-galerie:empty {
  display: none;
}

.grille-personnages {
  margin-top: 0;
}

.lien-personnage {
  display: block;
  color: inherit;
  text-decoration: none;
}

.lien-personnage:focus-visible {
  outline: 3px solid #fff9c8;
  outline-offset: -4px;
}

/* Commandes visibles seulement en mode modification. */
.actions-personnage {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  z-index: 5;

  display: none;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.galerie-edition .actions-personnage {
  display: flex;
}

.actions-personnage button,
.actions-formulaire button {
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;

  background: #20242e;
  color: white;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.actions-personnage button:hover,
.actions-formulaire button:hover {
  background: #353d4c;
}

/* Fenêtre de création et de modification. */
.fenetre-personnage {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100svh - 40px);
  padding: 28px;
  overflow-y: auto;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;

  background: #151820;
  color: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.fenetre-personnage::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fenetre-personnage h2 {
  margin: 0 0 26px;
  font-size: 23px;
}

.fenetre-personnage label {
  display: block;
  margin: 20px 0 10px;

  color: #d1d5df;
  font-size: 14px;
}

.fenetre-personnage input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px;

  border: 1px solid #424958;
  border-radius: 10px;

  background: #0e1118;
  color: white;
  font: inherit;
}

.aide-personnage {
  color: #a9afbd;
  font-size: 12px;
  line-height: 1.6;
}

#erreur-personnage {
  color: #ffb9b9;
  line-height: 1.5;
}

.actions-formulaire {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

#valider-personnage {
  background: #d4dfc6;
  color: #172018;
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.fenetre-personnage input:focus-visible,
.actions-personnage button:focus-visible,
.actions-formulaire button:focus-visible {
  outline: 2px solid #fff9c8;
  outline-offset: 3px;
}





/* Cette commande apparaît uniquement en mode modification. */
.associer-existant {
  display: none;
}

.galerie-edition .associer-existant {
  display: inline-flex;
}

.fenetre-personnage select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px;

  border: 1px solid #424958;
  border-radius: 10px;

  background: #0e1118;
  color: white;
  font: inherit;
}

.fenetre-personnage select:focus-visible {
  outline: 2px solid #fff9c8;
  outline-offset: 3px;
}

.erreur-liaison {
  color: #ffb9b9;
  line-height: 1.5;
}








.barre-galerie {
  align-items: flex-end;
}

.choix-galerie {
  display: flex;
  flex-direction: column;
  gap: 10px;

  width: 230px;
  max-width: 100%;
  margin-right: auto;
}

.choix-galerie label {
  color: #b9becb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.choix-galerie select {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;

  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;

  background: #161922;
  color: #ffffff;
  color-scheme: dark;

  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.choix-galerie select:hover {
  border-color: rgba(255, 255, 255, 0.45);
}

.choix-galerie select:focus-visible {
  outline: 2px solid #fff9c8;
  outline-offset: 4px;
}

@media (max-width: 600px) {
  .choix-galerie {
    width: 100%;
    margin-right: 0;
  }
}






/* Galerie plus large et boutons alignés avec les cartes. */
.grille-personnages,
.barre-galerie,
#etat-galerie {
  width: 94%;
  margin-left: auto;
  margin-right: auto;
}

/* Trois grandes cartes par ligne. */
.grille-personnages {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

/* Noms plus grands pour accompagner les portraits. */
.carte-personnage h2 {
  font-size: clamp(26px, 2.3vw, 44px);
}

/* Ajustements pour les petits écrans. */
@media (max-width: 600px) {
  .grille-personnages,
  .barre-galerie,
  #etat-galerie {
    width: 96%;
  }

  .grille-personnages {
    gap: 10px;
  }

  .carte-personnage h2 {
    font-size: clamp(14px, 3.3vw, 20px);
  }
}









/* FENÊTRE : NOIR, BLANC ET REFLET DISCRET */
.fenetre-personnage {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100svh - 40px);
  padding: 34px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;

  background:
    radial-gradient(
      ellipse at top left,
      rgba(255, 255, 255, 0.07),
      transparent 65%
    ),
    #0f0f0f;

  color: #ffffff;

  box-shadow:
    0 35px 100px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Fond du site derrière la fenêtre. */
.fenetre-personnage::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Titre et libellés. */
.fenetre-personnage h2 {
  margin: 0 0 30px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.6px;
}

.fenetre-personnage label {
  display: block;
  margin: 24px 0 12px;

  color: #dedede;
  font-size: 13px;
  font-weight: 600;
}

/* Champs de saisie et listes. */
.fenetre-personnage input,
.fenetre-personnage select {
  width: 100%;
  min-height: 54px;
  padding: 15px 16px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;

  background: #0a0a0a;
  color: #ffffff;

  font: inherit;
  font-size: 14px;

  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.fenetre-personnage input:hover,
.fenetre-personnage select:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

/* Bouton de sélection d’une photo. */
.fenetre-personnage input[type="file"] {
  padding: 8px;
  color: #b5b5b5;
  font-size: 12px;
}

.fenetre-personnage input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 12px 15px;

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;

  background: #242424;
  color: #ffffff;

  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.fenetre-personnage input[type="file"]::file-selector-button:hover {
  background: #333333;
}

/* Texte d’aide. */
.fenetre-personnage .aide-personnage {
  margin-top: 12px;
  color: #a0a0a0;
  font-size: 12px;
  line-height: 1.7;
}

/* Espace réservé aux boutons. */
.fenetre-personnage .actions-formulaire {
  gap: 12px;
  margin-top: 30px;
  padding-top: 24px;

  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fenetre-personnage .actions-formulaire button {
  min-height: 48px;
  padding: 13px 22px;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;

  background: #1b1b1b;
  color: #ffffff;

  font-size: 14px;
  font-weight: 700;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.fenetre-personnage .actions-formulaire button:hover {
  background: #292929;
  border-color: rgba(255, 255, 255, 0.4);
}

/* ENREGISTRER : BLANC AVEC TEXTE FONCÉ */
#valider-personnage,
.fenetre-personnage .actions-formulaire button[type="submit"] {
  background: #ffffff;
  color: #0f0f0f;
  border-color: #ffffff;

  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.08);
}

#valider-personnage:hover,
.fenetre-personnage .actions-formulaire button[type="submit"]:hover {
  background: #e8e8e8;
  border-color: #e8e8e8;
  color: #0f0f0f;
}

/* CONTOUR BLANC À LA PLACE DU JAUNE */
.fenetre-personnage input:focus-visible,
.fenetre-personnage select:focus-visible,
.fenetre-personnage button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
  border-color: rgba(255, 255, 255, 0.6);
}

/* Adaptation sur téléphone. */
@media (max-width: 600px) {
  .fenetre-personnage {
    padding: 24px;
    border-radius: 20px;
  }

  .fenetre-personnage h2 {
    font-size: 22px;
  }

  .fenetre-personnage .actions-formulaire button {
    flex: 1;
  }
}




/* Cadre plus grand, adapté à la longueur du nom. */
.contenu-banniere {
  width: max-content;
  max-width: 100%;
  min-width: 0;

  height: auto;
  min-height: 300px;
  padding: 56px 72px;
}

/* Nom plus grand, conservé sur une seule ligne. */
#nom-membre {
  margin: 0;

  font-size: clamp(32px, 6vw, 96px);
  line-height: 1.05;
  letter-spacing: clamp(1px, 0.3vw, 5px);

  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

/* Flèche proportionnée au nouveau cadre. */
.descendre-galerie {
  margin-top: 32px;
}

.descendre-galerie svg {
  width: 36px;
  height: 44px;
}

/* Dimensions adaptées aux téléphones. */
@media (max-width: 600px) {
  .contenu-banniere {
    min-height: 230px;
    padding: 36px 22px;
  }

  #nom-membre {
    font-size: clamp(24px, 6vw, 36px);
    letter-spacing: 1px;
  }

  .descendre-galerie {
    margin-top: 24px;
  }
}