/* ============================================================
   Expand Image — reusable hover/tap "expand to full page" treatment
   LOCKED standard, Craig, 2026-09-24 (see memory file
   feedback_hover_expand_full_page_bars_slide_standard_2026-09-24.md).
   One module, reused everywhere, never re-derived per page.

   Mark any <img> with data-expand to opt it in. Optional
   data-expand-src points to a full-resolution source; falls back to
   the element's own src. This file is intentionally standalone
   (no dependency on any page's own CSS variables) so it can be
   dropped into any page unchanged.
   ============================================================ */

[data-expand] {
  cursor: zoom-in;
}

.expand-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 3, 1, 0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
  touch-action: pinch-zoom;
}

.expand-overlay[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.expand-overlay__img {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 2;
  transform: scale(0.001);
  transform-origin: var(--expand-origin-x, 50%) var(--expand-origin-y, 50%);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  touch-action: pinch-zoom;
}

.expand-overlay[data-open="true"] .expand-overlay__img {
  transform: scale(1);
  transform-origin: 50% 50%;
}

/* The two gold bars: start collapsed at vertical centre, slide apart
   to the top/bottom edges on open. Kept behind the image (z-index 1)
   but above the backdrop. */
.expand-overlay__bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #d6b05c;
  box-shadow: 0 0 6px 1px rgba(214, 176, 92, 0.55), 0 0 16px 3px rgba(214, 176, 92, 0.25);
  z-index: 1;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.expand-overlay__bar--top {
  top: 50%;
  transform: translateY(-50%);
}

.expand-overlay__bar--bottom {
  bottom: 50%;
  transform: translateY(50%);
}

.expand-overlay[data-open="true"] .expand-overlay__bar--top {
  transform: translateY(0);
  top: 0;
}

.expand-overlay[data-open="true"] .expand-overlay__bar--bottom {
  transform: translateY(0);
  bottom: 0;
}

.expand-overlay__close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(214, 176, 92, 0.55);
  background: rgba(13, 11, 8, 0.7);
  color: #f0c774;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.expand-overlay[data-open="true"] .expand-overlay__close {
  opacity: 1;
}

.expand-overlay__close:focus-visible,
[data-expand]:focus-visible {
  outline: 2px solid #d6b05c;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .expand-overlay,
  .expand-overlay__img,
  .expand-overlay__bar,
  .expand-overlay__close {
    transition-duration: 0.001ms !important;
  }
}

/* Phone: no horizontal scroll while overlay is open, full-bleed. */
body.expand-overlay-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .expand-overlay__close {
    width: 44px;
    height: 44px;
  }
}
