/* Styles spécifiques à la page galerie (s'appuie sur style_2.css) */

/* Petit hero plus "photo" */
.gallery-hero{
  padding: clamp(2rem, 4vw, 3.2rem) 0 0;
}
.gallery-title{
  margin-top: 1rem;
  font-size: clamp(2.2rem, 5.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.6px;
  color: var(--red);
}
/* Galerie */
.gallery-group + .gallery-group{
  margin-top: 2.6rem;
}
.gallery-section-title{
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  letter-spacing: -0.2px;
}

.gallery{
  margin-top: clamp(1.6rem, 4vw, 2.6rem);
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: .9rem;
}

/* Répartition dynamique (type masonry "soft") */
.gallery-item{ 
  position: relative;
  display:block;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(178,103,98,.20);
  background: rgba(255,255,255,.45);
  box-shadow: var(--shadow-soft);
  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease;
}
.gallery-item:hover{ transform: translateY(-6px); box-shadow: var(--shadow); }

.gallery-item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1.01);
  transition: transform .35s ease;
}
.gallery-item:hover img{ transform: scale(1.06); }

/* Formats — grille 4 photos (formes variées) */
.gallery-quad .gallery-item:nth-child(1){ grid-column: span 8; aspect-ratio: 16/9; }
.gallery-quad .gallery-item:nth-child(2){ grid-column: span 4; aspect-ratio: 1/1; }
.gallery-quad .gallery-item:nth-child(3){ grid-column: span 4; aspect-ratio: 4/5; }
.gallery-quad .gallery-item:nth-child(4){ grid-column: span 8; aspect-ratio: 16/10; }

/* Formats — grille 6 photos (masonry) */
.gallery-sixtet .gallery-item:nth-child(1){ grid-column: span 6; aspect-ratio: 16/10; }
.gallery-sixtet .gallery-item:nth-child(2){ grid-column: span 3; aspect-ratio: 1/1; }
.gallery-sixtet .gallery-item:nth-child(3){ grid-column: span 3; aspect-ratio: 1/1; }
.gallery-sixtet .gallery-item:nth-child(4){ grid-column: span 4; aspect-ratio: 4/5; }
.gallery-sixtet .gallery-item:nth-child(5){ grid-column: span 4; aspect-ratio: 4/5; }
.gallery-sixtet .gallery-item:nth-child(6){ grid-column: span 4; aspect-ratio: 4/5; }

/* Format — grille justifiée façon Google Photos (rangées calculées en JS), test galerie.html */
.gallery-justified{
  display:block;
}
.gallery-justified .gallery-item{
  border-radius: 18px;
}
.justified-row{
  display:flex;
  gap: 8px;
  margin-bottom: 8px;
}
.justified-row:last-child{
  margin-bottom: 0;
}
.gallery-justified .gallery-item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Cadre blanc + coins carrés */
.gallery-framed .gallery-item{
  border-radius: 0;
  border: none;
  background: var(--white);
  padding: 8px;
}
.gallery-framed .gallery-item img{
  border-radius: 0;
}

/* Format — masonry façon Pinterest (proportions natives, colonnes packées), utilisé par index_3 et index_4 */
.gallery-masonry{
  display:block;
  column-count: 3;
  column-gap: .9rem;
}
.gallery-masonry .gallery-item{
  break-inside: avoid;
  margin-bottom: .9rem;
  width: 100%;
}
.gallery-masonry .gallery-item img{
  height: auto;
}

/* Format — grille carrée avec tailles variées (style bento), test index_2 */
.gallery-square{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: 150px;
  grid-auto-flow: dense;
  justify-content:center;
  gap: 3px;
}
.gallery-square .gallery-item{
  border-radius: 0;
  border: none;
  box-shadow: none;
}
.gallery-square .gallery-item:hover{
  box-shadow: none;
}
/* Variation de tailles (motif répété toutes les 4 photos) */
.gallery-square .gallery-item:nth-child(4n+1){ grid-column: span 2; grid-row: span 2; }
.gallery-square .gallery-item:nth-child(4n+3){ grid-column: span 2; }

/* Lightbox (CSS-only via :target) */
.lightbox{
  display:none;
}
.lightbox:target{
  display:grid;
}
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 4000;
  place-items: center;
  padding: 1.2rem;
  background: rgba(20,10,10,.62);
  backdrop-filter: blur(8px);
}

.lb-card{
  width: min(980px, 100%);
  height: min(70vh, 720px);
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.92);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.lb-card img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #120707;
}
.lb-close,
.lb-prev,
.lb-next{
  position: fixed;
  top: 18px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  text-decoration:none;
  color: rgba(255,255,255,.95);
  background: rgba(242,99,90,.18);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 14px 26px rgba(0,0,0,.22);
  transition: transform .18s ease, background .18s ease;
}
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover{ transform: translateY(-2px); background: rgba(242,99,90,.26); }
.lb-close{ right: 18px; }

.lb-prev,
.lb-next{
  top: 50%;
  transform: translateY(-50%);
}
.lb-prev:hover,
.lb-next:hover{ transform: translateY(-50%) scale(1.03); }
.lb-prev{ left: 18px; }
.lb-next{ right: 18px; }

/* Responsive */
@media (max-width: 980px){
  .gallery{ gap: .75rem; }
  .gallery-square{ gap: 3px; }
  .gallery-masonry{ column-count: 2; }
  .gallery-quad .gallery-item:nth-child(1),
  .gallery-quad .gallery-item:nth-child(4){ grid-column: span 12; }
  .gallery-quad .gallery-item:nth-child(2),
  .gallery-quad .gallery-item:nth-child(3){ grid-column: span 6; }
  .gallery-sixtet .gallery-item:nth-child(1){ grid-column: span 12; }
  .gallery-sixtet .gallery-item:nth-child(2),
  .gallery-sixtet .gallery-item:nth-child(3){ grid-column: span 6; }
  .gallery-sixtet .gallery-item:nth-child(4),
  .gallery-sixtet .gallery-item:nth-child(5),
  .gallery-sixtet .gallery-item:nth-child(6){ grid-column: span 6; }
}

@media (max-width: 560px){
  .gallery{ grid-template-columns: repeat(6, 1fr); }
  .gallery-quad .gallery-item,
  .gallery-sixtet .gallery-item{ grid-column: span 6 !important; aspect-ratio: 4/3 !important; }
  .gallery-square{ grid-auto-rows: 110px; }
  .gallery-square .gallery-item{ grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery-masonry{ column-count: 1; }
  .lb-prev, .lb-next{ display:none; }
}

@media (prefers-reduced-motion: reduce){
  .gallery-item, .gallery-item img, .lb-close, .lb-prev, .lb-next{ transition: none; }
}
