/* ============================================================
   Editorial lightbox — quiet, gallery-style enlargement.
   Part of the JasonWalker.design publishing system.

   Pairs with assets/js/lightbox.js. Dependency-free and inert
   until a supported editorial figure is opened, so it is safe
   to include on any page. The interface is meant to recede:
   no toolbars, no card, no heavy borders, no competing shadow.
   The artifact is the focus. Relative paths only.
   ============================================================ */

/* Affordance on eligible editorial figures. Quiet by default. */
.lbx-trigger { cursor: zoom-in; }
.lbx-trigger:focus-visible {
  outline: 2px solid var(--accent, #393E70);
  outline-offset: 3px;
}

/* Root overlay. Hidden until opened; fades via opacity only. */
.lbx-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}
.lbx-root.is-open { display: block; }

.lbx-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 15, 0.94);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.lbx-root.is-visible .lbx-backdrop { opacity: 1; }

.lbx-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(4vh, 26px) max(4vw, 26px);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.lbx-root.is-visible .lbx-frame { opacity: 1; }

/* Stage holds the cloned artifact. JS sizes the clone to fit. */
.lbx-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 84vh;
}
.lbx-stage > * {
  display: block;
  max-width: 92vw;
  max-height: 84vh;
}
.lbx-stage svg { width: auto; height: auto; }
/* Enlarged video figures (animated plates) keep the figure's soft corners. */
.lbx-stage video { display: block; border-radius: 8px; }
/* Transparent PNG artwork (logos, marks) is presented on a white plate when
   enlarged, so transparent areas don't dissolve into the dark overlay. Opt in
   with data-lbx-plate on the source <img>; the attribute survives the clone. */
.lbx-content[data-lbx-plate] {
  background: #fff;
  padding: clamp(20px, 4vw, 60px);
  border-radius: 8px;
  box-sizing: border-box;
}
/* Placeholder study frames read larger when enlarged. */
.lbx-stage .ph-frame { border-radius: 3px; }
.lbx-stage .ph-frame .lab { font-size: 15px; letter-spacing: 0.04em; }

/* Caption beneath the artifact. Never overlaid on the image. */
.lbx-caption {
  margin-top: 22px;
  max-width: 72ch;
  text-align: center;
  font-family: var(--font-system, "Inter", sans-serif);
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}
.lbx-caption:empty { display: none; }
.lbx-caption b, .lbx-caption strong { color: #fff; font-weight: 600; }
.lbx-caption em { font-style: italic; color: rgba(255, 255, 255, 0.85); }
.lbx-cap-label {
  display: block;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

/* Controls. Small, quiet, no chrome. */
.lbx-btn {
  position: absolute;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.66);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}
.lbx-btn:hover, .lbx-btn:focus-visible { color: #fff; }
.lbx-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }
.lbx-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.lbx-close { top: 16px; right: 18px; width: 44px; height: 44px; font-size: 26px; }
.lbx-nav { top: 50%; transform: translateY(-50%); width: 60px; height: 60px; }
.lbx-prev { left: 6px; }
.lbx-next { right: 6px; }
.lbx-nav[hidden] { display: none; }

.lbx-counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-family: var(--font-system, "Inter", sans-serif);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.45);
}
.lbx-counter[hidden] { display: none; }

/* Scroll lock applied to <html> while open. */
.lbx-locked { overflow: hidden !important; }

@media (max-width: 640px) {
  .lbx-nav { width: 46px; height: 46px; }
  .lbx-stage, .lbx-stage > * { max-width: 96vw; }
}

@media (prefers-reduced-motion: reduce) {
  .lbx-backdrop, .lbx-frame { transition: none; }
}

/* Caption children inherit the light caption color on the dark field. */
.lbx-caption * { color: inherit; }
.lbx-caption strong, .lbx-caption b, .lbx-caption .ph-figttl { color: #fff; }

/* ============================================================
   Enlarged Atlas plate — the live continuum study control.

   An interactive Atlas plate does not enlarge to a dead snapshot: it
   mounts a live instance plus a dedicated study control beneath it.
   The control speaks Atlas — a fine museum line, an elegant dot,
   restrained uppercase labels, directional cues, a grab cursor and a
   single teaching bloom. No timeline, no scrubber chrome, no play glyph.
   The plate scales down on short viewports so the control is never
   pushed off-screen and never needs scrolling to reach.
   ============================================================ */
.lbx-stage .apx {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.2vh, 24px);
  max-width: 92vw;
  max-height: 84vh;
}

/* the live plate — capped by height so the control always fits beneath */
.lbx-stage .apx-plate {
  margin: 0;
  flex: 0 1 auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  width: min(92vw, calc((84vh - 140px) * 16 / 9));
}
.lbx-stage .apx-plate > svg { display: block; width: 100%; height: 100%; }

.apx-control {
  flex: 0 0 auto;
  width: min(92vw, 680px);
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
}

/* teaching hint — unmistakable, and deliberately NOT player language */
.apx-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-system, "Inter", sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(190, 200, 230, 0.82);
  text-shadow: 0 1px 3px rgba(10, 11, 15, 0.85);
}
.apx-hint-dot { width: 5px; height: 5px; border-radius: 50%; background: #8FA2E0; }

/* rail:  STATE A ———— track ———— STATE B */
.apx-rail { display: flex; align-items: center; gap: 16px; width: 100%; }
.apx-end {
  flex: 0 0 auto;
  max-width: 26%;
  font-family: var(--font-system, "Inter", sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(174, 184, 218, 0.78);
  text-shadow: 0 1px 3px rgba(10, 11, 15, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apx-end-a { text-align: right; }
.apx-end-b { text-align: left; }

/* the track — fine line, elegant dot, finger-sized hit area */
.apx-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 160px;
  height: 44px;
  cursor: grab;
  touch-action: none;   /* swallow the drag gesture only on the control itself */
  outline: none;
}
.apx-track.apx-grabbing { cursor: grabbing; }
.apx-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(to right, rgba(147,160,196,0.30), rgba(147,160,196,0.66), rgba(147,160,196,0.30));
  border-radius: 2px;
}
.apx-cue {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  color: rgba(147, 160, 196, 0.55);
  pointer-events: none;
}
.apx-cue-l { left: -3px; }
.apx-cue-r { right: -3px; }
.apx-dot {
  position: absolute;
  top: 50%; left: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #7C93E0;
  border: 2px solid rgba(243, 240, 238, 0.92);
  box-shadow: 0 0 0 1px rgba(27, 42, 99, 0.35), 0 2px 8px rgba(10, 11, 15, 0.5);
  pointer-events: none;
  transition: background-color 0.15s ease, transform 0.06s ease;
}
.apx-track:hover .apx-dot { background: #93A6EC; }
.apx-track.apx-grabbing .apx-dot { transform: translate(-50%, -50%) scale(1.08); }

/* visible keyboard focus — a museum ring, not a browser outline */
.apx-track:focus-visible .apx-dot {
  box-shadow: 0 0 0 3px rgba(124, 147, 224, 0.6), 0 2px 8px rgba(10, 11, 15, 0.5);
}
.apx-track:focus-visible .apx-line {
  background: linear-gradient(to right, rgba(147,160,196,0.45), rgba(147,160,196,0.9), rgba(147,160,196,0.45));
}

/* one-time teaching bloom — a quiet ring that blooms twice, then rests */
.apx-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 147, 224, 0.6);
  opacity: 0;
}
.apx-teach .apx-dot::after { animation: apxTeach 1.8s ease-out 0.3s 2; }
@keyframes apxTeach {
  0%   { opacity: 0.7; transform: scale(0.6); }
  70%  { opacity: 0; transform: scale(1.9); }
  100% { opacity: 0; transform: scale(1.9); }
}

@media (max-width: 640px) {
  .apx-rail { gap: 10px; }
  .apx-end { max-width: 22%; font-size: 10px; letter-spacing: 0.1em; }
  .apx-track { min-width: 130px; }
  .lbx-stage .apx-plate { width: min(96vw, calc((80vh - 128px) * 16 / 9)); }
}

/* Reduced motion: no teaching movement, manual scrubbing unaffected. */
@media (prefers-reduced-motion: reduce) {
  .apx-teach .apx-dot::after { animation: none; }
  .apx-dot { transition: none; }
}
