/* styles/scroll-fx.css - the scroll motion painted by scripts/scroll-fx.js.

   Almost all of the motion is the script's: it never hides anything before it is about to play,
   and without it every element is simply where the HTML put it. What lives here is the little
   the script needs from a stylesheet (the HTML-in-Canvas wrapper, the Dev caret), the one effect
   that is pure CSS (the Artsy progress line), and the print safety net.

   prefers-reduced-motion: reduce gets none of it. The script does not start at all, and the
   progress line is the only thing here that would move. */

/* ---- 1. THE HTML-IN-CANVAS WRAPPER -------------------------------------------------------
   A <canvas layoutsubtree content="drawable"> put inside a heading for as long as its effect
   runs, holding the heading's own children. Its size and the negative margin that lets ink and
   a ripple overflow the line box are set from the script (CSSOM), because they are measured.
   Pointer events stay on: Chrome hit-tests the real text inside through the canvas, and text
   that comes later in the page (the line under the name) still paints, and so hit-tests, above
   the canvas's transparent margin. */
.sfx-hic {
  display: block;
  max-width: none;
}
.sfx-hic__in {
  box-sizing: content-box;
}

/* ---- 2. ARTSY: HOW FAR DOWN THE PAGE YOU ARE ---------------------------------------------
   A hairline in the accent colour along the top edge, scrubbed by the page's own scroll on the
   compositor. No fallback on purpose: a browser without scroll timelines simply has no line. */
.sfx-progress { display: none; }
@keyframes sfx-progress { from { transform: scaleX(0); } }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    :root[data-skin="artsy"]:not([data-mode="desktop"]) .sfx-progress {
      display: block;
      position: fixed;
      inset: 0 0 auto 0;
      z-index: 11;                         /* just above the sticky header */
      height: 2px;
      background: var(--accent);
      opacity: 0.75;
      transform-origin: 0 50%;
      pointer-events: none;
      animation: sfx-progress 1ms linear both;
      animation-timeline: scroll(root block);
    }
  }
}

/* ---- 3. DEV: THE CARET THAT TYPES THE LINES IN -------------------------------------------
   One block caret, placed by the script at the head of the line being typed. 1ch of the
   terminal font, because it is a child of <body>, which the Dev skin sets in that font. */
.sfx-caret { display: none; }
:root[data-skin="dev"] .sfx-caret.is-on {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 1ch;
  background: var(--nv-fg-dim, #a9b1d6);
  pointer-events: none;
}

/* ---- 4. PRINT ------------------------------------------------------------------------------
   The script settles everything on beforeprint; this is the net under it. */
@media print {
  .sfx-progress, .sfx-caret { display: none !important; }
  .sfx-pre, .sfx-pre * {
    opacity: 1 !important;
    clip-path: none !important;
    stroke-dashoffset: 0 !important;
  }
}
