@import url("../assets/fonts/Montserrat-Regular.ttf");
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-Black.ttf") format("truetype");
  font-weight: 900;
}

body {
  margin: 0;
  background: #111;
  font-family: "Montserrat", sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

main {
  flex: 1;
  position: relative;
  background-color: white;
  overflow: hidden; /* on garde le contenu dans son bloc */
  z-index: 1; /* en dessous du header et toolbar */
  margin-bottom: 40px; /* évite que le contenu passe sous la toolbar */
}

.top::before,
.header::before {
  pointer-events: none;
}

/* Container en grille 8 colonnes égales */
.characters-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 600;
  overflow: hidden;
}

.character-card {
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 0;
  transition: transform 0.3s ease;
  isolation: isolate;
}

.character-card .overlay {
  position: absolute;
  inset: -5px; /* Étendre l'overlay légèrement au-delà des bords */
  background-color: rgba(29, 29, 27, 0.5);
  z-index: 1;
  pointer-events: none;
}

.character-card img {
  will-change: transform;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.3s ease;
  z-index: 0;
}

.character-card h2 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  z-index: 2;
  text-shadow: 1px 1px 5px #000;
  transition: transform 0.3s ease;
  pointer-events: none;
  margin: 0;
  padding-bottom: 80px;
}

.character-card:hover img {
  transform: scale(1.1);
}

.character-card:hover h2 {
  transform: translate(-50%, -50%) scale(1.5);
}

.character-card:hover {
  transform: scale(1.1);
}

/* Barre d'outils fixe */
.toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 40px;
  background: #1d1d1b;
  z-index: 1000;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  pointer-events: auto;
}

.toolbar a,
.toolbar img {
  pointer-events: auto;
}

.toolbar .icon_toolbar {
  height: 20px;
  filter: brightness(0) invert(1);
}

.bottom,
.container,
.choix-jeu {
  z-index: 0;
}

.dropdown-menu {
  position: absolute;
  bottom: 40px; /* Juste au-dessus de la toolbar */
  left: 50%;
  transform: translateX(-50%);
  background: #1d1d1b;
  border-radius: 5px;
  overflow: hidden;
  display: none; /* Masqué par défaut */
  z-index: 1001; /* Au-dessus de la toolbar */
  min-width: 120px;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.3);
}

.dropdown-menu a {
  display: block;
  padding: 10px 20px;
  color: white;
  text-decoration: none;
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  text-align: center;
  transition: background-color 0.3s;
}

.dropdown-menu a:hover {
  background-color: #333;
}

.dropdown-menu.active {
  display: block;
}

@media (max-width: 1024px) {
  .toolbar {
    height: 70px;
  }

  .toolbar .icon_toolbar {
    height: 25px;
  }

  .container-audio {
    max-height: 70px;
    box-sizing: border-box;
  }

  #interface {
    bottom: 70px;
  }

  .dropdown-menu {
    bottom: 70px; /* Ajusté pour correspondre à la nouvelle hauteur de la toolbar */
  }
}

/* Empêche le scroll sous la toolbar sur mobile */
@media (max-width: 1024px) {
  html,
  body {
    height: 100%;
    max-height: 100vh;
    overflow-x: hidden;
    position: relative;
    overscroll-behavior-y: contain;
    touch-action: pan-x;
  }
  main {
    min-height: calc(100vh - 70px); /* 70px = hauteur toolbar mobile */
    box-sizing: border-box;
    padding-bottom: 70px; /* Ajoute de l'espace pour la toolbar */
    overflow-y: auto; /* Permet le scroll dans main */
  }
}

/* Desktop et tablette paysage : pas de scroll */
@media screen and (min-width: 769px) {
  html,
  body {
    overflow: hidden; /* empêche le scroll */
  }

  main {
    height: 100vh;
    padding-bottom: 40px; /* réserve l’espace de la toolbar */
    box-sizing: border-box; /* évite que ça dépasse */
  }

  .characters-grid {
    height: 100%;
  }
}

@media screen and (max-width: 768px) {
  main {
    height: auto;
    margin-bottom: 40px;
    padding-bottom: 0;
  }

  .h1 {
    font-size: 25px;
    text-align: left;
    left: 20px;
  }

  .characters-grid {
    grid-template-columns: 1fr;
    height: auto; /* pour permettre le scroll */
  }

  .character-card {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .character-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .character-card h2 {
    padding-bottom: 1px;
  }

  .dropdown-menu {
    left: auto; /* Réinitialise left */
    right: 0; /* Colle au bord droit */
    transform: none; /* Supprime tout décalage centré */
    min-width: 100px;
  }
}
