/* ===================================================================
   GALLERY
   Styles for the /medias (Galerie Photos) page: a uniform grid mixing
   YouTube embeds and lazy-loaded photos. Reuses tokens from
   variables.css — no new colors or type introduced.
   =================================================================== */

/* Page heading already inherits the site-wide `main > h1` hero style
   (centered, Libre Caslon Display, fade-in-up) from sections.css —
   nothing to redeclare here. */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-5);
  margin-bottom: var(--space-7);
}

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-teal-pale);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  animation: fade-in-up var(--transition-slow) both;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Stagger the entrance slightly across the first rows */
.gallery-item:nth-child(2) { animation-delay: 0.05s; }
.gallery-item:nth-child(3) { animation-delay: 0.1s; }
.gallery-item:nth-child(4) { animation-delay: 0.15s; }
.gallery-item:nth-child(5) { animation-delay: 0.2s; }
.gallery-item:nth-child(6) { animation-delay: 0.25s; }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.06);
}

/* A thin brass frame line on hover — echoes the porthole/hardware
   accent used elsewhere instead of a generic outline. */
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 0 var(--color-accent);
  transition: box-shadow var(--transition-base);
  pointer-events: none;
}

.gallery-item:hover::after {
  box-shadow: inset 0 0 0 3px var(--color-accent);
}

/* Video embeds keep their native 16:9 instead of the 4:3 photo crop */
.gallery-item:has(iframe) {
  aspect-ratio: 16 / 9;
  background-color: var(--color-navy);
}

.gallery-item iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Fallback for browsers without :has() support: size the iframe itself */
.gallery-item iframe {
  aspect-ratio: 16 / 9;
}

/* ---- Empty state ---- */
main > p:only-child {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
  margin-block: var(--space-6);
}

@media (min-width: 600px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
  }
}

@media (min-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}