/* ═══════════════════════════════════════════════════════════════════════
   Lavrenroof — Modal system
   modal.css · Shared modal/lightbox infrastructure
   Used by: video popup (manufacturing), gallery lightbox, RAL fullscreen
   ═══════════════════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 9, 8, 0.92);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}
.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Inner frame — content lives here */
.modal-inner {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.94);
  opacity: 0;
  transition:
    transform 480ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 320ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}
.modal.is-open .modal-inner {
  transform: scale(1);
  opacity: 1;
}

/* Close + nav buttons — circular, hollow, white */
.modal-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 320ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color 320ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 180ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
  flex-shrink: 0;
}
.modal-btn:hover {
  background: var(--accent, #7a1a1a);
  border-color: var(--accent, #7a1a1a);
}
.modal-btn:active {
  transform: scale(0.96);
}
.modal-btn svg {
  width: 20px;
  height: 20px;
}
.modal-btn--lg {
  width: 56px;
  height: 56px;
}
.modal-btn--lg svg {
  width: 22px;
  height: 22px;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
}

/* Side nav buttons (gallery) */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
.modal-nav.prev { left: 0; }
.modal-nav.next { right: 0; }
.modal-nav.prev:active { transform: translateY(-50%) scale(0.96); }
.modal-nav.next:active { transform: translateY(-50%) scale(0.96); }

/* ─── VIDEO MODAL ─────────────────────────────────────────────────── */
.modal-video {
  flex: 1;
  background: #000;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 200px);
  margin: auto;
  width: 100%;
}
.modal-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ─── IMAGE MODAL (gallery lightbox) ──────────────────────────────── */
.modal-image {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.modal-image img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* Cross-fade transition between gallery slides */
.modal-image img {
  opacity: 0;
  transition: opacity 360ms var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}
.modal-image img.is-active {
  opacity: 1;
}

/* Caption strip below image */
.modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: #fff;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-height: 24px;
}
.modal-caption {
  color: rgba(255, 255, 255, 0.8);
  max-width: 60%;
}
.modal-index {
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .modal { padding: 32px; }
  .modal-nav.prev { left: -8px; }
  .modal-nav.next { right: -8px; }
}

@media (max-width: 700px) {
  .modal { padding: 16px; }
  .modal-btn { width: 40px; height: 40px; }
  .modal-btn svg { width: 18px; height: 18px; }
  .modal-btn--lg { width: 44px; height: 44px; }
  .modal-nav.prev { left: -4px; }
  .modal-nav.next { right: -4px; }
  .modal-close { top: -8px; right: -8px; }
  .modal-meta {
    font-size: 10px;
    letter-spacing: 0.06em;
  }
}

/* ─── REDUCED MOTION ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-inner,
  .modal-image img,
  .modal-btn {
    transition: none !important;
    transform: none !important;
  }
}

/* Hide body scroll when any modal is open */
body.modal-open {
  overflow: hidden;
}
