/* Gentle entrances replay on re-entry. The resting state is always the readable state. */
@media (prefers-reduced-motion: no-preference) {
  body.has-motion {
    --entry-ease: cubic-bezier(.18,.66,.24,1);
    --entry-distance: 9px;
    --entry-time: 560ms;
    --entry-alpha: .48;
  }

  body.has-motion [data-motion],
  body.has-motion [data-motion].is-inview,
  body.has-motion [data-motion]:focus-within {
    opacity: 1;
    translate: none;
    clip-path: none;
    transition-property: color, background-color, border-color, box-shadow;
    transition-duration: .24s;
    transition-delay: 0s;
  }

  body.has-motion [data-motion="meta"] { --entry-distance: 4px; --entry-time: 420ms; }
  body.has-motion [data-motion="title"] { --entry-distance: 13px; --entry-time: 780ms; --entry-alpha: .56; }
  body.has-motion [data-motion="card"] { --entry-distance: 12px; --entry-time: 640ms; --entry-alpha: .54; }
  body.has-motion [data-motion="portrait"] { --entry-distance: 8px; --entry-time: 810ms; --entry-alpha: .63; }
  body.has-motion [data-motion="surface"] { --entry-distance: 0px; --entry-alpha: .81; }
  body.has-motion [data-motion].motion-observed:not(.is-inview):not(:focus-within) {
    opacity: var(--entry-alpha);
    translate: 0 var(--entry-distance);
  }
  body.has-motion [data-motion].is-inview {
    animation: aldem-entry var(--entry-time) var(--entry-ease) var(--entry-delay,var(--motion-delay,0ms)) backwards;
  }
  body.has-motion [data-motion="title"].is-inview { animation-name: aldem-title; }

  /* Single-plane exposure change on editorial photographs as their panels enter. */
  @supports (animation-timeline: view()) {
    body.has-motion :is(.op-portrait,.journal-cover figure) img {
      animation: aldem-print linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 42%;
    }
  }
  body.has-motion :is(.faq-list,.op-faq-group) details[open] > :not(summary) {
    animation: aldem-answer 280ms var(--entry-ease);
  }
  body.has-motion [data-motion]:focus-within {
    animation: none;
    opacity: 1;
    translate: none;
  }
  @media (max-width: 800px) {
    body.has-motion { --entry-distance: 5px; --entry-time: 460ms; }
    body.has-motion [data-motion="title"] { --entry-distance: 8px; --entry-time: 610ms; }
    body.has-motion [data-motion="card"] { --entry-distance: 7px; --entry-time: 490ms; }
    body.has-motion [data-motion="portrait"] { --entry-distance: 5px; --entry-time: 600ms; }
  }
}

@keyframes aldem-entry {
  from { opacity: var(--entry-alpha); translate: 0 var(--entry-distance); }
  to { opacity: 1; translate: 0 0; }
}
@keyframes aldem-title {
  from { opacity: var(--entry-alpha); translate: 0 var(--entry-distance); clip-path: inset(-.2em -.12em 17%); }
  to { opacity: 1; translate: 0 0; clip-path: inset(-.2em -.12em -.2em); }
}
@keyframes aldem-print { from { opacity: .80; } to { opacity: 1; } }
@keyframes aldem-answer { from { opacity: .65; } to { opacity: 1; } }

@media print {
  body.has-motion [data-motion] {
    animation: none !important; transition: none !important;
    opacity: 1 !important; translate: none !important; clip-path: none !important;
  }
}
