/*
  Studio 36 — Galerie publique (design.md §12). Un hub par studio : carte
  photo -> lightbox scopee aux photos de ce studio (data-group), plutot
  qu'une mosaique + chips filtrables — avec seulement 4 photos par studio,
  les deux auraient montre exactement le meme contenu. Lightbox plein écran
  distincte des modales standards (fond --bg-base à 96%, jamais
  --overlay-scrim, cf. §12.2). Deuxieme grille : "Projets realises",
  cartes vides tant qu'aucun projet client n'est documente.
*/

/* ---------- Cartes "Nos studios" (photo -> lightbox scopee) ---------- */

.studio-gallery-grid {
  margin-top: var(--space-7);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 768px) {
  .studio-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.studio-gallery-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-md);
  --studio-color: var(--accent);
  transition: transform var(--duration-standard) var(--ease-out);
}

.studio-gallery-card--plateau-show { --studio-color: var(--studio-plateau-show); }
.studio-gallery-card--brique-room { --studio-color: var(--studio-brique-room); }
.studio-gallery-card--blue-room { --studio-color: var(--studio-blue-room); }

.studio-gallery-card:hover,
.studio-gallery-card:focus-visible {
  transform: translateY(-4px);
}

.studio-gallery-card:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.studio-gallery-card:disabled:hover {
  transform: none;
}

.studio-gallery-card__photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-md);
}

.studio-gallery-card__photo::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2;
  background: var(--studio-color);
}

.studio-gallery-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-expressive) var(--ease-out);
}

.studio-gallery-card:hover .studio-gallery-card__img,
.studio-gallery-card:focus-visible .studio-gallery-card__img {
  transform: scale(1.05);
}

.studio-gallery-card__body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-1) 0;
}

.studio-gallery-card__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-h5-size);
  color: var(--text-primary);
}

.studio-gallery-card__count {
  font-family: var(--font-mono);
  font-size: var(--text-micro-size);
  letter-spacing: var(--text-micro-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Cartes "Projets realises" (vide pour l'instant) ---------- */

.gallery-projects-grid {
  margin-top: var(--space-7);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 768px) {
  .gallery-projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-project-card {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-muted);
}

.gallery-project-card__icon {
  display: flex;
  width: 40px;
  height: 40px;
}

.gallery-project-card__icon svg {
  width: 100%;
  height: 100%;
}

.gallery-project-card__label {
  font-size: var(--text-body-sm-size);
  margin: 0;
}

/* ---------- Lightbox (§12.2) ---------- */

.lightbox-scrim {
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-base) 96%, transparent);
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
  padding: var(--space-6);
}

/* La regle de base ne doit JAMAIS poser `display` : un `display: flex`
   inconditionnel ici (regle auteur) l'emporterait sur `[hidden] { display:
   none }` du navigateur (regle UA), meme avec [hidden] present sur
   l'element — le scrim resterait alors en pleine page (juste invisible via
   opacity:0) et intercepterait tous les clics du site. Seul ce selecteur,
   qui ne s'applique que lorsque [hidden] est absent, doit definir display. */
.lightbox-scrim:not([hidden]) {
  display: flex;
}

.lightbox-scrim[data-open="true"] {
  opacity: 1;
}

.lightbox__figure {
  position: relative;
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.lightbox__media {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.lightbox__caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-5);
  width: 100%;
  color: var(--text-secondary);
  font-size: var(--text-body-sm-size);
}

.lightbox__counter {
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex: 0 0 auto;
}

.lightbox__close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}

.lightbox__close svg {
  width: 18px;
  height: 18px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}

.lightbox__nav svg {
  width: 20px;
  height: 20px;
}

.lightbox__nav--prev {
  left: var(--space-5);
}

.lightbox__nav--next {
  right: var(--space-5);
}

@media (max-width: 767px) {
  .lightbox-scrim {
    padding: var(--space-4);
  }

  .lightbox__nav {
    width: 40px;
    height: 40px;
  }

  .lightbox__nav--prev {
    left: var(--space-2);
  }

  .lightbox__nav--next {
    right: var(--space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-scrim {
    transition: opacity 80ms linear;
  }

  .studio-gallery-card,
  .studio-gallery-card__img {
    transition: none;
  }
}
