/* =========================================================
   Gallery CSS
   Romm Coffee — real cafe photos + short videos.

   Masonry-style columns mixing portrait/landscape stills and
   muted looping clips. Each item has an overlay caption; video
   items show a small badge and only play while on screen
   (see gallery.js). Teal brand throughout.

   Works with:
   - Pages/Gallery.cshtml
   - wwwroot/js/gallery.js
   - wwwroot/media/gallery/*.mp4  + wwwroot/images/gallery/*-poster.jpg
========================================================= */

.gallery-masonry {
  columns: 3;
  column-gap: var(--space-4, 1rem);
}

@media (max-width: 900px) {
  .gallery-masonry { columns: 2; }
}

@media (max-width: 560px) {
  .gallery-masonry { columns: 1; }
}

.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: var(--space-4, 1rem);
  overflow: hidden;
  border-radius: var(--radius-md, 0.75rem);
  background: var(--color-surface-soft, #eaf1f1);
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(16, 24, 40, 0.08));

  transition:
    transform var(--transition-base, 220ms ease),
    box-shadow var(--transition-base, 220ms ease);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md, 0 12px 28px rgba(16, 24, 40, 0.12));
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  height: auto;
}

/* Caption overlay — sits at the bottom, reveals on hover/focus. */
.gallery-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-5, 1.5rem) var(--space-4, 1rem) var(--space-3, 0.75rem);

  display: flex;
  flex-direction: column;
  gap: 0.15rem;

  background: linear-gradient(
    to top,
    rgba(5, 50, 58, 0.88) 0%,
    rgba(5, 50, 58, 0.45) 55%,
    rgba(5, 50, 58, 0) 100%
  );

  color: #f6f8f8;

  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--transition-base, 220ms ease),
    transform var(--transition-base, 220ms ease);
}

.gallery-item:hover .gallery-caption,
.gallery-item:focus-within .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery-caption-title {
  font-family: var(--font-heading);
  font-size: var(--text-md, 1.125rem);
  line-height: var(--line-snug, 1.3);
}

.gallery-caption-text {
  font-size: var(--text-xs, 0.75rem);
  color: rgba(246, 248, 248, 0.82);
}

/* Video badge — marks clips, hides once playing. */
.gallery-badge {
  position: absolute;
  top: var(--space-3, 0.75rem);
  right: var(--space-3, 0.75rem);
  z-index: 2;

  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  padding: 0.3rem 0.6rem;

  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: var(--weight-bold, 700);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-dark, #05323a);

  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-full, 999px);
  backdrop-filter: blur(3px);

  transition: opacity var(--transition-base, 220ms ease);
}

.gallery-badge svg {
  width: 0.7rem;
  height: 0.7rem;
  fill: currentColor;
}

.gallery-item.is-playing .gallery-badge {
  opacity: 0;
}

/* Touch devices don't hover — keep captions readable by default. */
@media (hover: none) {
  .gallery-caption {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item:hover {
    transform: none;
    transition: none;
  }
}
