/* PhotoPieces v2.0 - shared scroll-reveal styles (ruling R11).
   Loaded on EVERY page (index.html, library.html, and every content page via
   ../css/reveal.css). Content pages do not load styles.css, so this file is
   self-contained: it needs no color tokens (reveal is opacity/translate only)
   and never assumes any other stylesheet is present.

   Safety contract: an element only gets the hidden start state while BOTH
   (a) html carries .pp-reveal-ready (set by js/reveal.js after it confirms
   IntersectionObserver exists and the visitor has not asked for reduced
   motion) AND (b) the element itself carries .pp-reveal (added by that same
   script, per element, right before it starts observing it). If js/reveal.js
   never runs, throws, or is blocked, neither class is ever added, no rule
   below matches anything, and every element stays exactly as authored -
   fully visible. Content can never be hidden by a script failure.

   Why the standalone `translate` property, not `transform: translateY()`:
   two reveal targets (.gallery-item, .library-card) already have their own
   `transform: translateY(-Npx)` hover-lift in styles.css/library.css. A
   second `transform` declaration on the same element does not compose with
   that one - only one wins - which would permanently break either the
   reveal or the hover effect depending on specificity/load order. The
   standalone translate/rotate/scale properties (Baseline since 2021) apply
   independently of `transform` and compose with it, so both effects work
   together with no page-specific special-casing needed here. */

:root {
  --pp-reveal-duration: 440ms;
  --pp-reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pp-reveal-distance: 16px;
}

html.pp-reveal-ready .pp-reveal {
  opacity: 0;
  translate: 0 var(--pp-reveal-distance);
  transition: opacity var(--pp-reveal-duration) var(--pp-reveal-ease),
              translate var(--pp-reveal-duration) var(--pp-reveal-ease);
  transition-delay: var(--pp-reveal-delay, 0ms);
}

html.pp-reveal-ready .pp-reveal.pp-revealed {
  opacity: 1;
  translate: 0 0;
}

/* Fallback for browsers without the standalone translate property (pre-2021
   engines). Narrower trade-off: only in this legacy path could the reveal
   transform and a host page's own hover transform collide. */
@supports not (translate: 0px) {
  html.pp-reveal-ready .pp-reveal {
    transform: translateY(var(--pp-reveal-distance));
    transition: opacity var(--pp-reveal-duration) var(--pp-reveal-ease),
                transform var(--pp-reveal-duration) var(--pp-reveal-ease);
  }
  html.pp-reveal-ready .pp-reveal.pp-revealed {
    transform: translateY(0);
  }
}

/* Landing-only hero parallax. js/reveal.js sets this inline on scroll; it
   never touches a .pp-reveal element (the hero itself is not one), so it
   never needs to compose with the rules above. */
.pp-parallax {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  /* Belt-and-braces: js/reveal.js already refuses to add pp-reveal-ready at
     all when reduced motion is on, so this rule should rarely be needed, but
     it costs nothing to also neutralise it here in case styles ever load in
     an order where that matters. */
  html.pp-reveal-ready .pp-reveal {
    opacity: 1 !important;
    translate: none !important;
    transform: none !important;
    transition: none !important;
  }
  .pp-parallax {
    transform: none !important;
  }
}
