/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color: #2c3e50;
  font-size: 100%;
  line-height: 1.4;
  background-color: #ffffff;
}

body {
  font-family: 'Playfair Display', serif;
  background-color: #ffffff;
  color: #2c3e50;
}

/* Sélection du texte */
::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/* Éléments media par défaut */
audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/* ==========================================================================
   HEADER / NAVIGATION
   ========================================================================== */

.header {
  background-color: #ffffff;
  color: #2c3e50;
  padding: 20px 0;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
  border-bottom: 1px solid #ecf0f1;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 16rem;
  padding: 0 20px 0 0;
}

.logo {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 16rem;
}

.logo-link {
  display: inline-block;
  text-decoration: none;
}

.logo-link:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 4px;
  border-radius: 4px;
}

.logo-img {
  width: auto;
  height: 16rem;
}

.site-title {
  width: 100%;
  text-align: center;
  font-size: clamp(3.3rem, 6vw, 4.8rem);
  font-weight: 700;
  letter-spacing: 1px;
  color: #2c3e50;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero {
  background: linear-gradient(100deg, #f4f8fb 0%, #f7efd8 55%, #f9e6b8 100%);
  color: #2c3e50;
  padding: 120px 20px;
  text-align: center;
  border-top: 1px solid #ecf0f1;
  border-bottom: 1px solid #ecf0f1;
}

.hero-content {
  max-width: 980px;
  margin: 0 auto;
}


.hero-content h2 {
  font-size: clamp(1.8rem, 3.8vw, 3.1rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
  letter-spacing: 0.4px;
  color: #2c3e50;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.hero-content p {
  font-size: 1.3rem;
  font-weight: 300;
  opacity: 0.95;
  color: #2c3e50;
}

/* ==========================================================================
   PRESENTATION SECTION
   ========================================================================== */

.presentation-section {
  background-color: #ffffff;
  color: #2c3e50;
  padding: 60px 20px;
}

.presentation-container {
  max-width: 1000px;
  margin: 0 auto;
}

/* Mise en forme dédiée de la section présentation/règles de Sexo'Quiz */
.quiz-presentation-layout {
  display: grid;
  gap: 30px;
}

.quiz-intro-card,
.quiz-rules-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e4ebf2;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 10px 24px rgba(44, 62, 80, 0.08);
}

.quiz-intro-card h3,
.quiz-rules-card h3 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: #2c3e50;
}

.quiz-intro-card p,
.quiz-rules-list li {
  font-size: 1.1rem;
  line-height: 1.75;
  color: #2c3e50;
}

.quiz-intro-card p {
  margin-bottom: 14px;
}

.quiz-rules-list {
  margin: 0;
  padding-left: 24px;
}

.quiz-rules-list li {
  margin-bottom: 12px;
}

.presentation-rules-separator {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(44, 62, 80, 0.08) 0%, rgba(44, 62, 80, 0.45) 50%, rgba(44, 62, 80, 0.08) 100%);
}

/* ==========================================================================
   GAMES SECTION - GRID & CARDS
   ========================================================================== */

.games-section {
  background-color: #f9f9f9;
  color: #2c3e50;
  padding: 60px 20px;
}

.games-container {
  max-width: 1200px;
  margin: 0 auto;
}

.games-container h2 {
  font-size: 2.4rem;
  margin-bottom: 40px;
  text-align: center;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  justify-items: center;
}

/* Carte de jeu */
.game-card {
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: var(--card-max-width, 320px);
  width: 100%;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(44, 62, 80, 0.15);
}

/* Image de couverture du jeu (boîte sur page d'accueil) */
.game-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.game-cover-image {
  width: 100%;
  height: var(--cover-height, auto);
  display: block;
  object-fit: var(--cover-fit, contain);
  object-position: var(--cover-position, center center);
  padding: var(--cover-padding, 0);
  transform: scale(var(--cover-scale, 1));
  transform-origin: center center;
  background-color: #ffffff;
}

/* Image individuelle de jeu (cartes au clic) */
.game-play-image {
  width: auto;
  height: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(44, 62, 80, 0.2);
}

/* Conteneur du verso */
.quiz-card-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 14px;
}

.quiz-card-content-verso {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: auto;
  max-width: 90%;
  aspect-ratio: 747 / 1122;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(44, 62, 80, 0.2);
  overflow: hidden;
  font-family: 'Playfair Display', serif;
}

/* Image du verso (fond) */
.quiz-verso-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

/* Superposition du texte sur l'image */
.quiz-card-text-overlay {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  height: 95%;
  padding: 20px 15px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.quiz-card-text-overlay::-webkit-scrollbar {
  width: 5px;
}

.quiz-card-text-overlay::-webkit-scrollbar-track {
  background: transparent;
}

.quiz-card-text-overlay::-webkit-scrollbar-thumb {
  background: #e5b04b;
  border-radius: 3px;
}

.quiz-card-text-overlay::-webkit-scrollbar-thumb:hover {
  background: #e5b04b;
}

/* Question */
.quiz-question {
  font-size: 1.1rem;
  line-height: 1.5;
  color: #e5b04b;
  text-align: center;
  margin-bottom: 18px;
  font-style: italic;
  font-weight: 500;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

/* Bonne réponse */
.quiz-answer {
  font-size: 1.5rem;
  line-height: 1.6;
  color: #e5b04b;
  text-align: center;
  margin-bottom: 18px;
  font-weight: 700;
  padding: 12px 10px;
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border-left: 5px solid #e5b04b;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

/* Explication */
.quiz-explanation {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #e5b04b;
  text-align: justify;
  font-weight: 400;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Contenu de la carte (description, boutons) */
.game-card-content {
  padding: 48px 24px 24px;
  text-align: center;
}

.game-card-description {
  margin-bottom: 18px;
  font-size: 1rem;
  line-height: 1.5;
  color: #2c3e50;
}

/* Bouton "Jouer" */
.game-button {
  display: inline-block;
  padding: 12px 22px;
  background-color: #2c3e50;
  color: #ffffff;
  text-decoration: none;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(44, 62, 80, 0.2);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.game-button:hover,
.game-button:focus-visible {
  background-color: #34495e;
  transform: translateY(-1px);
  outline: none;
}

/* Bouton "Réponse" - espacé du bouton Jouer */
.game-answer-button {
  margin-left: 12px;
  background-color: #dfc519;
}

.game-answer-button:hover,
.game-answer-button:focus-visible {
  background-color: #dfc519;
}


/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

/* Flip de carte (animation au clic) */
@keyframes cardFlip {
  0% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
  50% {
    transform: rotateY(90deg) scale(0.95);
    opacity: 0.7;
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

.game-image.flipping {
  animation: cardFlip 0.6s ease-in-out;
  transform-origin: center center;
  will-change: transform, opacity;
}

/* Animation de flip pour tous les conteneurs */
.quiz-card-container.flipping {
  animation: cardFlip 0.6s ease-in-out;
  transform-origin: center center;
  will-change: transform, opacity;
}

/* Apparition du message de complétion */
@keyframes slideIn {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Message de complétion du quiz */
.quiz-completion-message {
  margin-top: 16px;
  padding: 16px;
  background-color: #e8f5e9;
  border: 2px solid #4caf50;
  border-radius: 8px;
  color: #2e7d32;
  font-weight: 600;
  text-align: center;
  animation: slideIn 0.5s ease-out;
}

/* ==========================================================================
    RESPONSIVE - MOBILE (max-width: 768px)
    ========================================================================== */

@media only screen and (max-width: 768px) {
  /* Header */
  .header-container {
    flex-direction: column;
    gap: 15px;
    min-height: auto;
    padding: 0 20px;
  }

  .logo,
  .logo-img {
    height: 5rem;
  }

  .logo {
    position: static;
    transform: none;
  }

  .site-title {
    width: auto;
    font-size: 2.8rem;
  }


  /* Hero */
  .hero {
    padding: 80px 16px;
  }

  .hero-content h2 {
    font-size: clamp(1.45rem, 6.2vw, 2.05rem);
    line-height: 1.2;
  }

  .quiz-intro-card,
  .quiz-rules-card {
    padding: 20px;
    border-radius: 12px;
  }

  .quiz-intro-card h3,
  .quiz-rules-card h3 {
    font-size: 1.4rem;
  }

  .quiz-intro-card p,
  .quiz-rules-list li {
    font-size: 1rem;
    line-height: 1.65;
  }

  /* Games Grid */
  .games-container h2 {
    font-size: 2rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .game-card {
    max-width: 100%;
  }

  .game-play-image {
    margin-top: 10px;
    border-radius: 8px;
  }

   /* Mobile: conserver une taille identique pour toutes les cartes */
   .quiz-card-content-verso {
     aspect-ratio: 747 / 1122;
     overflow: hidden;
     max-width: 90%;
     height: auto;
   }

   .quiz-card-text-overlay {
     width: 90%;
     height: 95%;
     max-height: 100%;
     overflow-y: auto;
     -webkit-overflow-scrolling: touch;
     overscroll-behavior: contain;
     padding: 18px 12px 22px;
     justify-content: flex-start;
   }

   .quiz-question {
     font-size: 1rem;
     margin-bottom: 12px;
   }

   .quiz-answer {
     font-size: 1.2rem;
     margin-bottom: 12px;
     padding: 10px 8px;
   }

   .quiz-explanation {
     font-size: 0.95rem;
     line-height: 1.5;
   }

}
