/* Mynameis: the motion layer. Everything here is a supplement: without this file, without
   JavaScript, or with "reduce motion" on, the page is complete and static.

   Three kinds of motion, each with its own trigger:
   1. Arrival (time): the first screen and the page titles, once, when the page opens.
   2. Reveal (time, once): everything that carries text appears over a fixed duration when
      it enters the screen, and stays. It never depends on where the scroll stops.
   3. Geometry (scroll): only shapes follow the scroll (the phones, the tag of the first
      screen opening into the band). No text is ever left half-shown.

   Only transform, opacity and clip-path move: nothing shifts the layout. One easing, no
   overshoot. Text never moves for ever; small drawn things do, slowly (sparks, the wave,
   blobs, the pile of tags), and one blank is typed on while it is on screen.

   The studio's home pages carry a one-line script in their <head> that sets `.m` on <html>
   before the first paint (and `.m-skip` when the visitor comes from another page of the
   site: the arrival is then not replayed). Every hidden starting state below is under `.m`,
   so a browser without JavaScript never hides anything; if motion.js does not arrive, the
   same line removes `.m` after three seconds. */

@property --px {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --py {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
/* --ix / --iy: the same turn, played slowly by the page itself */
@property --ix {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --iy {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@media screen and (prefers-reduced-motion: no-preference) {

/* --k scales distances down on small screens */
.site {
  --k: 0.6;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rise: 16px;
}
@media (min-width: 1100px) {
.site {
  --k: 1;
}
}

/* ---------- page and language changes: a native cross-fade where the browser has it;
   the wordmark and the menu stay in place */
@view-transition {
  navigation: auto;
}
.top .wm {
  view-transition-name: wordmark;
}
.top .nav {
  view-transition-name: menu;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

@keyframes m-fade {
  from { opacity: 0; }
}
@keyframes m-rise {
  from { translate: 0 var(--rise); }
}
@keyframes m-line {
  from { translate: 0 110%; }
}

/* ==========================================================================
   1. Arrival
   ========================================================================== */

/* ---------- the sentence comes first. Without the script: as one block. With it: line by
   line from behind a mask, in well under a second (motion.js measures the lines, then puts
   the heading back exactly as it was). */
html:not(.m) .hero h1 {
  animation: m-fade 0.6s ease-out both, m-rise 0.8s var(--ease) both;
}
.m:not(.m-skip) .hero h1:not(.is-split, .is-done) {
  opacity: 0;
}
.ln,
.li {
  display: block;
}
.ln {
  clip-path: inset(-0.1em -0.2em -0.17em -0.2em);
}
.li {
  animation: m-line 0.7s var(--ease) both;
  animation-delay: calc(var(--i) * 80ms);
}
html:not(.m-skip) .hero .mono {
  animation: m-fade 0.6s ease-out both;
}
html:not(.m-skip) .hero-text > * {
  --rise: 14px;
  animation: m-fade 0.7s ease-out both, m-rise 0.9s var(--ease) both;
  animation-delay: 0.35s;
}
html:not(.m-skip) .hero-text > * + * {
  animation-delay: 0.45s;
}

/* ---------- single-tag first screen: the app's band is the tag. It rises empty, its name
   is typed on it at full size, then its colour fills it from left to right. motion.js lays
   an empty copy of the band's layout (.app-blank) over it, types on the copy, wipes it away
   (.is-named) and removes it. Without the script the band simply rises. */
html:not(.m) .app--hero {
  --rise: 70px;
  animation: m-fade 0.5s ease-out 0.2s both, m-rise 1s var(--ease) 0.2s both;
}
.m:not(.m-skip) .app--hero:not(.is-ready) {
  opacity: 0;
}
.m:not(.m-skip) .app--hero.is-ready {
  --rise: 70px;
  animation: m-fade 0.5s ease-out both, m-rise 1s var(--ease) both;
}
.app-blank {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: var(--bg);
  color: var(--fg);
  outline: 1.5px solid var(--fg);
  outline-offset: -1.5px;
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease);
}
.app-blank .app-top {
  color: var(--mu);
}
.app-blank :is(.app-line, .app-foot, .app-top .mono, .shots) {
  visibility: hidden;
}
.m .is-named > .app-blank {
  clip-path: inset(0 0 0 100%);
}

/* the letters typed on the empty copy, and their cursor */
.tl {
  visibility: hidden;
}
.tl.is-on {
  visibility: visible;
}
.tc {
  position: relative;
  display: inline-block;
  width: 0;
}
.tc::after {
  content: "";
  position: absolute;
  left: 0.05em;
  bottom: 0.02em;
  width: 0.05em;
  height: 0.74em;
  background: currentColor;
}

/* ---------- the top tag of the pile: words are typed on its blank, one after the other,
   for as long as it is on screen (motion.js adds the element and reads the words from the
   page). Without the script the blank stays a plain line. */
.slot.has-words .my::after {
  content: none;
}
.slot-word {
  /* the word is written large, like a name on a badge, on a line as wide as the tag */
  display: block;
  padding-bottom: 2px;
  background: linear-gradient(var(--fg), var(--fg)) 0 100% / 100% 1.5px no-repeat;
  color: var(--fg);
  font-size: min(1.875rem, 8vw);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.slot-word::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: m-wink 1s steps(1, end) infinite;
}
@keyframes m-wink {
  50% { opacity: 0; }
}
@media (min-width: 1100px) {
.slot-word {
  font-size: 2.5rem;
}
}

/* ---------- pages of long text and lists (both sites, no script): the title arrives,
   then the text, once. Nothing there depends on scrolling. */
.doc-head > *,
.doc-head ~ .doc {
  animation: m-fade 0.7s ease-out both, m-rise 0.9s var(--ease) both;
}
.doc-head > * + * {
  animation-delay: 0.1s;
}
.doc-head ~ .doc {
  --rise: 12px;
  animation-delay: 0.2s;
}

/* ---------- the page of an app (apps site): its band is the page header */
.app--page .app-top,
.app--page .app-line,
.app--page .app-intro {
  animation: m-fade 0.7s ease-out both, m-rise 0.9s var(--ease) both;
}
@keyframes m-name {
  from { clip-path: inset(-0.2em 100% -0.2em -0.1em); }
  to { clip-path: inset(-0.2em -0.1em -0.2em -0.1em); }
}
.app--page .app-name {
  animation: m-name 1.1s var(--ease) 0.1s both;
}
.app--page .app-line { animation-delay: 0.25s; }
.app--page .app-intro { animation-delay: 0.35s; }
@keyframes m-shot {
  from { opacity: 0; translate: 0 calc(var(--k) * 90px); }
}
.app--page .shot {
  animation: m-shot 1.2s var(--ease) 0.2s both;
}
.app--page .shot--b {
  animation-delay: 0.35s;
}
.app--page ~ .doc {
  animation: m-fade 0.7s ease-out 0.4s both;
}

/* ==========================================================================
   2. Reveal: once, over a fixed duration, when the element enters the screen.
   motion.js adds .is-in (and --d to stagger what enters together).
   ========================================================================== */

.m :is(.h2, .h3, .intro, .cards li, .mailtag, .foot-in, .rows li > *, .apps .app-top, .apps .app-line, .apps .app-foot) {
  transition: opacity 0.7s ease-out var(--d, 0s), translate 0.9s var(--ease) var(--d, 0s), rotate 0.9s var(--ease) var(--d, 0s), border-color 0.3s;
}
.m :is(.h2, .h3, .intro, .cards li, .mailtag, .foot-in):not(.is-in),
.m .rows li:not(.is-in) > *,
.m .apps .app:not(.is-in) :is(.app-top, .app-line, .app-foot) {
  opacity: 0;
  translate: 0 22px;
}
.m .cards li:not(.is-in) {
  rotate: -3deg;
}
.m .cards li:nth-child(3n + 2):not(.is-in) {
  rotate: 3deg;
}
.m .mailtag:not(.is-in) {
  rotate: -4deg;
}

/* the app band: its name is unveiled from the left, then the text */
.m .apps .app-name {
  clip-path: inset(-0.2em -0.1em -0.2em -0.1em);
  transition: clip-path 1.1s var(--ease) 0.1s;
}
.m .apps .app:not(.is-in) .app-name {
  clip-path: inset(-0.2em 100% -0.2em -0.1em);
}
.m .apps .app-line { --d: 0.2s; }
.m .apps .app-foot { --d: 0.3s; }

/* the rules draw themselves: on top of each section, and of each row of the know-how */
.m :is(.section, .apps, .rows li) {
  position: relative;
  border-top-color: transparent;
}
.m :is(.section, .apps)::before,
.m .rows li::after {
  content: "";
  position: absolute;
  inset: -1px 0 auto;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
  transition: scale 1.1s var(--ease) var(--d, 0s);
}
.m :is(.section, .apps):not(.is-in)::before,
.m .rows li:not(.is-in)::after {
  scale: 0 1;
}

/* no rule between the first screen and the band that belongs to it, nor under the pile */
.m .apps--lead::before,
.m .apps + .section::before {
  content: none;
}

/* the pile is dealt like cards: the lilac tag slides in from the left, the mint one from
   the right, then the blank tag is laid on top; the spark comes last */
.m :is(.stack-tag, .stack .slot) {
  transition: translate 1s var(--ease) var(--d, 0s), rotate 1s var(--ease) var(--d, 0s), scale 1s var(--ease) var(--d, 0s), opacity 0.4s ease-out var(--d, 0s);
}
.m .stack-tag {
  --d: 0.14s;
}
.m .stack .slot {
  --d: 0.3s;
}
.m .stack:not(.is-in) :is(.stack-tag, .slot) {
  opacity: 0;
}
.m .stack:not(.is-in) .stack-tag:first-child {
  translate: -150px 40px;
  rotate: -24deg;
}
.m .stack:not(.is-in) .stack-tag {
  translate: 150px 30px;
  rotate: 22deg;
}
.m .stack:not(.is-in) .slot {
  translate: 0 60px;
  rotate: 7deg;
  scale: 1.12;
}
.m .stack > .doodle {
  transition-delay: 0.9s;
}

/* drawn elements arrive in their turn: the wavy line once the sentence is in place, the
   arrow of the first screen once the tag below it has its colour, sparks and the other
   arrow with their section; the rhythm dots come one after the other */
@keyframes m-ink {
  from { text-decoration-color: transparent; }
}
html:not(.m) .wavy {
  animation: m-ink 0.6s ease-out 0.7s both;
}
.m:not(.m-skip) .hero h1:not(.is-done) .wavy {
  text-decoration-color: transparent;
}
.m:not(.m-skip) .hero h1.is-done .wavy {
  animation: m-ink 0.6s ease-out both;
}
.m .doodle {
  transition: scale 0.8s var(--ease) 0.3s, rotate 0.8s var(--ease) 0.3s, opacity 0.4s ease-out 0.3s;
}
.m .app:not(.is-in) .doodle,
.m .stack:not(.is-in) > .doodle,
.m .section:not(.is-in) > .doodle,
.m:not(.m-skip) .app--hero:not(.is-named) .doodle,
.m:not(.m-skip) .hero:not(:has(+ .apps .is-named)) .hero-arrow {
  opacity: 0;
  scale: 0.2;
  rotate: -60deg;
}
.m .hero-arrow {
  transition-delay: 0.7s;
}
.m .contact-arrow {
  transition-delay: 0.9s;
}
.m .beats i {
  transition: scale 0.5s var(--ease) calc(sibling-index() * 70ms + 0.3s);
}
.m:not(.m-skip) .app--hero:not(.is-named) .beats i.on {
  animation: none;
}
.m:not(.m-skip) .app--hero:not(.is-named) .beats i {
  scale: 0;
}

/* ---------- the phones are objects: the pair turns slowly in space by itself, and towards
   the pointer where there is one (--px / --py from motion.js). The second phone stands in
   front of the first, so they shift against each other. site.css draws their thickness
   from the same four values. */
@keyframes m-turn {
  from { --ix: -0.55; --iy: -0.3; }
  to { --ix: 0.55; --iy: 0.35; }
}
.shots {
  transform: perspective(1200px) rotateX(calc((var(--py) + var(--iy)) * -5deg)) rotateY(calc((var(--px) + var(--ix)) * 8deg));
  transform-style: preserve-3d;
  animation: m-turn 7s ease-in-out infinite alternate;
}
.shot--b {
  transform: rotate(6deg) translateZ(48px);
}

/* ---------- small drawn things keep moving, slowly: they are decoration, never text.
   Each is added on top of whatever else moves the element (additive), so reveals, hovers
   and scroll effects keep working underneath. */
@keyframes m-spin {
  to { rotate: 360deg; }
}
.d-spark {
  animation: m-spin 16s linear infinite;
  animation-composition: add;
}
.shots .s2,
.stack > .d-spark {
  animation-duration: 11s;
  animation-direction: reverse;
}
/* the wave rolls in place: it slides by exactly one wavelength, for ever */
@keyframes m-roll {
  to { translate: -28px 0; }
}
.d-squig path {
  animation: m-roll 1.8s linear infinite;
}
/* the two coloured tags of the pile sway, each at its own pace (nothing changes under
   the pointer: the pile keeps its shape) */
@keyframes m-sway {
  from { rotate: -0.5deg; translate: -3px 2px; }
  to { rotate: 0.7deg; translate: 4px -3px; }
}
.stack-tag {
  animation: m-sway 7s ease-in-out infinite alternate;
  animation-composition: add;
}
.stack-tag:first-child {
  animation-duration: 9s;
  animation-direction: alternate-reverse;
}
/* blobs tilt and breathe */
@keyframes m-tilt {
  from { rotate: -5deg; translate: 0 2px; }
  to { rotate: 8deg; translate: 0 -3px; }
}
@keyframes m-pulse {
  to { scale: 1.12; }
}
@keyframes m-morph {
  to { border-radius: 54% 46% 47% 53% / 46% 55% 45% 54%; }
}
.blob {
  animation: m-tilt 3.6s ease-in-out infinite alternate, m-morph 5s ease-in-out infinite alternate;
  animation-composition: add, replace;
}
.blob .mi {
  animation: m-pulse 1.8s ease-in-out infinite alternate;
}
/* and pop in with their line or their card */
.m :is(.rows, .cards) li .blob {
  transition: scale 0.8s var(--ease) 0.15s, rotate 0.8s var(--ease) 0.15s, opacity 0.7s ease-out, translate 0.9s var(--ease);
}
.m :is(.rows, .cards) li:not(.is-in) .blob {
  scale: 0.3;
  rotate: -50deg;
}
:is(.rows, .cards) li:nth-child(even) .blob,
.ateliers > div:nth-child(even) .blob {
  animation-direction: alternate-reverse, alternate;
}
/* arrows nudge towards what they point at */
@keyframes m-nudge {
  to { translate: 4px 5px; }
}
.d-arrow {
  animation: m-nudge 1.6s ease-in-out infinite alternate;
  animation-composition: add;
}
/* the rhythm of the band plays: each full dot beats in its turn */
@keyframes m-beat {
  0%, 14%, 100% { scale: 1; }
  5% { scale: 1.55; }
}
.beats i.on {
  animation: m-beat 3.2s ease-out calc(sibling-index() * 0.4s) infinite;
}

/* about: the paragraph lights up word by word, in half a second (--n: index of the word) */
.bw {
  transition: opacity 0.6s ease-out calc(var(--n) * 16ms);
}
.m .big:not(.is-in) .bw {
  opacity: 0.2;
}

/* contact: the tag lands, then the address is written from left to right, once
   (the insets leave room for the focus ring) */
.m .mailtag .mail {
  clip-path: inset(-8px -8px -8px -8px);
  transition: clip-path 1.2s var(--ease) 0.35s;
}
.m .mailtag:not(.is-in) .mail {
  clip-path: inset(-8px 100% -8px -8px);
}

/* ==========================================================================
   Pointer (mouse only): small answers
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
/* the phones turn a little towards the pointer:
   --px / --py are set by motion.js on the group, CSS eases them */
.shots {
  transition: --px 0.9s var(--ease), --py 0.9s var(--ease);
}


.nav-links a,
.lang a:not([aria-current]) {
  background: linear-gradient(currentColor, currentColor) 0 calc(50% + 0.85em) / 0 1px no-repeat;
  transition: background-size 0.4s var(--ease), color 0.2s;
}
.nav-links a:hover,
.lang a:not([aria-current]):hover {
  background-size: 100% 1px;
}
.btn span {
  display: inline-block;
  transition: translate 0.4s var(--ease);
}
.btn:hover span {
  translate: 3px -3px;
}
.btn {
  transition: scale 0.4s var(--ease);
}
.btn:hover {
  scale: 1.03;
}
/* stickers: the three cards and the contact tag can be picked up and put down anywhere
   (motion.js sets --dx / --dy while one is held, and --spin when it is put down;
   a double click sends it home). Links inside keep working. */
.cards li,
.mailtag,
.ateliers > div {
  transition: rotate 0.6s var(--ease), border-color 0.3s, translate 0.6s var(--ease);
}
.ateliers > div:hover {
  border-color: var(--fg);
  translate: 0 -4px;
}
.m :is(.cards li, .mailtag) {
  cursor: grab;
  translate: var(--dx, 0px) var(--dy, 0px);
  rotate: var(--spin, 0deg);
}
.m :is(.cards li, .mailtag):hover {
  border-color: var(--fg);
  translate: var(--dx, 0px) calc(var(--dy, 0px) - 4px);
}
.m :is(.cards li, .mailtag).is-moved {
  position: relative;
  z-index: 4;
}
.m :is(.cards li, .mailtag).is-held {
  z-index: 5;
  cursor: grabbing;
  scale: 1.03;
  translate: var(--dx, 0px) var(--dy, 0px);
  transition: scale 0.3s var(--ease), border-color 0.3s;
  user-select: none;
  -webkit-user-select: none;
}
}

/* ==========================================================================
   3. Geometry tied to scrolling: only where the browser can do it natively
   ========================================================================== */
@supports (animation-timeline: view()) {

/* the first screen leaves with depth: the sentence falls behind a little and dims as it
   goes out of view */
@keyframes m-leave {
  to { translate: 0 calc(var(--k) * 70px); opacity: 0.3; }
}
html:not(.m) .hero h1 {
  animation: m-fade 0.6s ease-out both, m-rise 0.8s var(--ease) both, m-leave linear both;
  animation-timeline: auto, auto, scroll(root);
  animation-range: normal, normal, 80px 700px;
}
.m .hero h1 {
  animation: m-leave linear both;
  animation-timeline: scroll(root);
  animation-range: 80px 700px;
}

/* one timeline for the band, shared by what it contains: .app clips its overflow, so its
   children cannot use view() themselves */
.app {
  view-timeline: --app block;
}
/* single-tag first screen: a tilted tag at rest, the full-width band once scrolled. Tied
   to the page's scroll position, not to the band entering the screen: the first screen is
   the same on every screen height. site.css holds the tilt; this undoes it. */
@keyframes m-open {
  to { rotate: calc(var(--tilt) * -1); scale: calc(1 / var(--fit)); border-radius: 0; }
}
html:not(.m) .app--hero {
  animation: m-fade 0.5s ease-out 0.2s both, m-rise 1s var(--ease) 0.2s both, m-open linear both;
  animation-timeline: auto, auto, scroll(root);
  animation-range: normal, normal, 0px 62vh;
}
.m .app--hero {
  animation: m-open linear both;
  animation-timeline: scroll(root);
  animation-range: 0px 62vh;
}
.m:not(.m-skip) .app--hero.is-ready {
  animation: m-fade 0.5s ease-out both, m-rise 1s var(--ease) both, m-open linear both;
  animation-timeline: auto, auto, scroll(root);
  animation-range: normal, normal, 0px 62vh;
}

/* the two phones: they come up from below at different speeds and straighten a little */
@keyframes m-par-a {
  from { translate: 0 var(--par); rotate: calc(var(--par-r) * -1); }
  to { translate: 0 calc(var(--par) * -0.5); rotate: calc(var(--par-r) * 0.5); }
}
@keyframes m-par-b {
  from { translate: 0 calc(var(--par) * 2.1); rotate: var(--par-r); }
  to { translate: 0 calc(var(--par) * -0.25); rotate: calc(var(--par-r) * -0.5); }
}
.shots {
  --par: calc(var(--k) * 96px);
  --par-r: 4deg;
}
@keyframes m-float {
  to { translate: 0 -9px; }
}
.apps .shot--a {
  animation: m-par-a linear both, m-float 4.5s ease-in-out infinite alternate;
  animation-composition: replace, add;
  animation-timeline: --app, auto;
}
.apps .shot--b {
  animation: m-par-b linear both, m-float 5.5s ease-in-out infinite alternate-reverse;
  animation-composition: replace, add;
  animation-timeline: --app, auto;
}
.app--tile .shot {
  animation: none;
}
/* on the page of an app the band is already in view: the phones only drift as it leaves */
@keyframes m-par-page {
  to { translate: 0 calc(var(--par) * var(--speed, 1)); }
}
.app--page .shot {
  --par: calc(var(--k) * -70px);
  animation: m-shot 1.2s var(--ease) 0.2s both, m-par-page linear both;
  animation-composition: replace, add;
  animation-timeline: auto, --app;
  animation-range: normal, exit 0% exit 100%;
}
.app--page .shot--b {
  --speed: 1.8;
  animation-delay: 0.35s, 0s;
}

}
}
