/* ============================================================
   Motion proposal (Nov 2026, src/proposals/motion/ only; see PROPOSAL.md).
   A layer over Draft 6.1's d6.css: nothing in d6.css is edited. Every rule
   is scoped to html[data-motion="on"] (set by js/motion-gate.js from
   ?motion=on|off), so ?motion=off is Draft 6.1 exactly.

   Rules of the layer:
   - Movement lives only inside (prefers-reduced-motion: no-preference).
     Under reduce, the reveals, fades and header easing are gone; the
     static hover and focus states stay (they carry meaning, not motion).
   - Hidden-before-reveal states need html.m-ready, which only motion.js
     sets, so if scripting fails nothing is ever left invisible. Their
     transitions wait for html.m-armed, two frames later, so blocks below
     the fold start hidden instead of fading out at load.
   - Opacity and transform only (compositor-friendly); the one exception is
     the header's height, a single fixed element.
   ============================================================ */

:root {
  --m-ease: cubic-bezier(.2, .7, .2, 1);      /* decelerate: arrivals */
  --m-ease-out: cubic-bezier(.4, 0, 1, 1);    /* accelerate: departures */
  --m-nav-compact: 62px;
}
@media (max-width: 640px) { :root { --m-nav-compact: 56px; } }

/* ---------- 1. Load and scroll reveals (round 4, Nov 20) ----------
   Evin's pick: the load style of the Chris Wallis site ("man for the
   job"), measured from its stylesheet. Three strengths, set per block by
   motion.js as data-m:
   - "in":   photos, cards, the gift widget, the signup form, steps, the
             campaign rows. Rises 70px and fades over 1.5s; a photo inside
             settles from 116% to rest over 2.2s, inside its own frame.
   - "rise": buttons. 26px over 1.1s (the same site's smaller rise).
   - "fade": split sections' full-bleed photos (round 5): no rise; the
             photo starts in place, fades in and settles.
   - "rise" also covers paragraphs, list items, subheads and the footer's
             contents (round 5).
   Headings keep Draft 6.1's word reveal. Siblings step 120ms apart (capped
   at four steps). Blocks on the first screen play on load, after the
   headline has started; the rest play as they scroll in.
   Hidden-before-reveal: from first paint only for the "in" and "rise"
   targets (so nothing flashes, then vanishes), and only with motion on,
   scripting on, and no reduced-motion preference. motion-gate.js lifts it
   after 2.5s if motion.js never ran, so nothing is ever left invisible. */
:root {
  --m-in-ease: cubic-bezier(.16, 1, .3, 1);   /* the transform curve */
  --m-in-fade: cubic-bezier(.2, .6, .2, 1);   /* the opacity curve */
  --m-slow-ease: cubic-bezier(.3, .8, .3, 1); /* overlays: less front-loaded */
}
@media (prefers-reduced-motion: no-preference) {
  /* Before motion.js runs. Keep this list in step with IN and RISE in
     motion.js. */
  html[data-motion="on"].js:not(.m-ready):not(.m-off) main :is(
    .cv-dbx-a, .alt-media, .split-media, .media, .cv-w, .cv-db-photo, .photo-card, .cb-card,
    .step, .camp, .camp-detail, .film-inset, .cu-cover, .cn-row, .exhibit,
    h3:not(.anim-words), h4:not(.anim-words)
  ):not(:is(.hero-a, .page-head, .mosaic-sec, .salsa-live, .vbar, .toc, .cv-bar, .modal, .video-modal) *),
  html[data-motion="on"].js:not(.m-ready):not(.m-off) main :is(.widget, .signup-form, .cv-how > li, .btn, p, li, .stat):not(:is(.mosaic-sec, .salsa-live, .vbar, .toc, .cv-bar, .modal, .video-modal, .visually-hidden, .vealbar-wrap) *) { opacity: 0; }

  html[data-motion="on"].m-armed .m-rv {
    transition: opacity .8s var(--m-ease), transform .8s var(--m-ease);
    transition-delay: var(--m-d, 0ms);
  }
  html[data-motion="on"].m-armed .m-rv[data-m="in"] {
    transition: opacity 1.5s var(--m-in-fade), transform 1.5s var(--m-in-ease);
    transition-delay: var(--m-d, 0ms);
  }
  html[data-motion="on"].m-armed .m-rv[data-m="rise"] {
    transition: opacity 1.1s var(--m-in-fade), transform 1.1s var(--m-in-ease), background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .3s ease;
    transition-delay: var(--m-d, 0ms), var(--m-d, 0ms), 0s, 0s, 0s, 0s;
  }
  html[data-motion="on"].m-armed .m-rv[data-m="fade"] {
    transition: opacity 1.5s var(--m-in-fade);
    transition-delay: var(--m-d, 0ms);
  }
  html[data-motion="on"].m-ready .m-rv:not(.m-in) { opacity: 0; transform: translateY(16px); }
  html[data-motion="on"].m-ready .m-rv[data-m="fade"]:not(.m-in) { transform: none; }
  html[data-motion="on"].m-ready .m-rv[data-m="in"]:not(.m-in) { transform: translateY(70px); }
  html[data-motion="on"].m-ready .m-rv[data-m="rise"]:not(.m-in) { transform: translateY(26px); }
  /* Keyboard focus never lands on something invisible. */
  html[data-motion="on"].m-ready .m-rv:focus-within { opacity: 1; transform: none; transition-delay: 0ms; }

  /* The settle: the photo inside a revealed block. It moves the <picture>,
     so the hover zoom on .media-img and the slider's own slow zoom compose
     with it. */
  html[data-motion="on"].m-armed .m-rv:is([data-m="in"], [data-m="fade"]) .pic { transition: transform 2.2s var(--m-in-ease); transition-delay: var(--m-d, 0ms); }
  html[data-motion="on"].m-ready .m-rv:is([data-m="in"], [data-m="fade"]):not(.m-in) .pic { transform: scale(1.16); }
  html[data-motion="on"] .m-rv[data-m="in"].m-clip { overflow: hidden; }

  /* An opened campaign: its contents rise into place (shorter, quicker
     than a load, since it answers a click). */
  html[data-motion="on"] .m-open > * {
    animation: m-fade-in .9s var(--m-in-fade) both, m-rise-24 .9s var(--m-in-ease) both;
  }
  html[data-motion="on"] .m-open > :nth-child(2) { animation-delay: .08s; }
  html[data-motion="on"] .m-open > :nth-child(n+3) { animation-delay: .16s; }
}
@keyframes m-fade-in { from { opacity: 0; } }
@keyframes m-rise-24 { from { transform: translateY(24px); } }
@keyframes m-rise-70 { from { transform: translateY(70px); } }
@keyframes m-zoom-in { from { transform: scale(1.16); } }
@keyframes m-scrim-in { from { background-color: rgba(15, 14, 12, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
@keyframes m-panel-in { from { transform: translateX(72px); } }
@media print { .m-rv { opacity: 1 !important; transform: none !important; } }

/* ---------- 2. Image transitions ----------
   A lazy photo fades up from its frame's pale ground when it arrives,
   instead of popping in. Only photos not yet loaded when the page opens
   (motion.js marks them), never the hero's first slide or the LCP image. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"].m-armed .pic > img.m-fade { transition: opacity .7s ease; }
  html[data-motion="on"].m-ready .pic > img.m-wait { opacity: 0; }
}

/* ---------- 3. Links ---------- */
/* Text links: the underline darkens left to right on hover and focus. The
   2px rule stays; a second line in the hover color draws over it. */
html[data-motion="on"] .text-link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-origin: border-box;
  background-position: 0 100%; background-size: 0% 2px;
}
html[data-motion="on"] .text-link:is(:hover, :focus-visible) { background-size: 100% 2px; color: var(--link-hover); }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .text-link { transition: background-size .4s var(--m-ease), color .15s ease; }
}

/* Top bar links: the line draws out from the center instead of snapping on;
   the current page keeps it drawn. */
html[data-motion="on"] .nav-links a { position: relative; border-bottom-color: transparent; }
html[data-motion="on"] .nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1.5px; height: 1.5px;
  background: currentColor; transform: scaleX(0); transform-origin: 50% 50%;
}
html[data-motion="on"] .nav-links a:is(:hover, :focus-visible, [aria-current="page"])::after { transform: scaleX(1); }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .nav-links a::after { transition: transform .35s var(--m-ease); }
}

/* Footer and drawer links: a 3px nudge right on hover, the "this goes
   somewhere" cue, kept small enough to read as settling, not bouncing. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] :is(.footer-col, .drawer-secondary) a { display: inline-block; transition: transform .3s var(--m-ease), color .15s ease; }
  html[data-motion="on"] :is(.footer-col, .drawer-secondary) a:hover { transform: translateX(3px); }
}

/* ---------- 4. Buttons ----------
   No lift and no bounce. The fill already deepens on hover (d6.css); this
   adds a soft shadow under the action color so Donate reads as pressable,
   and a 1px press on click. */
html[data-motion="on"] .btn-action:is(:hover, :focus-visible) { box-shadow: 0 8px 20px -12px rgba(var(--scrim, 40, 36, 32), .55); }
html[data-motion="on"] .btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .btn { transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .3s ease, transform .1s ease; }
}

/* ---------- 5. Cards ----------
   Linked cards answer keyboard focus exactly as they answer the pointer:
   the same zoom, title color and CTA run. Photo cards that aren't links
   (Donate's ways, About's goals) stay still: in this draft, movement on an
   image means "this is a link". */
html[data-motion="on"] .cb-card:is(:hover, :focus-visible) { background: color-mix(in srgb, var(--cb-card, var(--g-pale)) 92%, var(--ink)); }
html[data-motion="on"] .cb-card:focus-visible .camp-title { color: var(--action-deep); }
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .cb-card { transition: background-color .3s ease; }
  html[data-motion="on"] :is(a.media, .media-link, button.media-link):focus-visible .media-img,
  html[data-motion="on"] a:focus-visible > .media .media-img,
  html[data-motion="on"] a:focus-visible .camp-photo .media-img,
  html[data-motion="on"] .film-inset:focus-visible .media-img { transform: scale(1.1); }
}

/* ---------- 6. Focus ----------
   The ring is the draft's (3px, the link color, 3px out). Two additions:
   it draws in from 7px out to its place over 180ms, which helps the eye
   find it after a Tab; and on photos it turns white with a dark halo, so it
   holds contrast on any part of any image. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] :is(a, button, summary, [tabindex]):focus-visible { animation: m-ring .18s var(--m-ease); }
  @keyframes m-ring { from { outline-offset: 7px; outline-color: transparent; } }
}
html[data-motion="on"] body :is(.on-photo, .nav.is-over-photo) :is(a, button, summary, [tabindex]):focus-visible {
  outline-color: #fff; box-shadow: 0 0 0 7px rgba(0, 0, 0, .38);
}

/* ---------- 7. The top bar on scroll ----------
   Draft 6.1's behavior stays (hide on the way down, the same bar back on
   the way up, :focus-within always shows it). Changes: it leaves faster
   than it returns (departures accelerate, arrivals settle), and once the
   page is past its head it comes back 14px shorter, so the returning bar
   covers less of what you were reading. Never compact over the photo hero
   or the Clear bar's page head. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .nav {
    transition: transform .45s var(--m-ease), height .35s var(--m-ease),
      background-color .25s ease, color .25s ease, box-shadow .35s ease;
  }
  html[data-motion="on"] .nav.is-hidden {
    transition: transform .28s var(--m-ease-out), height .35s var(--m-ease),
      background-color .25s ease, color .25s ease, box-shadow .2s ease;
  }
  html[data-motion="on"] .nav .wm strong { transition: font-size .35s var(--m-ease); }
}
html[data-motion="on"] .nav.m-compact:not(.is-over-photo):not(.is-over-head) { height: var(--m-nav-compact); }
html[data-motion="on"] .nav.m-compact:not(.is-over-photo):not(.is-over-head) .wm strong { font-size: 22px; }
html[data-motion="on"] .nav.m-compact:not(.is-over-photo):not(.is-over-head) .nav-right .btn { padding-top: 10px; padding-bottom: 10px; }
/* About's sticky contents bar follows the shorter bar down. */
html[data-motion="on"] body.m-nav-compact:not(.nav-gone) .toc { top: var(--m-nav-compact); }

/* ---------- The switch (internal, on the palette bar) ---------- */
.palbar button[data-motion-btn] { font: inherit; color: #ddd; background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 4px; padding: 3px 7px; cursor: pointer; }
.palbar button[data-motion-btn][aria-pressed="true"] { background: #f2f2f2; color: #111; border-color: #f2f2f2; }

/* ---------- 8. The Get Updates window (round 4; twice as fast, round 5) ----------
   The same arrival: the shade fades in over 0.45s, the card rises
   70px over 0.7s while its photo settles from 116% over 1.2s, then the
   label, title, line and form follow 50ms apart. Opening only; closing
   stays instant, so dismissing never waits on an animation. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] #updates-modal.is-open { animation: m-scrim-in 0.45s ease both; }
  html[data-motion="on"] #updates-modal.is-open .modal-card { animation: m-fade-in 0.55s var(--m-in-fade) both, m-rise-70 0.7s var(--m-slow-ease) both; }
  html[data-motion="on"] #updates-modal.is-open .modal-photo { animation: m-zoom-in 1.2s var(--m-slow-ease) both; }
  html[data-motion="on"] #updates-modal.is-open .modal-body > * { animation: m-fade-in 0.5s var(--m-in-fade) both, m-rise-24 0.55s var(--m-slow-ease) both; animation-delay: 0.175s; }
  html[data-motion="on"] #updates-modal.is-open .modal-body > .modal-close { animation-delay: 0.3s; }
  html[data-motion="on"] #updates-modal.is-open .modal-body > :nth-child(3) { animation-delay: 0.225s; }
  html[data-motion="on"] #updates-modal.is-open .modal-body > :nth-child(4) { animation-delay: 0.275s; }
  html[data-motion="on"] #updates-modal.is-open .modal-body > :nth-child(n+5) { animation-delay: 0.325s; }
}

/* ---------- 9. The menu drawer (round 4; twice as fast, round 5) ----------
   Was a .32s slide (d6.css). Now the shade fades over 0.4s, the panel
   glides 72px in over 0.65s, and its contents rise in order: wordmark,
   each menu line 35ms apart, the two buttons, then the footer links. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .drawer:not([hidden]) .drawer-scrim { animation: m-fade-in 0.4s ease both; }
  html[data-motion="on"] .drawer:not([hidden]) .drawer-panel { animation: m-fade-in 0.35s var(--m-in-fade) both, m-panel-in 0.65s var(--m-slow-ease) both; }
  html[data-motion="on"] .drawer:not([hidden]) :is(.drawer-top, .drawer-primary li, .drawer-ctas, .drawer-bottom) {
    animation: m-fade-in 0.45s var(--m-in-fade) both, m-rise-24 0.5s var(--m-slow-ease) both;
    animation-delay: calc(0.075s + var(--m-i, 0) * 35ms);
  }
  html[data-motion="on"] .drawer .drawer-top { --m-i: 0; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(1) { --m-i: 1; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(2) { --m-i: 2; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(3) { --m-i: 3; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(4) { --m-i: 4; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(5) { --m-i: 5; }
  html[data-motion="on"] .drawer .drawer-primary li:nth-child(n+6) { --m-i: 6; }
  html[data-motion="on"] .drawer .drawer-ctas { --m-i: 7; }
  html[data-motion="on"] .drawer .drawer-bottom { --m-i: 8; }
}

/* ---------- 10. The veal bar, with the rise (round 6, two options) ----------
   ?bar=1 or ?bar=2 on Our Track Record (motion.js sets html[data-bar]);
   without it, the bar as before. main.js still starts it (.is-draining,
   then .is-running) when the section scrolls in.
   1 · Rise and drain: the bar rises 70px into place, its scale marks
       follow one by one, then it drains on a decelerating curve; the line
       under it rises in once the drain has landed.
   2 · Build, then drain: the bar rises in, fills from 0 up to 3.4M, holds a
       beat, then drains to the sliver while a large count above it runs
       down with it (3.4M to 125K); the line rises in at the end. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"][data-bar] .vealbar-track,
  html[data-motion="on"][data-bar] .vealbar-ticks span,
  html[data-motion="on"][data-bar] .vealbar-count { opacity: 0; transform: translateY(70px); }
  html[data-motion="on"][data-bar] .vealbar-ticks span { transform: translateY(26px); }
  html[data-motion="on"][data-bar] .vealbar-ticks span:first-child { transform: translateY(26px); }
  html[data-motion="on"][data-bar] .vealbar-ticks span:not(:first-child):not(:last-child) { transform: translate(-50%, 26px); }
  html[data-motion="on"][data-bar] .vealbar-ticks span:last-child { transform: translate(-100%, 26px); }

  html[data-motion="on"][data-bar] .is-draining .vealbar-track { opacity: 1; transform: none; transition: opacity 1.5s var(--m-in-fade), transform 1.5s var(--m-in-ease); }
  html[data-motion="on"][data-bar] .is-draining .vealbar-ticks span { opacity: 1; transition: opacity 1.1s var(--m-in-fade), transform 1.1s var(--m-in-ease); }
  html[data-motion="on"][data-bar] .is-draining .vealbar-ticks span:first-child { transform: none; transition-delay: .45s; }
  html[data-motion="on"][data-bar] .is-draining .vealbar-ticks span:nth-child(2) { transform: translateX(-50%); transition-delay: .57s; }
  html[data-motion="on"][data-bar] .is-draining .vealbar-ticks span:nth-child(3) { transform: translateX(-50%); transition-delay: .69s; }
  html[data-motion="on"][data-bar] .is-draining .vealbar-ticks span:last-child { transform: translateX(-100%); transition-delay: .81s; }
  /* Round 7 (Evin): the line under the bar stays visible the whole time. */

  /* 1 · the drain decelerates into the sliver */
  html[data-motion="on"][data-bar="1"] .vealbar.is-draining.is-running .vealbar-fill {
    transition: width 2.8s cubic-bezier(.22, 1, .36, 1) .45s;   /* round 8b: starts while the bar is still rising (Evin) */
  }
  /* 2 · build to full, hold, drain */
  html[data-motion="on"][data-bar="2"] .vealbar.is-draining .vealbar-fill { width: 3.68%; transition: none; animation: vb-build-drain 4.8s linear .6s both; }
  @keyframes vb-build-drain {
    0%   { width: 0%;    animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
    28%  { width: 100%;  animation-timing-function: linear; }
    40%  { width: 100%;  animation-timing-function: cubic-bezier(.6, 0, .25, 1); }
    100% { width: 3.68%; }
  }
  html[data-motion="on"][data-bar="2"] .is-draining ~ .vealbar-count,
  html[data-motion="on"][data-bar="2"] .vealbar-wrap.is-started .vealbar-count { opacity: 1; transform: none; transition: opacity 1.5s var(--m-in-fade), transform 1.5s var(--m-in-ease); }
}
.vealbar-count { display: none; }
html[data-bar="2"] .vealbar-count { display: block; margin-bottom: 18px; text-align: right; font-family: var(--serif); font-size: clamp(40px, 5vw, 64px); line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 11. Home splash load-in (round 8) ----------
   Once the first photo has decoded it fades up from black and comes from a
   soft blur into focus, both on one 2.4s curve. No zoom of its own (Evin,
   round 8b): the slide's slow zoom starts at once.
   It moves the <picture>, so the slider's own slow zoom on the slide is
   untouched. */
@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"].js:not(.m-off) .hero-a .slider { background: #000; }
  html[data-motion="on"].js:not(.m-off) .hero-a:not(.hero-in) .slide:first-child .pic { opacity: 0; }
  html[data-motion="on"] .hero-a.hero-in .slide:first-child .pic { animation: m-hero-in 2.4s cubic-bezier(.22, 1, .36, 1) both; }
  /* the shade and words sit over the photo; keep the shade from flashing */
  html[data-motion="on"].js:not(.m-off) .hero-a:not(.hero-in) .photo-fade { opacity: 0; }
  html[data-motion="on"] .hero-a.hero-in .photo-fade { animation: m-fade-in 1.4s ease both; }
}
@keyframes m-hero-in { from { opacity: 0; filter: blur(12px); } to { opacity: 1; filter: blur(0); } }

/* ---------- 12. Button hover (round 8: the arrow, Evin) ----------
   The fill still deepens; an arrow slides in after the label as the label
   makes room, on the load style's curve. Not on form submit buttons. */
.btn { transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
@media (hover: hover) {
  .btn::after { content: "→"; display: inline-block; width: 0; opacity: 0; transform: translateX(-8px); overflow: hidden; transition: width .45s cubic-bezier(.16, 1, .3, 1), opacity .3s ease, transform .45s cubic-bezier(.16, 1, .3, 1), margin .45s cubic-bezier(.16, 1, .3, 1); margin-left: -10px; }
  .btn:hover::after { width: 1em; opacity: 1; transform: none; margin-left: 0; }
  .btn[type="submit"]::after { content: none; }
  .nav .btn::after { content: none; }   /* round 8c (Evin): not in the nav bar */
}
@media (prefers-reduced-motion: reduce) {
  .btn::after { transition: none !important; }
}

/* ---------- 13. Film play button ripple (round 8, Evin chose 3) ----------
   On every film button (Home and Suwanna Ranch): a thin ring spreads out
   from the play icon and fades every 3.2s. It rests while the film is
   hovered, so the hover's grow reads cleanly, and never runs with reduced
   motion. */
@media (prefers-reduced-motion: no-preference) {
  .film-play::before { content: ""; position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .8); animation: m-pulse-ripple 3.2s cubic-bezier(.22, 1, .36, 1) infinite; pointer-events: none; }
  .film-btn:is(:hover, :focus-visible) .film-play::before { animation-play-state: paused; opacity: 0; }
}
@keyframes m-pulse-ripple { 0% { transform: scale(.9); opacity: 0; } 15% { opacity: .8; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
