/*
 * intro.css — the homepage art + music explorer.
 * A fixed, full-viewport stage cycling the whole library (artworks + drawing clips) with
 * a slow Ken-Burns drift. A "tap for sound" control fades in a live music mix; a scrub
 * bar lets visitors move through the artwork at their own pace. This IS the homepage.
 */

/* lock page scroll — the explorer fills the viewport; nav still floats on top */
html.intro-locked, html.intro-locked body { overflow: hidden; height: 100%; }

.intro {
  position: fixed; inset: 0; z-index: 800;   /* above page, below the site nav/header */
  background: #06100c;
  opacity: 1;
}

/* ---- the explorer IS the homepage: no nav, no chrome ---- */
/* hide the site header (logo + New Work/Everything/Tape Deck links) and the mobile nav */
body.has-intro .site-header,
body.has-intro .js-responsive-nav,
body.has-intro .js-hamburger { display: none !important; }
/* hide the actual page content below — the explorer is the homepage now */
body.has-intro .site-container { display: none; }

.intro__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
}

/* soft vignette so the video edges feel cinematic, never a hard box */
.intro::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 220px rgba(0,0,0,.55);
  background: radial-gradient(120% 120% at 50% 45%, transparent 55%, rgba(0,0,0,.35));
}

/* ---- bottom audio player bar ----
   Left group: play/pause + (gallery) prev. Centre: track-name word (gallery only).
   Right group: (gallery) next + mute/unmute. The play button is hidden until the user
   first unmutes ('audio-engaged'); prev/next + track name only show in the gallery. */
.intro__bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px) calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,.12) 75%, transparent);
  pointer-events: none;   /* only the buttons catch taps; rest of the bar is pass-through */
}
.intro__bar-left, .intro__bar-right { display: flex; align-items: center; gap: 10px; }
.intro__play-btn, .intro__mute-btn, .intro__prev-btn, .intro__next-btn {
  pointer-events: auto; flex: 0 0 auto;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.4); color: #f3ece2; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background .2s ease, transform .08s ease, opacity .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.intro__play-btn:hover, .intro__mute-btn:hover, .intro__prev-btn:hover, .intro__next-btn:hover { background: rgba(0,0,0,.6); }
.intro__play-btn:active, .intro__mute-btn:active, .intro__prev-btn:active, .intro__next-btn:active { transform: scale(.92); }
.intro__play-btn svg, .intro__mute-btn svg { width: 22px; height: 22px; fill: currentColor; }
.intro__prev-btn svg, .intro__next-btn svg { width: 22px; height: 22px; }
/* play/pause icon swap */
.intro__ico-pause { display: none; }
.intro__play-btn.is-playing .intro__ico-play { display: none; }
.intro__play-btn.is-playing .intro__ico-pause { display: block; }
/* mute icon swap */
.intro__ico-muted { display: none; }
.intro__mute-btn.is-muted .intro__ico-unmuted { display: none; }
.intro__mute-btn.is-muted .intro__ico-muted { display: block; }
.intro__mute-btn.is-muted { color: #ff8a8a; }

/* play button is HIDDEN until the user first unmutes */
.intro__play-btn { display: none; }
.intro.audio-engaged .intro__play-btn { display: flex; }

/* the "track name" word + prev/next arrows appear only in the gallery */
.intro__track {
  pointer-events: none; color: #f3ece2; opacity: 0;
  font-family: 'Roboto Slab', serif; font-size: 14px; letter-spacing: 2px;
  text-transform: uppercase; text-shadow: 0 2px 12px rgba(0,0,0,.8);
  transition: opacity .3s ease; white-space: nowrap;
}
.intro__prev-btn, .intro__next-btn { display: none; }
.intro.is-grid .intro__prev-btn, .intro.is-grid .intro__next-btn { display: flex; }
.intro.is-grid .intro__track { opacity: .9; }
/* in grid view the bar sits above the masonry overlay */
.intro.is-grid .intro__bar { z-index: 5; }

/* current-piece caption — centred on screen */
.intro__caption {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 3; text-align: center;
  color: rgba(243,236,226,.9); font-family: 'Roboto Slab', serif;
  font-size: clamp(14px, 2vw, 20px); letter-spacing: 3px; text-transform: uppercase;
  pointer-events: none; text-shadow: 0 2px 18px rgba(0,0,0,.85), 0 0 40px rgba(0,0,0,.5);
  transition: opacity .3s ease;
}
.intro.is-grid .intro__caption { opacity: 0; }

/* LANDING phase: just the zooming drawing clip — hide all chrome until the montage begins */
.intro.is-landing .intro__bar,
.intro.is-landing .intro__caption,
.intro.is-landing .intro__title { opacity: 0 !important; pointer-events: none; transition: opacity .6s ease; }

/* wordmark / title, top-left — also the grid<->montage toggle button */
.intro__title {
  position: absolute; top: 26px; left: 28px; z-index: 6;
  color: #f3ece2; font-family: 'Roboto Slab', serif; text-align: left;
  font-size: clamp(15px, 2.4vw, 22px); font-weight: 300; letter-spacing: 1px;
  text-shadow: 0 2px 18px rgba(0,0,0,.6);
  background: none; border: 0; padding: 4px 6px; margin: -4px -6px; cursor: pointer;
  transition: opacity .2s ease, transform .1s ease;
}
.intro__title:active { transform: scale(.98); }
.intro__title small { display: block; font-size: 11px; opacity: .65; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; transition: opacity .2s ease; }

/* on hover the wordmark glitches into an action hint:
   - in the MONTAGE: a square + GALLERY (opens the grid)
   - in the GALLERY: a play triangle + MONTAGE (plays a montage) */
.intro__title .intro__hint {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  opacity: 0; pointer-events: none; color: #f3ece2; padding: 4px 6px;
}
.intro__title .intro__hint svg { width: 24px; height: 24px; fill: currentColor; flex: 0 0 auto; }
.intro__title .intro__hint span { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; opacity: .85; }
.intro__brand { transition: opacity .15s ease; }
/* which hint shows depends on the mode */
.intro:not(.is-grid) .intro__title:hover .intro__hint--gallery,
.intro.is-grid .intro__title:hover .intro__hint--montage {
  opacity: 1; animation: intro-glitch .5s steps(2) infinite;
}
.intro__title:hover .intro__brand { opacity: 0; }
@keyframes intro-glitch {
  0%   { transform: translate(0,0);   filter: none; }
  20%  { transform: translate(-1.5px,1px); filter: drop-shadow(2px 0 0 rgba(255,0,80,.6)) drop-shadow(-2px 0 0 rgba(0,200,255,.6)); }
  40%  { transform: translate(1.5px,-1px); filter: none; }
  60%  { transform: translate(-1px,0);  filter: drop-shadow(-2px 0 0 rgba(255,0,80,.6)) drop-shadow(2px 0 0 rgba(0,200,255,.6)); }
  80%  { transform: translate(1px,1px); filter: none; }
  100% { transform: translate(0,0);   filter: none; }
}

/* ---- masonry grid overlay (toggled by the wordmark) ---- */
.intro__grid {
  position: absolute; inset: 0; z-index: 4;
  background: #06100c;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  opacity: 0; pointer-events: none; transition: opacity .4s ease;
  padding: 0;                          /* edge to edge: top / left / right */
}
.intro.is-grid .intro__grid { opacity: 1; pointer-events: auto; }
.intro.is-grid .intro__canvas,
.intro.is-grid .intro__caption { opacity: 0; pointer-events: none; }
/* keep the player bar visible over the gallery (it gains prev/next + track name there) */

/* CSS columns masonry — flush to the edges, 2px gaps */
.intro__grid-masonry {
  column-count: 4; column-gap: 2px; width: 100%; margin: 0;
}
@media (max-width: 1100px) { .intro__grid-masonry { column-count: 3; } }
@media (max-width: 720px)  { .intro__grid-masonry { column-count: 2; } }
.intro__cell {
  display: block; width: 100%; margin: 0 0 2px; break-inside: avoid;
  border: 0; padding: 0; background: #0c1712; cursor: zoom-in;
  overflow: hidden; position: relative; line-height: 0;
}
.intro__cell.is-video { cursor: default; }
.intro__cell img, .intro__cell video {
  display: block; width: 100%; height: auto;
  /* film grade by default; goes clean on hover */
  filter: sepia(0.32) saturate(0.78) contrast(0.94) brightness(1.02);
  transition: filter .25s ease;
}
.intro__cell:hover img, .intro__cell:hover video { filter: none; }
/* progressively pixelated repeats on infinite scroll — stretch the blocky thumb, no smoothing */
.intro__cell img.is-pixelated, .intro__cell video.is-pixelated {
  image-rendering: pixelated; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges;
}
/* a soft grain veil over each thumb, removed on hover */
.intro__cell::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='80' height='80' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: .22; mix-blend-mode: overlay; transition: opacity .25s ease;
}
.intro__cell:hover::after { opacity: 0; }

/* clip progress bar — appears on hover, draggable to seek the clip */
.intro__cell-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 16px; z-index: 2;
  display: flex; align-items: flex-end; cursor: pointer;
  opacity: 0; transition: opacity .2s ease; touch-action: none;
}
.intro__cell.is-video:hover .intro__cell-bar { opacity: 1; }
.intro__cell-bar::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(255,255,255,.28);
}
.intro__cell-bar-fill {
  position: relative; height: 4px; width: 0; background: #f3ece2; z-index: 1; align-self: flex-end;
}

/* ---- simple enlarge lightbox (clean, high-res) ---- */
.intro__lightbox {
  position: absolute; inset: 0; z-index: 7;
  background: rgba(4,8,6,.94); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.intro.is-lightbox .intro__lightbox { display: flex; }
.intro__lightbox-stage { max-width: 94vw; max-height: 90vh; display: flex; }
.intro__lightbox-stage img, .intro__lightbox-stage video {
  max-width: 94vw; max-height: 90vh; width: auto; height: auto;
  box-shadow: 0 20px 80px rgba(0,0,0,.6); border-radius: 2px;
}
/* YouTube embed of the full drawing time-lapse */
.intro__lightbox-stage .intro__yt {
  width: min(90vw, 1280px); height: min(50.6vw, 720px); max-height: 86vh;
  border: 0; box-shadow: 0 20px 80px rgba(0,0,0,.6); border-radius: 2px;
}
.intro__lightbox-close {
  position: absolute; top: 18px; right: 22px; z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.intro__lightbox-close:hover { background: rgba(255,255,255,.22); }

@media (max-width: 540px) {
  .intro__bar { padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .intro__play-btn, .intro__mute-btn, .intro__prev-btn, .intro__next-btn { width: 52px; height: 52px; }  /* bigger tap targets on mobile */
  .intro__track { font-size: 12px; letter-spacing: 2px; }  /* keep the track name clear of the arrows on narrow screens */
  .intro__caption { font-size: 11px; }
  .intro__grid { padding: 72px 12px 32px; }
}
