/* Scope the entrance animation to elements registered by the home page. */
[data-section-motion].reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

[data-section-motion] {
  --section-motion-offset: 38px;
  --section-motion-duration: 1500ms;
  --section-motion-wait: 0ms;
  --section-motion-delay: 0ms;
}

@media (min-width: 991px) and (hover: hover) and (pointer: fine) {
  [data-section-motion] {
    --section-motion-wait: 500ms;
  }
}

[data-section-motion="heading"] {
  --section-motion-offset: 46px;
  --section-motion-duration: 1650ms;
}

[data-section-motion="gallery"] {
  --section-motion-offset: 48px;
  --section-motion-duration: 1750ms;
}

[data-section-motion="strip"] {
  --section-motion-offset: 26px;
}

[data-section-motion][data-motion-pending]:not(:focus-within) {
  opacity: 0;
}

[data-motion-entered]:not(:focus-within) {
  animation: section-motion-enter var(--section-motion-duration)
    cubic-bezier(.30, .38, .32, 1)
    calc(var(--section-motion-wait) + var(--section-motion-delay)) backwards;
}

@keyframes section-motion-enter {
  from { opacity: 0; transform: translateY(var(--section-motion-offset)); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  [data-section-motion] {
    --section-motion-offset: 8px;
  }

  /* Use a small movement even when the legacy reveal transform is disabled. */
  [data-motion-entered]:not(:focus-within) {
    animation-name: section-motion-gentle;
    animation-duration: 480ms !important;
    animation-delay: var(--section-motion-wait);
  }
}

@keyframes section-motion-gentle {
  from { translate: 0 var(--section-motion-offset); }
  to { translate: 0 0; }
}

@media print {
  [data-section-motion] {
    animation: none !important;
    opacity: 1 !important;
  }
}

/* Headings use a directional reveal, independent of the section fade. */
.heading-wipe__line {
  display: inline-block;
  max-inline-size: 100%;
  vertical-align: top;
}

.hero-name .heading-wipe__line {
  align-self: flex-start;
}

.hero-name .heading-wipe__text {
  display: inline;
}

.works-full-bleed .section-headline h2 :is(.heading-wipe__line, .heading-wipe__text) {
  color: inherit !important;
}

.toolkit-header h2 :is(.heading-wipe__line, .heading-wipe__text) {
  color: inherit;
}

.heading-wipe[data-motion-entered] {
  animation: none;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .heading-wipe[data-motion-entered] .heading-wipe__line {
    --wipe-duration: 1050ms;
    --wipe-stagger: 0ms;
    --wipe-delay: calc(var(--section-motion-wait) + var(--section-motion-delay) + var(--wipe-stagger));
    position: relative;
  }

  .heading-wipe[data-motion-entered] .heading-wipe__line:nth-of-type(2) {
    --wipe-stagger: 150ms;
  }

  .heading-wipe[data-motion-entered] .heading-wipe__line:nth-of-type(3) {
    --wipe-stagger: 300ms;
  }

  .heading-wipe[data-motion-entered] .heading-wipe__line::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--marker-yellow, #ffe240);
    pointer-events: none;
    animation: heading-wipe-block var(--wipe-duration)
      cubic-bezier(.65, 0, .3, 1) var(--wipe-delay) both;
  }

  .heading-wipe[data-motion-entered] .heading-wipe__text {
    animation: heading-wipe-text var(--wipe-duration) steps(1, end) var(--wipe-delay) both;
  }
}

@keyframes heading-wipe-block {
  0% { clip-path: inset(0 100% 0 0); }
  46%, 55% { clip-path: inset(0); }
  100% { clip-path: inset(0 0 0 100%); }
}

@keyframes heading-wipe-text {
  0% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce), print {
  .heading-wipe[data-motion-pending], .heading-wipe[data-motion-entered] {
    opacity: 1 !important;
    animation: none !important;
  }
}
