/* Agima project page: image lightbox and the Figure 1 panel hotspots (both built by lightbox.js).
   The page is light only; the lightbox is a dark viewing room on purpose, so the figure is the brightest thing. */

/* ============================== affordance on the page ============================== */
.lbx-target { cursor: zoom-in; }
.lbx-box { position: relative; }
/* the corner icon replaces the older "Full size" badge on figures that open in the lightbox */
.lbx-target .zoom-hint { display: none; }
.lbx-hint {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  color: #fff; background: rgba(22, 24, 29, .72);
  opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.lbx-hint svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lbx-target:hover > .lbx-hint, .lbx-target:focus-visible > .lbx-hint, .lbx-target:focus-within > .lbx-hint { opacity: 1; }
.lbx-target:hover img, .lbx-target:hover canvas { filter: brightness(1.03); }
.lbx-box img[data-lbx-key]:focus-visible, .lbx-box canvas[data-lbx-key]:focus-visible { outline: 2px solid var(--blue, #2660E0); outline-offset: 3px; }
/* Fig. 5 boards: a small icon in the lower corner (the result badge owns the upper one) */
.lbx-hint.is-small { top: auto; bottom: 4px; right: 4px; width: 22px; height: 22px; }
.lbx-hint.is-small svg { width: 13px; height: 13px; }
.f5-step:not(.is-on) .lbx-target { cursor: default; }
.f5-step:not(.is-on) .lbx-hint { display: none; }
/* touch screens: the icon stays visible on figures and clips (not on every Fig. 5 board) */
@media (hover: none) {
  .lbx-hint { top: 6px; right: 6px; width: 26px; height: 26px; opacity: .88; }
  .lbx-hint svg { width: 15px; height: 15px; }
  .lbx-hint.is-small { display: none; }
}

/* ============================== Figure 1 hotspots ============================== */
.team-diagram.has-f1-hot a.zoom { cursor: default; }
.team-diagram.has-f1-hot a.zoom .lbx-hint { display: none; }
.f1-hot { position: absolute; inset: 0; z-index: 3; }
.f1-spot {
  position: absolute; display: block; margin: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .f1-spot:hover { background: rgba(38, 96, 224, .045); box-shadow: inset 0 0 0 1.5px rgba(38, 96, 224, .45); }
}
.f1-spot:focus-visible { outline: none; box-shadow: inset 0 0 0 2.5px var(--blue, #2660E0); }
.f1-spot[aria-pressed="true"]:hover { background: transparent; box-shadow: none; }
.f1-enlarge {
  position: absolute; right: 10px; bottom: 10px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px 0 9px;
  border: 0; border-radius: 6px; color: #fff; background: rgba(22, 24, 29, .78);
  font: 600 .8125rem/1 var(--sans, sans-serif); cursor: zoom-in;
  opacity: 0;
  transition: opacity 160ms ease;
}
.f1-enlarge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.team-diagram:hover .f1-enlarge, .f1-enlarge:focus-visible { opacity: 1; }
.f1-enlarge:hover { background: rgba(22, 24, 29, .92); }
.f1-enlarge:focus-visible { outline: 2px solid #fff; outline-offset: -4px; box-shadow: 0 0 0 2px var(--blue, #2660E0); }
@media (hover: none) {
  .f1-enlarge { opacity: .9; min-height: 28px; padding: 0 8px; }
  .f1-enlarge span { display: none; }
}
/* the Figure 1 caption (styled with .fig-cap in styles.css): math in italic, a fixed line under the figure */
.f1-cap { min-width: 0; }
.f1-cap sub { font-size: .72em; line-height: 0; }

/* ============================== the lightbox ============================== */
html.lbx-lock { overflow: hidden; }
.lbx {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  color: #F1F2F4;
  background: rgba(14, 15, 18, .9);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 170ms ease;
  overscroll-behavior: contain;
}
.lbx[hidden] { display: none; }
.lbx.is-open { opacity: 1; }
.lbx-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 6px 20px; font-family: var(--sans); }
.lbx-count { font-size: .8125rem; font-weight: 600; color: rgba(241, 242, 244, .72); font-variant-numeric: tabular-nums; }
.lbx-tools { display: flex; gap: 8px; margin-left: auto; }
.lbx-tip { display: none; font-size: .8125rem; color: rgba(241, 242, 244, .72); }
@media (hover: none) { .lbx.is-small-fit:not(.is-zoomed) .lbx-tip { display: inline; } }
.lbx-btn, .lbx-nav {
  display: grid; place-items: center; width: 42px; height: 42px; margin: 0; padding: 0;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 50%;
  color: #fff; background: rgba(255, 255, 255, .08); cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.lbx-btn:hover, .lbx-nav:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .45); }
.lbx-btn:focus-visible, .lbx-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lbx-btn svg, .lbx-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lbx-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .22); }
.lbx-stage {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 0;
  margin: 0 clamp(8px, 6vw, 76px); overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.lbx-img {
  display: block; max-width: none; flex: none;
  border-radius: 6px; background: #fff;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
  transform-origin: 50% 50%; cursor: zoom-in;
  transform: none;
  transition: opacity 140ms ease;
}
.lbx-img.is-anim { transition: transform 220ms cubic-bezier(.2, .7, .2, 1), opacity 140ms ease; }
.lbx.is-zoomed .lbx-img { cursor: grab; border-radius: 0; }
.lbx.is-zoomed .lbx-img:active { cursor: grabbing; }
.lbx.is-pixel .lbx-img { image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.lbx.is-loading .lbx-img { opacity: 0; }
.lbx-spin {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 2.5px solid rgba(255, 255, 255, .22); border-top-color: #fff; border-radius: 50%;
  opacity: 0; pointer-events: none;
}
.lbx.is-loading .lbx-spin { opacity: 1; animation: lbx-spin 800ms linear infinite; }
@keyframes lbx-spin { to { transform: rotate(360deg); } }
.lbx-nav { position: absolute; top: 50%; margin-top: -21px; z-index: 2; }
.lbx-prev { left: clamp(6px, 1.6vw, 20px); }
.lbx-next { right: clamp(6px, 1.6vw, 20px); }
.lbx-nav[hidden] { display: none; }
.lbx-foot { display: flex; justify-content: center; padding: 12px 20px max(16px, env(safe-area-inset-bottom)); }
.lbx-cap {
  max-width: 62rem; margin: 0; text-align: center;
  color: rgba(241, 242, 244, .92); font-size: .9375rem; line-height: 1.5;
}
.lbx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  .lbx-top { padding: 8px 8px 4px 16px; }
  .lbx-stage { margin: 0; }
  .lbx-nav { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); margin: 0; width: 38px; height: 38px; }
  .lbx-foot { padding: 10px 56px max(14px, env(safe-area-inset-bottom)); }
  .lbx-prev { left: 8px; }
  .lbx-next { right: 8px; }
  .lbx-cap { font-size: .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lbx, .lbx-img, .lbx-hint, .f1-enlarge { transition: none; }
  .lbx.is-loading .lbx-spin { animation: none; }
}
@media (forced-colors: active) {
  .lbx { background: Canvas; color: CanvasText; }
  .lbx-btn, .lbx-nav { border-color: ButtonText; color: ButtonText; }
}
@media print { .lbx, .lbx-hint, .f1-enlarge, .f1-hot { display: none !important; } }
