/* ── System gallery ───────────────────────────────────────────────── */
/* Screenshots are the ERP-scale proof, but the detail in them is
   unreadable at thumbnail size — so every shot opens full size. */

.gallery {
  margin-top: 44px;
  padding-top: 36px;
  border-top: 1px solid var(--grey-2);
}

.gallery-group + .gallery-group {
  margin-top: 40px;
}

.gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.gallery-head .field-label {
  margin-bottom: 0;
  color: var(--white);
}

.gallery-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-3);
}

/* Horizontal strip keeps fifteen screenshots on the page without the
   Work section turning into a scroll marathon. */
.filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 320px);
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-2) transparent;
}

.filmstrip::-webkit-scrollbar {
  height: 6px;
}
.filmstrip::-webkit-scrollbar-track {
  background: transparent;
}
.filmstrip::-webkit-scrollbar-thumb {
  background: var(--grey-2);
}
.filmstrip::-webkit-scrollbar-thumb:hover {
  background: var(--grey-3);
}

.filmstrip:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

.shot {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shot-btn {
  display: block;
  padding: 0;
  border: 1px solid var(--grey-2);
  background: var(--grey-1);
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color var(--transition-base),
              transform var(--dur-press) var(--ease-out);
}

.shot-btn img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.86;
  transition: opacity var(--transition-base);
}

@media (hover: hover) and (pointer: fine) {
  .shot-btn:hover {
    border-color: var(--grey-3);
  }
  .shot-btn:hover img {
    opacity: 1;
  }
}

.shot-btn:active {
  transform: scale(0.98);
  transition-duration: 100ms;
}

.shot figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--grey-3);
  line-height: 1.6;
}

/* ── Lightbox ─────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 4, 4, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 72px 88px;
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}

.lightbox[hidden] {
  display: none;
}

.lightbox.open {
  opacity: 1;
}

.lb-stage {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Never from scale(0) — nothing in the real world appears from nothing. */
.lb-img {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  width: auto;
  object-fit: contain;
  border: 1px solid var(--grey-2);
  transform: scale(0.97);
  opacity: 0;
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

.lightbox.open .lb-img {
  transform: scale(1);
  opacity: 1;
}

.lb-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--grey-4);
  text-align: center;
  letter-spacing: 0.05em;
  max-width: 620px;
  line-height: 1.6;
}

.lb-close,
.lb-nav {
  position: absolute;
  color: var(--white);
  font-family: var(--font-mono);
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid var(--grey-2);
  transition: background-color var(--transition-base),
              border-color var(--transition-base),
              transform var(--dur-press) var(--ease-out);
}

.lb-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 24px;
  line-height: 1;
}

.lb-nav {
  top: 50%;
  margin-top: -28px;
  width: 44px;
  height: 56px;
  font-size: 26px;
  line-height: 1;
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-close:active,
.lb-nav:active {
  transform: scale(0.94);
  transition-duration: 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .lb-close:hover,
  .lb-nav:hover {
    background: var(--grey-2);
    border-color: var(--grey-3);
  }
}

@media (max-width: 768px) {
  .gallery {
    margin-top: 32px;
  }
  .filmstrip {
    grid-auto-columns: minmax(228px, 78vw);
  }

  /* The label already wraps at this width; the peeking next card is a
     clearer affordance than a hint that wraps into it. */
  .gallery-hint {
    display: none;
  }

  .lightbox {
    padding: 64px 0 76px;
  }

  /* A 2:1 desktop screenshot scaled to a 390px phone is an unreadable
     smear, and the detail is the whole point. Render it larger than the
     viewport and let the reader pan. */
  .lb-stage {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
  }
  .lb-img {
    /* Big enough that labels and values read, small enough that the pan
       is a nudge rather than an expedition. */
    min-width: 620px;
    max-width: none;
    max-height: none;
  }
  .lb-caption {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px;
    max-width: none;
    padding: 10px 14px;
    background: rgba(4, 4, 4, 0.92);
    border-top: 1px solid var(--grey-2);
  }

  .lb-nav {
    top: auto;
    bottom: 14px;
    margin-top: 0;
    width: 52px;
    height: 44px;
  }
  .lb-prev { left: 50%; margin-left: -58px; }
  .lb-next { right: 50%; margin-right: -58px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-img {
    transform: none;
    transition: opacity 200ms linear;
  }
  .shot-btn:active,
  .lb-close:active,
  .lb-nav:active {
    transform: scale(0.99);
  }
  .filmstrip {
    scroll-behavior: auto;
  }
}
