/* --- 1. VARIABLES & CONFIGURATION --- */
:root {
  /* Couleurs Brand */
  --primary-orange: #ff6a00;
  --secondary-yellow: #FFE066;

  /* Couleurs UI */
  --bg-cream: #fff2be;
  --card-bg: #ffffff;

  /* Textes */
  --text-dark: #1a1a1a;
  --text-gray: #555;
  --text-light-gray: #888;

  /* Ombres */
  --shadow-small: 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);

  /* Radius & Transitions */
  --border-radius-large: 24px;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- 2. BASE --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-cream);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content-wrapper {
  flex-grow: 1;
}

.gradient-text {
  background: linear-gradient(135deg, #ff6a00, #ff9500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- 3. SECTION HERO (Header) --- */
.subjects-hero {
  /* RÉDUCTION DE L'ESPACE HEADER <-> TITRE */
  /* Top: 50px (c'était 80px) | Bottom: 20px */
  padding: 50px 0 20px 0;
  text-align: center;
}

.subjects-header {
  text-align: center;
  /* RÉDUCTION DE L'ESPACE TITRE <-> CARTES (~ -40%) */
  margin-bottom: 40px;
}

.subjects-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 106, 0, 0.1);
  color: #ff6a00;
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
  /* Réduit aussi légèrement ici */
  border: 1px solid rgba(255, 106, 0, 0.2);
}

.subjects-header h1 {
  font-family: 'Poppins', sans-serif;
  /* EXACTEMENT COMME TON INDEX (.modern-title) */
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  color: #222;
  margin-bottom: 15px;
  letter-spacing: -1px;
}

.subjects-subtitle {
  font-size: 1.1rem;
  color: #222;
  font-weight: 400;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

/* --- 4. GRILLE & CARTES (Nouveau Design) --- */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  padding-top: 20px;
  /* Espace pour laisser dépasser les têtes */
  margin-bottom: 60px;
}

.subject-card {
  background: var(--secondary-yellow);
  /* Yellow background like terminale2 */
  border-radius: var(--border-radius-large);
  text-decoration: none;
  color: var(--text-dark);
  box-shadow: var(--shadow-small);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 20px;
  /* CRUCIAL : Overflow visible pour l'effet 3D */
  overflow: visible;
}

/* -- Zone Visuelle (Haut) -- */
.card-visual {
  height: 180px;
  border-top-left-radius: var(--border-radius-large);
  border-top-right-radius: var(--border-radius-large);
  position: relative;
  overflow: visible;
  /* CRUCIAL pour que la tête dépasse */
  z-index: 1;
  background-color: #2c3e50;
  /* Couleur de secours si l'image ne charge pas */
}

/* Texture de fond (Tableau noir) */
.background-texture {
  position: absolute;
  inset: 0;
  border-top-left-radius: var(--border-radius-large);
  border-top-right-radius: var(--border-radius-large);
  background-size: cover;
  background-position: center;
  /* On assombrit un peu l'image de fond pour que le texte et le perso ressortent */
  filter: brightness(0.7);
  z-index: 1;
}

/* Images de fond spécifiques */
/* Assure-toi que ces fichiers existent ou change les noms */
.maths-bg {
  background-image: url('../images/fond_maths.webp');
  background-color: #2c3e50;
}

.physique-bg {
  background-image: url('../images/fond_physique.webp');
  background-color: #2c3e50;
}

.chimie-bg {
  background-image: url('../images/fond_chimie.webp');
  background-color: #2c3e50;
}

/* L'image du Scientifique (Pop-up) */
.scientist-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  height: 220px;
  /* Doit être plus grand que la zone bleue (180px) */
  width: auto;
  /* Garde les proportions */
  object-fit: contain;
  z-index: 5;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Ombre portée pour détacher le perso du fond */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transform-origin: bottom center;
  pointer-events: none;
  /* Pour éviter de cliquer sur l'image au lieu du lien */
}

/* Petite icône flottante (Overlay) */
.overlay-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  background: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 6;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* -- Contenu (Bas) -- */
.card-content {
  padding: 25px;
  background: transparent;
  /* Transparent to show yellow card background */
  border-bottom-left-radius: var(--border-radius-large);
  border-bottom-right-radius: var(--border-radius-large);
  position: relative;
  z-index: 10;
  /* Passe devant le bas de l'image coupée */
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-header h3 {
  font-size: 1.4rem;
  margin: 0;
  font-weight: 600;
}

.difficulty-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f2f6;
  color: #a4b0be;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
}

.description {
  color: var(--text-gray);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
  min-height: 45px;
  /* Aligne les cartes */
}

.meta-data {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  font-size: 0.85rem;
  color: var(--text-dark);
  /* Changed from blue to dark for better contrast on yellow */
  font-weight: 500;
}

/* Bouton Footer */
.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f2f6;
  padding-top: 15px;
  color: var(--primary-orange);
  font-weight: 600;
}

.arrow-icon {
  transition: transform 0.3s ease;
}

/* -- ANIMATIONS HOVER -- */
.subject-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

/* Le scientifique POP ! */
.subject-card:hover .scientist-img {
  transform: translateX(-50%) scale(1.15);
  filter: drop-shadow(0 15px 20px rgba(0, 0, 0, 0.4));
}

.subject-card:hover .arrow-icon {
  transform: translateX(5px);
}

/* --- 6. RESPONSIVE --- */

@media (max-width: 768px) {
  .subjects-hero {
    padding: 30px 0 10px 0;
  }

  .subjects-header h1 {
    font-size: 2.5rem;
    letter-spacing: -0.5px;
  }

  .subjects-header {
    margin-bottom: 30px;
    padding: 0 15px;
  }

  .subjects-subtitle {
    font-size: 1rem;
    padding: 0 10px;
  }

  .subjects-grid {
    gap: 25px;
    padding-top: 10px;
    margin-bottom: 40px;
  }
}

@media (max-width: 480px) {
  .subjects-hero {
    padding-top: 20px;
  }

  .subjects-badge {
    margin-bottom: 15px;
    padding: 6px 16px;
    font-size: 0.8rem;
  }

  .subjects-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
  }

  .subjects-grid {
    grid-template-columns: 1fr;
    /* Force single column */
    gap: 30px;
    /* More space between stacked cards */
    padding: 0 10px;
  }

  .subject-card {
    margin-top: 10px;
  }

  .card-visual {
    height: 150px;
  }

  .scientist-img {
    height: 180px;
  }

  .card-content {
    padding: 20px;
  }

  .card-header h3 {
    font-size: 1.25rem;
  }

  .meta-data {
    gap: 10px;
    font-size: 0.8rem;
    margin-bottom: 20px;
  }

  .subject-card:hover .scientist-img {
    /* Subtle hover effect for mobile touch */
    transform: translateX(-50%) scale(1.05);
  }
}

/* --- COMING SOON STYLES --- */
.coming-soon-card {
  opacity: 0.8;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.coming-soon-card:hover {
  transform: none !important;
  box-shadow: var(--shadow-small) !important;
}

.coming-soon-card:hover .scientist-img {
  transform: translateX(-50%) scale(0.95) !important;
}

.unavailable-badge {
  display: inline-block;
  background: #e0e0e0;
  color: #757575;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}