/* Layered parallax — CSS scroll-driven animations, no JavaScript.
   Each layer sets --lag (0 = moves with the page, 1 = stays still). */

.px-hero {
  position: relative;
  height: 100svh;
  overflow: clip;
  background: linear-gradient(#24120c, #6e2f1b 55%, #c4552e);
  view-timeline: --px-hero block;
}

.px-layer,
.px-title {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.px-title {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 0 24px 18vh;
  text-align: center;
}
.px-title h1 {
  margin: 0;
  max-width: 12ch;
  font: 700 clamp(48px, 8vw, 112px)/0.98 var(--font-display, system-ui, sans-serif);
  letter-spacing: -0.035em;
  color: #fff3ea;
}
.px-title .demo-note { color: #ffd2b8; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .px-layer,
    .px-title {
      will-change: transform;
      animation: px-sink linear both;
      animation-timeline: --px-hero;
      animation-range: exit 0% exit 100%;
    }
    .px-title { animation-name: px-sink, px-fade; }
  }
}

/* While the header scrolls up by 100svh, push a layer down by --lag of that. */
@keyframes px-sink {
  to { transform: translateY(calc(var(--lag) * 100svh)); }
}
@keyframes px-fade {
  60%, 100% { opacity: 0; }
}

/* Reduced motion or no support: the same scene, standing still. */

/* demo content */
.px-content {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: 96px 28px 60vh;
  color: var(--muted, #9c9488);
  font-size: 18px;
}
.px-content h2 {
  margin: 0 0 20px;
  color: var(--text, #f0ebe2);
  font: 700 44px/1 var(--font-display, system-ui, sans-serif);
  letter-spacing: -0.025em;
}
.px-content code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.9em; color: var(--text, #f0ebe2); }
