/* Global infographic lightbox (companion to lightbox.js).
   Any `.gx-zoomable` element advertises zoomability (cursor + focus ring +
   hover lift) and opens full-screen in a native <dialog class="gx-lightbox">.
   Works in both themes via the base tokens; reduced motion disables the
   zoom-in animation. CSP-safe: pure stylesheet, no imports, no URLs. */

.gx-zoomable {
  cursor: zoom-in;
  transition: filter 160ms ease, transform 160ms ease;
}
.gx-zoomable:hover {
  filter: brightness(1.05);
}
.gx-zoomable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.gx-lightbox {
  /* Native <dialog>: centered by UA styles; we stretch it near-full-viewport. */
  width: min(97vw, 1600px);
  max-width: none;
  max-height: 96vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.5);
}
.gx-lightbox::backdrop {
  background: rgb(4 6 12 / 0.82);
  backdrop-filter: blur(2px);
}
.gx-lightbox[open] {
  animation: gx-zoom-in 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes gx-zoom-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gx-zoomable { transition: none; }
  .gx-lightbox[open] { animation: none; }
}

.gx-lightbox-body {
  display: grid;
  place-items: center;
  min-height: 40vh;
  /* Clip the zoomed clone so it pans WITHIN the viewport instead of growing
     the dialog; touch-action:none lets a finger drag pan rather than scroll. */
  overflow: hidden;
  touch-action: none;
}
/* When zoomed in, the body is a draggable canvas — a "hand" grab cursor that
   reads as "move the image", not "zoom". */
.gx-lightbox-body.is-zoomed { cursor: grab; }
.gx-lightbox-body.is-zoomed:active { cursor: grabbing; }
/* The clone: fill the dialog, keep the aspect, never crop or distort. Zoom/pan
   is applied via an inline transform (lightbox.js); scale from the centre. */
.gx-lightbox-content {
  width: 100%;
  max-width: 100%;
  max-height: 84vh;
  height: auto;
  object-fit: contain;
  margin: 0;
  transform-origin: center center;
  will-change: transform;
}
.gx-lightbox-body svg {
  width: 100%;
  height: auto;
  max-height: 84vh;
}
.gx-lightbox-body img {
  max-width: 100%;
  max-height: 84vh;
  width: auto;
  height: auto;
}

.gx-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.gx-lightbox-close:hover,
.gx-lightbox-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* Zoom controls (out · fit · in), top-left, mirroring the close button's chrome. */
.gx-lightbox-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.gx-lightbox-zoom {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.gx-lightbox-zoom:hover,
.gx-lightbox-zoom:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.gx-lightbox-caption {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
}
.gx-lightbox-caption[hidden] {
  display: none;
}
