/* The motion layer for the landing pages and serero.co.il (owner's approved list, 2026-09-28).
   Nothing here changes a colour, a font, a text or the layout: only how things move. The landing
   pages load it after their other stylesheets; tools/build-www.mjs puts it last in the site's one
   stylesheet. The demo of every move is design/motion/.

   The language: one shape at a time changes its size, corners and colour, and the text inside it
   swaps with a short blur (its own exit and entrance, so two texts never show on top of each
   other). Every move is a spring from tools/springs.mjs, and passes its target by under 1% at most:
   no bounce, glow, gradient or particles.

   It all waits for the m-on class on <html>, which every page carries (the demo takes it away to
   show the old motion). Under reduced motion, base.css's global rule already stops every transition
   and animation here, and motion.js makes each change at once. */

/* springs:start (written by tools/springs.mjs; edit the springs there, not here) */
:root {
  --spring-press: var(--ease-out); --dur-press: 223ms;
  --spring-snap: var(--ease-out); --dur-snap: 334ms;
  --spring-morph: var(--ease-out); --dur-morph: 447ms;
  --spring-trail: var(--ease-out); --dur-trail: 517ms;
  --spring-fade: var(--ease-out); --dur-fade: 306ms;
  --spring-exit: var(--ease-out); --dur-exit: 188ms;
  --spring-reveal: var(--ease-out); --dur-reveal: 646ms;
  --spring-settle: var(--ease-out); --dur-settle: 1175ms;
  --spring-draw: var(--ease-out); --dur-draw: 1528ms;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    /* a button pressed and let go; 279ms, passes the target by 0.50% */
    --spring-press: linear(0, 0.0211, 0.0745, 0.1479, 0.2321, 0.3204, 0.408, 0.4917, 0.5693, 0.6397, 0.7023, 0.7571, 0.8044, 0.8446, 0.8784, 0.9064, 0.9293, 0.9479, 0.9627, 0.9744, 0.9834, 0.9902, 0.9953, 0.999, 1.0016, 1.0033, 1.0043, 1.0048, 1.005, 1.0049, 1.0047, 1.0043, 1.0039, 1.0035, 1.003, 1.0026, 1.0022, 1.0019, 1.0015, 1.0013, 1);
    --dur-press: 279ms;
    /* ticks, markers, the leading edge of an indicator; 417ms, passes the target by 0.77% */
    --spring-snap: linear(0, 0.021, 0.0745, 0.1482, 0.2331, 0.3224, 0.4111, 0.496, 0.5749, 0.6464, 0.71, 0.7656, 0.8134, 0.854, 0.8879, 0.9159, 0.9386, 0.9568, 0.9711, 0.9822, 0.9905, 0.9967, 1.0011, 1.0042, 1.0061, 1.0072, 1.0077, 1.0077, 1.0074, 1.0069, 1.0063, 1.0056, 1.0049, 1.0042, 1.0036, 1.003, 1.0025, 1.002, 1.0016, 1.0013, 1);
    --dur-snap: 417ms;
    /* a shape changing its size and corners; 559ms, passes the target by 0.15% */
    --spring-morph: linear(0, 0.0193, 0.0682, 0.1356, 0.2133, 0.2952, 0.3771, 0.4558, 0.5297, 0.5974, 0.6586, 0.7129, 0.7607, 0.8021, 0.8378, 0.8681, 0.8937, 0.9152, 0.933, 0.9476, 0.9596, 0.9692, 0.977, 0.9832, 0.988, 0.9917, 0.9946, 0.9968, 0.9984, 0.9996, 1.0004, 1.0009, 1.0013, 1.0014, 1.0015, 1.0015, 1.0015, 1.0014, 1.0013, 1.0011, 1);
    --dur-morph: 559ms;
    /* the trailing edge of an indicator; 646ms, no overshoot */
    --spring-trail: linear(0, 0.0229, 0.0788, 0.1532, 0.236, 0.3207, 0.4029, 0.4801, 0.5508, 0.6145, 0.671, 0.7206, 0.7637, 0.8009, 0.8328, 0.86, 0.8831, 0.9027, 0.9191, 0.9329, 0.9444, 0.9541, 0.9621, 0.9688, 0.9743, 0.9789, 0.9827, 0.9858, 0.9884, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-trail: 646ms;
    /* content coming in: opacity and blur; 382ms, no overshoot */
    --spring-fade: linear(0, 0.0229, 0.0788, 0.1532, 0.236, 0.3207, 0.4029, 0.4801, 0.5508, 0.6145, 0.671, 0.7205, 0.7637, 0.8009, 0.8328, 0.86, 0.8831, 0.9026, 0.9191, 0.9329, 0.9444, 0.9541, 0.9621, 0.9688, 0.9743, 0.9789, 0.9827, 0.9858, 0.9883, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-fade: 382ms;
    /* content going out; 235ms, no overshoot */
    --spring-exit: linear(0, 0.0229, 0.0787, 0.1531, 0.2359, 0.3205, 0.4027, 0.4799, 0.5506, 0.6143, 0.6708, 0.7204, 0.7635, 0.8007, 0.8327, 0.8599, 0.883, 0.9025, 0.919, 0.9328, 0.9444, 0.954, 0.962, 0.9687, 0.9743, 0.9788, 0.9826, 0.9858, 0.9883, 0.9904, 0.9922, 0.9936, 0.9948, 0.9957, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-exit: 235ms;
    /* a section or a headline entering the page; 808ms, no overshoot */
    --spring-reveal: linear(0, 0.0229, 0.0788, 0.1531, 0.236, 0.3206, 0.4028, 0.48, 0.5507, 0.6144, 0.6709, 0.7205, 0.7636, 0.8008, 0.8328, 0.86, 0.8831, 0.9026, 0.9191, 0.9329, 0.9444, 0.9541, 0.9621, 0.9688, 0.9743, 0.9789, 0.9826, 0.9858, 0.9883, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-reveal: 808ms;
    /* a large picture settling into place (the booklet, the portrait); 1469ms, no overshoot */
    --spring-settle: linear(0, 0.0229, 0.0788, 0.1532, 0.2361, 0.3207, 0.403, 0.4802, 0.5509, 0.6146, 0.6711, 0.7206, 0.7638, 0.801, 0.8329, 0.8601, 0.8832, 0.9027, 0.9191, 0.9329, 0.9445, 0.9541, 0.9621, 0.9688, 0.9743, 0.9789, 0.9827, 0.9858, 0.9884, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-settle: 1469ms;
    /* a fine line drawing itself (the arcs behind the portrait); 1910ms, no overshoot */
    --spring-draw: linear(0, 0.0229, 0.0788, 0.1532, 0.236, 0.3207, 0.4029, 0.4801, 0.5508, 0.6145, 0.671, 0.7205, 0.7637, 0.8009, 0.8328, 0.86, 0.8831, 0.9026, 0.9191, 0.9329, 0.9444, 0.9541, 0.9621, 0.9688, 0.9743, 0.9789, 0.9827, 0.9858, 0.9883, 0.9905, 0.9922, 0.9936, 0.9948, 0.9958, 0.9965, 0.9972, 0.9977, 0.9981, 0.9985, 0.9988, 1);
    --dur-draw: 1910ms;
  }
}
/* springs:end */

/* The tick drawings, as the forms already use them: navy on gold (the answer cards), gold on navy (the boxes). */
:root {
  --m-tick-navy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l2.9 2.9L12.6 5' fill='none' stroke='%23021B41' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --m-tick-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l2.9 2.9L12.6 5' fill='none' stroke='%23C28722' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 1. A press: the button sinks a little and springs back when let go. A full-width button sinks less,
   so its edges do not travel further than a small one's. */
.m-on .btn { transition: transform var(--dur-press) var(--spring-press), background-color .2s, box-shadow .2s, color .2s; }
.m-on .btn:active { transform: scale(var(--m-press, .97)); }
.m-on .btn-block, .m-on .sticky-cta .btn { --m-press: .985; }
.m-on .step-back, .m-on .g-callback-toggle, .m-on .menu > summary { transition: transform var(--dur-press) var(--spring-press), background-color .15s, color .15s; }
.m-on .step-back:active, .m-on .g-callback-toggle:active, .m-on .menu > summary:active { transform: scale(.96); }
.m-on .chip span {
  transition: background-color var(--dur-fade) var(--spring-fade), border-color var(--dur-fade) var(--spring-fade),
    color var(--dur-fade) var(--spring-fade), transform var(--dur-press) var(--spring-press);
}
.m-on .chip:active span { transform: scale(.985); }

/* 3. A tick: the marker comes in on a small spring, then the tick draws itself from its short arm to its
   long one (a cover of the marker's own colour slides off it). motion.js adds .m-popping when a visitor
   ticks; a tick restored on load, or one set by its twin, just shows. */
@keyframes m-pop { from { transform: scale(.55); } }
@keyframes m-wipe-14 { from { background-size: 100% 100%, 14px 14px, auto; } }
@keyframes m-wipe-18 { from { background-size: 100% 100%, 18px 18px, auto; } }
.m-on .chip span.m-popping::before { animation: m-pop var(--dur-snap) var(--spring-snap); }
.m-on .chip input[type="checkbox"]:checked + span.m-popping::before {
  background: linear-gradient(var(--gold), var(--gold)) right center / 0% 100% no-repeat, var(--m-tick-navy) center / 14px 14px no-repeat, var(--gold);
  animation: m-pop var(--dur-snap) var(--spring-snap), m-wipe-14 var(--dur-fade) var(--spring-fade) 80ms backwards;
}
.m-on .tick-box { transition: background-color var(--dur-fade) var(--spring-fade), box-shadow var(--dur-fade) var(--spring-fade); }
.m-on .tick-wrap input:checked + .tick-box.m-popping {
  background: linear-gradient(var(--navy), var(--navy)) right center / 0% 100% no-repeat, var(--m-tick-gold) center / 18px 18px no-repeat, var(--navy);
  animation: m-pop var(--dur-snap) var(--spring-snap), m-wipe-18 var(--dur-fade) var(--spring-fade) 80ms backwards;
}
.m-on .toc-n.m-popping { animation: m-pop var(--dur-snap) var(--spring-snap); }

/* 2. The form in steps. The script moves the old step out and the new one in (blur, and a short slide
   in the reading direction), and the card follows the new step's height. The old keyframe goes. */
.m-on .lead-form.is-stepped [data-step]:not([hidden]) { animation: none; }
.m-on .step-bar i { transition: width var(--dur-morph) var(--spring-morph); }
.m-stage { position: relative; }
.m-stage.m-moving { overflow: clip; overflow-clip-margin: 8px; }
/* Text that the script swaps in place (a counter): an inline box cannot move, a block can. */
.m-on [data-progress], .m-on .step-n { display: inline-block; }

/* 4. The send button becomes a circle that turns, then a tick. The label and the circle are two layers
   of the same button (motion.js adds them), so the shape never breaks while its content changes. */
.m-part { display: inline-flex; align-items: center; justify-content: center; gap: inherit; }
.m-spin { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; }
.m-spin svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m-spin .m-track { opacity: .26; }
.m-spin .m-turn { transform-box: fill-box; transform-origin: center; }
.m-spin .m-arc { stroke-dasharray: .26 1; }
.m-spin .m-check { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
@keyframes m-turn { to { transform: rotate(360deg); } }
.m-on .m-shape { position: relative; overflow: hidden; }
.m-on .m-shape.btn-block { margin-inline: auto; }
.m-on .m-busy .m-turn { animation: m-turn .9s linear infinite; }

/* 6 and 7. One indicator for a set of choices: a navy shape laid over the current one, holding a white
   copy of its label. Its two edges ride different springs (the script picks which edge leads), so the
   leading edge stretches ahead and the trailing one catches up. The choices under it keep their plain
   look, so nothing flashes before the shape arrives. */
.m-ind, .m-ind-label { display: none; }
.m-on .m-ind-host { position: relative; }
.m-on .m-ind {
  position: absolute; z-index: 1; display: block; margin: 0; padding: 0; list-style: none; pointer-events: none;
  border-radius: var(--m-ind-r, var(--r-ctl)); background: var(--navy);
  transition:
    left var(--m-dl, var(--dur-morph)) var(--m-el, var(--spring-morph)),
    right var(--m-dr, var(--dur-morph)) var(--m-er, var(--spring-morph)),
    top var(--m-dt, var(--dur-morph)) var(--m-et, var(--spring-morph)),
    bottom var(--m-db, var(--dur-morph)) var(--m-eb, var(--spring-morph)),
    opacity var(--dur-fade) var(--spring-fade), transform var(--dur-snap) var(--spring-snap);
}
.m-on .m-ind.m-still { transition: none; }
.m-on .m-ind.m-away { opacity: 0; transform: scale(.86); }
.m-on .m-ind-label { position: absolute; z-index: 2; display: flex; margin: 0; pointer-events: none; }

/* The contents bar: the current chapter keeps its plain chip underneath. */
.m-on .reader-nav .m-ind-host a[aria-current] { background: var(--mist); color: var(--ink); }
.m-on .reader-nav .m-ind-host a[aria-current] .toc-n { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.m-on .reader-nav .m-ind-host a[aria-current].is-done .toc-n { box-shadow: none; }
@media (min-width: 1000px) { .m-on .reader-nav .m-ind-host a[aria-current] { background: transparent; } }
.m-on .reader-nav .m-ind-label { background: transparent; color: var(--white); }
.m-on .reader-nav .m-ind-label .toc-n { box-shadow: inset 0 0 0 1.5px rgba(var(--white-rgb), .5); }
.m-on .reader-nav .m-ind-label.is-done .toc-n { background: var(--gold); box-shadow: none; color: var(--navy); }
/* The summary's answers: the picked one keeps the plain look underneath; the copy on the shape is white,
   with the gold dot the picked marker has. */
.m-on .m-ind-host .chip input:checked + span { background: var(--white); border-color: var(--edge); color: var(--ink); }
.m-on .m-ind-host .chip input[type="radio"]:checked + span::before { box-shadow: inset 0 0 0 2px var(--edge); background: transparent; }
.m-on .m-ind-label.chip span { background: transparent; border-color: transparent; color: var(--white); }
.m-on .m-ind-label.chip span::before { box-shadow: inset 0 0 0 4px var(--navy); background: var(--gold); }
.m-on .m-ind-host.chips { --m-ind-r: var(--r-pill); }
@media (max-width: 460px) { .m-on .m-ind-host.chips { --m-ind-r: var(--r-ctl); } }

/* 8. "Leave details": the box grows to the form's height while the pill's shape opens into it. */
.m-ghost { position: absolute; z-index: 0; pointer-events: none; background: var(--navy); }
.m-on .g-callback { position: relative; }
.m-on .g-callback > :not(.m-ghost) { position: relative; z-index: 1; }

/* 9. The floating bar grows out of a small gold circle to its full width, like an island, and its text
   comes in once there is room for it; going away, the text leaves first and the shape shrinks back.
   The shape is a clip on the full-width button, so nothing is laid out again while it grows (design review,
   2026-10-10: animating the width moved the button and its text on every frame, 75 small layout shifts in one
   scroll of the home page). A clip also cuts the button's own shadow, so the bar draws it around the clip. */
.m-on .sticky-cta {
  transform: none; visibility: hidden; transition: visibility 0s linear var(--dur-morph);
  filter: drop-shadow(0 9px 11px rgba(var(--navy-rgb), .3));
}
.m-on .sticky-cta.is-on { visibility: visible; transition: none; }
.m-on .sticky-cta .btn {
  display: flex; white-space: nowrap; box-shadow: none;
  clip-path: inset(0 calc(50% - 28px) round 28px); opacity: 0; transform: translateY(16px) scale(.86);
  transition: clip-path var(--dur-morph) var(--spring-morph) 40ms,
    opacity var(--dur-exit) var(--spring-exit) 160ms, transform var(--dur-morph) var(--spring-morph) 90ms;
}
.m-on .sticky-cta.is-on .btn {
  clip-path: inset(0 round var(--r-ctl)); opacity: 1; transform: none;
  transition: clip-path var(--dur-morph) var(--spring-morph) 90ms,
    opacity var(--dur-exit) var(--spring-exit), transform var(--dur-snap) var(--spring-snap);
}
/* The keyboard focus ring is drawn outside the button, where the clip would cut it. */
.m-on .sticky-cta.is-on .btn:focus-visible { clip-path: none; }
@media (forced-colors: active) { .m-on .sticky-cta { filter: none; } }
.m-on .sticky-cta .btn > * { opacity: 0; filter: blur(4px); transition: opacity var(--dur-exit) var(--spring-exit), filter var(--dur-exit) var(--spring-exit); }
.m-on .sticky-cta.is-on .btn > * { opacity: 1; filter: none; transition: opacity var(--dur-fade) var(--spring-fade) 230ms, filter var(--dur-fade) var(--spring-fade) 230ms; }
.m-on .book-bar .btn { clip-path: inset(0 calc(50% - 28px) round 31px); }
.m-on .book-bar.is-on .btn { clip-path: inset(0 round var(--r-ctl)); }

/* 10. FAQ: the plus turns half a circle and loses its upright stroke on the way, ending as the minus,
   while its circle turns navy. The script opens and closes the answer at the height of its text. */
@property --m-bar { syntax: "<color>"; inherits: false; initial-value: #021B41; }
@property --m-bg { syntax: "<color>"; inherits: false; initial-value: #F2F4F8; }
@property --m-v { syntax: "<length>"; inherits: false; initial-value: 12px; }
.m-on .faq-mark {
  background:
    linear-gradient(var(--m-bar), var(--m-bar)) center / 12px 2px no-repeat,
    linear-gradient(var(--m-bar), var(--m-bar)) center / 2px var(--m-v) no-repeat,
    var(--m-bg);
  transition: --m-bar var(--dur-fade) var(--spring-fade), --m-bg var(--dur-fade) var(--spring-fade),
    --m-v var(--dur-snap) var(--spring-snap), transform var(--dur-morph) var(--spring-morph);
}
.m-on .faq details[open] .faq-mark { --m-bar: var(--gold); --m-bg: var(--navy); --m-v: 0px; transform: rotate(180deg); }
.m-on .faq details.m-closing .faq-mark { --m-bar: var(--navy); --m-bg: var(--mist); --m-v: 12px; transform: none; }
.m-on .faq details.m-moving { overflow: clip; }

/* The ring by "בדקתם N מתוך 7" (owner, with the list): a gold arc that fills as chapters are ticked.
   It shows no number of its own; the count beside it says it in words. Its markup carries
   display="none", so a page without this stylesheet (the direction-B prototype) never shows it. */
.m-ring { display: none; }
.m-on .m-ring { display: inline-block; width: 22px; height: 22px; margin-inline-end: 8px; vertical-align: -5px; transform: rotate(-90deg); }
.m-ring circle { fill: none; stroke-width: 3; }
.m-ring .m-ring-track { stroke: var(--line); }
.m-ring .m-ring-fill { stroke: var(--gold); stroke-linecap: butt; stroke-dasharray: 1 1; stroke-dashoffset: calc(1 - var(--done, 0)); transition: stroke-dashoffset var(--dur-morph) var(--spring-morph); }

/* The contents bar's gold line fills on the same spring. */
.m-on .progress-bar::before { transition: transform var(--dur-morph) var(--spring-morph); }

/* Entrances that already exist: the same moves, on springs. Only their pace changes; whether they run at
   all is still up to page.css and www.css (never under reduced motion). */
.m-on.js [data-reveal] { transition: opacity var(--dur-reveal) var(--spring-reveal), transform var(--dur-reveal) var(--spring-reveal); }
.m-on .hero-copy > *, .m-on .home-hero-copy > *, .m-on .page-hero-copy > * { animation-duration: var(--dur-reveal); animation-timing-function: var(--spring-reveal); }
.m-on .book, .m-on .portrait img { animation-duration: var(--dur-settle); animation-timing-function: var(--spring-settle); }
.m-on .arc-line, .m-on .arc-line-2 { animation-duration: var(--dur-draw); animation-timing-function: var(--spring-draw); }

/* With reduced motion every change is made at once: base.css stops the durations, and this stops the
   delays too (QA, 2026-09-29: the floating bar showed empty for a moment before its text). */
@media (prefers-reduced-motion: reduce) {
  .m-on *, .m-on *::before, .m-on *::after { transition-delay: 0s !important; animation-delay: 0s !important; }
}

/* The tick a link-like button shows when it answers ("הקישור הועתק"). */
.linkish .icon { width: 18px; height: 18px; vertical-align: -4px; stroke-width: 2.2; }

/* The page change after the form: the old view leaves before the new one comes, so the two never mix. */
.m-on::view-transition-old(root) { animation: m-vt-out var(--dur-exit) var(--spring-exit) both; }
.m-on::view-transition-new(root) { animation: m-vt-in var(--dur-reveal) var(--spring-reveal) 120ms both; }
@keyframes m-vt-out { to { opacity: 0; } }
@keyframes m-vt-in { from { opacity: 0; transform: translateY(14px); } }
