/* The photo theatre: the queue, the carousel cards, Show All and the
   lightbox. Positions are written per frame by js/photo/; these rules
   carry everything that does not move. */

.photo-section {
  --photo-insert-progress: 0;
  --photo-queue-y: 140px;
  --photo-queue-opacity: 0;
  --photo-queue-bleed: clamp(96px, 14vh, 160px);
  --photo-queue-bottom-offset: 0px;
  --photo-queue-final-bottom: clamp(78px, 12vh, 154px);
  --photo-queue-final-y: clamp(20px, 4vh, 76px);
  position: relative;
  /* Fallback only: applyPhotoSectionScrollHeight() sets the real height inline
     from PHOTO_INTRO_PHASES (about 2.5 viewports plus padding). This used to
     say 580vh, a number nothing ever produced -- and the phone blocks below
     went on saying 620vh for the same reason until they were brought here. */
  min-height: 250vh;
  min-height: 250svh;
  min-height: 250dvh;
  color: var(--text);
  overflow: visible;
  background: transparent;
  background-color: transparent;
}

.photo-sticky {
  position: relative;
  min-height: inherit;
  display: block;
  padding: 0;
  overflow: visible;
}

.photo-shell {
  min-height: inherit;
  display: block;
  position: relative;
  padding-top: 1px;
}

.photo-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.photo-fixed-title {
  --photo-fixed-title-opacity: 0;
  position: fixed;
  top: 80px;
  left: 50%;
  z-index: var(--z-photo-title);
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0 auto;
  text-align: center;
  opacity: var(--photo-fixed-title-opacity);
  pointer-events: none;
  transform: translate3d(-50%, var(--photo-title-y, 24px), 0) scale(0.98);
  transition:
    opacity 320ms ease,
    transform 360ms ease;
  will-change: opacity, transform;
}

.photo-fixed-title.is-visible {
  transform: translate3d(-50%, var(--photo-title-y, 0px), 0) scale(1);
}

.photo-fixed-title .eyebrow,
.photo-heading .eyebrow {
  margin: 0;
}

.photo-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(3rem, 7.5vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 16px 42px color-mix(in srgb, var(--text) 10%, transparent);
}

.photo-stage {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  margin-top: 0;
  isolation: isolate;
  overflow: visible;
  background: transparent;
}

.photo-queue {
  position: absolute;
  left: 50%;
  top: auto;
  --photo-queue-bottom-offset: 0px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--photo-queue-final-bottom) - var(--photo-queue-bottom-offset));
  z-index: 20;
  display: block;
  gap: clamp(12px, 2vw, 22px);
  opacity: var(--photo-queue-opacity);
  transform: translate3d(-50%, calc(var(--photo-queue-y) + var(--photo-queue-final-y)), 0);
  width: min(980px, 100%);
  height: clamp(180px, 18vw, 220px);
  pointer-events: none;
  will-change: transform, opacity;
}

.photo-queue::before {
  content: "";
  position: absolute;
  left: max(-36px, -4vw);
  right: max(-36px, -4vw);
  top: -18px;
  bottom: calc(-1 * var(--photo-queue-bleed));
  z-index: 0;
  border-radius: 28px 28px 0 0;
  background: transparent;
  pointer-events: none;
}

.photo-show-all-button {
  position: absolute;
  left: 0;
  top: 0;
  z-index: var(--z-photo-controls);
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 999px;
  padding: 0.68rem 1.05rem;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow:
    0 14px 34px color-mix(in srgb, var(--text) 8%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 24%, transparent);
  opacity: var(--photo-show-all-opacity, 0);
  pointer-events: none;
  transform:
    translate3d(var(--photo-show-all-x, 50vw), var(--photo-show-all-y, 50vh), 0)
    translate(-50%, -100%);
  transition:
    opacity 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  will-change: transform, opacity;
}

.photo-show-all-button.is-visible {
  pointer-events: auto;
}

.photo-show-all-button:hover {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--line));
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
}

.photo-card {
  --photo-card-shadow-strength: 4.8%;
  position: relative;
  flex: 0 0 auto;
  width: clamp(132px, 13vw, 160px);
  aspect-ratio: 8 / 11;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  background: transparent;
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--text) var(--photo-card-shadow-strength), transparent);
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  transition: box-shadow 300ms ease;
  will-change: transform, opacity;
}

.photo-card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  image-orientation: from-image;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.photo-card::before {
  content: none;
}

.photo-card::after {
  content: none;
}

.photo-queue-card {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 1;
  transition: none;
  transform-origin: center center;
}

.photo-floating-card {
  --photo-card-depth: 8px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 25;
  opacity: 0.18;
  pointer-events: none;
  transform-origin: center center;
  box-shadow:
    0 var(--photo-card-depth) 42px color-mix(in srgb, var(--text) var(--photo-card-shadow-strength), transparent);
}

.photo-floating-card .photo-card-shine {
  display: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 24%, color-mix(in srgb, white 28%, transparent) 45%, transparent 62%);
  transform: translateX(var(--photo-shine-x, -18%));
  opacity: 0.54;
  pointer-events: none;
  z-index: 3;
}

.photo-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px))
    max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--chrome-bg) 78%, transparent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease;
  overscroll-behavior: contain;
  touch-action: none;
}

html.is-photo-zoom-open,
html.is-photo-zoom-open body {
  overflow: hidden;
  overscroll-behavior: contain;
}

html.is-photo-zoom-open .topbar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.photo-zoom-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.photo-zoom-shell {
  display: grid;
  justify-items: end;
  gap: 10px;
  max-width: calc(100vw - 44px);
  max-height: calc(var(--app-height, 100dvh) - 36px);
}

.photo-zoom-frame {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: calc(var(--app-height, 100dvh) - 104px);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
  box-shadow:
    0 28px 82px color-mix(in srgb, var(--text) 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 20%, transparent);
  overflow: hidden;
}

.photo-zoom-overlay.is-loading .photo-zoom-frame,
.photo-zoom-overlay.is-active:not(.is-image-ready) .photo-zoom-frame {
  width: var(--photo-zoom-loading-width, min(72vw, 720px));
  height: var(--photo-zoom-loading-height, min(72vh, 720px));
  background: var(--dark-bg);
}

.photo-zoom-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(var(--app-height, 100dvh) - 108px);
  object-fit: contain;
  image-orientation: from-image;
  user-select: none;
}

.photo-zoom-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.photo-zoom-loading::before {
  content: "";
  width: 38px;
  height: 38px;
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-top-color: rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.14);
  animation: photoZoomLoadingSpin 760ms linear infinite;
}

.photo-zoom-overlay.is-loading .photo-zoom-loading,
.photo-zoom-overlay.is-active:not(.is-image-ready) .photo-zoom-loading {
  opacity: 1;
  visibility: visible;
}

@keyframes photoZoomLoadingSpin {
  to {
    transform: rotate(360deg);
  }
}

.photo-zoom-close {
  position: relative;
  z-index: calc(var(--z-lightbox) + 1);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.photo-zoom-close::before,
.photo-zoom-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.photo-zoom-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.photo-zoom-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.photo-zoom-close:hover {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.photo-zoom-close:active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

/* Bare :focus stays ring-less so a mouse click doesn't leave a ring behind;
   :focus-visible (keyboard only) gets a real one. */
.photo-zoom-close:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.photo-zoom-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-color: rgba(255, 255, 255, 0.42);
}

html:not(.theme-dark) .photo-zoom-close {
  border-color: rgba(12, 18, 28, 0.48);
  background: rgba(255, 255, 255, 0.34);
  color: rgba(10, 15, 24, 0.94);
}

html:not(.theme-dark) .photo-zoom-close:hover {
  border-color: rgba(12, 18, 28, 0.68);
  background: rgba(255, 255, 255, 0.52);
  color: rgba(5, 8, 14, 1);
}

html:not(.theme-dark) .photo-zoom-close:active {
  background: rgba(255, 255, 255, 0.68);
  color: rgba(5, 8, 14, 1);
}

html:not(.theme-dark) .photo-zoom-close:focus,
html:not(.theme-dark) .photo-zoom-close:focus-visible {
  border-color: rgba(12, 18, 28, 0.58);
  box-shadow: 0 0 0 2px rgba(12, 18, 28, 0.12);
}

html.theme-dark .photo-card {
  border-color: transparent;
  background: transparent;
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.46);
}


html.theme-dark .photo-section {
  background: transparent;
  background-color: transparent;
}

html.theme-dark .photo-sticky,
html.theme-dark .photo-shell,
html.theme-dark .photo-stage,
html.theme-dark .photo-queue {
  background: transparent;
  background-color: transparent;
}

html.theme-dark .photo-queue::before {
  background: transparent;
}
