/* =================================================================
   05-GALLERY.CSS
   Gallery Grid with 3D Tilt Effect (Desktop) & Gradient Info (Mobile)
   ================================================================= */

/* --- GRILLE --- */
.gallery {
  grid-column: 2 / 3;
  padding: 60px 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  row-gap: 20px;
  column-gap: 20px;
  align-items: start;
  align-content: start;
  min-height: 50vh; 
}

.gallery-item {
  background-color: #f7f7f7;
  position: relative;
  aspect-ratio: 1 / 1;              
  border-radius: 0;
  perspective: 1000px;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.1s ease-out; 
  cursor: pointer;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0); 
  border-radius: 10px;
}

.gallery-item picture,
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateZ(50px);
  pointer-events: none; 
}

.overlay-text {
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 5px;
  text-align: center; 
  max-width: 80%;
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.overlay-category {
  color: #ffffff;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px; 
  font-weight: 400; 
  opacity: 1;
}

.overlay-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.5px;
}

@media (min-width: 901px) {
    .gallery-item:hover .overlay { opacity: 1; }
    .gallery-item:hover .overlay-text { 
      opacity: 1; 
      transform: translateY(0); 
    }
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

/* TABLETTE */
@media (max-width: 1200px) and (min-width: 901px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 25px; row-gap: 25px; padding: 40px 25px;
  }
}

/* =================================================================
   RESPONSIVE MOBILE (Design "Carte Classique")
   ================================================================= */

@media (max-width: 900px) {
  
  /* GRILLE (1 Colonne ou 2 selon ton choix, ici 1 pour de belles images) */
  .gallery {
    display: grid; 
    grid-template-columns: 1fr; 
    row-gap: 40px; /* Plus d'espace entre les projets */
    padding: 20px 34px 60px; 
    width: 100%; 
    max-width: 600px;
    margin: 0 auto; /* Centre la grille */
  }

  /* ITEM (On enlève le clip pour laisser le texte sortir) */
  .gallery-item {
    background-color: transparent; /* Plus de fond gris */
    aspect-ratio: auto; /* Laisse la hauteur s'adapter au contenu */
    overflow: visible; /* Laisse le texte dépasser en dessous */
    transform: none !important; /* Pas de 3D */

  }

  /* IMAGE (Ratio carré ou 4/5 maintenu) */
  .gallery-item picture {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1; /* Ou 4/3 selon tes images */
    overflow: hidden;
    /* Optionnel : petit arrondi moderne */
    /* border-radius: 8px; */ 
  }
  
  .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
  }

  /* L'OVERLAY DEVIENT UN BLOC TEXTE SOUS L'IMAGE */
.overlay {
    position: relative; 
    top: auto; left: auto; 
    width: 100%; height: auto;
    background-color: transparent !important; 
    opacity: 1 !important;
    display: block !important;
    transform: none !important;
    padding: 15px 0 0 0; /* Espace entre image et texte */
    pointer-events: none; 
  }

  /* TEXTE */
 .overlay-text {
    display: flex;              
    flex-direction: column;     
    align-items: center;        
    text-align: center;
    gap:0px;         
    transform: none !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: none !important; 
    margin: 0 auto;
  }

  /* TITRE (Gros et Noir) */
  .overlay-title {
    font-size: 20px;
    font-weight: 600;
    color: #222; /* Noir */
    margin-bottom: 0px;
    display: block;
  }

  /* CATÉGORIE (Petit et Gris) */
  .overlay-category {
    font-size: 13px;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
  }
  
  /* DARK MODE MOBILE */
  html.dark-theme .overlay-title { color: #fff; }
  html.dark-theme .overlay-category { color: #aaa; }
} 

/* =================================================================
   DARK MODE
   ================================================================= */

html.dark-theme .gallery-item {
    background-color: transparent !important;
    outline: 1px solid #141414; 
  }