/* ============================================================
   MOTION GRAPHICS — v4/motion.html (draft, 3 Dec 2026)
   Same paper, type and palette as the rest of the site: the body's dot
   field paints the ground, Roc Grotesk carries everything, the rotated
   .tag labels and the blue .strip come straight from style.css.
   ============================================================ */

/* ---- 01 · the reel -------------------------------------------------
   A tall runway with a sticky stage. motion.js sets --mo-run to the
   distance the track has to travel, so one pixel of scroll moves the
   track one pixel sideways — nothing is hijacked, the page just scrolls. */
.mo-reel {
  position: relative;
  height: calc(var(--vhu) * 100 + var(--mo-run, 0px));
}
.mo-stage {
  position: sticky; top: 0;
  height: calc(var(--vhu) * 100);
  display: flex; flex-direction: column;
  /* clip, not hidden: a hidden box can still be scrolled sideways by focus,
     which would pull the track out from under the transform */
  overflow: hidden;
  overflow: clip;
}
.mo-track {
  --clip-h: min(calc(var(--vhu) * 56), 74vw);
  position: relative;
  flex: 1; min-height: 0;
  width: max-content;
  display: flex; align-items: center;
  gap: clamp(18px, 2.4vw, 44px);
  padding: calc(var(--vhu) * 7) 6vw 0;
  will-change: transform;
}

/* ---- the title card: the first thing on the track — the headline alone ---- */
.mo-intro {
  position: relative; flex: none;
  width: min(44vw, 760px);
  padding-right: 3vw;
}
.mo-titlewrap { position: relative; display: inline-block; }
.mo-title {
  font-family: var(--roc); font-weight: 700;
  font-size: clamp(54px, 8.4vw, 158px);
  letter-spacing: -.055em; line-height: .86;
  text-transform: lowercase;
  color: #000;
}
.mo-title em { font-style: normal; color: var(--blue); }
/* "frame by … frame": the same rotated labels as Making's lowkey / cool */
.mo-titlewrap .tag { font-size: max(11px, calc(var(--u) * 21)); }
.mo-tag1 { right: -.6em; top: -1.4em; transform: rotate(9deg); }
/* hangs past the full stop, never on it */
.mo-tag2 { left: 100%; bottom: .1em; margin-left: .2em; transform: rotate(-11deg); }

/* ---- the clips ---- */
.mo-clip { position: relative; flex: none; margin: 0; }
.mo-film {
  position: relative;
  height: var(--clip-h);
  aspect-ratio: var(--ar, 1 / 1);      /* the film's own shape — never cropped */
  border-radius: clamp(12px, 1.3vw, 22px);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 clamp(14px, 2vw, 36px) clamp(28px, 3.6vw, 64px) rgba(27, 21, 51, .16);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.mo-film img,
.mo-film iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; display: block;
  object-fit: cover;
}
/* The player never takes the pointer — the click belongs to .mo-hit, which
   opens the same film WITH sound in the lightbox. The background player is
   transparent until its first frame, so the poster under it shows through. */
.mo-film iframe { pointer-events: none; }
.mo-hit { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; }
.mo-hit:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; border-radius: inherit; }
.mo-clip:hover .mo-film { transform: translateY(-6px); box-shadow: 0 clamp(20px, 2.8vw, 48px) clamp(36px, 4.6vw, 80px) rgba(27, 21, 51, .22); }

.mo-cap {
  display: flex; align-items: baseline; gap: .9em;
  margin-top: clamp(12px, 1.2vw, 18px);
}
.mo-no {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(11px, .85vw, 13px); letter-spacing: .14em;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}
.mo-cn {
  font-family: var(--roc); font-weight: 700;
  font-size: clamp(17px, 1.45vw, 24px); letter-spacing: -.02em;
  color: var(--ink);
  transition: color .3s ease;
}
.mo-du {
  margin-left: auto;
  font-family: var(--mono); font-size: clamp(11px, .85vw, 13px);
  letter-spacing: .14em; color: #6d6884;
  font-variant-numeric: tabular-nums;
}
.mo-clip.is-active .mo-cn { color: var(--blue); }

/* ---- the timeline: timecode · lane under a fixed playhead · count ---- */
.mo-tl {
  flex: none;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: clamp(12px, 2vw, 32px);
  padding: 0 6vw calc(var(--vhu) * 4);
}
.mo-tc, .mo-count {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(11px, .9vw, 14px); letter-spacing: .12em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mo-count { color: #6d6884; font-weight: 500; }
.mo-lane {
  position: relative;
  height: clamp(44px, 3.4vw, 52px);       /* room for an 11px label with air above and below */
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(27, 21, 51, .08);
  overflow: hidden;
}
/* the strip starts at the playhead (the lane's centre) and slides left by
   the current time × --pps (px per second, set by motion.js) */
.mo-strip {
  --pps: 16px;
  position: absolute; left: 50%; top: 0; bottom: 0;
  display: flex; align-items: stretch;
  padding: 11px 0 6px;
  will-change: transform;
  /* one tick a second along the top edge, like the ruler on a timeline */
  background: linear-gradient(to right, rgba(27, 21, 51, .28) 1px, transparent 1px) 0 3px / var(--pps) 5px repeat-x;
}
.mo-blk {
  flex: none;
  width: calc(var(--d) * var(--pps) - 2px);
  margin-right: 2px;                      /* the cut between two clips */
  border-radius: 5px;
  display: flex; align-items: center;
  padding: 6px 10px;
  overflow: hidden; white-space: nowrap;
  font-family: var(--mono); font-weight: 700;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;   /* 11px floor: a label, not smallprint */
  color: var(--ink);
  background: var(--c, var(--blue));
}
.mo-blk.c-blue   { --c: var(--blue);   color: #fff; }
.mo-blk.c-orange { --c: var(--orange); }
.mo-blk.c-sky    { --c: var(--sky); }
.mo-blk.c-yellow { --c: var(--yellow); }
.mo-blk.c-lav    { --c: var(--lav); }
.mo-blk.c-purple { --c: var(--purple); color: #fff; }
/* the playhead: a blue flag on a hairline, fixed at the lane's centre */
.mo-ph {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; translate: -1px 0;
  background: var(--blue);
  pointer-events: none;
}
.mo-ph::before {
  content: ''; position: absolute; left: 50%; top: 0;
  width: 10px; height: 8px; translate: -50% 0;
  background: var(--blue);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

/* ---- the PLAY pill that rides the pointer (the showreel's, reused) ---- */
.mo-cursor {
  position: fixed; left: 0; top: 0; z-index: 90;
  pointer-events: none;
}
.mo-cursor b {
  display: block;
  padding: .95em 1.6em;
  background: var(--yellow);
  border-radius: 99px;
  font-family: var(--mono); font-weight: 400;
  font-size: max(11px, calc(var(--u) * 18));
  letter-spacing: .12em; color: var(--ink);
  white-space: nowrap;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .2s ease;
}
.mo-cursor.is-on b { transform: translate(-50%, -50%) scale(1); }

/* ---- 02 · the archive: poster + title only ---- */
.mo-archive {
  padding: clamp(64px, 8vw, 130px) 6vw 0;
}

/* Rows of 2 / 3 / 2 on a six-column grid: halves span 3, thirds span 2.
   motion.js deals the cards into rows and writes --span on each, so every
   row is full whatever the count (a lone card on the last row was the
   problem with one big card + three columns). */
.mo-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(34px, 4vw, 64px) clamp(16px, 2vw, 32px);
  align-items: start;
}
.mo-item { grid-column: span var(--span, 2); }

.mo-a { display: block; color: inherit; text-decoration: none; }
.mo-thumb {
  display: block; position: relative;
  aspect-ratio: 16 / 9;
  border-radius: clamp(10px, 1.2vw, 18px);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 28px rgba(27, 21, 51, .1);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.mo-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .9s var(--ease);
}
/* a Vimeo card's silent loop sits over its still (motion.js); the click
   still belongs to the card, which opens the film with sound */
.mo-thumb iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; display: block;
  pointer-events: none;
  transition: transform .9s var(--ease);
}
.mo-a:hover .mo-thumb iframe { transform: scale(1.035); }
.mo-noimg {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(22px, 2.4vw, 40px); color: var(--blue);
}
.mo-a:hover .mo-thumb,
.mo-a:focus-visible .mo-thumb { transform: translateY(-5px); box-shadow: 0 22px 48px rgba(27, 21, 51, .18); }
.mo-a:hover .mo-thumb img { transform: scale(1.035); }
.mo-a:focus-visible { outline: none; }
.mo-a:focus-visible .mo-thumb { outline: 3px solid var(--blue); outline-offset: 3px; }

.mo-name {
  display: block; margin-top: clamp(12px, 1.2vw, 18px);
  font-family: var(--roc); font-weight: 700;
  font-size: clamp(18px, 1.5vw, 25px);
  letter-spacing: -.025em; line-height: 1.12;
  color: var(--ink);
  transition: color .3s ease;
}
.mo-item.is-half .mo-name { font-size: clamp(20px, 1.9vw, 31px); }
.mo-a:hover .mo-name { color: var(--blue); }

/* ---- phones + tablets ---- */
/* tablets: two columns; with an odd count the first card runs full width */
@media (max-width: 1000px) {
  .mo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mo-item { grid-column: auto; }
  .mo-grid.is-odd .mo-item:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .mo-track { --clip-h: min(calc(var(--vhu) * 50), 76vw); padding-top: calc(var(--vhu) * 9); }
  .mo-intro { width: 82vw; padding-right: 0; }
  .mo-tl { grid-template-columns: auto minmax(0, 1fr); padding-bottom: calc(var(--vhu) * 3); }
  .mo-count { display: none; }
  .mo-grid { grid-template-columns: minmax(0, 1fr); }
  .mo-cursor { display: none; }
}

/* reduced motion: the loops stay as posters (motion.js never loads the
   players) and nothing lifts on hover */
@media (prefers-reduced-motion: reduce) {
  .mo-film, .mo-thumb, .mo-thumb img { transition: none; }
  .mo-clip:hover .mo-film, .mo-a:hover .mo-thumb, .mo-a:hover .mo-thumb img { transform: none; }
}
