/* page-experiment-03 - extracted from the template so every rule
   lives in a .css file, enqueued conditionally in functions.php.
   Viola Cherchi, 2025-26 */

/* ============================================
   EXPERIMENT 03 - THE SCROLL THAT LIES
   ============================================ */

/* --- scroll runway: empty div that creates the scrollable height.
   All visible content is position:fixed and driven by JS. --- */
[data-scroll-runway] {
  height: 700vh;
  position: relative;
  pointer-events: none;
}

/* --- fixed viewport: holds all visible content --- */
[data-scroll-viewport] {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  transition: opacity 0.5s ease;
}

/* piece complete - release the fixed layer so the closing
   nav, explore grid, and footer underneath become visible
   and clickable again. JS toggles data-complete on <main>. */
[data-experiment="scroll"][data-complete] [data-scroll-viewport],
[data-experiment="scroll"][data-complete] [data-scroll-hud],
[data-experiment="scroll"][data-complete] [data-fake-progress] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* --- phase containers: each fills the viewport, stacked --- */
[data-phase] {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--s-xl) var(--s-m);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

[data-phase][data-active] {
  opacity: 1;
  pointer-events: auto;
}

/* --- text lines within phases --- */
[data-line] {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1rem + 3.5vw, 4.5rem);
  color: var(--off-white);
  line-height: 1.15;
  margin-block-end: var(--s-s);
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-line][data-visible] {
  opacity: 1;
  /* JS drives the per-phase drift via --line-y */
  transform: translateY(var(--line-y, 0px));
}

/* --- phase-specific styling --- */

/* SUSPICION: smaller, monospace annotation lines */
[data-phase="suspicion"] [data-line][data-annotation] {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  text-transform: none;
  letter-spacing: 0.05em;
}

/* REVERSAL: red text, disorient */
[data-phase="reversal"] [data-line] {
  color: var(--red-text);
}
[data-phase="reversal"] [data-line]:nth-child(even) {
  color: var(--off-white);
}

/* REBELLION: scattered word cloud */
[data-word] {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 0.5rem + 1.2vw, 1.6rem);
  color: var(--off-white);
  padding: var(--s-xs) var(--s-s);
  letter-spacing: 0.05em;
  white-space: nowrap;
  /* JS scatters the words by setting these custom properties */
  transform: translate(var(--word-x, 0px), var(--word-y, 0px))
             rotate(var(--word-r, 0deg));
  opacity: var(--word-o, 1);
  will-change: transform;
}

[data-phase="rebellion"] [data-subtitle] {
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--grey);
  max-inline-size: 50ch;
  line-height: 1.6;
  margin-block-start: var(--s-l);
  text-transform: none;
  /* fades in during the second half of the phase, via JS */
  opacity: var(--sub-o, 0);
  transition: opacity 0.8s ease;
}

/* TRUTH: stats and closing */
[data-stat] {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 0.5rem + 0.8vw, 1rem);
  color: var(--grey);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-block-end: var(--s-xs);
}
[data-stat] span {
  color: var(--red-text);
  font-weight: 700;
}
[data-final] {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 3vw, 5.5rem);
  color: var(--white);
  text-transform: uppercase;
  margin-block-start: var(--s-xl);
  line-height: 1;
}
[data-final-sub] {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.7rem + 1.5vw, 2.2rem);
  color: var(--grey);
  text-transform: uppercase;
  margin-block-start: var(--s-xs);
  line-height: 1;
}

/* --- HUD: top-right data overlay --- */
[data-scroll-hud] {
  position: fixed;
  top: var(--s-m);
  right: var(--s-m);
  z-index: 30;
  text-align: right;
  pointer-events: none;
}
[data-hud-phase] {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--scale-00);
  color: var(--red-text);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-block-end: 0.3em;
}
[data-hud-lies] {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--scale-000);
  color: var(--grey);
  letter-spacing: 0.1em;
}

/* --- fake progress bar: top of viewport --- */
[data-fake-progress] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--mid);
  z-index: 30;
  pointer-events: none;
}
[data-fake-bar] {
  height: 100%;
  /* the bar's dishonest width arrives from JS as --fake-w */
  width: var(--fake-w, 0%);
  background: var(--red);
  transition: background-color 0.4s;
}
[data-fake-bar][data-lying] {
  background: var(--cyan);
}

/* --- experiment nav --- */
[data-exp-nav] {
  position: fixed;
  bottom: var(--s-m);
  left: var(--s-m);
  right: var(--s-m);
  z-index: 30;
}

/* keep the fixed nav's right edge clear of the burger on phones */
@media (max-width: 640px) {
  [data-exp-nav] {
    right: calc(var(--s-l) + 4.25rem);
  }
}

/* --- reduced motion: show all content as a static narrative --- */
@media (prefers-reduced-motion: reduce) {
  [data-scroll-runway] { height: auto; }
  [data-scroll-viewport] { position: relative; }
  [data-phase] {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    min-height: 80vh;
    transition: none;
  }
  [data-line] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  [data-word] { transition: none; }
  [data-fake-progress],
  [data-scroll-hud] { display: none; }
  [data-exp-nav] { position: relative; display: flex; justify-content: center; padding: var(--s-xl); }
}
/* Manual toggle */
[data-reduced-motion] [data-scroll-runway] { height: auto; }
[data-reduced-motion] [data-scroll-viewport] { position: relative; }
[data-reduced-motion] [data-phase] {
  position: relative; opacity: 1; pointer-events: auto;
  min-height: 80vh; transition: none;
}
[data-reduced-motion] [data-line] { opacity: 1; transform: none; transition: none; }
[data-reduced-motion] [data-word] { transition: none; }
[data-reduced-motion] [data-fake-progress],
[data-reduced-motion] [data-scroll-hud] { display: none; }
[data-reduced-motion] [data-exp-nav] { position: relative; display: flex; justify-content: center; padding: var(--s-xl); }
