/* ==========================================================================
 Gallery
 Before/after photo pairs and the video cards.
 ========================================================================== */

.gallery-grid {
  display: grid;
  gap: 24px;
}
@media (min-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.gallery-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.gallery-split > div {
  position: relative;
  overflow: hidden;
}
.tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(10, 20, 35, 0.15);
}
.tag.after {
  background: var(--crimson);
  color: #fff;
}

/* Video card: same frame height as a photo pair. The portrait clip sits centred over a blurred backdrop */
.gallery-video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 1;
  background: var(--ink);
  isolation: isolate;
}
.gallery-video-backdrop {
  position: absolute;
  inset: -24px;
  z-index: -1;
  background: center / cover no-repeat;
  filter: blur(18px) brightness(0.75);
  transform: scale(1.1);
}
/* Phones show one card per row, so a taller frame gives the portrait clip room */
@media (max-width: 759px) {
  .gallery-video-frame {
    aspect-ratio: 4 / 5;
  }
}
/* Each video card sets its poster here, not in a style="" attribute, which the Content Security Policy blocks */
.gallery-video-backdrop-dashboard {
  background-image: url('../assets/images/gallery/dashboard-restoration-poster.webp');
}
.gallery-video-backdrop-radio {
  background-image: url('../assets/images/gallery/dashboard-radio-repair-poster.webp');
}
.gallery-video-frame video {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  object-fit: cover;
  box-shadow: 0 0 40px rgba(4, 8, 14, 0.45);
  cursor: pointer;
}
/* Play button that main.js adds; hidden while the clip plays */
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0 0 0 4px;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: rgba(20, 26, 34, 0.62);
  box-shadow:
    0 6px 24px rgba(4, 8, 14, 0.35),
    0 0 0 2px rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    transform 0.2s var(--ease-spring),
    opacity 0.2s var(--ease-exit);
}
.video-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
}
.video-play:active {
  transform: translate(-50%, -50%) scale(0.96);
}
.video-play:focus-visible {
  outline: 2px solid var(--accent-ink-dark);
  outline-offset: 3px;
}
.is-playing .video-play {
  opacity: 0;
  pointer-events: none;
}
/* While the clip loads after a tap, a spinning ring replaces the triangle */
.video-play svg {
  transition: opacity 0.2s var(--ease-exit);
}
.video-play::after {
  content: '';
  position: absolute;
  inset: 14px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--white);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s var(--ease-exit);
}
.is-loading .video-play svg {
  opacity: 0;
}
.is-loading .video-play::after {
  opacity: 1;
  animation: video-spin 0.8s linear infinite;
}
@keyframes video-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Cards */
.gallery-card {
  margin: 0;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.gallery-card .gallery-split > div {
  aspect-ratio: 1;
  background: var(--champagne);
}
.gallery-card .gallery-split img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-card figcaption {
  padding: 20px 24px 24px;
}
.gallery-card figcaption strong {
  display: block;
  font:
    400 26px/1.1 'Instrument Serif',
    serif;
  letter-spacing: -0.02em;
}
.gallery-card figcaption span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}
.instagram-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-weight: 600;
  color: var(--accent-ink);
  border-radius: 8px;
  transition: color 0.2s ease;
}
.instagram-link:hover {
  color: var(--link-hover);
}
.instagram-link:active {
  opacity: 0.8;
}
