/* ==========================================================================
   Media gallery — fullscreen overlay opened from a project card in the reel.
   Solid background (no transparency) so nothing of the page shows through.
   ========================================================================== */

/* --- The hover link on the focused card ----------------------------------
   A plain orange disc with the icon while the pointer is anywhere on the
   card; hovering the disc itself opens it out into a labelled pill. The
   width is never animated directly — it follows the label's max-width and
   the padding, which both are. */
.reel__cta {
  --cta-size: clamp(44px, 3.6vw, 56px);
  position: absolute;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 0;
  min-width: var(--cta-size);
  height: var(--cta-size);
  border: 0;
  border-radius: 999px;
  background: var(--accent, #f5451b);
  color: var(--color-surface-white, #fffce1);
  font-family: inherit;
  font-size: clamp(11px, 0.95vw, 14px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -50%) translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease,
    padding 0.34s cubic-bezier(0.2, 0.7, 0.2, 1),
    gap 0.34s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}

.reel__cta.is-visible,
.reel__cta:focus-visible {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0);
  pointer-events: auto;
}

.reel__cta [data-cta-label] {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.34s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.2s ease;
}

.reel__cta:is(:hover, :focus-visible) {
  padding: 0 1.25em;
  gap: 0.55em;
}

.reel__cta:is(:hover, :focus-visible) [data-cta-label] {
  max-width: 14em;
  opacity: 1;
}

.reel__cta svg {
  flex: none;
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Overlay -------------------------------------------------------------- */
.gal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #151515; /* same flat dark as the work / services sections */
  opacity: 0;
  transition: opacity 0.32s ease;
}

.gal[hidden] {
  display: none;
}

.gal.is-open {
  opacity: 1;
}

.gal__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* DOM fallback when WebGL2 is unavailable: a plain cross-fading stack. */
.gal__stack {
  position: absolute;
  inset: 88px 96px 104px;
}

.gal__stack figure {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.gal__stack figure.is-active {
  opacity: 1;
}

.gal__stack img,
.gal__stack video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  object-fit: contain;
}

/* --- Controls ------------------------------------------------------------- */
.gal__close,
.gal__arrow {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 252, 225, 0.22);
  border-radius: 50%;
  background: rgba(255, 252, 225, 0.04);
  color: var(--color-surface-white, #fffce1);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.gal__close:hover,
.gal__arrow:hover {
  background: var(--accent, #f5451b);
  border-color: var(--accent, #f5451b);
}

.gal__close {
  top: clamp(16px, 2.4vw, 30px);
  right: clamp(16px, 2.4vw, 30px);
  width: 46px;
  height: 46px;
}

.gal__arrow {
  top: 50%;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
}

.gal__arrow--prev {
  left: clamp(12px, 2vw, 28px);
}

.gal__arrow--next {
  right: clamp(12px, 2vw, 28px);
}

.gal__arrow[disabled] {
  opacity: 0.25;
  cursor: default;
}

.gal__arrow[disabled]:hover {
  background: rgba(255, 252, 225, 0.04);
  border-color: rgba(255, 252, 225, 0.22);
}

.gal__close svg,
.gal__arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Caption + dots ------------------------------------------------------- */
.gal__foot {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 3vh, 34px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(86vw, 900px);
  transform: translateX(-50%);
  text-align: center;
}

.gal__caption {
  margin: 0;
  min-height: 1.3em;
  color: rgba(255, 252, 225, 0.82);
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: none;
  transition: opacity 0.22s ease;
}

.gal__caption.is-swapping {
  opacity: 0;
}

.gal__caption b {
  display: block;
  margin-bottom: 0.25em;
  color: var(--color-surface-white, #fffce1);
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gal__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gal__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 252, 225, 0.28);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.gal__dot:hover {
  background: rgba(255, 252, 225, 0.6);
}

.gal__dot.is-current {
  background: var(--accent, #f5451b);
  transform: scale(1.45);
}

@media (max-width: 700px) {
  .gal__arrow {
    width: 44px;
    height: 44px;
  }

  .gal__stack {
    inset: 76px 16px 108px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gal,
  .gal__caption,
  .reel__cta,
  .reel__cta [data-cta-label] {
    transition: none;
  }
}
