/* Project galleries, the card media badge and the full-screen viewer. */

/* Card: a quiet count of shots and videos */
.media-badge {
  position: absolute; left: 12px; bottom: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 999px; font-size: .74rem; letter-spacing: .04em; color: var(--ink-2);
  background: color-mix(in oklab, var(--surface) 82%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  transition: transform .5s var(--ease), background-color .4s;
}
.media-badge svg { width: 12px; height: 12px; }
.media-badge i { width: 1px; height: 11px; margin: 0 3px; background: var(--line-2); }
.card:hover .media-badge { transform: translateY(-2px); }

/* Sheet with a gallery: a little wider so screenshots breathe */
.sheet.has-gallery { width: min(960px, 100%); }

.gallery { padding: 14px 14px 0; }
.g-stage {
  position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; isolation: isolate;
  background: var(--bg-2); touch-action: pan-y; user-select: none; -webkit-user-select: none; outline-offset: 4px;
}
/* A soft, blurred wash of the current shot fills the letterbox */
.g-ambient {
  position: absolute; inset: -40px; z-index: -1; background: center / cover no-repeat;
  filter: blur(36px) saturate(1.1); opacity: .55; transform: scale(1.1);
  transition: background-image .8s var(--ease-soft);
}
[data-theme-active="dark"] .g-ambient { opacity: .35; }
.g-slides { position: absolute; inset: 0; }
.g-slide {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0;
  opacity: 0; transform: translateX(calc(var(--dir, 1) * 18px)) scale(.985);
  transition: opacity .7s var(--ease), transform .8s var(--ease);
}
.g-slide.in { opacity: 1; transform: none; }
.g-slide.out { opacity: 0; transform: translateX(calc(var(--dir, 1) * -12px)); transition-duration: .5s; }
.g-slide img, .g-slide video {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block;
  box-shadow: 0 18px 40px -24px rgb(30 22 14 / .5);
}
.g-slide img { cursor: zoom-in; }
.g-slide video { width: 100%; height: 100%; background: transparent; }
.single .g-slide img, .single .g-slide video { border-radius: 0; }

.g-nav, .g-expand {
  position: absolute; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--line) 70%, transparent); color: var(--ink);
  background: color-mix(in oklab, var(--surface) 78%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  cursor: pointer; opacity: 0; transition: opacity .35s, transform .45s var(--ease), background-color .3s;
}
.g-nav svg, .g-expand svg { width: 18px; height: 18px; }
.g-nav { top: 50%; translate: 0 -50%; }
.g-nav.prev { left: 14px; transform: translateX(-6px); }
.g-nav.next { right: 14px; transform: translateX(6px); }
.g-expand { right: 14px; bottom: 12px; width: 36px; height: 36px; transform: translateY(4px); }
.g-stage:has(.g-slide.in video) .g-expand { display: none; } /* videos have their own full-screen button */
.g-expand svg { width: 16px; height: 16px; }
.g-stage:hover .g-nav, .g-stage:hover .g-expand, .g-stage:focus-within .g-nav, .g-stage:focus-within .g-expand { opacity: 1; transform: none; }
.g-nav:hover, .g-expand:hover { background: var(--surface); }
.g-nav.prev:hover { transform: translateX(-2px); }
.g-nav.next:hover { transform: translateX(2px); }
@media (hover: none) { .g-nav, .g-expand { opacity: 1; transform: none; } .g-nav { display: none; } }

.g-count {
  position: absolute; left: 14px; bottom: 12px; z-index: 2; font-size: .74rem; letter-spacing: .12em; color: var(--ink-2);
  padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums;
  background: color-mix(in oklab, var(--surface) 78%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
/* Leave room for the video's own controls */
.g-stage:has(.g-slide.in video) .g-count { bottom: auto; top: 14px; }

.g-caption {
  margin: 14px 6px 0; min-height: 1.5em; font-family: var(--serif); font-size: .98rem; color: var(--ink-2); text-align: center;
  transition: opacity .4s;
}
.g-caption.empty { opacity: 0; }

.g-thumbs {
  display: flex; gap: 10px; overflow-x: auto; padding: 12px 6px 6px; scroll-snap-type: x proximity; scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.g-thumbs::-webkit-scrollbar { display: none; }
.g-thumb {
  position: relative; flex: 0 0 auto; width: 92px; aspect-ratio: 16 / 10; padding: 0; border: 0; border-radius: 9px; overflow: hidden;
  background: var(--bg-2); cursor: pointer; scroll-snap-align: center; opacity: .55;
  transition: opacity .4s, transform .5s var(--ease);
  animation: thumb-in .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + .2s);
}
.g-thumb::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 10%, transparent); transition: box-shadow .4s;
}
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-thumb:hover { opacity: .85; transform: translateY(-2px); }
.g-thumb.on { opacity: 1; }
.g-thumb.on::after { box-shadow: inset 0 0 0 2px var(--accent); }
.g-thumb-ph { display: block; width: 100%; height: 100%; background: var(--surface-2); }
.g-play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle, rgb(20 16 12 / .35), transparent 70%);
}
.g-play svg { width: 18px; height: 18px; filter: drop-shadow(0 1px 3px rgb(0 0 0 / .4)); }
@keyframes thumb-in { from { opacity: 0; transform: translateY(8px); } }
.g-thumb.on { animation: none; }

@media (max-width: 719px) {
  .gallery { padding: 10px 10px 0; }
  .g-stage { border-radius: 12px; aspect-ratio: 16 / 11; }
  .g-thumb { width: 74px; }
}

/* ───── Full-screen viewer ───── */
.lightbox figure { display: grid; justify-items: center; width: min(1400px, 100%); }
#lightbox-media { display: grid; place-items: center; width: 100%; }
#lightbox-media img, #lightbox-media video { max-height: 82vh; max-width: 100%; border-radius: 10px; display: block; }
#lightbox-media video { width: min(100%, 1280px); background: #000; }
#lightbox-media.swap > * { animation: lb-in .6s var(--ease) both; }
@keyframes lb-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 22px)) scale(.985); } }
.lightbox figcaption { display: flex; gap: 14px; justify-content: center; align-items: baseline; flex-wrap: wrap; max-width: 70ch; }
#lightbox-count { font-size: .78rem; letter-spacing: .14em; opacity: .6; font-variant-numeric: tabular-nums; }
.lightbox .lb-nav { top: 50%; right: auto; translate: 0 -50%; width: 48px; height: 48px; }
.lightbox .lb-nav.prev { left: 16px; }
.lightbox .lb-nav.next { left: auto; right: 16px; }
.lightbox .lb-nav svg { width: 22px; height: 22px; }
.lightbox .lb-nav[hidden] { display: none; }
@media (max-width: 719px) { .lightbox .lb-nav { top: auto; bottom: 18px; translate: none; } }

/* Live embeds (e.g. the Franky print viewer): a cover with a launch button, then the page itself */
.g-embed { position: relative; width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; }
.g-embed > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; filter: saturate(.9) brightness(.82); cursor: default; box-shadow: none; transition: transform 1.2s var(--ease), filter .6s; }
.g-embed:hover > img { transform: scale(1.03); filter: saturate(1) brightness(.75); }
.g-embed-go {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--line) 60%, transparent); background: color-mix(in oklab, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer;
  box-shadow: 0 12px 30px -16px rgb(30 22 14 / .6); transition: transform .45s var(--ease), background-color .3s;
}
.g-embed-go svg { width: 20px; height: 20px; color: var(--accent); }
.g-embed-go:hover { transform: translateY(-2px) scale(1.02); background: var(--surface); }
.g-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg-2); opacity: 0; transition: opacity .6s var(--ease); }
.g-embed.live > img, .g-embed.live .g-embed-go { opacity: 0; pointer-events: none; transition: opacity .4s; }
.g-embed.loaded iframe { opacity: 1; }
.g-embed-note { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 10px; margin: 0; text-align: center; font-size: .8rem; color: var(--muted); opacity: 0; pointer-events: none; transition: opacity .4s; }
.g-embed.slow:not(.loaded) .g-embed-note { opacity: 1; pointer-events: auto; }
.g-embed.live::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: gSpin 1s linear infinite; }
.g-embed.loaded::before { display: none; }
@keyframes gSpin { to { rotate: 1turn; } }
.g-stage:has(.g-slide.in .g-embed) .g-expand { display: none; }
.g-stage:has(.g-slide.in .g-embed.live) .g-nav { top: 24px; translate: 0; }
#lightbox-media .g-embed { width: min(1200px, 94vw); height: min(80vh, 760px); border-radius: 12px; }
