/* fx/transitions.css — page transitions (owned by fx/transitions.js). See fx/README.md. */

/* ---- Leave: a white layer fades in (transitions.js adds .is-white), then the browser navigates ----------------- */
.fx-tx-fade {
  position: fixed;
  inset: 0;
  z-index: var(--fx-z-transition, 100);
  pointer-events: none;
  background: #fff;
  opacity: 0;
  transition: opacity 220ms ease-out;   /* FADE_OUT_MS in transitions.js */
}

.fx-tx-fade.is-white { opacity: 1; }

/* ---- Arrive: the same white from the very first paint (fx/prepaint.js sets html.fx-tx-cover) --------------------
   transitions.js fades it out (html.fx-tx-out) once the web font is ready and fires krisha:arrive in the same task;
   the collage fades in underneath (scroll-reveal.js). If no script ever runs, the failsafe fades it after 1.2s.
   pointer-events: none so it can never trap a click. */
html.fx-tx-cover::after {
  content: '';
  position: fixed;
  inset: 0;
  height: 100lvh;
  z-index: var(--fx-z-transition, 100);
  background: #fff;
  pointer-events: none;
  animation: fx-tx-fade-out 320ms ease-out 1.2s forwards;
}

html.fx-tx-cover.fx-tx-out::after {
  animation: fx-tx-fade-out 320ms ease-out forwards;   /* FADE_IN_MS in transitions.js */
}

@keyframes fx-tx-fade-out {
  to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  html.fx-tx-cover::after,
  .fx-tx-fade { display: none !important; }
}

/* ---- Grow: a creative tile morphs into its project's hero (cross-document View Transitions) ----------------------
   OFF (GROW = false in transitions.js): the @view-transition opt-in below is commented out, so these rules are dormant.
   To switch back on, restore it and set GROW = true. The old tile gets view-transition-name: fx-grow inline on click. */
/* @media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } } */

html:active-view-transition-type(fx-grow) .pralaya-hero,
html:active-view-transition-type(fx-grow) .ahlan-hero,
html:active-view-transition-type(fx-grow) .talisman-hero,
html:active-view-transition-type(fx-grow) .wwyfm-bg,
html:active-view-transition-type(fx-grow) .wardi-bg,
/* the hub is also a grow source (both covers): name its hero only while arriving, never in the old document */
html.fx-tx-grow:active-view-transition-type(fx-grow) .sec-hub__issue--00 .sec-hub__cover,
html:active-view-transition-type(fx-grow) .sec-issue__cover {
  view-transition-name: fx-grow;
}

/* GROW_MS = 760ms (also in transitions.js) */
html:active-view-transition-type(fx-grow)::view-transition-group(*) {
  animation-duration: 760ms;
  animation-timing-function: var(--fx-ease-in-out, cubic-bezier(0.65, 0, 0.35, 1));
}

/* Tile and hero have different shapes: crop both to the morphing box instead of stretching. No cross-fade: the tile
   holds underneath, and the arriving hero — transparent until scroll-reveal.js draws its first coarse pass (the
   live new snapshot) — covers it and refines inside the morph. */
html:active-view-transition-type(fx-grow)::view-transition-old(fx-grow),
html:active-view-transition-type(fx-grow)::view-transition-new(fx-grow) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  overflow: clip;
  animation: none;
  mix-blend-mode: normal;
}

/* The new page cuts in at once under the morph: no line-open, no fade. */
html:active-view-transition-type(fx-grow)::view-transition-old(root),
html:active-view-transition-type(fx-grow)::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
