/* Movement and the details shared by every page of the Lab5 home site (home/s/site.js runs the moving parts).
   The vocabulary is the 2022 site's, measured from its own interaction definitions and then smoothed:
     buttons lift 4px under the pointer; a line grows under navigation links; text links draw their underline;
     blocks arrive together or a beat apart, top to bottom, fading in while they rise; pictures follow from further;
     a ball travels the line of steps as the page scrolls; the map leans with the mouse; figures count up.
   Nothing here hides content unless the script has put `motion` on <html>, so a page without the script, or a
   reader who asks for reduced motion, sees everything at rest. */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-soft: cubic-bezier(.22, .7, .22, 1);
  /* the 2022 site's own easings, by the names its interaction file uses */
  --out-expo: cubic-bezier(.19, 1, .22, 1); --out-quad: cubic-bezier(.25, .46, .45, .94); --out-quart: cubic-bezier(.165, .84, .44, 1); --ease-in: cubic-bezier(.42, 0, 1, 1); }

/* buttons, exactly as the 2022 site ("Button Hover Start/End"): up 4px in 200 ms, ease-in, and back the same way;
   the blue darkens over 300 ms. No shadow, no press effect, nothing else moves. */
.btn { transition: transform .2s var(--ease-in), background-color .3s, color .25s; }
@media (hover: hover) { .btn:hover { transform: translateY(-4px); } }

/* navigation, exactly as the 2022 site ("Nav Link Hover/Out"): a 2px line 5px under the word grows from its left
   edge to its full width in 500 ms (out-expo) and is gone in 100 ms. No background, no chip. */
header.site nav a::after { content: ""; display: block; height: 2px; margin-top: 5px; width: 0; background: var(--navy); transition: width .1s var(--out-expo); }
@media (hover: hover) { header.site nav a:hover::after { width: 100%; transition: width .5s var(--out-expo); } }
header.site nav a:focus-visible::after { width: 100%; transition: width .5s var(--out-expo); }

/* text links: a faint line that is drawn in full under the pointer */
a.tl, .story a, .others a, footer a, .work a, .foot-cols a {
  text-decoration: none; padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(color-mix(in srgb, currentColor 26%, transparent), color-mix(in srgb, currentColor 26%, transparent));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0 1.5px, 100% 1.5px;
  transition: background-size .45s var(--ease-out), color .25s;
}
a.tl:hover, .story a:hover, .others a:hover, footer a:hover, .work a:hover, .foot-cols a:hover,
a.tl:focus-visible, .story a:focus-visible, footer a:focus-visible { background-size: 100% 1.5px, 100% 1.5px; }

/* arrive:start (tools/lab5_site/make_model.py copies this block into s/arrive.css for a page that keeps its own stylesheet) */
/* Arrivals, each copied from the 2022 site's interaction file (docs/lab5-2022-site): upward only, except the two
   side slides it had.
     (default)  "Element Appears": from 30px below; the move takes 600 ms and the fade 1 s, both linear
     load       the opening words on page load: one block from 20px after 600 ms; fade 600 ms ease, move 600 ms out-quad
     far        the opening picture: from 60px, same timing, 800 ms after the words start
     review     what clients said: from 20px; fade 800 ms ease, move 500 ms out-quad; 0, 200 and 400 ms apart
     bottom     "slideInBottom": from 100px, 1 s out-quart
     left/right "slideInLeft/Right": from 100px to the side, 1 s out-quart
     grow       "growIn": from 75% size, 1 s out-quart */
.motion [data-rise]:not(.done) { transition: transform .6s linear, opacity 1s linear; }
.motion [data-rise]:not(.in) { opacity: 0; transform: translate3d(0, 30px, 0); will-change: opacity, transform; }
/* The opening is plain CSS, so it needs no script and no timer and can never be left hidden: the words wait 600 ms
   (as the 2022 site's did) and rise 20px in 600 ms; the picture starts 800 ms after them and rises 60px. */
@keyframes lab5-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lab5-rise-20 { from { transform: translate3d(0, 20px, 0); } to { transform: none; } }
@keyframes lab5-rise-60 { from { transform: translate3d(0, 60px, 0); } to { transform: none; } }
@keyframes lab5-swing { 0% { transform: rotate(-12deg); } 20% { transform: rotate(7.5deg); } 40% { transform: rotate(-4.6deg); } 58% { transform: rotate(2.7deg); } 74% { transform: rotate(-1.5deg); } 88% { transform: rotate(.7deg); } 100% { transform: none; } }
@keyframes lab5-sway { 0%, 100% { transform: none; } 25% { transform: rotate(1.1deg); } 75% { transform: rotate(-1.1deg); } }
/* A ball under gravity (Patrick, 27 Nov: "a bit more of a bounce", after the pen he sent, "but I want it to end
   faster"): it comes up from below, 70px past its place, falls back and bounces on its own resting line, each
   bounce about a third of the last (70, 25, 9, 3px). Every rise slows as a thrown thing does and every fall speeds
   up, with one gravity throughout, so the timings below are worked out, not chosen: 1.11 s in all. */
@keyframes lab5-ball {
  0% { transform: translate3d(0, 140px, 0); animation-timing-function: cubic-bezier(.33, .67, .67, 1); }
  34.2% { transform: translate3d(0, -70px, 0); animation-timing-function: cubic-bezier(.33, 0, .67, .33); }
  54% { transform: none; animation-timing-function: cubic-bezier(.33, .67, .67, 1); }
  65.8% { transform: translate3d(0, -25px, 0); animation-timing-function: cubic-bezier(.33, 0, .67, .33); }
  77.6% { transform: none; animation-timing-function: cubic-bezier(.33, .67, .67, 1); }
  84.7% { transform: translate3d(0, -9px, 0); animation-timing-function: cubic-bezier(.33, 0, .67, .33); }
  91.8% { transform: none; animation-timing-function: cubic-bezier(.33, .67, .67, 1); }
  95.9% { transform: translate3d(0, -3px, 0); animation-timing-function: cubic-bezier(.33, 0, .67, .33); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  [data-rise="load"] { animation: lab5-fade .6s ease .6s both, lab5-rise-20 .6s var(--out-quad) .6s both; }
  [data-rise="far"] { animation: lab5-fade .6s ease 1.4s both, lab5-rise-60 .6s var(--out-quad) 1.4s both; }
  /* a hero's circle arrives with its drawing inside it, like a ball bouncing into view (Patrick, 27 Nov): up from
     below, a little past its place, and two smaller settles; it starts when the picture used to, 800 ms after the words */
  [data-rise="ball"] { animation: lab5-fade .25s ease 1.4s both, lab5-ball 1.11s linear 1.4s both; }
  /* three balls land one after another, about a fifth of a second apart: near enough to read as one arrival, far
     enough to see (Patrick, 27 Nov; the first try, 0.05 and 0.12 s apart, could not be seen) */
  [data-rise="ball"][data-nth="2"] { animation-delay: 1.6s, 1.6s; animation-duration: .25s, 1.17s; }
  [data-rise="ball"][data-nth="3"] { animation-delay: 1.82s, 1.82s; animation-duration: .25s, 1.06s; }
  /* the hanging map (Patrick, 27 Nov: "the hanging map on the about page needs to be animated"): it swings in from
     the hand that holds it, each swing smaller than the last, then keeps a slow sway, as a hung thing does. The
     pivot is the 2022 page's own, 40% 10%. The pointer's lean is on the picture inside, so the two add up. */
  [data-rise="swing"] { transform-origin: 40% 10%; animation: lab5-fade .4s ease 1s both, lab5-swing 2.8s ease-in-out 1s both, lab5-sway 7s ease-in-out 3.8s infinite; }
}
.motion [data-rise="review"]:not(.done) { transition: opacity .8s ease, transform .5s var(--out-quad); }
.motion [data-rise="review"]:not(.in) { transform: translate3d(0, 20px, 0); }
.motion [data-rise="bottom"]:not(.done), .motion [data-rise="left"]:not(.done), .motion [data-rise="right"]:not(.done), .motion [data-rise="grow"]:not(.done) { transition: opacity 1s var(--out-quart), transform 1s var(--out-quart); }
.motion [data-rise="bottom"]:not(.in) { transform: translate3d(0, 100px, 0); }
.motion [data-rise="left"]:not(.in) { transform: translate3d(-100px, 0, 0); }
.motion [data-rise="right"]:not(.in) { transform: translate3d(100px, 0, 0); }
.motion [data-rise="grow"]:not(.in) { transform: scale(.75); }
/* arrive:end */

/* cards answer the pointer */
.lift { transition: transform .3s var(--ease-soft), box-shadow .3s var(--ease-soft), border-color .3s, background-color .4s; }
@media (hover: hover) { .lift:hover { transform: translateY(-4px); } }
.zoom { overflow: hidden; }
.zoom img { transition: transform .6s var(--ease-soft); }
@media (hover: hover) { a:hover .zoom img, .zoom:hover img { transform: scale(1.04); } }

/* a band with the 2022 site's saw-tooth edge, and a picture that bridges the edge from the section above */
.zig { position: relative; background: var(--surface-2); }
.zig::before { content: ""; position: absolute; left: 0; right: 0; bottom: calc(100% - 1px); height: 17px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='17' viewBox='0 0 28 17'%3E%3Cpath d='M0 17 14 0l14 17z' fill='%23EAEDFF'/%3E%3C/svg%3E") repeat-x 0 0 / 28px 17px; }
.zig.beige { background: var(--beige); }
.zig.beige::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='17' viewBox='0 0 28 17'%3E%3Cpath d='M0 17 14 0l14 17z' fill='%23FFEFDF'/%3E%3C/svg%3E"); }
.bridge { position: relative; z-index: 1; display: block; margin-inline: auto; }

/* the line of steps: a ball rides down it with the scroll and each step lights as the ball reaches it */
.steps { --p: 1; --pad: 56px; position: relative; display: grid; gap: 28px; padding-left: var(--pad); }
/* --len is the distance from the first step's dot to the last one's (site.js sets it), so the line and the ball end
   on the last step and not below it */
.steps { --len: calc(100% - 20px); }
.steps::before { content: ""; position: absolute; left: 17px; top: 10px; height: var(--len); width: 2px; background: var(--navy); opacity: .18; }
.steps::after { content: ""; position: absolute; left: 17px; top: 10px; width: 2px; height: calc(var(--len) * var(--p)); background: var(--navy); }
.steps .ball { position: absolute; left: 18px; top: calc(10px + var(--len) * var(--p)); width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--surface); border: 2px solid var(--navy); z-index: 2; }
.steps .ball::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--accent); }
.steps .stop { position: relative; display: grid; gap: 4px; transition: opacity .4s ease; }
.steps .stop::before { content: ""; position: absolute; left: calc(9px - var(--pad)); top: .5em; width: 16px; height: 16px; border-radius: 50%; background: var(--navy); transform: scale(.55); opacity: .35; transition: transform .35s var(--ease-out), opacity .35s; }
.motion .steps .stop { opacity: .5; }
.motion .steps .stop.on { opacity: 1; }
.steps .stop.on::before { transform: scale(1); opacity: 1; }

/* the map leans with the mouse */
.tilt-box { overflow: visible; }   /* the map must not lose its edges when it leans (Patrick, 27 Nov) */
[data-tilt] { transform-origin: 50% 60%; will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  .motion [data-rise]:not(.in) { opacity: 1; transform: none; }
  .motion [data-rise]:not(.done) { transition: none; }
  .btn, .lift, .zoom img, header.site nav a::after, a.tl, .story a, footer a { transition: none; }
  .btn:hover, .lift:hover { transform: none; }
}
