/* ============================================================
   portraits-moviola_v1.css — scoped to #nhp-portraits-v2-page
   ============================================================ */

:root {
  --pmv-gold: #c9a96e;
  --pmv-gap: 3px;
  --pmv-grid-transition: 300ms ease;
  --pmv-slide-duration: 280ms;
  --pmv-slide-easing: ease-out;
}

.nhp-pv2-grid-section {
  padding: 0;
}

/* ── Grid — true masonry via CSS columns ── */
#nhp-portraits-v2 {
  columns: 5;
  column-gap: var(--pmv-gap);
  transition: opacity var(--pmv-grid-transition);
}

@media (max-width: 1024px) {
  #nhp-portraits-v2 { columns: 3; }
}

@media (max-width: 640px) {
  #nhp-portraits-v2 { columns: 2; }
}

/* Grid dims when moviola is open */
#nhp-portraits-v2.nhp-pv2--dimmed {
  opacity: 0.10;
  pointer-events: none;
}

/* ── Grid items ── */
.nhp-pv2-item {
  display: block;
  cursor: pointer;
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: var(--pmv-gap);
  line-height: 0;
}

.nhp-pv2-item img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(1);
  transition: filter 150ms ease;
  will-change: filter;
}

.nhp-pv2-item:hover img {
  filter: brightness(1.08);
}

/* Gold pulse — applied by JS on last-viewed item when closing */
.nhp-pv2-item--pulse {
  animation: pmv-pulse 600ms ease-out forwards;
}

@keyframes pmv-pulse {
  0%   { outline: 2px solid var(--pmv-gold); outline-offset: 0; }
  100% { outline: 2px solid transparent; outline-offset: 0; }
}

/* ── Moviola overlay ── */
#nhp-moviola {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 8, 0.87);
  outline: none;
}

#nhp-moviola[hidden] {
  display: none;
}

/* Vignette — dark edges, transparent center (doesn't cover hero) */
#nhp-moviola::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 70% at center, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
  z-index: 9006;
}

/* Warm flash overlay for fast-scrub glow — fades in fast, settles slow */
#nhp-moviola::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 236, 190, 0);
  z-index: 9050;
  pointer-events: none;
  transition: background 600ms ease-out;
}

#nhp-moviola.pmv--fast-scrub::before {
  background: rgba(255, 236, 190, 0.09);
  transition: background 120ms linear;
}

/* Film strip */
.pmv-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 80px);
  overflow: visible;
  position: relative;
  user-select: none;
}

/* Individual frame */
.pmv-frame {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--pmv-slide-duration) var(--pmv-slide-easing),
    opacity   var(--pmv-slide-duration) var(--pmv-slide-easing),
    filter    var(--pmv-slide-duration) var(--pmv-slide-easing);
  will-change: transform, opacity, filter;
}

.pmv-frame img {
  max-height: 87vh;
  max-width: 55vw;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  /* z-space scale — synced with carousel slide */
  transform: scale(1.0);
  transition: transform var(--pmv-slide-duration) var(--pmv-slide-easing);
  will-change: transform;
}

/* Center (active) */
.pmv-frame[data-pos="0"] {
  opacity: 1;
  filter: blur(0px) brightness(1);
  z-index: 10;
}

.pmv-frame[data-pos="0"] img {
  transform: scale(1.03);
  transition: transform var(--pmv-slide-duration) var(--pmv-slide-easing);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.9),
    0 12px 60px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* Adjacent ±1 */
.pmv-frame[data-pos="1"],
.pmv-frame[data-pos="-1"] {
  opacity: 0.58;
  filter: blur(0.8px) brightness(0.9);
  z-index: 5;
}

/* Outer ±2 */
.pmv-frame[data-pos="2"],
.pmv-frame[data-pos="-2"] {
  opacity: 0.28;
  filter: blur(4px) brightness(0.7);
  z-index: 2;
}

/* Hidden beyond range */
.pmv-frame[data-pos="hidden"] {
  opacity: 0;
  pointer-events: none;
}

/* ── Nav arrows ── */
.pmv-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9200;
  width: 64px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.35);
  font-size: 26px;
  font-weight: 200;
  line-height: 1;
  transition: color 200ms ease;
  user-select: none;
  letter-spacing: -0.05em;
}

.pmv-nav:hover {
  color: rgba(255, 255, 255, 0.85);
}

.pmv-nav--prev { left: 12px; }
.pmv-nav--next { right: 12px; }

/* ── Scrubber ── */
.pmv-scrubber-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(80vw, 620px);
}

.pmv-scrubber {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 24px;
  cursor: pointer;
  touch-action: none;
  width: 100%;
  padding-bottom: 4px;
}

.pmv-tick {
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  transition: height 180ms ease, background 180ms ease, transform 180ms ease;
  border-radius: 1px;
  flex-shrink: 0;
  flex-grow: 0;
  transform-origin: bottom center;
}

/* ±2 from current */
.pmv-tick[data-rel="2"],
.pmv-tick[data-rel="-2"] {
  height: 7px;
  background: rgba(255, 255, 255, 0.4);
}

/* ±1 from current */
.pmv-tick[data-rel="1"],
.pmv-tick[data-rel="-1"] {
  height: 8px;
  background: rgba(255, 255, 255, 0.55);
}

/* Current tick — gentle breathing pulse */
.pmv-tick[data-rel="0"] {
  height: 12px;
  background: var(--pmv-gold);
  animation: pmv-tick-breathe 2.4s ease-in-out infinite;
}

@keyframes pmv-tick-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Click ping — grows tall and settles to gold (communicates grab) */
.pmv-tick--ping {
  animation: pmv-tick-ping 380ms ease-out forwards !important;
}

@keyframes pmv-tick-ping {
  0%   { height: 6px;  background: rgba(255,255,255,0.4); }
  25%  { height: 20px; background: #fff; }
  100% { height: 12px; background: var(--pmv-gold); }
}

/* Fast-scrub: collapse ticks to streak */
#nhp-moviola.pmv--fast-scrub .pmv-tick {
  height: 3px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  animation: none !important;
  transition: height 100ms linear, background 100ms linear;
}

/* Counter */
.pmv-counter {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

/* ── Desktop close button ── */
.pmv-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9200;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  user-select: none;
  transition: color 200ms ease;
  line-height: 1;
}

.pmv-close:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* ════════════════════════════════════════════
   MOBILE OVERLAY (≤768px — own system)
════════════════════════════════════════════ */

/* Suppress desktop overlay on mobile */
@media (max-width: 768px) {
  #nhp-moviola { display: none !important; }
}

#nhp-moviola-mobile {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #080706;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#nhp-moviola-mobile[hidden] {
  display: none;
}

/* Film grain */
#nhp-moviola-mobile::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 1;
}

/* Position dock — counter + track, unified at bottom */
.pmv-m-dock {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: min(68vw, 260px);
  z-index: 9100;
}

.pmv-m-counter {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  height: 14px;
  position: relative;
}

.pmv-m-counter-inner {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  transition: transform 120ms ease-in, opacity 120ms ease-in;
}

/* Shuttle — fixed tick ruler, current position spikes */
.pmv-m-shuttle {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  cursor: pointer;
  touch-action: none;
  padding-top: 16px; /* fat hit area above ticks */
}

.pmv-m-tick {
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  transition: height 150ms ease, background 150ms ease;
  flex-shrink: 0;
}

.pmv-m-tick[data-rel="-2"],
.pmv-m-tick[data-rel="2"] {
  height: 7px;
  background: rgba(255, 255, 255, 0.38);
}

.pmv-m-tick[data-rel="-1"],
.pmv-m-tick[data-rel="1"] {
  height: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.pmv-m-tick[data-rel="0"] {
  height: 16px;
  background: var(--pmv-gold);
  animation: pmv-tick-breathe 2.4s ease-in-out infinite;
}

/* Fast scrub: collapse to streak */
#nhp-moviola-mobile.pmv--fast-scrub .pmv-m-tick {
  height: 3px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  animation: none !important;
  transition: height 100ms linear, background 100ms linear;
}

/* Warm glow overlay — fades in fast on fast-scrub, settles slow */
.pmv-m-warm-glow {
  position: absolute;
  inset: 0;
  background: rgba(255, 236, 190, 0);
  z-index: 9048;
  pointer-events: none;
  transition: background 600ms ease-out;
}

#nhp-moviola-mobile.pmv--fast-scrub .pmv-m-warm-glow {
  background: rgba(255, 236, 190, 0.09);
  transition: background 120ms linear;
}


/* Close button */
.pmv-m-close {
  position: absolute;
  top: 0; right: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.35);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 9200;
  transition: color 200ms ease;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.pmv-m-close:active {
  color: rgba(255, 255, 255, 0.85);
}

/* Image wrapper — fills between progress bar and counter */
.pmv-m-img-wrap {
  position: absolute;
  inset: 2px 0 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 0; /* top: clear close button; sides: breathing room */
  z-index: 9050;
}

.pmv-m-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Counter */
.pmv-m-counter {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 9100;
}

/* Mobile nav arrows */
.pmv-m-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.45);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 9200;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease;
  line-height: 1;
  letter-spacing: -0.05em;
}

.pmv-m-nav:active {
  color: rgba(255, 255, 255, 0.9);
}

.pmv-m-nav--prev { left: 0; }
.pmv-m-nav--next { right: 0; }
