/* TWG lightbox — site-wide image popup. Pairs with /assets/lightbox/lightbox.js.
   Theme tokens come from restyling.css (data-theme on <html>); fallbacks keep it standalone. */
.twg-lb-zoomable { cursor: zoom-in; }
.twg-lb-rel { position: relative; }
.twg-lb-badge {
  position: absolute; z-index: 2; width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center; pointer-events: none;
  background: rgba(8, 5, 16, .72); color: #fff; border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28); opacity: .82; transform: scale(.92);
  transition: opacity .18s ease, transform .18s ease;
}
.twg-lb-badge svg { width: 18px; height: 18px; }
.twg-lb-host:hover > .twg-lb-badge,
.twg-lb-zoomable:focus-visible ~ .twg-lb-badge { opacity: 1; transform: scale(1.06); }
.twg-lb-zoomable:focus-visible { outline: 3px solid var(--accent-violet-bright, #c084fc); outline-offset: 3px; }

html.twg-lb-open, html.twg-lb-open body { overflow: hidden; }

.twg-lb {
  position: fixed; inset: 0; z-index: 2147483100; display: flex; flex-direction: column;
  font-family: var(--font-sans, system-ui, sans-serif); color: var(--fg-primary, #f8fafc);
  background: rgba(3, 1, 3, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overscroll-behavior: contain; animation: twg-lb-in .16s ease-out;
}
.twg-lb[hidden] { display: none; }
:root[data-theme="light"] .twg-lb { background: rgba(248, 250, 252, .96); color: var(--fg-primary, #0f172a); }
@keyframes twg-lb-in { from { opacity: 0; } to { opacity: 1; } }

.twg-lb-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.twg-lb-count { font: 600 12.5px/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .06em; opacity: .75; white-space: nowrap; }
.twg-lb-hint { margin-right: auto; margin-left: 10px; font-size: 13px; line-height: 1.3; opacity: .72; }
.twg-lb-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--border-medium, rgba(255, 255, 255, .16)); background: var(--bg-card-solid, #100b1c);
  color: inherit; cursor: pointer; padding: 0; transition: background .15s ease, transform .15s ease;
}
.twg-lb-btn:hover { background: var(--bg-card-hover, rgba(24, 17, 40, .88)); transform: scale(1.05); }
.twg-lb-btn:focus-visible { outline: 3px solid var(--accent-violet-bright, #c084fc); outline-offset: 2px; }
.twg-lb-btn svg { width: 20px; height: 20px; }
.twg-lb-btn[hidden] { display: none; }

.twg-lb-stage {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; display: flex;
  touch-action: pan-x pan-y pinch-zoom; -webkit-overflow-scrolling: touch;
}
.twg-lb-img {
  margin: auto; display: block; max-width: calc(100vw - 32px); max-height: 100%;
  width: auto; height: auto; object-fit: contain; border-radius: 10px; cursor: zoom-in;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45); background: #0b0f1a; user-select: none;
}
:root[data-theme="light"] .twg-lb-img { box-shadow: 0 18px 50px rgba(15, 23, 42, .22); background: #fff; }
/* Actual-size mode: native pixels, pan by scrolling */
.twg-lb.is-full .twg-lb-img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; }
.twg-lb.is-full .twg-lb-stage { display: block; }
.twg-lb.is-full .twg-lb-stage .twg-lb-img { margin: 0 auto; }

.twg-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; }
.twg-lb-nav:hover { transform: translateY(-50%) scale(1.05); }
.twg-lb-prev { left: max(12px, env(safe-area-inset-left)); }
.twg-lb-next { right: max(12px, env(safe-area-inset-right)); }
.twg-lb.is-full .twg-lb-nav { position: fixed; }

.twg-lb-cap {
  flex: 0 0 auto; margin: 0 auto; width: min(960px, 100%); text-align: center;
  padding: 12px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-size: 14.5px; line-height: 1.5; color: var(--fg-secondary, #cbd5e1);
}
.twg-lb-cap strong { display: block; color: var(--fg-primary, #f8fafc); font-size: 16px; margin-bottom: 2px; }
:root[data-theme="light"] .twg-lb-cap { color: var(--fg-secondary, #334155); }
:root[data-theme="light"] .twg-lb-cap strong { color: var(--fg-primary, #0f172a); }
.twg-lb-cap:empty { display: none; }
.twg-lb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  .twg-lb-img { max-width: 100vw; border-radius: 0; }
  .twg-lb-nav { top: auto; bottom: 8px; transform: none; }
  .twg-lb-nav:hover { transform: none; }
  .twg-lb-cap { font-size: 13.5px; padding-left: 64px; padding-right: 64px; }
  .twg-lb-cap strong { font-size: 15px; }
  .twg-lb.is-full .twg-lb-cap { display: none; }
  .twg-lb-hint { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .twg-lb { animation: none; }
  .twg-lb-badge, .twg-lb-btn { transition: none; }
}
