/* Motion & Matter — one motion system.

   Curves, durations and distances are tokens on :root in index.html:
     --ease         anything that travels and settles (cards, rises, underlines, arrows)
     --ease-inout   anything that crosses from one side to the other (rules, the scroll cue)
     --dur-quick    colour and opacity
     --dur-move     hover movement
     --dur-reveal   entrances
     --rise / --stagger   how far and how far apart entrances happen

   The films never move. The interface moves around them. */

/* ---------- Reveal on scroll ----------
   [data-reveal] is hidden only while html.js-motion is set (see the script in <head>).
   motion.js adds .is-in when the element enters the viewport, then removes both the
   attribute and the class, so nothing here outlives the entrance. */
.js-motion [data-reveal]{
  opacity:0;
  transform:translate3d(0,var(--rise),0);
  transition:opacity var(--dur-reveal) ease,transform var(--dur-reveal) var(--ease);
  transition-delay:calc(var(--base,0ms) + var(--d,0) * var(--stagger));
}
.js-motion [data-reveal].is-in{opacity:1;transform:none}

/* Hairlines draw from the left. */
.js-motion [data-reveal="rule"]{
  opacity:1;
  transform:scaleX(0);
  transform-origin:left center;
  transition:transform 1.1s var(--ease-inout);
  transition-delay:calc(var(--base,0ms) + var(--d,0) * var(--stagger));
}
.js-motion [data-reveal="rule"].is-in{transform:none}

/* Photographs rise with their frame while the image settles inside it. */
.js-motion [data-reveal="photo"] img{
  transform:scale(1.045);
  transition:transform 1.4s var(--ease);
  transition-delay:calc(var(--base,0ms) + var(--d,0) * var(--stagger));
}
.js-motion [data-reveal="photo"].is-in img{transform:none}

/* A scene changes the room rather than moving: the studio chapter starts as paper and
   the lights go down as it arrives. */
.js-motion [data-reveal="scene"]{
  opacity:1;
  transform:none;
  transition:background-color 1s ease;
}
.js-motion [data-reveal="scene"]::before{transition:opacity 1.4s ease .15s}
.js-motion [data-reveal="scene"]:not(.is-in){background-color:var(--paper)}
.js-motion [data-reveal="scene"]:not(.is-in)::before{opacity:0}

/* Order within a group: the heading leads, what it introduces follows. */
.deck-wrap,
.deck-controls{--base:220ms}
.studio-intro{--base:380ms}

/* ---------- Hero entrance ----------
   Navigation first; the wordmark and what it does follow in hero.css. */
@media (prefers-reduced-motion:no-preference){
  @keyframes hero-rise{from{opacity:0;transform:translate3d(0,14px,0)}}
  @keyframes hero-fade{from{opacity:0}}
  .hero-nav > a,.nav-social > a{animation:hero-rise .56s var(--ease) backwards}
  .nav-social > a + a{animation-delay:60ms}
  .hero-cue{animation:hero-fade .5s ease .5s backwards}
}

/* ---------- Scroll cue ----------
   Sits on the film, level with the foot of the wordmark block, in the film's light type.
   Steps aside once the page has moved. */
.hero-cue{
  position:absolute;
  z-index:5;
  right:var(--hero-gutter);
  bottom:var(--hero-inset);
  /* Keeps its margin from the frame's right edge as the frame closes in. */
  translate:calc(var(--frame-now) * -1) 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  font-size:var(--type-meta-size);
  letter-spacing:var(--type-meta-track);
  text-transform:uppercase;
  color:rgba(247,245,240,.9);
  text-shadow:0 1px 10px rgba(0,0,0,.5);
  transition:opacity var(--dur-move) ease,transform var(--dur-move) var(--ease);
}
.hero-cue-label{margin-right:calc(var(--type-meta-track) * -1)}
.hero-cue-line{
  position:relative;
  width:1px;
  height:40px;
  overflow:hidden;
  background:rgba(247,245,240,.28);
}
.hero-cue-line::after{
  content:"";
  position:absolute;
  inset:0;
  background:currentColor;
  transform:translateY(-101%);
  animation:cue-travel 2.6s var(--ease-inout) infinite;
}
@keyframes cue-travel{
  0%{transform:translateY(-101%)}
  60%,100%{transform:translateY(101%)}
}
.hero-film.is-scrolled .hero-cue{
  opacity:0;
  transform:translateY(8px);
  pointer-events:none;
}
@media(max-width:600px){
  .hero-cue{right:max(16px, env(safe-area-inset-right));bottom:calc(var(--hero-inset) + env(safe-area-inset-bottom));gap:8px;translate:none}
  .hero-cue-line{height:28px}
}
@media (prefers-reduced-motion:reduce){
  /* No travelling line: the label and a still rule say the same thing. */
  .hero-cue-line{background:currentColor;opacity:.45}
}

/* ---------- Text links ----------
   One underline everywhere: a quiet line at rest, an ink line drawn over it from the
   left on hover and withdrawn to the right on leave. */
.card-link,
.site-foot a,
.sv-link,
.hero-nav a{
  --underline-rest:rgba(41,42,40,.28);
  border-bottom:0;
  padding-bottom:2px;
  background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--underline-rest),var(--underline-rest));
  background-repeat:no-repeat;
  background-position:100% 100%,0 100%;
  background-size:0 1px,100% 1px;
  transition:background-size var(--dur-move) var(--ease),color var(--dur-quick) ease;
}
.hero-nav a{--underline-rest:transparent}
.sv-link{--underline-rest:rgba(255,255,255,.35)}
.card-link:hover,
.site-foot a:hover,
.sv-link:hover,
.hero-nav a:hover,
.card-link:focus-visible,
.site-foot a:focus-visible,
.sv-link:focus-visible,
.hero-nav a:focus-visible{
  background-position:0 100%,0 100%;
  background-size:100% 1px,100% 1px;
}

/* Arrows step a few pixels in the direction they point. */
.diag-arrow{transition:translate var(--dur-move) var(--ease)}
a:hover .diag-arrow,
a:focus-visible .diag-arrow{translate:.24em -0.05em}
.link-arrow{
  display:inline-block;
  transition:transform var(--dur-move) var(--ease);
}
a:hover .link-arrow,
a:focus-visible .link-arrow{transform:translateX(.2em)}

/* ---------- Deck ---------- */
/* Position and opacity are driven per frame by deck.js; only the shadow is left to CSS. */
.project-card{transition:box-shadow var(--dur-move) var(--ease)}

.count-now{display:inline-block}
@keyframes tick-up{from{opacity:0;transform:translateY(.5em)}}
@keyframes tick-down{from{opacity:0;transform:translateY(-.5em)}}
.count-now.tick-up{animation:tick-up .34s var(--ease)}
.count-now.tick-down{animation:tick-down .34s var(--ease)}
.track-inner{
  width:100%;
  transform:scaleX(var(--progress,0));
  transform-origin:left center;
  transition:transform var(--dur-move) var(--ease);
}

.nav-button{
  transition:background-color var(--dur-quick) ease,border-color var(--dur-quick) ease,transform var(--dur-quick) var(--ease);
}
.nav-arrow{
  display:block;
  transition:transform var(--dur-move) var(--ease);
}
@media (hover:hover){
  #prev:hover .nav-arrow{transform:translateX(-3px)}
  #next:hover .nav-arrow{transform:translateX(3px)}
}
@media (hover:none){
  /* No sticky hover fill after a tap. */
  .nav-button:hover{background:transparent;border-color:#dfdcd5}
}
#prev:active .nav-arrow{transform:translateX(-5px)}
#next:active .nav-arrow{transform:translateX(5px)}

/* ---------- Arrows ----------
   Drawn, not typed: phones turn the arrow characters into emoji. One line weight, taking the
   colour of the text around them. */
.arr{
  display:inline-block;width:.7em;height:.7em;vertical-align:-.02em;flex-shrink:0;
  background:currentColor;
  -webkit-mask:var(--arr) center / contain no-repeat;mask:var(--arr) center / contain no-repeat;
}
.arr-ne{--arr:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M2.5 9.5l7-7M4 2.5h5.5V8'/%3E%3C/svg%3E")}
.arr-e{--arr:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M1.5 6h9M7 2.5L10.5 6 7 9.5'/%3E%3C/svg%3E")}
.arr-w{--arr:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M10.5 6h-9M5 2.5L1.5 6 5 9.5'/%3E%3C/svg%3E")}
.credit-arrow.arr{width:.66em;height:.66em;margin-left:.22em}
.link-arrow.arr{margin-left:.1em}
.nav-arrow.arr,.studio-lightbox-nav .arr{width:18px;height:18px;vertical-align:middle}

