/* ---------- gallery: 4 x 3 grid of our rollouts with a lightbox (after Memorizon) ---------- */
#gallery { border-top: 1px solid var(--border); }
.gal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gal-tile {
  position: relative; display: block; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in;
  background: var(--video-bg); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.gal-tile:hover, .gal-tile:focus-visible { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent), 0 8px 22px rgba(20, 24, 30, .18); outline: none; }
.gal-tile video { display: block; width: 100%; aspect-ratio: 960 / 528; object-fit: cover; pointer-events: none; }
.gal-label {
  position: absolute; top: 6px; left: 6px; z-index: 2; pointer-events: none; max-width: calc(100% - 12px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .7rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px;
  background: rgba(10, 22, 51, .66); color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
/* camera path: appears on hover in the tile, always shown in the lightbox */
.gal-map { position: absolute; top: 6px; right: 6px; width: 30%; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.gal-map canvas { display: block; width: 100%; aspect-ratio: 4 / 3; }
.gal-tile:hover .gal-map, .gal-tile:focus-visible .gal-map { opacity: 1; }
.gal-tile .rvc-keys { left: 6px; right: 6px; bottom: 6px; }
.gal-tile .rvc-keys .cluster { grid-template-columns: repeat(3, 11px); grid-template-rows: repeat(2, 11px); gap: 1.5px; }
.gal-tile .rvc-keys .k { font-size: 7px; border-radius: 2px; }
.gal-tile .rvc-keys .k svg { width: 7px; height: 7px; }
.gal-hint { margin: 10px 0 0; font-size: .82rem; color: var(--text-muted); text-align: center; }
.gal-hint kbd { font: 600 .68rem var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text-muted); }

/* lightbox */
.gal-lb {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 16, 36, .96); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s ease;
}
.gal-lb.on { opacity: 1; }
.gal-lb[hidden] { display: none; }
body.gal-lock { overflow: hidden; }
.gal-lb-stage { margin: 0; width: min(1100px, calc(100vw - 150px)); transform: scale(.97); transition: transform .2s ease; }
.gal-lb.on .gal-lb-stage { transform: none; }
.gal-lb-media { position: relative; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.gal-lb-media video { display: block; width: 100%; aspect-ratio: 960 / 528; }
.gal-map.big { opacity: 1; top: 12px; left: 12px; right: auto; width: 20%; }
/* keys as on the thumbnails: WASD bottom-left, IJKL bottom-right (the controls sit below the video) */
.gal-lb-media .rvc-keys { left: 14px; right: 14px; bottom: 14px; }
.gal-lb-media .rvc-keys .cluster { grid-template-columns: repeat(3, 22px); grid-template-rows: repeat(2, 22px); gap: 3px; }
.gal-lb-media .rvc-keys .k { font-size: 11px; border-radius: 4px; }
.gal-lb-media video { cursor: pointer; }
.gal-lb-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: rgba(255, 255, 255, .85); }
.gal-lb-bar .ctrl-btn { width: 34px; height: 34px; }
.gal-lb-scrub {
  --p: 0%; flex: 1; min-width: 0; height: 18px; margin: 0; background: none; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.gal-lb-scrub::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #6fa8ff var(--p), rgba(255, 255, 255, .25) var(--p)); }
.gal-lb-scrub::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #6fa8ff var(--p), rgba(255, 255, 255, .25) var(--p)); }
.gal-lb-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%; background: #fff; border: 0; }
.gal-lb-scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.gal-lb-time { font-size: .82rem; min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.gal-lb figcaption { margin-top: 12px; color: rgba(255, 255, 255, .92); }
.gal-lb-title { display: flex; align-items: baseline; gap: 10px; font-size: 1rem; }
.gal-lb-title .dom { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.gal-lb-title .count { margin-left: auto; font-size: .85rem; opacity: .75; font-variant-numeric: tabular-nums; }
.gal-lb figcaption p { margin: 6px 0 0; font-size: .86rem; line-height: 1.55; color: rgba(255, 255, 255, .72); }
.gal-lb-arrow, .gal-lb-close {
  position: fixed; border: 0; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .85); color: #1c2b33; box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
.gal-lb-arrow { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; }
.gal-lb-arrow.prev { left: 24px; } .gal-lb-arrow.next { right: 24px; }
.gal-lb-close { top: 18px; right: 22px; width: 40px; height: 40px; font-size: 24px; line-height: 1; }
.gal-lb-arrow:hover, .gal-lb-close:hover { background: #fff; }

@media (max-width: 1000px) { .gal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .gal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .gal-tile .rvc-keys { display: none; }
  .gal-lb-stage { width: calc(100vw - 24px); }
  .gal-lb-arrow { top: auto; bottom: 18px; transform: none; }
}
