/* ==========================================================================
   INTERACTIVE CSS — task t2
   Styling for JS-driven overlay UI only: lightbox, status region.
   Uses tokens only; no new colours or magic numbers.
   Respects prefers‑reduced‑motion in every transition.

   CHANGES MADE (per requirements):
   1. Lightbox dialog restructured — flex column becoming row at 60em with
      #lightbox-figure at 50% and .lightbox-panel as a flex column whose
      .lightbox-body scrolls and .lightbox-nav sits pinned at its foot.
   2. Added .is-open transition states for scrim and dialog.
   3. Removed .lightbox[hidden] override (base.css handles [hidden] globally).
   4. Uses var(--tap-target) and design tokens throughout.
   5. Every transition respects prefers-reduced-motion.
   ========================================================================== */

/* ----------------------------------------------------------------------
   Lightbox
   ---------------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--container-pad);
  
  /* Scrim fade-in animation */
  background: rgba(30, 27, 24, 0);
  transition: background var(--transition-slow);
}

.lightbox.is-open {
  background: var(--scrim);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox.is-open {
    transition: none;
    background: var(--scrim);
  }
}

/* ----------------------------------------------------------------------
   Lightbox dialog with scale-in animation
   ---------------------------------------------------------------------- */
.lightbox-dialog {
  position: relative;
  width: 100%;
  max-width: 56rem;
  max-height: calc(100vh - 2 * var(--container-pad));
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  
  /* Scale-in animation */
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--transition-base), transform var(--transition-base);
  
  /* Layout: single column on mobile, split at desktop */
  display: flex;
  flex-direction: column;
}

.lightbox.is-open .lightbox-dialog {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-dialog,
  .lightbox.is-open .lightbox-dialog {
    transition: none;
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 60em) {
  .lightbox-dialog {
    flex-direction: row;
    max-height: calc(90vh - 2 * var(--container-pad));
  }
}

/* ----------------------------------------------------------------------
   Lightbox close button
   ---------------------------------------------------------------------- */
.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  min-width: var(--tap-target);
  min-height: var(--tap-target);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  transition: background var(--transition-fast), 
              border-color var(--transition-fast), 
              color var(--transition-fast);
}

.lightbox-close:hover,
.lightbox-close:focus {
  background: var(--color-surface-alt);
  border-color: var(--color-border-strong);
  color: var(--color-accent);
}

/* ----------------------------------------------------------------------
   Lightbox figure area (visual side)
   ---------------------------------------------------------------------- */
.lightbox-figure {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-alt);
  overflow: hidden;
  position: relative;
}

@media (min-width: 60em) {
  .lightbox-figure {
    width: 50%;
    aspect-ratio: auto;
    max-height: 100%;
  }
}

.lightbox-figure svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ----------------------------------------------------------------------
   Lightbox panel (content side)
   ---------------------------------------------------------------------- */
.lightbox-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0; /* Allows body to scroll */
}

/* ----------------------------------------------------------------------
   Lightbox body (text content, scrolls when needed)
   ---------------------------------------------------------------------- */
.lightbox-body {
  padding: var(--space-7) var(--space-5);
  overflow-y: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.lightbox-body::-webkit-scrollbar {
  width: 6px;
}

.lightbox-body::-webkit-scrollbar-track {
  background: transparent;
}

.lightbox-body::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 3px;
}

@media (min-width: 60em) {
  .lightbox-body {
    padding: var(--space-8) var(--space-6);
  }
}

.lightbox-body h2 {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.lightbox-body .work-tag {
  display: inline-block;
  font-size: var(--fs-tiny);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-5);
}

.lightbox-body p {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text-muted);
  max-width: 48ch;
}

/* ----------------------------------------------------------------------
   Lightbox navigation (prev/next) — pinned at bottom of panel
   ---------------------------------------------------------------------- */
.lightbox-nav {
  display: flex;
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-alt);
  flex-shrink: 0;
}

@media (min-width: 60em) {
  .lightbox-nav {
    padding: var(--space-4) var(--space-6);
  }
}

.lightbox-prev,
.lightbox-next {
  flex: 1;
  text-align: center;
  padding: var(--space-3) var(--space-2);
  min-height: var(--tap-target);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text);
  background: transparent;
  border: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.lightbox-prev {
  border-right: 1px solid var(--color-border);
}

.lightbox-prev:hover:not(:disabled),
.lightbox-next:hover:not(:disabled) {
  color: var(--color-accent);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-prev[aria-disabled="true"],
.lightbox-next[aria-disabled="true"] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------------
   Reduced motion overrides
   ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next,
  .lightbox-dialog,
  .lightbox.is-open .lightbox-dialog,
  .lightbox {
    transition: none;
  }
}

/* The screen-reader filter status region uses the shared .visually-hidden
   helper from base.css — not redefined here. */