/* motion.css — transition classes + reduced-motion contract.
   P1: static foundations only. P5 adds the choreography hooks; everything here
   must degrade to instant/short states under prefers-reduced-motion. */

.method-page { }
.method-section { padding: var(--s-6) var(--margin); border-bottom: 1px solid var(--rule); }
.method-section h3 { font-size: var(--t-sub); margin-bottom: var(--s-3); }
.method-section h3 .num { color: var(--signal); font-size: .6em; vertical-align: .35em; margin-right: .4em; }
.method-section p { margin-bottom: var(--s-2); }
.tier-list { display: grid; gap: var(--s-2); max-width: 46rem; }
.tier { display: grid; grid-template-columns: 8.5rem 1fr; gap: var(--s-2); align-items: start; }
.tier dd { font-size: var(--t-caption); color: var(--ink-muted); }
.formula {
  border: 1px solid var(--rule-strong);
  padding: var(--s-2) var(--s-3);
  font-size: .875rem;
  background: var(--paper-high);
  max-width: 46rem;
}

/* ---- route entrance: one leading motion per change ----
   A pure CSS keyframe animation (compositor-driven) so content is NEVER left
   invisible waiting on a throttled requestAnimationFrame. `both` fill keeps the
   final visible state; the whole thing is a no-op under reduced motion. */
.route-enter { animation: routeEnter var(--d-change) var(--ease-out) both; }
@keyframes routeEnter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
/* the dossier fades only, never translates: the plate performs its own reveal
   (see stagePlateIn below), so the container must not move underneath it */
.dossier.route-enter { animation-name: routeEnterFade; }
@keyframes routeEnterFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .route-enter { animation: none; }
}

/* ---- dossier: the plate reveals FIRST, then the content arrives ----
   Everything except the stage plate is held back while the plate wipes itself
   in, so the eye follows one thing at a time instead of reading a page that
   assembled all at once. One CSS animation does it: `both` fill holds the
   hidden state through the 600ms delay, then fades the content up and KEEPS the
   visible state. Self-completing and compositor-driven — no JS timer decides
   whether the content becomes visible, so a throttled or hidden surface can
   never strand the dossier at opacity 0 (the rule the letter reveal follows).
   Layout is untouched: opacity/transform only, so the plate never shifts. */
.dossier.stage-lead > :not(.dossier-stage),
.dossier.stage-lead .dossier-stage > :not(.stage-frame) {
  animation: dossierContentIn var(--d-change) var(--ease-out) var(--d-stage-cue) both;
}
/* opacity ONLY. The blocks inside carry the movement (.lift), so translating
   the container as well made the whole first screen move twice — a muddy,
   double-shifted arrival instead of one calm fade with content rising in it. */
@keyframes dossierContentIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  /* never hold content back when motion is reduced (no flip runs either) */
  .dossier.stage-lead > :not(.dossier-stage),
  .dossier.stage-lead .dossier-stage > :not(.stage-frame),
  .dossier.stage-lead .stage-img,
  .dossier.stage-lead .stage-canvas { animation: none; }
}

/* ---- dossier plate: an elegant self-reveal ----
   The old FLIP flew a copy of the reel thumbnail across the screen onto the
   stage. With the dossier image already visible underneath, the eye read two
   copies of the same picture sliding over each other — it looked like a glitch,
   not a transition. The thumbnail now stays put and the dossier's OWN plate
   introduces itself: a top-to-bottom wipe with the image settling out of a
   slight overscale. Self-completing (`both` fill), compositor-only properties,
   and it looks identical however the visitor arrived. */
.dossier.stage-lead .stage-img,
.dossier.stage-lead .stage-canvas {
  animation: stagePlateIn var(--d-open) var(--ease-strong) both;
}
@keyframes stagePlateIn {
  from { clip-path: inset(0 0 100% 0); transform: scale(1.06); }
  to   { clip-path: inset(0 0 0 0);    transform: none; }
}

/* ---- search overlay reveal ---- */
.search-overlay { transition: opacity var(--d-label) var(--ease-out); }
.search-overlay[hidden] { display: grid !important; opacity: 0; pointer-events: none; visibility: hidden; }
.search-overlay:not([hidden]) { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
