/* ============================================================
📄 PAGE JEUX — QUIZ ARCHITECTURE
============================================================ */

/* Conteneur : pleine largeur pour que le hub s'aligne sur les colonnes de projet (les marges
   latérales viennent de .site-content). Padding vertical seulement. */
.page-jeux .container-global {
  max-width: none;
  margin: 0;
  padding: 0 0 24px; /* collé sous le header (aucune marge en haut) */
}

/* L'attribut [hidden] doit toujours l'emporter : plusieurs éléments du quiz ont un display
   explicite (flex, inline-block…) qui, sinon, le neutralise. */
.page-jeux [hidden] { display: none !important; }

/* Vue de jeu en pleine largeur (comme une page projet) : la colonne de vignettes tombe au bon
   endroit et reste visible pendant le jeu ET sur l'écran de score. */
.quiz-container { max-width: none; }
/* Le score occupe la colonne de contenu (à droite des vignettes, qui restent visibles). */
.quiz-score     { flex: 1; min-width: 0; }

/* Titre centré, en haut de la colonne de contenu (Gambetta, même style que .titre1). */
.quiz-title {
  width: 100%;
  max-width: 500px;
  font-family: "Gambetta", sans-serif; letter-spacing: 0.03em;
  font-size: 26px;
  font-weight: bold;
  color: var(--color-text);
  text-align: center;
  margin: 0 0 12px;
}

/* Trois colonnes, comme une page projet : vignettes des autres quiz (10.5%, bord gauche) | quiz
   (absorbe l'espace) | explication (largeur fixe, place réservée → le quiz ne bouge pas quand elle
   apparaît). align-items: center → explication centrée verticalement le long du quiz. */
.quiz-body {
  /* Deux colonnes : vignettes des autres quiz (10.5%, comme une page projet) + colonne unique
     de contenu. */
  display: flex;
  gap: var(--grid-gap);
  align-items: flex-start;
  width: 100%;
}
/* Colonne de gauche : vignettes des autres quiz, à la MÊME largeur/place que la colonne d'une
   page projet (.project-vignettes : 10.5% du contenu). */
.quiz-others {
  width: 10.5%;
  flex-shrink: 0;
  align-self: flex-start;
}
.quiz-switch {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}
/* Titre « Choisir un autre quiz » : visible seulement en mobile (au-dessus des vignettes du bas). */
.quiz-switch-title { display: none; }
.quiz-switch-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
  background-color: var(--color-fill);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quiz-switch-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  transition: background 0.3s ease;
}
.quiz-switch-tile:hover::before { background: rgba(0, 0, 0, 0.15); }
.quiz-switch-tile .quiz-tile-q { font-size: 11px; padding: 8px; letter-spacing: 0.5px; }
.quiz-switch-tile.is-soon { cursor: default; }
.quiz-switch-tile.is-soon::before { background: rgba(0, 0, 0, 0.65); }

/* Colonne unique de contenu : tout centré, dans l'ordre titre → image → question → réponses →
   explication → « Suivant ». */
.quiz-data {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Image (entre le titre et la question) : carré RÉDUIT, plafonné en hauteur d'écran pour que
   l'ensemble tienne sans défilement. Masquée si le quiz n'a ni image de question ni couverture. */
.quiz-gallery {
  width: min(260px, 22vh);
  margin-bottom: 12px;
}
.quiz-image-wrapper {
  width: 100%;
  max-width: none;
  aspect-ratio: 1 / 1;
  margin: 0;
}
.quiz-image-wrapper img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;   /* recadré au carré, comme la galerie projet */
  display: block;
}

/* Panneau d'explication (entre les réponses et « Suivant »), centré comme le reste. */
.quiz-aside-inner {
  width: 100%;
  max-width: 500px;
  margin-bottom: 14px;
  text-align: center;
}
/* « PLUS D'EXPLICATIONS » : même graphisme que « Description du projet » en page projet. */
.quiz-aside-title {
  font-family: "Archivo", sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text);
  margin: 0 0 12px;
}

/* ============================================================
   HUB — écran de choix des quiz (une vignette par quiz)
============================================================ */
/* Toutes les vignettes sur une même ligne, à largeur égale, séparées par le même écart que
   les colonnes de projet (--grid-gap). */
.quiz-hub {
  display: flex;
  gap: var(--grid-gap);
}

/* Vignette : image de fond + question en surimpression (graphisme des tuiles Matériau). */
.quiz-tile {
  position: relative;
  flex: 1 1 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
  background-color: var(--color-fill);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Voile sombre pour garder la question lisible quelle que soit l'image (et léger éclaircissement au survol). */
.quiz-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.3s ease;
}
.quiz-tile:hover::before { background: rgba(0, 0, 0, 0.15); }

.quiz-tile-q {
  position: relative;
  z-index: 1;
  padding: 16px;
  text-align: center;
  font-family: "Archivo", sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}

/* Quiz pas encore prêt : vignette éteinte + libellé « Bientôt ». */
.quiz-tile.is-soon { cursor: default; }
.quiz-tile.is-soon::before { background: rgba(0, 0, 0, 0.6); }
.quiz-tile-soon {
  position: absolute;
  z-index: 1;
  bottom: 14px;
  font-family: "Archivo", sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-main);
}

/* Bouton « ← Choisir un autre quiz » (vue quiz et écran de score). */
.quiz-back {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 24px;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}
.quiz-back:hover { background: #fff; color: var(--color-main); }
.quiz-score .quiz-back { align-self: center; margin-top: 20px; margin-bottom: 0; }

@media (max-width: 600px) {
  /* Mobile : vignettes empilées (une par ligne) et carrées. */
  .quiz-hub { flex-direction: column; align-items: center; }
  .quiz-tile { flex: none; width: 100%; max-width: 340px; aspect-ratio: 1 / 1; }
  .quiz-tile-q { font-size: 15px; }
}

/* Conteneur du quiz */
.quiz-container {
  background: #fff;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* titre + corps alignés sur le bord gauche */
}

/* (Le carré image est défini plus haut, dans .quiz-gallery / .quiz-image-wrapper.) */

/* Question — centrée ; même police/taille que les textes d'une page projet (Archivo 13px). */
.quiz-question {
  font-family: "Archivo", sans-serif;
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 14px;
  width: 100%;
  max-width: 500px; /* Largeur max pour la question */
}

/* ============================================================
   OPTIONS DE RÉPONSE (Rectangles blancs distincts)
============================================================ */
.quiz-options {
  /* Conteneur des options */
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 500px; /* Largeur max pour les options */
}

.quiz-option {
  /* Rectangle blanc individuel avec ombre */
  background: #fff;
  border: 1px solid var(--color-border-strong);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  padding: 15px 20px;
  width: 100%;
  
  /* Texte gris */
  font-family: "Archivo", sans-serif;
  font-size: 14px;
  color: var(--color-muted);
  text-align: center;
  
  /* Interaction */
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 0;
}

.quiz-option:hover:not(:disabled) {
  color: #fff;
  background: var(--color-main);
  border-color: var(--color-main);
}

.quiz-option:active:not(:disabled) {
  transform: scale(0.98);
}

/* États des réponses */
.quiz-option.correct {
  background: var(--color-success) !important;
  color: #fff !important;
  border-color: var(--color-success) !important;
  font-weight: bold;
}

.quiz-option.wrong {
  background: var(--color-danger) !important;
  color: #fff !important;
  border-color: var(--color-danger) !important;
  font-weight: bold;
}

.quiz-option:disabled {
  cursor: not-allowed;
}

/* ============================================================
   EXPLICATION DE RÉPONSE (affichée après réponse) + bouton Suivant
============================================================ */
/* Texte d'explication : dans le panneau de droite, sans fond ni encadré. */
.quiz-explanation {
  font-family: "Archivo", sans-serif;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--color-text);
  text-align: left;
  margin-bottom: 14px;
}

/* Bouton « En savoir plus sur ce projet » : contour gris au repos, survol orange + texte blanc.
   Même graphisme que le bouton d'outro (Habitats Heureux, cf. .quiz-outro-cta). */
.quiz-project-link {
  display: inline-block;
  padding: 11px 26px;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.quiz-project-link:hover { background: var(--color-main); border-color: var(--color-main); color: #fff; }

.quiz-next {
  background: var(--color-text);
  color: #fff;
  border: none;
  padding: 14px 32px;
  margin-bottom: 20px;
  font-family: "Archivo", sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.quiz-next:hover { background: var(--color-main); }

/* ============================================================
   PROGRESSION
============================================================ */
.quiz-progress {
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
  margin-top: 12px;
}

/* ============================================================
   SCORE FINAL
============================================================ */
.quiz-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
}

/* Ces trois conteneurs ont un display: flex explicite qui, sinon, l'emporte sur l'attribut
   [hidden] (règle navigateur) : le hub resterait affiché en ouvrant un quiz, et l'écran de
   score ne s'afficherait jamais. On rend donc [hidden] prioritaire pour eux. */
.quiz-hub[hidden],
.quiz-container[hidden],
.quiz-score[hidden] { display: none; }

.score-value {
  margin-bottom: 40px;
}

.score-number {
  font-family: "Gambetta", sans-serif; letter-spacing: 0.03em;
  font-size: 80px;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 10px;
}

.score-text {
  font-family: "Archivo", sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: var(--color-muted);
  margin-bottom: 5px;
}

.score-percentage {
  font-family: "Archivo", sans-serif;
  font-size: 14px;
  color: var(--color-muted);
}

/* ============================================================
   OUTRO — invitation à en savoir plus (jeu Habitats Heureux)
============================================================ */
.quiz-outro {
  width: 100%;
  max-width: 460px;
  margin: 0 auto 36px;
  padding: 28px 24px;
  background: var(--color-fill);
  border-top: 3px solid var(--color-main);
  text-align: center;
}
.quiz-outro-text {
  font-family: "Archivo", sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--color-text);
  margin: 0 0 20px;
}
.quiz-outro-text strong { font-weight: 700; }
/* Même graphisme que « En savoir plus sur ce projet » : contour gris, survol orange + blanc. */
.quiz-outro-cta {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
  padding: 12px 28px;
  font-family: "Archivo", sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.quiz-outro-cta:hover { background: var(--color-main); border-color: var(--color-main); color: #fff; }

/* Bouton recommencer */
.restart-button {
  background: var(--color-text);
  color: #fff;
  border: none;
  padding: 15px 40px;
  font-family: "Archivo", sans-serif;
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.3s ease;
  border-radius: 0;
}

.restart-button:hover {
  background: var(--color-main);
}

/* Message si pas de questions */
/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) {
  .page-jeux .container-global {
    padding: 0 0 30px;
  }

  /* Pas de place pour plusieurs colonnes : tout s'empile, centré. Les vignettes des autres quiz
     passent TOUT EN BAS (order), précédées de leur titre. */
  .quiz-body { flex-direction: column; align-items: center; gap: 0; }
  .quiz-others { order: 99; width: 100%; margin-top: 28px; }
  .quiz-switch-title {
    display: block;
    text-align: center;
    font-family: "Archivo", sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text);
    margin: 0 0 14px;
  }
  .quiz-switch { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .quiz-switch-tile { width: 96px; }
  .quiz-gallery { flex: none; width: 100%; max-width: 380px; align-self: center; margin-bottom: 16px; }
  .quiz-data { align-items: center; }
  .quiz-title, .quiz-question { text-align: center; }
  .quiz-aside-inner { border-left: none; padding-left: 0; text-align: center; }
  .quiz-aside-title { text-align: center; }

  .quiz-question {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .quiz-option {
    padding: 12px 16px;
    font-size: 13px;
  }

  .score-number {
    font-size: 60px;
  }
}

@media (max-width: 600px) {
  .page-jeux .container-global {
    padding: 0 0 20px;
  }
  
  .quiz-gallery { max-width: 320px; }

  .quiz-question {
    font-size: 12px;
    margin-bottom: 16px;
  }
  
  .quiz-options {
    gap: 12px;
  }
  
  .quiz-option {
    padding: 10px 14px;
    font-size: 12px;
  }
  
  .score-number {
    font-size: 50px;
  }
  
  .score-text {
    font-size: 14px;
  }
  
  .restart-button {
    padding: 12px 30px;
    font-size: 12px;
  }
}
