/* Interactive experience (html.experience, set before first paint). */

.experience,
.experience body {
  height: 100%;
  overflow: hidden;
}

/* v19 (iOS Safari): no position:fixed layers touching the screen edges. Safari 26 fills its
   status-bar / toolbar areas with the flat colour of such layers; with absolute layers in a
   non-scrolling full-height body it shows the page (html background image) behind the bars. */
.experience body {
  position: relative;
}
.experience .backdrop {
  position: absolute;
}

.experience body {
  overscroll-behavior: none;
  touch-action: none; /* the stage owns touch while the story plays */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.experience.is-invite body {
  touch-action: manipulation;
  -webkit-user-select: auto;
  user-select: auto;
}

.experience .backdrop__grain {
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

.experience .stage {
  display: block;
  position: absolute; /* v19: was fixed (iOS bar tint) */
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* hero: fixed, centred, fades in during STILL */
.experience .hero {
  position: absolute; /* v19: was fixed (iOS bar tint) */
  inset: 0;
  z-index: 1;
  min-height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease-soft); /* short intro fade: input is live right away */
}

.experience.is-ready .hero {
  opacity: 1;
}

.experience .hero__tagline,
.experience .hero__meta {
  opacity: 0;
  transition: opacity 0.9s var(--ease-soft) 0.15s;
}

.experience.is-ready .hero__tagline,
.experience.is-ready .hero__meta {
  opacity: 1;
}

.experience.is-resolving .hero {
  opacity: 0;
  transition: opacity 1.2s var(--ease-soft) 0.6s;
}

.experience.is-solo .hero {
  display: none;
}

.experience .char {
  will-change: transform, opacity;
}

/*
 * Resolution layout: one centred column (manifesto block, a clear gap, signup).
 * The signup always occupies its space (invisible until the invitation), so the
 * manifesto never moves when the signup fades in below it.
 */
.experience .page {
  position: absolute; /* v19: was fixed (iOS bar tint) */
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--gutter);
  pointer-events: none;
  z-index: 3; /* above the stage canvas so drifting pixels never cross the form / consent panel */
}

/*
 * manifesto: written by the particles line by line and it STAYS in pixels
 * (canvas, see js/manifesto.js). The DOM rows only reserve layout; the text
 * is read by assistive tech from the .sr-only copy inside each line.
 */
.experience .manifesto {
  position: relative;
  z-index: 3;
  padding: 0;
  pointer-events: none;
}

.experience .manifesto__line {
  margin: 0;
}

.experience .manifesto__rows {
  visibility: hidden;
}

/* never paint the DOM text in the experience (not even before js/manifesto.js has
   split it on boot): html.experience is set in <head> before the first paint */
.experience .manifesto__line {
  color: transparent;
}

/* invitation: fades in below the manifesto, nothing else moves */
.experience .signup {
  position: relative;
  z-index: 4;
  width: 100%;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s var(--ease-soft);
}

.experience.is-invite .signup {
  opacity: 1;
  pointer-events: auto;
}

.experience .signup__mark {
  position: fixed; /* stays fixed: sits below the top edge, so it doesn't tint Safari's bars */
  top: max(1.25rem, 5vh);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0 var(--gutter);
}

.experience .signup__name {
  font-size: clamp(1rem, 1.35vw, 1.3rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
}

/* v9: place · date on one compact line again (as in v6); the hero keeps two lines */
.experience .signup__meta {
  font-size: var(--fs-meta);
  line-height: 1.2;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: var(--track-meta);
  margin-right: calc(-1 * var(--track-meta)); /* optically centre tracked caps */
  color: rgba(var(--c-paper-rgb), 0.8); /* v11: was --c-paper-dim (0.66); sits over the lighter texture */
}

@media (max-width: 26rem) {
  .experience .signup__meta {
    letter-spacing: 0.18em; /* one line on narrow phones */
    margin-right: -0.18em;
  }
}

.experience .signup__form {
  width: min(28rem, 100%);
  transform: translateY(0.6rem);
  transition: transform 1.4s var(--ease-out);
}

.experience.is-invite .signup__form {
  transform: none;
}

.experience .signup.is-subscribed .signup__form {
  display: flex;
  visibility: hidden; /* keep its space so nothing shifts */
}

.experience .signup__status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  animation: fade-in 1.2s var(--ease-soft) both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Invitation: KNOW breathes between solid type and pixels; a light    */
/* scan runs along the pixel underline. Both calm down on focus/text.  */
/* ------------------------------------------------------------------ */

.experience .signup__know::after {
  content: attr(data-text) / "";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--c-paper);
  opacity: 0;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(90deg, #000 2px, transparent 0) 0 0 / 3px 3px,
    linear-gradient(#000 2px, transparent 0) 0 0 / 3px 3px;
  -webkit-mask-composite: source-in;
  mask:
    linear-gradient(90deg, #000 2px, transparent 0) 0 0 / 3px 3px,
    linear-gradient(#000 2px, transparent 0) 0 0 / 3px 3px;
  mask-composite: intersect;
}

.experience.is-invite .signup__know {
  animation: know-type 3.6s var(--ease-soft) 1.4s infinite;
}

.experience.is-invite .signup__know::after {
  animation: know-pixels 3.6s var(--ease-soft) 1.4s infinite;
}

/* colour (not opacity) so the pixel ::after is not faded along with the solid type */
@keyframes know-type {
  0%, 100% { color: var(--c-paper); text-shadow: 0 0 14px rgba(var(--c-paper-rgb), 0.28); }
  50% { color: rgba(var(--c-paper-rgb), 0.16); text-shadow: 0 0 14px rgba(var(--c-paper-rgb), 0); }
}

@keyframes know-pixels {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.experience.is-invite .signup__pixels::before {
  animation: pixels-breathe 3.6s var(--ease-soft) 1.4s infinite;
}

.experience.is-invite .signup__pixels::after {
  animation: pixels-scan 3.6s linear 1.4s infinite;
}

@keyframes pixels-breathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.26; }
}

/* a bright band of pixels travels along the line once per breath, right after KNOW peaks */
@keyframes pixels-scan {
  0% { opacity: 1; -webkit-mask-position: -40% 0; mask-position: -40% 0; }
  46% { opacity: 1; -webkit-mask-position: 140% 0; mask-position: 140% 0; }
  47%, 100% { opacity: 0; -webkit-mask-position: 140% 0; mask-position: 140% 0; }
}

/* calm once the visitor is in the field or has typed */
.experience .signup__field:focus-within .signup__pixels::before,
.experience .signup__field:focus-within .signup__pixels::after,
.experience .signup__input:not(:placeholder-shown) ~ .signup__pixels::before,
.experience .signup__input:not(:placeholder-shown) ~ .signup__pixels::after,
.experience .signup.is-consenting .signup__know,
.experience .signup.is-consenting .signup__know::after,
.experience .signup__form:focus-within .signup__know,
.experience .signup__form:focus-within .signup__know::after {
  animation: none;
}

.experience .signup__field:focus-within .signup__pixels,
.experience .signup__input:not(:placeholder-shown) ~ .signup__pixels {
  opacity: 0;
}
