/* ==========================================================================
   Editorial Parallax Slide Page Transitions
   ClusterNZS — High-End Magazine Navigation Engine
   ========================================================================== */

:root {
  --ps-ease-track: cubic-bezier(0.76, 0, 0.24, 1);
  --ps-ease-odometer: cubic-bezier(0.22, 1, 0.36, 1);
  --ps-ease-depth: cubic-bezier(0.16, 1, 0.3, 1);
  --ps-ease-pill: cubic-bezier(0.16, 1, 0.3, 1);
  --ps-track-duration: 1100ms;
  --ps-depth-duration: 1150ms;
  --ps-stagger-base: 120ms;
  --ps-stagger-step: 140ms;
}

/* ---------- Viewport & Horizontal Track ---------- */
.ps-viewport {
  position: relative;
  width: 100%;
  flex: 1 0 auto;
  min-height: 0;
  overflow-x: clip;
  overflow-y: visible;
  background: transparent;
}

.ps-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
  transform: none;
  will-change: auto;
}

.ps-track.is-animating {
  will-change: transform;
}

.ps-track.animate-track {
  transition: transform var(--ps-track-duration) var(--ps-ease-track);
}

/* Individual slide */
.ps-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
  position: relative;
}

/* ---------- Fixed Magazine Navigation Chrome & Counter ---------- */
.ps-indicator-strip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  color: var(--muted);
  user-select: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

[data-theme="light"] .ps-indicator-strip {
  background: #faf7f0;
  border-color: rgba(160, 110, 35, 0.20);
  color: var(--muted);
}

/* Pill Indicator Morph (56x22 -> 22x22 -> 56x22) */
.ps-pill-indicator {
  position: relative;
  width: 56px;
  height: 22px;
  border-radius: 11px;
  border: 1.5px solid var(--accent, #b8860b);
  background: rgba(184, 134, 45, 0.12);
  transition: width 400ms var(--ps-ease-pill), background 300ms ease, border-color 300ms ease;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-pill-indicator::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #b8860b);
  box-shadow: 0 0 8px var(--accent, #b8860b);
  transition: transform 300ms ease;
}

.ps-pill-indicator.is-morphing {
  width: 22px !important;
  background: var(--accent, #b8860b) !important;
}

.ps-pill-indicator.is-morphing::after {
  background: #ffffff !important;
  box-shadow: none;
}

/* Odometer Roll Counter (0-350ms) */
.ps-odometer {
  position: relative;
  display: inline-block;
  height: 18px;
  line-height: 18px;
  overflow: hidden;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

.ps-odometer-slot {
  display: block;
  height: 18px;
  line-height: 18px;
  transition: transform 350ms var(--ps-ease-odometer);
  will-change: transform;
}

.ps-odometer-roll-forward .ps-odometer-slot.curr {
  transform: translateY(-100%);
}
.ps-odometer-roll-forward .ps-odometer-slot.next {
  transform: translateY(-100%);
}

.ps-odometer-roll-backward .ps-odometer-slot.curr {
  transform: translateY(100%);
}
.ps-odometer-roll-backward .ps-odometer-slot.next {
  transform: translateY(100%);
}

.ps-label-roll {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold, #d97706);
  font-weight: 600;
}

/* ---------- Layered Parallax Element Depths ---------- */
[data-depth] {
  transform: translate3d(0, 0, 0);
  transition-property: transform, opacity;
  transition-timing-function: var(--ps-ease-depth);
  will-change: auto;
}

.ps-animating [data-depth] {
  will-change: transform, opacity;
}

/* Incoming animation states */
.ps-incoming-forward [data-depth] {
  transform: translate3d(calc(var(--depth, 0.8) * 22vw), 0, 0);
  opacity: 0.88;
}

.ps-incoming-backward [data-depth] {
  transform: translate3d(calc(var(--depth, 0.8) * -22vw), 0, 0);
  opacity: 0.88;
}

/* Settling animation (applied during slide) */
.ps-settle [data-depth] {
  transform: translate3d(0, 0, 0) !important;
  opacity: 1 !important;
  transition-duration: var(--ps-depth-duration) !important;
  transition-delay: calc(var(--ps-stagger-base) + (var(--depth, 0.8) * var(--ps-stagger-step))) !important;
}

/* Outgoing animation states */
.ps-outgoing-forward [data-depth] {
  transform: translate3d(calc(var(--depth, 0.8) * -22vw), 0, 0) !important;
  opacity: 0.3 !important;
  transition-duration: var(--ps-depth-duration) !important;
}

.ps-outgoing-backward [data-depth] {
  transform: translate3d(calc(var(--depth, 0.8) * 22vw), 0, 0) !important;
  opacity: 0.3 !important;
  transition-duration: var(--ps-depth-duration) !important;
}

/* Depth 0.3: Soft decorative blobs & shapes (fade in 0 -> 1) */
[data-depth="0.3"] {
  --depth: 0.3;
}
.ps-incoming-forward [data-depth="0.3"],
.ps-incoming-backward [data-depth="0.3"] {
  opacity: 0;
}

/* Depth 0.6: Big Hero Headings */
[data-depth="0.6"] {
  --depth: 0.6;
}

/* Depth 0.8: Paragraphs, buttons, list items */
[data-depth="0.8"] {
  --depth: 0.8;
}

/* Depth 1.0: Cards, Images, Showcase Stages (arrive last) */
[data-depth="1.0"] {
  --depth: 1.0;
}

/* Editorial typography & layer accents */
.editorial-title {
  font-family: "Cinzel", "Playfair Display", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.editorial-backdrop-layer {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  opacity: 0.18;
}

[data-theme="light"] .editorial-backdrop-layer {
  opacity: 0.12;
}

/* ---------- Dedicated Showcase Slider (data-slider) ---------- */
.magazine-slider-container {
  position: relative;
  width: 100%;
  min-height: 82vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
}

.magazine-slide {
  position: relative;
  padding: 60px 0;
}

.magazine-slider-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .magazine-slider-controls {
  border-top-color: rgba(160, 110, 35, 0.18);
}

.magazine-slider-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.magazine-slider-btn:hover {
  background: var(--accent, #b8860b);
  color: #ffffff;
  border-color: var(--accent, #b8860b);
  transform: translateY(-2px);
}

[data-theme="light"] .magazine-slider-btn {
  background: #faf7f0;
  border-color: rgba(160, 110, 35, 0.25);
  color: #7a490d;
}

[data-theme="light"] .magazine-slider-btn:hover {
  background: #8a5310;
  color: #ffffff;
  border-color: #8a5310;
}

/* Screen reader announcement */
.ps-sr-announce {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Reduced-Motion Accessibility Fallback ---------- */
@media (prefers-reduced-motion: reduce) {
  .ps-track,
  .ps-slide,
  [data-depth] {
    transition: none !important;
    transform: none !important;
  }
  .ps-fade-cross {
    animation: psFadeCross 200ms ease forwards;
  }
  @keyframes psFadeCross {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}
