/* ---------- Expandable case study images (assets/js/lightbox.js) ---------- */

/* The wrapper takes the image's place in the layout, so it carries the flex/snap behaviour */
.zoom { position: relative; display: block; flex: 0 1 auto; cursor: zoom-in; border-radius: 2px; -webkit-tap-highlight-color: transparent; }
.strip > .zoom { flex: 0 0 auto; scroll-snap-align: start; }

/* Expand badge: always shown on touch screens, on hover with a mouse */
.zoom-badge {
  position: absolute; right: 8px; bottom: 8px;
  display: grid; place-items: center; width: 32px; height: 32px;
  color: var(--ink); background: rgba(246, 246, 243, 0.92);
  box-shadow: 0 0 0 1px rgba(15, 15, 15, 0.12); border-radius: 2px;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .zoom-badge { opacity: 0; transition: opacity 0.2s ease; }
  .zoom:hover .zoom-badge { opacity: 1; }
}

/* Accent outline that glides between hovered images (mouse only, added by lightbox.js) */
.zoom-ring {
  position: absolute; top: 0; left: 0; z-index: 5;
  border: 1.5px solid rgba(158, 40, 18, 0.5); border-radius: 4px; /* same colour as the link cursor outline */
  pointer-events: none; opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.zoom-ring.is-on { opacity: 1; }
.zoom-ring.is-snap { transition: opacity 0.2s ease; }
@media (prefers-reduced-motion: reduce) {
  .zoom-ring { transition: opacity 0.15s ease; }
}

/* ---------- The viewer ---------- */
html.lb-lock { overflow: hidden; }

.lb {
  /* Fills the screen so a click anywhere around the image lands on the dialog itself */
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 64px 48px 48px; border: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(15, 15, 15, 0.9); color: #F6F6F3;
  cursor: zoom-out; overflow: auto; overscroll-behavior: contain;
}
.lb[open] { display: flex; }
.lb::backdrop { background: transparent; }

.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: 0; max-width: 100%; }
.lb-img {
  display: block; max-width: 100%; max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px);
  width: auto; height: auto; object-fit: contain; border-radius: 2px; background: #F6F6F3;
  cursor: default;
}
.lb-cap { max-width: 64ch; font: 400 13px/24px var(--mono); color: rgba(246, 246, 243, 0.82); text-align: center; }
.lb-hint { margin: 0; font: 400 11px/24px var(--mono); color: rgba(246, 246, 243, 0.5); }

.lb-close {
  position: absolute; top: 12px; right: 12px; min-width: 44px; min-height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px/24px var(--mono); color: #F6F6F3; background: transparent;
  border: 1px solid rgba(246, 246, 243, 0.4); border-radius: 2px; cursor: pointer;
}
.lb-close:hover { border-color: #F6F6F3; }
.lb-close:focus-visible { outline: 2px solid #F6F6F3; outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .lb[open] { animation: lb-fade 0.2s ease-out; }
  .lb[open] .lb-figure { animation: lb-rise 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
}
@keyframes lb-fade { from { opacity: 0; } }
@keyframes lb-rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

@media (max-width: 860px) {
  .lb { padding: 64px 12px 24px; }
  .lb-img { max-height: calc(100vh - 176px); max-height: calc(100dvh - 176px); }
  .lb-cap { font-size: 12px; line-height: 20px; padding: 0 12px; }
}

/* Tall images (whole design pages): shown at a readable width, the viewer scrolls */
.lb.lb-tall { justify-content: flex-start; }
.lb.lb-tall .lb-figure { flex: none; }
.lb.lb-tall .lb-img { max-height: none; width: min(100%, 1120px); }
.lb-close { position: fixed; z-index: 1; }
