/* Motion (Audrey Huang site). Loaded after style.css and the other feature files. Owned by the motion session.
   The reading line on the top bar, a gentle stop at every section, and the smoother opening (Nov 29).
   Older spots edited in place: "Where you are" and the name glide in script.js. See "Motion" in CLAUDE.md. */

/* 1. Where you are: a garnet line along the bottom edge of the top bar fills as you read (the side dots are gone).
   The track clips to the pill, so the line follows its rounded ends. Where the browser can, the line is tied to
   scrolling in CSS alone (it runs on the compositor, so it never stutters); elsewhere script.js sets it each frame. */
.nav-track { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.nav-track::before, .nav-progress { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.nav-track::before { background: color-mix(in srgb, var(--acc) 14%, transparent); }
.nav-progress { background: var(--acc); transform: scaleX(0); transform-origin: left center; will-change: transform; }
@supports (animation-timeline: scroll()) {
  .nav-progress { animation-name: nav-read; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: scroll(root block); }
  @keyframes nav-read { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* 2. Scrolling is plain and free (Nov 30, her words: "very minimal scroll lock ... the beginning introduction locks
   too too much"). The section stops are gone from features/motion.js. .snap-off below is unused, kept harmless. */
html.snap-off { scroll-snap-type: none !important; }

/* 3. A smoother opening (her words: "opening animations need to be more buttery smooth").
   One clock: while .wait is on (script.js, until the flip photos have arrived) the flip, the tiles, her name and the
   cue all hold still, then start on the same frame. */
.motion .hero.wait .flick, .motion .hero.wait .hero-name, .motion .hero.wait .hero-cue, .motion .hero.wait .hc { animation-play-state: paused; }
/* each flip photo is its own layer, drawn ahead of time, so switching photos is only a change of opacity */
.motion .flick img { will-change: opacity; }
/* the collage dims as her name leaves. It was a brightness() filter on the whole collage, redrawn on every scroll step.
   Now a black layer fades in over it (the same look: 18% black is brightness 0.82), which the compositor does alone. */
.hero-collage { filter: none; }
.hero-collage::after { content: ""; position: absolute; inset: 0; z-index: 1; background: #000; opacity: calc(var(--p, 0) * 0.18); will-change: opacity; pointer-events: none; }
/* the band behind the gliding name fades on its own layer, so the big letters are never redrawn while they move */
.fly-name { background: transparent !important; box-shadow: none !important; }
.fly-name::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sheet); box-shadow: 0 18px 40px -18px rgba(26, 24, 22, 0.45); opacity: var(--band, 1); will-change: opacity; }
[data-theme="dark"] .fly-name::before { background: var(--page); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7); }

/* 4. Which section you're in: the small strip under the top bar is gone (Dec 1, her note: "the tag in the top left
   corner is also redundant"). The current-section pill on the nav links and the reading line above stay. */

/* 5. Livelier entrances (features/motion.js): what waits below the screen stays hidden until it rises in.
   Only opacity here; the rise itself is a Web Animation (translate), so it never fights the press squish (scale). */
.motion .mo-pre { opacity: 0; }

/* 6. Backdrops fold away as the content slides over them (her note: "as I scroll this should kinda collapse a little
   better right now it's kinda ugly"). features/motion.js sets --cover (0 to 1) on each sticky backdrop: the title lifts,
   shrinks a little and is gone by a quarter covered, so the sheet never slices it; the photo dims.
   Opacity and transforms only. Off with reduced motion (no .motion class, and the backdrops aren't sticky then). */
.motion .band { --cover: 0; }
.motion .band::before { content: ""; position: absolute; inset: 0; z-index: -1; background: #0E0C0A; opacity: calc(var(--cover) * 0.6); pointer-events: none; }
.motion .band > .band-text { opacity: calc(1 - var(--cover) * 4); translate: 0 calc(var(--cover) * -26px); scale: calc(1 - var(--cover) * 0.08); transform-origin: 0 100%; will-change: opacity, translate, scale; }

/* 7. Living tiles in the opening (features/motion.js): one tile at a time crossfades from its photo into a few seconds
   of her footage and back. Off with reduced motion (the script doesn't run, and this hides any clip anyway). */
.hc .hc-live { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }
.hc .hc-live.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hc .hc-live { display: none !important; } }

/* ---------- 8. The opening's tiles open in the viewer (her note, Nov 30: "when i click on a picture or a video something
   should start playing with a caption"). features/motion.js marks each tile .tap. Pointing at one leans the picture
   in like other photos, with the zoom moon (the play moon on the three video tiles). The viewer plays a clip larger. */
.hero-collage .hc.tap { pointer-events: auto; }
.hc.tap:focus-visible { outline: none; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9), inset 0 0 0 5px rgba(140, 47, 57, 0.85); }
@media (hover: hover) and (pointer: fine) {
  .hc.tap img { transition: transform 0.9s var(--e-out, cubic-bezier(0.2, 0.8, 0.2, 1)); }
  .hc.tap .hc-live { transition: opacity 0.45s ease, transform 0.9s var(--e-out, cubic-bezier(0.2, 0.8, 0.2, 1)); }
  .hc.tap:hover img, .hc.tap:hover .hc-live { transform: scale(1.05); }
  .hc.tap, .hc.tap * {
    cursor: url("../images/cursor/zoom.png") 13 13, zoom-in;
    cursor: image-set(url("../images/cursor/zoom.png") 1x, url("../images/cursor/zoom@2x.png") 2x) 13 13, zoom-in;
  }
  .hc.tap.has-clip, .hc.tap.has-clip * {
    cursor: url("../images/cursor/play.png") 13 13, pointer;
    cursor: image-set(url("../images/cursor/play.png") 1x, url("../images/cursor/play@2x.png") 2x) 13 13, pointer;
  }
}
@media (prefers-reduced-motion: reduce) { .hc.tap img { transition: none !important; transform: none !important; } }
.vw-fig .vw-vid { display: block; max-width: 100%; max-height: 82vh; margin: 0 auto; background: #000; opacity: 0; transition: opacity 0.3s ease; }
.vw-fig .vw-vid.in { opacity: 1; }
.vw-fig .vw-vid[hidden], .vw-fig img[hidden] { display: none; }
@media (max-width: 640px) { .vw-fig .vw-vid { max-height: 72vh; } }
.vw-more { display: inline-block; margin-left: 10px; color: #E58D97; font-weight: 600; text-decoration: none; white-space: nowrap; }
.vw-more:hover, .vw-more:focus-visible { color: #F2B3BA; text-decoration: underline; text-underline-offset: 3px; }
