/* Segev Studio - motion library. Load after tokens.css and components.css.
   Principles (brand book, section 11; Apple "Designing Fluid Interfaces"):
   respond on press, not on release; springs, not fixed durations; enter and exit along the same path;
   bounce only for moments of joy or momentum; reveals are click-driven (her control);
   reduced motion = gentle cross-fades, never nothing. */

:root{
  /* springs, computed from damping ratio + response (Apple's two parameters) */
  --spring-snappy: linear(0, .0238, .0816, .1582, .2431, .3294, .4129, .4909, .562, .6256, .6819, .731, .7736, .8101, .8412, .8677, .89, .9088, .9246, .9377, .9487, .9578, .9653, .9716, .9767, .9809, .9844, .9873, .9896, .9916, .9931, .9944, .9955, .9963, .997, .9976, 1);
  --spring-snappy-d: 405ms;  /* damping 1.0, response 0.3: buttons, tabs, toggles */
  --spring-smooth: linear(0, .0237, .0814, .1577, .2425, .3287, .412, .4899, .561, .6246, .6809, .7301, .7727, .8093, .8405, .867, .8894, .9083, .9241, .9373, .9483, .9575, .965, .9713, .9765, .9808, .9843, .9872, .9895, .9915, .9931, .9943, .9954, .9963, .997, .9975, 1);
  --spring-smooth-d: 540ms;  /* damping 1.0, response 0.4: panels, cards, reveals (default) */
  --spring-soft-d: 740ms;    /* same curve, response 0.55: large surfaces, slide changes */
  --spring-joy: linear(0, .0274, .0985, .1985, .3147, .4369, .5573, .67, .7711, .8583, .9306, .988, 1.0314, 1.062, 1.0816, 1.0919, 1.0948, 1.092, 1.0851, 1.0755, 1.0645, 1.0529, 1.0415, 1.0308, 1.0213, 1.0131, 1.0063, 1.0009, .9969, .994, .9922, .9913, .991, .9913, .992, .9929, .9939, .995, .9961, .9971, 1);
  --spring-joy-d: 705ms;     /* damping 0.6: ONLY for joy moments (copied, stamp, done) */
  --press: 100ms;            /* press feedback: instant */
}

/* ---------- 1. press: on pointer-down, instant ---------- */
.m-press{transition:transform var(--spring-snappy-d) var(--spring-snappy)}
.m-press:active{transform:scale(.96);transition:transform var(--press) ease-out}

/* ---------- 2. lift on hover (cards, video, prompt) ---------- */
.m-lift{transition:transform var(--spring-smooth-d) var(--spring-smooth),box-shadow var(--spring-smooth-d) var(--spring-smooth),border-color .2s}
.m-lift:hover{transform:translateY(-6px);box-shadow:var(--shadow-lift)}

/* ---------- 3. focus ring grows in ---------- */
.m-focus:focus-visible{outline:3px solid var(--c-yellow);outline-offset:2px;animation:m-ring-in var(--spring-snappy-d) var(--spring-snappy)}
@keyframes m-ring-in{from{outline-offset:8px;outline-color:transparent}}

/* ---------- 4. success morph (copy -> copied) ---------- */
.m-morph .slot{position:relative;display:inline-flex;width:20px;height:20px;flex:none}
.m-morph .a,.m-morph .b{position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center;transition:transform var(--spring-joy-d) var(--spring-joy),opacity .15s}
.m-morph .b{opacity:0;transform:scale(.3) rotate(-30deg)}
.m-morph.done .a{opacity:0;transform:scale(.3)}
.m-morph.done .b{opacity:1;transform:none}

/* ---------- 5. tabs: sliding indicator ---------- */
.m-tabs{position:relative}
.m-tabs .ind{position:absolute;bottom:0;height:3px;background:var(--c-yellow);border-radius:2px;transition:right var(--spring-snappy-d) var(--spring-snappy),width var(--spring-snappy-d) var(--spring-snappy)}
.m-panel-enter{animation:m-panel var(--spring-smooth-d) var(--spring-smooth) both}
@keyframes m-panel{from{opacity:0;transform:translateX(var(--from,-16px))}}

/* ---------- 6. checkbox draws its check ---------- */
.m-check{appearance:none;width:26px;height:26px;border:2px solid var(--c-navy);border-radius:8px;display:inline-grid;place-items:center;cursor:pointer;transition:background .2s,transform var(--spring-joy-d) var(--spring-joy);margin:0}
.m-check::after{content:"";width:12px;height:7px;border:3px solid var(--c-yellow);border-top:0;border-right:0;transform:rotate(-45deg) scale(0);transition:transform var(--spring-joy-d) var(--spring-joy);margin-top:-3px}
.m-check:checked{background:var(--c-navy)}
.m-check:checked::after{transform:rotate(-45deg) scale(1)}
.m-check:active{transform:scale(.9)}

/* ---------- 7. accordion opens with a spring ---------- */
.m-acc{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--spring-smooth-d) var(--spring-smooth)}
.m-acc>div{overflow:hidden}
.m-acc.open{grid-template-rows:1fr}
.m-chev{transition:transform var(--spring-snappy-d) var(--spring-snappy)}
.open-btn[aria-expanded="true"] .m-chev{transform:rotate(180deg)}

/* ---------- 8. toast: enters and leaves along the same path ---------- */
.m-toast{transform:translateY(140%);opacity:0;transition:transform var(--spring-smooth-d) var(--spring-smooth),opacity .2s}
.m-toast.show{transform:none;opacity:1}

/* ---------- 9. agent: typing dots and message arrival ---------- */
.m-typing i{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--c-text-2);margin:0 2px;animation:m-dot 1.1s ease-in-out infinite}
.m-typing i:nth-child(2){animation-delay:.15s}.m-typing i:nth-child(3){animation-delay:.3s}
@keyframes m-dot{0%,60%,100%{transform:translateY(0);opacity:.4}30%{transform:translateY(-5px);opacity:1}}
.m-arrive{animation:m-arrive var(--spring-smooth-d) var(--spring-smooth) both}
@keyframes m-arrive{from{opacity:0;transform:translateY(14px) scale(.98)}}

/* ---------- 10. reveals (click-driven; JS adds .in) ---------- */
.m-strip{clip-path:inset(0 0 0 100%)}
.m-strip.in{clip-path:inset(0 0 0 0);transition:clip-path var(--spring-soft-d) var(--spring-smooth)}
.m-rise{opacity:0;transform:translateY(12px);filter:blur(4px)}
.m-rise.in{opacity:1;transform:none;filter:none;transition:opacity .3s,transform var(--spring-smooth-d) var(--spring-smooth),filter .3s}
.m-stamp{opacity:0;transform:scale(1.5) rotate(-16deg)}
.m-stamp.in{opacity:1;transform:rotate(-8deg);transition:transform var(--spring-joy-d) var(--spring-joy),opacity .15s}

/* ---------- 11. ring pulse ("you are here") ---------- */
.m-pulse{position:relative}
.m-pulse::before{content:"";position:absolute;inset:-10px;border-radius:50%;border:2px solid var(--c-yellow);animation:m-pulse 2.4s ease-out infinite}
@keyframes m-pulse{0%{transform:scale(.7);opacity:.6}100%{transform:scale(1.7);opacity:0}}

/* ---------- 12. slide change: the next slide enters from the reading direction ---------- */
.m-slide{transition:transform var(--spring-soft-d) var(--spring-smooth),opacity .3s}

/* ---------- 13-19. ambient motion: no interaction needed. Slow, subtle, never behind text being read, one per view ---------- */
/* 13 scroll reveal (web pages only; slides stay click-driven) */
.m-scroll{opacity:0;transform:translateY(24px)}
.m-scroll.seen{opacity:1;transform:none;transition:opacity .6s ease,transform var(--spring-soft-d) var(--spring-smooth)}
/* 14 title highlight sweeps in when the title appears */
.m-hl{background-image:linear-gradient(var(--c-yellow),var(--c-yellow));background-repeat:no-repeat;background-position:right 92%;background-size:0% 28%}
.m-hl.seen{background-size:100% 28%;transition:background-size .9s var(--ease-inout) .2s}
/* 15 background drifts very slowly (dots / grid) */
@keyframes m-drift{to{background-position:44px 22px}}
.m-drift{animation:m-drift 18s linear infinite}
/* 16 floating chips, staggered */
@keyframes m-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
.m-float{animation:m-float 4.2s ease-in-out infinite}
.m-float:nth-child(2){animation-delay:-1.4s}.m-float:nth-child(3){animation-delay:-2.8s}
/* 17 glint across the main button, rarely (once every 7s), one per page */
.m-glint{position:relative;overflow:hidden}
.m-glint::after{content:"";position:absolute;top:0;bottom:0;width:40%;right:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.55),transparent);transform:skewX(-18deg);animation:m-glint 7s ease-in-out infinite}
@keyframes m-glint{0%,82%{right:-60%}100%{right:130%}}
/* 18 the yellow dot breathes (brand moment: the dot of the logo) */
@keyframes m-breathe{0%,100%{transform:scale(1);box-shadow:0 0 0 0 rgba(247,182,49,.45)}50%{transform:scale(1.08);box-shadow:0 0 0 10px rgba(247,182,49,0)}}
.m-breathe{animation:m-breathe 3.2s ease-in-out infinite}
/* (19 contour sway removed 2026-12-01: no wave/contour backgrounds in the brand) */

/* ---------- from the test site (approved 1.12) ---------- */
/* 20 slow staggered reveal: 1.1s rise, .12s steps. Web pages and chapter openings, not buttons. JS adds .in */
.m-slow{opacity:0;transform:translateY(28px)}
.m-slow.in{opacity:1;transform:none;transition:opacity 1.1s var(--ease-out),transform 1.1s var(--ease-out)}
.m-slow.d1.in{transition-delay:.12s}.m-slow.d2.in{transition-delay:.24s}.m-slow.d3.in{transition-delay:.36s}
/* 21 the yellow period lands once, after the sentence appears (joy spring). .m-period on the sentence, .ss-period on the dot */
.m-period .ss-period{display:inline-block;opacity:0;transform:translateY(-.6em) scale(.4)}
.m-period.in .ss-period{opacity:1;transform:none;transition:transform var(--spring-joy-d) var(--spring-joy) .55s,opacity .2s .55s}

/* ---------- reduced motion: gentle cross-fades instead ---------- */
@media (prefers-reduced-motion: reduce){
  .m-press,.m-lift,.m-morph .a,.m-morph .b,.m-tabs .ind,.m-check,.m-check::after,.m-acc,.m-toast,.m-slide{transition:opacity .2s ease!important}
  .m-lift:hover{transform:none}.m-press:active{transform:none}
  .m-panel-enter,.m-arrive,.m-typing i,.m-pulse::before,.m-drift,.m-float,.m-glint::after,.m-breathe{animation:none!important}
  .m-scroll{opacity:1;transform:none}.m-hl{background-size:100% 28%}
  .m-slow,.m-slow.in{opacity:1;transform:none;transition:opacity .25s ease}.m-period .ss-period{opacity:1;transform:none}
  .m-strip,.m-rise,.m-stamp{clip-path:none;transform:none;filter:none}
  .m-strip:not(.in),.m-rise:not(.in),.m-stamp:not(.in){opacity:0}
  .m-strip.in,.m-rise.in,.m-stamp.in{opacity:1;transition:opacity .25s ease}
}
