/* ============================================================================
   motion.css — KEYFRAMES AND TRANSITIONS
   ----------------------------------------------------------------------------
   The fourth layer, added for this brief. Durations and easings are brand
   values exactly like colours: they live in tokens.css and are consumed here.
   A literal 0.3s in this file is the same mistake as a literal #00BAE9.

   Every effect has a reduced-motion path. The tokens collapse the durations to
   1ms under prefers-reduced-motion, so movement disappears and nothing else
   changes — no element becomes unreachable.
   ========================================================================== */

/* ---- card transition ---------------------------------------------------
   The card sequence is driven entirely by site/js/cards.js using the Web
   Animations API. It used to be a CSS state machine toggled by a data-state
   attribute, and it did not work: the computed translate on the leaving cards
   stayed at 0% and nothing moved, while setTimeout guessed at the timings on
   top. Explicit keyframes with real completion promises either run correctly
   or throw; they cannot half happen.

   Nothing here may set transform, translate, scale or width on .card, or it
   will fight the animation mid-flight.

   Under prefers-reduced-motion cards.js skips straight to hiding the grid. */

/* ---- walter hops in ------------------------------------------------------
   A CSS animation runs when its element is inserted, so this plays on the
   first load AND every time router.js swaps in the next page's Walter - no
   JavaScript timing involved. Grows from his feet, so he lands rather than
   inflates. Under reduced motion --dur-mascot is 1ms: he is simply there.

   A REAL HOP, NOT A POP. Konny, 19 Oct: "Könntest Du die Figur noch etwas
   länger bewegen/hereinhüpfen lassen?" It was one 560ms grow with an
   overshoot. Now, over --dur-mascot: he pops up into the air, falls, lands
   with a squash, takes a smaller second hop and settles.

   GENERATED - edit tools/mascot-hop.mjs and paste its output, do not edit
   these lines by hand. Each part of the jump needs its own easing (slowing to
   the top, fastest at the ground), and Chrome ignores var() as a per-keyframe
   easing: getKeyframes() reported every step "linear". So the two parabolas
   are sampled every 2.5% and played linearly between points two frames
   apart. */
@keyframes mascot-in {
     0% { opacity: 0; scale: 0.55; translate: 0 10%; }
   2.5% { opacity: 0.125; scale: 0.622; translate: 0 5.847%; }
     5% { opacity: 0.25; scale: 0.688; translate: 0 2.056%; }
   7.5% { opacity: 0.375; scale: 0.747; translate: 0 -1.375%; }
    10% { opacity: 0.5; scale: 0.8; translate: 0 -4.444%; }
  12.5% { opacity: 0.625; scale: 0.847; translate: 0 -7.153%; }
    15% { opacity: 0.75; scale: 0.888; translate: 0 -9.5%; }
  17.5% { opacity: 0.875; scale: 0.922; translate: 0 -11.486%; }
    20% { opacity: 1; scale: 0.95; translate: 0 -13.111%; }
  22.5% { opacity: 1; scale: 0.972; translate: 0 -14.375%; }
    25% { opacity: 1; scale: 0.988; translate: 0 -15.278%; }
  27.5% { opacity: 1; scale: 0.997; translate: 0 -15.819%; }
    30% { opacity: 1; scale: 1; translate: 0 -16%; }
  32.5% { opacity: 1; scale: 1; translate: 0 -15.84%; }
    35% { opacity: 1; scale: 1; translate: 0 -15.36%; }
  37.5% { opacity: 1; scale: 1; translate: 0 -14.56%; }
    40% { opacity: 1; scale: 1; translate: 0 -13.44%; }
  42.5% { opacity: 1; scale: 1; translate: 0 -12%; }
    45% { opacity: 1; scale: 1; translate: 0 -10.24%; }
  47.5% { opacity: 1; scale: 1; translate: 0 -8.16%; }
    50% { opacity: 1; scale: 1.01 0.983; translate: 0 -5.76%; }
  52.5% { opacity: 1; scale: 1.035 0.942; translate: 0 -3.04%; }
    55% { opacity: 1; scale: 1.06 0.9; translate: 0 0%; }
  57.5% { opacity: 1; scale: 1.035 0.942; translate: 0 -1.833%; }
    60% { opacity: 1; scale: 1.01 0.983; translate: 0 -3.333%; }
  62.5% { opacity: 1; scale: 1; translate: 0 -4.5%; }
    65% { opacity: 1; scale: 1; translate: 0 -5.333%; }
  67.5% { opacity: 1; scale: 1; translate: 0 -5.833%; }
    70% { opacity: 1; scale: 1; translate: 0 -6%; }
  72.5% { opacity: 1; scale: 1; translate: 0 -5.833%; }
    75% { opacity: 1; scale: 1; translate: 0 -5.333%; }
  77.5% { opacity: 1; scale: 1; translate: 0 -4.5%; }
    80% { opacity: 1; scale: 1.005 0.993; translate: 0 -3.333%; }
  82.5% { opacity: 1; scale: 1.018 0.977; translate: 0 -1.833%; }
    85% { opacity: 1; scale: 1.03 0.96; translate: 0 0%; }
  87.5% { opacity: 1; scale: 1.018 0.977; translate: 0 0%; }
    90% { opacity: 1; scale: 1.005 0.993; translate: 0 0%; }
  92.5% { opacity: 1; scale: 1; translate: 0 0%; }
    95% { opacity: 1; scale: 1; translate: 0 0%; }
  97.5% { opacity: 1; scale: 1; translate: 0 0%; }
   100% { opacity: 1; scale: 1; translate: 0 0%; }
}
.brand__mascot {
  transform-origin: 50% 100%;
  animation: mascot-in var(--dur-mascot) linear both;
}

/* ---- content panels entering ------------------------------------------- */
@keyframes panel-in {
  from { opacity: 0; translate: 0 2.4vh; }
  to   { opacity: 1; translate: 0 0; }
}
.panel,
.tile,
.person,
.shot-wrap,
.map,
.map__links {
  animation: panel-in var(--dur-panel) var(--ease-out) both;
  animation-delay: var(--delay-panel);
}
/* stagger the tiles so the grid assembles rather than blinking */
.tile:nth-child(2) { animation-delay: calc(var(--delay-panel) + 40ms); }
.tile:nth-child(3) { animation-delay: calc(var(--delay-panel) + 80ms); }
.tile:nth-child(4) { animation-delay: calc(var(--delay-panel) + 120ms); }
.tile:nth-child(5) { animation-delay: calc(var(--delay-panel) + 160ms); }
.tile:nth-child(6) { animation-delay: calc(var(--delay-panel) + 200ms); }
.tile:nth-child(7) { animation-delay: calc(var(--delay-panel) + 240ms); }
.tile:nth-child(8) { animation-delay: calc(var(--delay-panel) + 280ms); }

@media (prefers-reduced-motion: reduce) {
  @keyframes panel-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

/* ---- über uns: the two arrows are FIXED, and they are drawn twice --------

   MEASURED FROM THE IDML, not inferred. Pages 2 and 3 are the two states of
   this screen, and both draw EXACTLY the same two triangles:

     page 2  photo on top, name box below     page 3  name box on top, photo below
       upper box  arrow at x1174..1214.7        upper box  arrow at x1174..1214.7
                  right edge, pointing RIGHT               right edge, pointing RIGHT
       lower box  arrow at x832.3..873.0        lower box  arrow at x832.3..873.0
                  left edge, pointing LEFT                 left edge, pointing LEFT

   The arrows do not move between the states and they do not encode which
   person is showing. They belong to the POSITION: the upper box points out to
   the right, the lower box points out to the left, both aligned to the top of
   their box.

   WHAT WAS WRONG. We bound the arrow to the STATE instead - photo meant right,
   name box meant left. In the opening state that happens to agree with the
   drawing, which is why it looked right until you hovered. Swap the two people
   and both arrows jump to the opposite sides, and the drawing is inside out.
   Fawad saw it twice: "the arrow kind of goes in a really bad way to the other
   sides", and then "the arrow in Über uns is still not good" against this very
   page of the document.

   THE LAP OF THE BORDER IS GONE. An arrow that rides up the left edge, around
   the corner and down the right one can only exist if the two states put it in
   two different places. They do not. Chasing that motion is what produced the
   rotation bug, the it-only-runs-once bug, and a second round of both. The
   document draws a still arrow, so the arrow is still.

   WHAT MOVES INSTEAD. Only the person you can actually click - the one showing
   a name box - nudges its arrow a little further out while you point at it.
   It is a transition on one property, so it runs on every hover in both
   directions with no animation-name trickery, which is the trap that made the
   lap run exactly once. */
/* translate is written out as 0 0 rather than left to default to `none`.
   Measured: leaving the arrow at `none` made the outward lean animate and the
   return snap, because the browser would not interpolate a length back to a
   keyword. Two lengths transition in both directions. */
/* ---- the arrow does NOT animate -----------------------------------------
   Three attempts, all rejected, and the third by name: "you have tried two
   times and failed. the current animation is just bullshit. lets just remove
   the animation for the arrow."

     1. A lap of the box's border. Wrong from the start — both design pages
        draw both arrows in the same two places, so there is nowhere to travel
        to — and it brought a backwards rotation and a run-once bug with it.
     2. A 25% lean on a transition. Six pixels on a 26px arrow: invisible, and
        reported as "you removed it".
     3. A 90% shove outward. Visible, and still wrong.

   So the arrows are exactly what the document draws and nothing else: the
   upper box's on its right pointing right, the lower box's on its left
   pointing left, both aligned to the top of their box, in both states. The
   reveal below is the animation on this screen.

   WHAT FAWAD ASKED FOR, IF IT COMES BACK. Not a lap and not a lean: the arrow
   should CROSS to the other side of its box — travelling left when the card
   opens so that it points AT the card, and back to the right when it closes.
   That is a different motion from anything tried here and it needs the two
   resting positions to belong to the STATE rather than to the position, which
   contradicts the drawing. It is a design decision, not a bug fix. */
.person__arrow { top: 0; }
.person--top    .person__arrow { left: 100%;                        rotate: 0deg; }
.person--bottom .person__arrow { left: calc(var(--arrow-pw) * -1);  rotate: 180deg; }

/* ---- …unless the arrows FOLLOW the selected person (the default) --------
   The rules above are the layout and stay as the 'fixed' option. The client,
   26 Oct: "bei mir der Pfeil nach rechts zeigt und beim Markus nach links zum
   Textfeld. Wäre es nicht sinnvoll, wenn die Pfeile in dem Moment auf das
   Textfeld zeigen, wenn man die Person anklickt?" So, in 'follow' mode
   (WordPress: Über uns -> Pfeile an den Personen):

     selected person (photo showing, bio in the panel)  arrow on the LEFT,
                                                         pointing at the text
     the other person (name box showing)                 arrow on the RIGHT,
                                                         pointing away

   This is the motion Fawad described in the note above - the arrow crosses
   to the other side of its box when the person opens - now that the client
   asks for the resting positions to belong to the STATE.

   HOW IT CROSSES: ROUND THE BORDER. Fawad, 26 Oct: "like it moves across
   the border to the other side". It goes up round the top-right corner, along
   the top edge pointing UP, round the top-left corner and down onto the left
   side; back the same way. The lap was rejected once before (attempt 1 in the
   note above), and rightly: in the layout both states put each arrow in the
   same place, so there was nowhere to travel to. In 'follow' mode there is.

   ONLY AFTER A CLICK. reveal.js sets data-swapped on the grid on the first
   swap. Without that, the animation would also run on page load and every
   arrow would do a lap the moment the page appeared - the old trap. Before
   the first click the two rules below just place the arrows.

   TWO NAMES, one per direction, never animation-direction: reverse. A browser
   does not restart an animation whose NAME has not changed, which is the
   "ran once and never again" trap. Every swap changes both names.

   GENERATED - edit tools/arrow-travel.mjs and paste its output. The lap needs
   one easing across all three legs; CSS would apply it to each keyframe
   interval and stop dead at both corners. */
.grid--ueber-uns[data-arrows="follow"] .person__arrow {
  left: 100%;
  top: 0;
  rotate: 0deg;
}
.grid--ueber-uns[data-arrows="follow"] .person[data-showing="photo"] .person__arrow {
  left: calc(var(--arrow-pw) * -1);
  rotate: -180deg;
}
.grid--ueber-uns[data-arrows="follow"][data-swapped="true"] .person[data-showing="photo"] .person__arrow {
  animation: arrow-to-text var(--dur-arrow-travel) linear both;
}
.grid--ueber-uns[data-arrows="follow"][data-swapped="true"] .person[data-showing="box"] .person__arrow {
  animation: arrow-to-side var(--dur-arrow-travel) linear both;
}
@keyframes arrow-to-text {
    0% { left: 100%; top: calc(var(--arrow-pw) * 0); rotate: 0deg; }
    4% { left: calc(100% - var(--arrow-pw) * 0.002); top: calc(var(--arrow-pw) * -0.002); rotate: -0.102deg; }
    8% { left: calc(100% - var(--arrow-pw) * 0.014); top: calc(var(--arrow-pw) * -0.014); rotate: -0.814deg; }
   12% { left: calc(100% - var(--arrow-pw) * 0.046); top: calc(var(--arrow-pw) * -0.046); rotate: -2.748deg; }
   16% { left: calc(100% - var(--arrow-pw) * 0.109); top: calc(var(--arrow-pw) * -0.109); rotate: -6.513deg; }
   20% { left: calc(100% - var(--arrow-pw) * 0.212); top: calc(var(--arrow-pw) * -0.212); rotate: -12.721deg; }
   24% { left: calc(100% - var(--arrow-pw) * 0.366); top: calc(var(--arrow-pw) * -0.366); rotate: -21.983deg; }
   28% { left: calc(100% - var(--arrow-pw) * 0.582); top: calc(var(--arrow-pw) * -0.582); rotate: -34.908deg; }
   32% { left: calc(100% - var(--arrow-pw) * 0.868); top: calc(var(--arrow-pw) * -0.868); rotate: -52.107deg; }
   36% { left: calc(100% - var(--arrow-pw) * 1.237); top: calc(var(--arrow-pw) * -1.237); rotate: -74.191deg; }
   40% { left: calc(94.589% - var(--arrow-pw) * 1.392); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   44% { left: calc(79.104% - var(--arrow-pw) * 1.082); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   48% { left: calc(60.532% - var(--arrow-pw) * 0.711); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   52% { left: calc(39.468% - var(--arrow-pw) * 0.289); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   56% { left: calc(20.896% + var(--arrow-pw) * 0.082); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   60% { left: calc(5.411% + var(--arrow-pw) * 0.392); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   64% { left: calc(0% + var(--arrow-pw) * 0.237); top: calc(var(--arrow-pw) * -1.237); rotate: -105.809deg; }
   68% { left: calc(0% - var(--arrow-pw) * 0.132); top: calc(var(--arrow-pw) * -0.868); rotate: -127.893deg; }
   72% { left: calc(0% - var(--arrow-pw) * 0.418); top: calc(var(--arrow-pw) * -0.582); rotate: -145.092deg; }
   76% { left: calc(0% - var(--arrow-pw) * 0.634); top: calc(var(--arrow-pw) * -0.366); rotate: -158.017deg; }
   80% { left: calc(0% - var(--arrow-pw) * 0.788); top: calc(var(--arrow-pw) * -0.212); rotate: -167.279deg; }
   84% { left: calc(0% - var(--arrow-pw) * 0.891); top: calc(var(--arrow-pw) * -0.109); rotate: -173.487deg; }
   88% { left: calc(0% - var(--arrow-pw) * 0.954); top: calc(var(--arrow-pw) * -0.046); rotate: -177.252deg; }
   92% { left: calc(0% - var(--arrow-pw) * 0.986); top: calc(var(--arrow-pw) * -0.014); rotate: -179.186deg; }
   96% { left: calc(0% - var(--arrow-pw) * 0.998); top: calc(var(--arrow-pw) * -0.002); rotate: -179.898deg; }
  100% { left: calc(0% - var(--arrow-pw) * 1); top: calc(var(--arrow-pw) * 0); rotate: -180deg; }
}
@keyframes arrow-to-side {
    0% { left: calc(0% - var(--arrow-pw) * 1); top: calc(var(--arrow-pw) * 0); rotate: -180deg; }
    4% { left: calc(0% - var(--arrow-pw) * 0.998); top: calc(var(--arrow-pw) * -0.002); rotate: -179.898deg; }
    8% { left: calc(0% - var(--arrow-pw) * 0.986); top: calc(var(--arrow-pw) * -0.014); rotate: -179.186deg; }
   12% { left: calc(0% - var(--arrow-pw) * 0.954); top: calc(var(--arrow-pw) * -0.046); rotate: -177.252deg; }
   16% { left: calc(0% - var(--arrow-pw) * 0.891); top: calc(var(--arrow-pw) * -0.109); rotate: -173.487deg; }
   20% { left: calc(0% - var(--arrow-pw) * 0.788); top: calc(var(--arrow-pw) * -0.212); rotate: -167.279deg; }
   24% { left: calc(0% - var(--arrow-pw) * 0.634); top: calc(var(--arrow-pw) * -0.366); rotate: -158.017deg; }
   28% { left: calc(0% - var(--arrow-pw) * 0.418); top: calc(var(--arrow-pw) * -0.582); rotate: -145.092deg; }
   32% { left: calc(0% - var(--arrow-pw) * 0.132); top: calc(var(--arrow-pw) * -0.868); rotate: -127.893deg; }
   36% { left: calc(0% + var(--arrow-pw) * 0.237); top: calc(var(--arrow-pw) * -1.237); rotate: -105.809deg; }
   40% { left: calc(5.411% + var(--arrow-pw) * 0.392); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   44% { left: calc(20.896% + var(--arrow-pw) * 0.082); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   48% { left: calc(39.468% - var(--arrow-pw) * 0.289); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   52% { left: calc(60.532% - var(--arrow-pw) * 0.711); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   56% { left: calc(79.104% - var(--arrow-pw) * 1.082); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   60% { left: calc(94.589% - var(--arrow-pw) * 1.392); top: calc(var(--arrow-pw) * -1.5); rotate: -90deg; }
   64% { left: calc(100% - var(--arrow-pw) * 1.237); top: calc(var(--arrow-pw) * -1.237); rotate: -74.191deg; }
   68% { left: calc(100% - var(--arrow-pw) * 0.868); top: calc(var(--arrow-pw) * -0.868); rotate: -52.107deg; }
   72% { left: calc(100% - var(--arrow-pw) * 0.582); top: calc(var(--arrow-pw) * -0.582); rotate: -34.908deg; }
   76% { left: calc(100% - var(--arrow-pw) * 0.366); top: calc(var(--arrow-pw) * -0.366); rotate: -21.983deg; }
   80% { left: calc(100% - var(--arrow-pw) * 0.212); top: calc(var(--arrow-pw) * -0.212); rotate: -12.721deg; }
   84% { left: calc(100% - var(--arrow-pw) * 0.109); top: calc(var(--arrow-pw) * -0.109); rotate: -6.513deg; }
   88% { left: calc(100% - var(--arrow-pw) * 0.046); top: calc(var(--arrow-pw) * -0.046); rotate: -2.748deg; }
   92% { left: calc(100% - var(--arrow-pw) * 0.014); top: calc(var(--arrow-pw) * -0.014); rotate: -0.814deg; }
   96% { left: calc(100% - var(--arrow-pw) * 0.002); top: calc(var(--arrow-pw) * -0.002); rotate: -0.102deg; }
  100% { left: 100%; top: calc(var(--arrow-pw) * 0); rotate: 0deg; }
}

/* THE REVEAL.
   The photo is uncovered left to right. It used to hold still for the first
   28% and finish by 72%, so that the uncovered edge tracked the arrow tip as
   the arrow crossed the box. The arrow no longer crosses the box - see above -
   so that hold is 146ms of a 520ms reveal in which nothing happens, which is
   the same "it feels slow" that the delay before the panels was. The wipe now
   runs the whole duration. */
.person__frame { transition: clip-path var(--dur-arrow) var(--ease-arrow); }
.person__box   { transition: opacity var(--dur-swap) linear; }

/* name box showing: the photo is clipped away, waiting on the left */
.person[data-showing="box"] .person__frame { clip-path: inset(0 100% 0 0); }
.person[data-showing="box"] .person__box   { opacity: 1; }

/* photo showing: fully uncovered */
.person[data-showing="photo"] .person__frame { clip-path: inset(0 0 0 0); }
.person[data-showing="photo"] .person__box   { opacity: 0; pointer-events: none; }

/* Armed: hovering a name box previews the photo underneath it.
   NAMED FORWARD AND NAMED REVERSE, never `animation-direction: reverse`.
   Changing only the direction leaves the animation-NAME the same, and a
   browser does not restart an animation whose name has not changed - so the
   preview ran on the first hover and never again. Two names means the name
   really does change when data-armed does. */
@keyframes photo-wipe      { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes photo-wipe-back { from { clip-path: inset(0 0 0 0); }   to { clip-path: inset(0 100% 0 0); } }
@keyframes name-fade       { from { opacity: 1; } to { opacity: 0; } }
@keyframes name-fade-back  { from { opacity: 0; } to { opacity: 1; } }

.person[data-showing="box"][data-armed="true"] .person__frame {
  animation: photo-wipe var(--dur-arrow) var(--ease-arrow) forwards;
}
.person[data-showing="box"][data-armed="true"] .person__box {
  animation: name-fade var(--dur-arrow) var(--ease-arrow) forwards;
}
.person[data-showing="box"][data-armed="off"] .person__frame {
  animation: photo-wipe-back var(--dur-arrow) var(--ease-arrow) forwards;
}
.person[data-showing="box"][data-armed="off"] .person__box {
  animation: name-fade-back var(--dur-arrow) var(--ease-arrow) forwards;
}

/* ---- footer slide-up ---------------------------------------------------
   Closed, only the arrow shows. Hover or tap on the arrow opens it.
   The arrow is present on desktop AND mobile. */
/* Closed leaves a 1.68vh sliver of the panel on screen, which is what the
   design draws on pages 2-7. Open brings its bottom flush with the viewport. */
.footer {
  transition: translate var(--dur-footer) var(--ease-out);
  /* 100% OF ITS OWN HEIGHT, NOT --footer-h.
     A percentage in `translate` resolves against the element's own border box,
     so this is right whatever the footer measures. It used to be
     calc(var(--footer-h) - var(--footer-peek)), and on a phone .footer is
     `height: auto` — measured 231px against a token that says 212 — so it slid
     down 198 of the 231 it needed and 33px stayed on screen instead of 14.
     Fawad: "now the contact is in the page the whole time... in every page
     contact is clearly visible. it is really bad." */
  translate: 0 calc(100% - var(--footer-peek));
}
.footer-dock[data-open="true"] .footer { translate: 0 0; }

/* The handle needs no transition and no open state of its own any more: it is
   a child of the panel at `bottom: 100%`, so it is carried by the panel's own
   translate. Two things that had to be kept in step are now one thing. */

/* ---- referenzen slider ------------------------------------------------- */
.slide {
  transition: opacity var(--dur-slide) var(--ease-inout);
  opacity: 0;
  pointer-events: none;
}
.slide[aria-hidden="false"] { opacity: 1; pointer-events: auto; }

.dot { transition: background-color var(--dur-swap) linear; }

/* ---- nav-to-nav page change -------------------------------------------
   Coming from the top nav does NOT replay the card sequence. The outgoing
   background cross-dissolves into the incoming one. Spec 5.2, our proposal. */
.bg img { transition: opacity var(--dur-expand) var(--ease-inout); }
.screen[data-leaving="true"] .panel,
.screen[data-leaving="true"] .tile,
.screen[data-leaving="true"] .person,
.screen[data-leaving="true"] .shot-wrap,
.screen[data-leaving="true"] .map {
  animation: none;
  opacity: 0;
  transition: opacity var(--dur-panel) linear;
}
