/* 3D photo collage (collage.html). Loaded after site.css; js/collage.js moves the photos. */

/* Header on this page: only "contact", top right, and no black bar on scroll. White text with a difference blend,
   so it reads black on white and inverts over photos (and stays white on the black contact panel). */
.collage-page { background: var(--white); }
.collage-page .header, .collage-page .header.is-solid { background: none; color: var(--white); mix-blend-mode: difference; }
.collage-page .header::before { display: none; }

/* The track is the scroll distance for the whole animation; the stage sticks to the screen while you scroll through it */
.collage-track { padding-top: 0; height: 500svh; }
.collage { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--white); }
/* The perspective sits on its own box with no background: a background on the same element hides the far photos in Chrome */
.collage-space { position: absolute; inset: 0; perspective: 1000px; }   /* keep in step with P in collage.js */
.collage-world { position: absolute; inset: 0; transform-style: preserve-3d; }

.card {
  position: absolute; left: 50%; top: 50%; display: block;
  opacity: 0; will-change: transform, opacity; cursor: pointer;
}
.card img, .card video {
  display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  transition: transform .6s var(--ease);
}
.card:hover img, .card:hover video { transform: scale(1.1); }
.card:active img, .card:active video { transform: scale(1.04); }
.card:focus-visible { outline-offset: 2px; }

/* The titles: a flat layer above the 3D photos, so no photo ever covers them. Clicks pass through to the photos */
.collage-titles { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
/* The name, the role line and "view work" sit at the centre of that layer.
   Plain text, no box, cycling through colours. Edit the colours or the 8s loop time here */
.collage-name {
  position: absolute; left: 50%; top: 50%; margin: 0; transform: translate(-50%, -50%);
  white-space: nowrap; pointer-events: none; opacity: 0;
  font-weight: 500; font-size: clamp(36px, 5vw, 76px); letter-spacing: -0.035em; line-height: 1;
  color: #ff4fa3; animation: name-colors 8s linear infinite;
}
/* The role line, "is a photographer in New York": same look as the name, on one line */
.collage-bio { width: max-content; max-width: 88vw; text-align: center; }
/* The rotating role. .roles is the mask; collage.js sets its width to the role showing, so "in New York" glides along.
   The old role drops down out of the mask while the next drops in from above. Edit the timings here */
/* .roles is a one-cell grid with every role stacked in the cell, so it shares the line's baseline with "is" and "in New York".
   The padding gives descenders (p, g, y) room inside the mask; the negative margin cancels it in the layout */
.roles {
  display: inline-grid; grid-template-columns: max-content; justify-items: start;
  padding: .12em 0 .2em; margin: -.12em 0 -.2em;
  position: relative; overflow: hidden; clip-path: inset(0);   /* both, so Chrome clips the roles while they animate */
  transition: width .45s var(--snap);
}
.role {
  grid-area: 1 / 1; white-space: nowrap;
  transform: translateY(-140%);
  transition: transform .45s var(--snap);
}
.collage-bio { --snap: cubic-bezier(.76, 0, .24, 1); }   /* ease in and out: slow start, quick middle, soft landing */
.role.is-in { transform: none; }
.role.is-out { transform: translateY(140%); }
.role.is-reset { transition: none; }   /* moved back above the mask without animating, ready for its next turn */
.bio-place { display: inline-block; }
/* phones: "in New York" on its own line, so the longest role still fits */
@media (max-width: 600px) {
  .collage-bio { white-space: normal; width: 88vw; }
  .bio-place { display: block; }
}

/* "view work": the same type as the name, in the middle of the wall */
.collage-work { visibility: hidden; }
.collage-work.is-live { pointer-events: auto; }
.collage-work::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.06em; height: .06em;
  background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease);
}
.collage-work:hover::after, .collage-work:focus-visible::after { transform: scaleX(1); }
.collage-work:active { opacity: .6; }
@keyframes name-colors {
  0%, 100% { color: #ff4fa3; }   /* pink */
  20% { color: #ffd400; }        /* yellow */
  40% { color: #1e90ff; }        /* blue */
  60% { color: #19c37d; }        /* green */
  80% { color: #ff6a00; }        /* orange */
}

/* Reduced motion: no scroll animation, just the wall of photos */
@media (prefers-reduced-motion: reduce) {
  .collage-track { height: 100svh; }
}
