/* Work — the reel. The case under the playhead lifts out of the track. */
:root {
  --ruler: 28px;
  --row: clamp(72px, 12vh, 124px);
  --audio: clamp(28px, 4.5vh, 48px);
  --stem: 28px;                 /* gap between the lifted frame and the timeline */
  --head: 50%;                  /* playhead position; work.js reads this too */
}

.reel {
  height: 100svh;
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  padding: var(--top) 0 20px;
}
.reel .tagline {
  padding: 0 var(--gutter);
  font-size: min(4.4vw, 76px);
}

/* Stage: the frame sits centred on the playhead, the case details to its right */
.stage {
  position: relative;
  margin: clamp(24px, 4vh, 48px) 0 var(--stem);
  container-type: size;
}
.stage::after {             /* the playhead continues up into the frame */
  content: '';
  position: absolute; left: var(--head); bottom: calc(-1 * var(--stem));
  width: 1px; height: var(--stem);
  background: var(--fg);
}
.lift {
  --w: min(48cqw, 100cqh * 16 / 9);
  position: absolute; bottom: 0;
  left: calc(var(--head) - var(--w) / 2);
  width: var(--w);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: #0b0b0b;
  transform-origin: 0 0;
  transition: transform .75s cubic-bezier(.2, .8, .2, 1), filter .75s ease, opacity .4s ease;
}
.lift img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}
.lift img + img { opacity: 0; transition: opacity .4s ease; }
.lift img + img.is-ready { opacity: 1; }
.lift.is-from { filter: grayscale(1) brightness(.62); transition: none; }
.lift.is-out {
  opacity: 0;
  filter: grayscale(1) brightness(.62);
  transition: transform .55s cubic-bezier(.5, 0, .75, 0), filter .4s ease, opacity .35s ease .2s;
}

.case {
  position: absolute; bottom: 0;
  left: calc(var(--head) + min(24cqw, 50cqh * 16 / 9) + var(--gutter));
  right: var(--gutter);
  display: grid; gap: 6px;
  max-width: 360px;
}
.case__label {
  display: flex; justify-content: space-between; gap: 16px;
  padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim);
}
.case__brand {
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 38px);
  line-height: 1.05;
  letter-spacing: -.025em;
}
.case__title { font-size: 15px; }
.case__kind { font-size: 14px; color: var(--dim); }
.case__link {
  justify-self: start;
  margin-top: 10px;
  font-size: 14px;
  border-bottom: 1px solid var(--dim);
  transition: border-color .2s;
}
.case__link:hover { border-color: var(--fg); }
.case > * { transition: opacity .3s; }
.case.is-swapping > :not(.case__label) { opacity: 0; transition-duration: .12s; }

/* Edit timeline */
.edit__view {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.edit__view.is-dragging { cursor: grabbing; }
.edit__strip { position: relative; will-change: transform; }

.ruler {
  position: relative;
  height: var(--ruler);
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px var(--tick, 14px)) var(--tick-x, 0) bottom / 100% 6px repeat-x;
}
.ruler span {
  position: absolute; top: 6px; left: 0;
  padding-left: 5px;
  border-left: 1px solid var(--dim);
  height: 16px;
  font: 10px/16px var(--mono);
  color: var(--dim);
  white-space: nowrap;
}

.track { position: relative; height: var(--row); border-bottom: 1px solid var(--line); }
.track--a1 { height: var(--audio); border-bottom: 0; }

.clip {
  position: absolute; top: 6px; bottom: 6px;
  display: block;
  overflow: hidden;
  border-radius: 3px;
  background: #111;
  outline: 1px solid transparent;
  outline-offset: -1px;
  transition: outline-color .2s;
}
.clip img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.14); /* crop the letterbox / white borders baked into some thumbnails */
  display: block;
  pointer-events: none;
  /* back to grey slowly, after a short hold */
  filter: grayscale(1) brightness(.62);
  transition: filter .8s ease 1.2s;
}
.clip:hover img, .clip:focus-visible img, .clip.is-live img {
  filter: none;
  transition: filter .25s ease 0s;
}
.clip b {
  position: absolute; left: 7px; bottom: 6px; right: 7px;
  font: 600 11px/1.2 var(--sans);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clip:hover, .clip:focus-visible, .clip.is-live { outline-color: var(--fg); }

.wave { position: absolute; top: 6px; bottom: 6px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.wave i { flex: 0 0 2px; background: var(--dim); border-radius: 1px; }

.playhead {
  position: absolute; top: 0; bottom: 0; left: var(--head);
  width: 1px; background: var(--fg);
  pointer-events: none;
}
.playhead::before {
  content: ''; position: absolute; top: 0; left: -6px;
  border: 6px solid transparent; border-top: 8px solid var(--fg);
}

.edit__foot { padding: 12px var(--gutter) 0; }
.tc { font: 12px var(--mono); }

/* Narrow: frame full width, case details underneath it */
@media (max-width: 800px) {
  .reel { height: auto; min-height: 100svh; }
  .reel .tagline { font-size: calc((100vw - 2 * var(--gutter)) / 12.5); }
  .stage {
    container-type: inline-size;
    height: calc((100vw - 2 * var(--gutter)) * 9 / 16 + 190px);
  }
  .lift { --w: calc(100cqw - 2 * var(--gutter)); left: var(--gutter); top: 0; bottom: auto; }
  .case { left: var(--gutter); right: var(--gutter); max-width: none; }
  .stage::after { display: none; }
}
