/* Audio collage: a pile of music videos around the Chantilly EP */

body:has(.collage-wrap) {
  overflow-x: clip;
}

.collage-wrap {
  position: relative;
  left: 50%;
  width: min(1320px, calc(100vw - 32px));
  transform: translateX(-50%);
  margin-bottom: 72px;
}

.collage-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 36px;
  padding: 0 8px;
}

.collage-head .page-title {
  margin: 0;
}

.collage {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: clamp(44px, 6.6vw, 88px);
  gap: 6px;
}

.collage-tile,
.collage-ep {
  position: relative;
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.collage-tile {
  grid-column: var(--c, auto) / span var(--w, 4);
  grid-row: var(--r, auto) / span var(--h, 3);
  display: block;
  text-decoration: none;
  border-bottom: 0;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  transform: translate(var(--nudge-x, 0), var(--nudge-y, 0)) rotate(var(--tilt, 0deg));
}

.collage-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* a small silent loop, fading in over the still once it plays */
.collage-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.collage-tile video.is-on {
  opacity: 1;
}

.collage-label {
  position: absolute;
  z-index: 2;
  left: -4px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 12px);
  padding: 4px 9px 5px;
  background: var(--bg);
  text-align: left;
  transform: rotate(-1deg);
}

.collage-label small {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.collage-label small b {
  margin-right: 8px;
  font-weight: 400;
}

.collage-label small i {
  font-style: normal;
}

.collage-label span {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.6vw, 21px);
  line-height: 1.1;
}

.collage-tile.no-still {
  background: var(--accent);
}

.collage-tile:hover,
.collage-tile:focus-visible {
  z-index: 5;
  color: var(--ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
  transform: translate(var(--nudge-x, 0), var(--nudge-y, 0)) rotate(var(--tilt, 0deg)) scale(1.03);
}

/* The EP always sits in the middle, on top */
.collage-ep {
  z-index: 4;
  grid-column: 5 / span 4;
  grid-row: 1 / span 5;
  display: block;
  background: #000;
  text-decoration: none;
  border-bottom: 0;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.8);
  transform: rotate(-1deg);
}

.collage-ep img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collage-ep:hover,
.collage-ep:focus-visible {
  z-index: 6;
  transform: rotate(-1deg) scale(1.015);
}

.collage-ep-name {
  position: absolute;
  left: -14px;
  bottom: 54px;
  padding: 4px 16px 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 48px);
  line-height: 1;
  transform: rotate(-2deg);
}

.collage-ep-play {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 7px 14px 7px 12px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.collage-ep-play::before {
  content: "\25B6\00A0";
}

.collage-tile:focus-visible,
.collage-ep:focus-visible,
.collage-close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* The screen a video opens in */
.collage-screen {
  margin: auto;
  width: min(1040px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.collage-screen.is-album {
  width: min(560px, calc(100vw - 32px));
}

.collage-screen::backdrop {
  background: rgba(10, 10, 9, 0.88);
}

.collage-screen .media-embed {
  margin: 0;
}

.collage-close {
  display: block;
  margin: 0 0 10px auto;
  padding: 8px 14px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 700px) {
  .collage {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 27vw;
    grid-auto-flow: dense;
    gap: 10px 6px;
  }

  .collage-ep {
    grid-column: 1 / -1;
    grid-row: 1 / span 3;
    justify-self: center;
    width: 81vw;
  }

  .collage-tile {
    grid-column: span 1;
    grid-row: span 1;
    transform: translate(calc(var(--nudge-x, 0px) / 3), calc(var(--nudge-y, 0px) / 3)) rotate(var(--tilt, 0deg));
  }

  .collage-tile:nth-of-type(3n + 1) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .collage-tile:not(:nth-of-type(3n + 1)) .collage-label small b {
    display: none;
  }

  .collage-tile:not(:nth-of-type(3n + 1)) .collage-label span {
    font-size: 13px;
  }

  .collage-ep-name {
    left: -6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collage-tile,
  .collage-ep {
    transition: none;
  }
}

/* Project photos and Bandcamp links in the sections below the collage */
.project-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 20px 0 24px;
  object-fit: cover;
}

.link-row a,
.credit-title a,
.page-section p a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink);
  text-decoration-thickness: 1px;
}

.link-row a:hover,
.credit-title a:hover,
.page-section p a:hover {
  text-decoration-color: var(--accent-text);
  text-decoration-thickness: 2px;
}

/* Credits stay grey, with an underlined link */
.page-section p.credit-meta {
  margin-top: 20px;
}

.page-section p.credit-meta a,
.page-section p.media-caption a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
}

.page-section p.credit-meta a:hover,
.page-section p.media-caption a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* A click-to-load video with a still behind its play button */
.media-embed--poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.media-embed--poster .media-play {
  z-index: 1;
}

.media-embed--poster .media-play::before {
  border-color: transparent transparent transparent var(--ink);
}

.media-embed--poster .media-play:hover {
  color: var(--ink);
}

.media-embed--poster .media-play small {
  color: var(--ink);
}
