/* PlugTrust motion, v2.0.0
   One vocabulary, borrowed from a terminal coming online: labels are typed,
   headings rise word by word, text resolves out of a blur, short titles
   decode, rows arrive in turn, lines draw, the steps light up as you scroll.

   Every hidden starting state lives under html.pt-m, a class the script adds
   only when the visitor has not asked for reduced motion. Without the script,
   or with reduced motion, all content is simply visible.

   Classes (templates, or Advanced → Additional CSS class(es) in the editor):
     pt-rule      the hairline along its top edge draws in (the theme draws the line)
     pt-label     small label: typed out
     pt-heading   plain-text heading: words rise into place
     pt-fade      paragraph: resolves out of a blur
     pt-stagger   list or group: its items arrive one after another
     pt-decode    short title: decodes from random characters
     pt-cta       buttons: arrive last
     pt-steps     numbered steps: markers light up and the line fills from one to the next as you scroll
     pt-header    site header: firmer once the page scrolls
*/

:root {
  --pt-accent: #0affff;
  --pt-accent-2: #a78bfa;
  --pt-ease: cubic-bezier(0.2, 0.75, 0.1, 1);
  --pt-draw: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Reading progress */
.pt-progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  .pt-m .pt-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: 1px;
    background: linear-gradient(90deg, var(--pt-accent-2), var(--pt-accent));
    box-shadow: 0 0 8px var(--pt-accent);
    transform-origin: left;
    pointer-events: none;
    animation: pt-grow-x linear both;
    animation-timeline: scroll(root);
  }
}

.pt-m .pt-header::before {
  transition: background-color 0.3s ease-out;
}

.pt-m .pt-header.pt-scrolled::before {
  background-color: rgb(11 12 14 / 0.92);
}

/* Hairlines draw */
.pt-m .pt-rule::before {
  transform: scaleX(0);
  transition: transform 1.2s var(--pt-draw);
}

.pt-m .pt-rule.pt-in::before {
  transform: none;
}

/* Labels are typed out. Clipped only until revealed: the clip must not stay,
   or it would cut the focus outline of a link inside the label. */
.pt-m .pt-label:not(.pt-in) {
  clip-path: inset(0 100% 0 0);
}

.pt-m .pt-label.pt-in {
  animation: pt-type calc(var(--n, 16) * 28ms) steps(var(--n, 16), end) 0.1s backwards;
}

/* Headings: words rise out of a mask, one after another */
.pt-m .pt-heading .pt-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.pt-m .pt-heading .pt-c {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 0.9s var(--pt-ease) calc(0.15s + var(--i, 0) * 45ms);
}

.pt-m .pt-heading.pt-in .pt-c {
  transform: none;
}

/* Text resolves out of a blur */
.pt-m .pt-fade {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(0.75rem);
  transition:
    opacity 0.8s ease-out 0.25s,
    filter 0.8s ease-out 0.25s,
    transform 0.9s var(--pt-ease) 0.25s;
}

.pt-m .pt-fade.pt-in {
  opacity: 1;
  filter: none;
  transform: none;
}

/* Groups: items arrive in turn (long lists stop adding delay after eight).
   A keyframe animation, not a transition, so the items keep their own hover
   transitions. */
.pt-m .pt-stagger:not(.pt-in) > * {
  opacity: 0;
}

.pt-m .pt-stagger.pt-in > * {
  animation: pt-rise 0.9s var(--pt-ease) calc(0.2s + min(var(--c, 0), 8) * 80ms) backwards;
}

/* Decoding titles: the real text stays readable to screen readers. */
.pt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons arrive last */
.pt-m .pt-cta {
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity 0.6s ease-out 0.45s,
    transform 0.8s var(--pt-ease) 0.45s;
}

.pt-m .pt-cta.pt-in {
  opacity: 1;
  transform: none;
}

/* Steps: the text stays still; each marker lights up and the line fills on to
   the next one as you scroll. The script eases --pt-p (0 to 1, how far the
   group has scrolled) towards the scroll position, so the line glides rather
   than jumps; --pt-n is the number of steps and --c each step's index. Each
   step fills its own stretch of the line in turn; its marker lights as the
   fill reaches it. Stacked (phones) the line runs down, in a row (wide
   screens, the theme's 60rem breakpoint) across. */
.pt-m .pt-steps > * {
  --pt-fill: clamp(0, var(--pt-p, 0) * var(--pt-n, 1) - var(--c, 0), 1);
  --pt-lit: clamp(0, (var(--pt-p, 0) * var(--pt-n, 1) - var(--c, 0)) * 4 + 0.2, 1);
}

.pt-m .pt-steps > *::before {
  background-color: color-mix(in srgb, var(--pt-accent) calc(var(--pt-lit) * 100%), var(--bg, #0b0c0e));
  box-shadow: 0 0 calc(var(--pt-lit) * 14px) color-mix(in srgb, var(--pt-accent) calc(var(--pt-lit) * 100%), transparent);
  transition: none;
}

.pt-m .pt-steps > *::after {
  background-size: 100% calc(var(--pt-fill) * 100%);
}

@media (min-width: 60rem) {
  .pt-m .pt-steps > *::after {
    background-size: calc(var(--pt-fill) * 100%) 100%;
  }
}

/* Printing: everything visible, wherever the reader had scrolled to. */
@media print {
  .pt-m .pt-label,
  .pt-m .pt-fade,
  .pt-m .pt-cta,
  .pt-m .pt-stagger > *,
  .pt-m .pt-steps > *,
  .pt-m .pt-heading .pt-c,
  .pt-m .pt-rule::before {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    clip-path: none !important;
    animation: none !important;
  }

  .pt-progress {
    display: none !important;
  }

  .pt-m .pt-steps > * {
    --pt-fill: 1;
    --pt-lit: 1;
  }
}

@keyframes pt-rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
}

@keyframes pt-grow-x {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes pt-type {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

