/* =========================================================
   DJ Lil Steve — Media page (music player + photo gallery)
   Builds on styles.css (tokens, nav, footer, section titles).
   ========================================================= */

.media-page__inner {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  justify-items: center;
  text-align: center;
}

.music {
  padding-block: clamp(28px, 5vh, 72px) clamp(40px, 7vh, 88px);
}

.photos {
  padding-block: clamp(24px, 5vh, 64px) clamp(96px, 14vh, 160px);
}

/* ---------- Player card ---------- */

.player {
  width: 100%;
  max-width: 72rem;
  display: grid;
  gap: clamp(20px, 3vw, 40px);
  padding: clamp(16px, 3vw, 32px);
  text-align: left;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(120% 70% at 15% 0%, rgba(229, 204, 167, 0.14), rgba(229, 204, 167, 0) 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(122, 84, 50, 0.2), rgba(122, 84, 50, 0) 65%),
    #121212;
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.player__now {
  display: grid;
  gap: 20px;
  align-content: start;
}

.player__art {
  width: 100%;
  max-width: 320px;
  justify-self: center;
}

.player__cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #1c1c1c;
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.85);
  transition: opacity 0.3s var(--ease-out);
}

.player__meta { min-width: 0; }

.player__label {
  margin: 0 0 8px;
  color: var(--beige);
  font-size: 0.75rem;
  font-weight: 600;
  font-stretch: 118%;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.player__title {
  margin: 0;
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  font-weight: 800;
  font-stretch: 105%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.player__artist {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 1rem;
}

.player__album {
  margin: 4px 0 0;
  color: var(--text-subtle);
  font-size: 0.875rem;
}

/* Controls */
.player__controls {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.player__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--white);
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), transform 0.15s var(--ease-out), color 0.2s var(--ease-out);
}

.player__btn:hover { background: rgba(255, 255, 255, 0.08); }
.player__btn:active { transform: scale(0.94); }
.player__btn:focus-visible { border-radius: 50%; }

.player__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player__btn svg .fill { fill: currentColor; stroke: none; }

.player__btn--play {
  width: 60px;
  height: 60px;
  background: var(--beige);
  color: var(--black);
}

.player__btn--play:hover { background: #f0dcbd; }
.player__btn--play svg { width: 26px; height: 26px; stroke-width: 2.6; }

/* Play/pause icon swap (shared by the main and mini players) */
.icon-pause { display: none; }
.is-playing .icon-play { display: none; }
.is-playing .icon-pause { display: block; }

/* Progress */
.player__progress {
  margin-top: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.player__time {
  min-width: 2.6em;
  color: var(--text-subtle);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.player__time[data-duration] { text-align: right; }

.player__seek {
  --pct: 0%;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.player__seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(var(--beige), var(--beige)) 0 / var(--pct) 100% no-repeat, rgba(255, 255, 255, 0.18);
}

.player__seek::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(var(--beige), var(--beige)) 0 / var(--pct) 100% no-repeat, rgba(255, 255, 255, 0.18);
}

.player__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.player__seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--white);
}

.player__seek:focus-visible { outline-offset: 2px; }

/* ---------- Tracklist ---------- */

/* The list scrolls inside the card instead of making the card taller */
.tracklist {
  margin: 0;
  padding: 0 6px 0 0;
  list-style: none;
  display: grid;
  align-content: start;
  gap: 2px;
  max-height: 22rem;                       /* phones: about 5 songs, scroll for more */
  overflow-y: auto;
  overscroll-behavior: contain;            /* reaching the end doesn't scroll the page */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  /* soft fade at the bottom hints there's more to scroll */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent);
}

.tracklist.is-at-end {
  -webkit-mask-image: none;
  mask-image: none;
}

.tracklist::-webkit-scrollbar { width: 6px; }
.tracklist::-webkit-scrollbar-track { background: transparent; }
.tracklist::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
}
.tracklist::-webkit-scrollbar-thumb:hover { background: rgba(229, 204, 167, 0.6); }

.track {
  width: 100%;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}

.track:hover { background: rgba(255, 255, 255, 0.05); }
.track:focus-visible { outline-offset: 0; border-radius: 10px; }

.track__num {
  justify-self: center;
  color: var(--text-subtle);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.track__text { display: grid; gap: 2px; min-width: 0; }

.track__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.track__tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  color: var(--text-subtle);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
  white-space: nowrap;
}

.track__artist {
  color: var(--text-muted);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track__time {
  color: var(--text-subtle);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* Current track */
.track[aria-current="true"] { background: rgba(229, 204, 167, 0.1); }
.track[aria-current="true"] .track__title,
.track[aria-current="true"] .track__num { color: var(--beige); }

/* Equaliser bars replace the number while the current track plays */
.player.is-playing .track[aria-current="true"] .track__num {
  width: 14px;
  height: 14px;
  font-size: 0;
  background:
    linear-gradient(var(--beige), var(--beige)) 0 100% / 3px 40% no-repeat,
    linear-gradient(var(--beige), var(--beige)) 50% 100% / 3px 90% no-repeat,
    linear-gradient(var(--beige), var(--beige)) 100% 100% / 3px 60% no-repeat;
  animation: eq 1s ease-in-out infinite;
}

@keyframes eq {
  0%, 100% { background-size: 3px 40%, 3px 90%, 3px 60%; }
  33%      { background-size: 3px 90%, 3px 45%, 3px 80%; }
  66%      { background-size: 3px 60%, 3px 75%, 3px 35%; }
}

/* Desktop: now-playing on the left, tracklist on the right. The card is only
   as tall as the left side; the list scrolls to fit that height. */
@media (min-width: 900px) {
  .player {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: stretch;
  }

  .tracklist {
    max-height: none;
    contain: size;          /* the list's length no longer sets the card height */
  }

  /* Capped so the cover + controls always fit on one laptop screen */
  .player__art {
    max-width: min(340px, calc(var(--vh) - var(--nav-h) - 420px));
    min-width: 200px;
    justify-self: start;
  }
}

/* ---------- Video (YouTube) ---------- */

.video-section {
  padding-block: clamp(16px, 4vh, 48px);
}

/* Videos: stacked on phones, 2 across on medium screens (an odd one out is
   centred underneath), 3 across on wide screens */
.yt-grid {
  --yt-gap: clamp(20px, 3vw, 32px);
  width: 100%;
  max-width: 72rem;
  display: grid;
  gap: var(--yt-gap);
  align-items: start;
}

@media (min-width: 760px) {
  .yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .yt-grid > .yt:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - var(--yt-gap) / 2);
  }
}

@media (min-width: 1100px) {
  .yt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .yt-grid > .yt:last-child:nth-child(odd) {
    grid-column: auto;
    width: 100%;
  }

  .yt-grid .yt__play { width: 56px; height: 56px; }
  .yt-grid .yt__play svg { width: 22px; height: 22px; }
}

.yt {
  width: 100%;
  margin: 0;
  min-width: 0;
}

.yt__frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
}

.yt__frame:focus-visible { outline-offset: 4px; border-radius: 14px; }

/* Thumbnail fills the 16:9 frame (trims YouTube's letterbox bars) */
.yt__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.82);
  transition: filter 0.3s var(--ease-out), transform 0.6s var(--ease-out);
}

.yt__frame:hover .yt__thumb {
  filter: brightness(0.95);
  transform: scale(1.02);
}

/* Play button in the site's style (beige, like the music player) */
.yt__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--beige);
  color: var(--black);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  transition: transform 0.25s var(--ease-out), background-color 0.2s var(--ease-out);
}

.yt__frame:hover .yt__play { transform: translate(-50%, -50%) scale(1.08); background: #f0dcbd; }

.yt__play svg { width: 26px; height: 26px; margin-left: 3px; fill: currentColor; }

.yt__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt__caption {
  margin-top: 14px;
  display: grid;
  gap: 2px;
  text-align: center;
}

.yt__title {
  font-size: 1rem;
  font-weight: 700;
  font-stretch: 105%;
}

.yt__credits {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---------- Now-playing mini bar ---------- */

.mini {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 900;                       /* under the nav (1000) */
  width: min(640px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 18, 18, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transform: translate(-50%, calc(100% + 24px));
  opacity: 0;
  transition: transform 0.45s var(--ease-out), opacity 0.3s var(--ease-out);
}

.mini.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.mini__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.mini__bar {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--beige);
}

.mini__cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #1c1c1c;
}

.mini__text { min-width: 0; }

.mini__title,
.mini__artist {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini__title { font-size: 0.875rem; font-weight: 600; }
.mini__artist { color: var(--text-muted); font-size: 0.75rem; }

/* Keep the footer clear of the mini bar once it has appeared */
body.has-mini { padding-bottom: 88px; }

/* ---------- Photo gallery (keeps each photo's own shape) ---------- */

.gallery {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 4 160px;
  column-gap: 12px;
  text-align: left;
}

.gallery li {
  margin-bottom: 12px;
  break-inside: avoid;
}

/* With JavaScript, media.js places each photo itself so the gallery reads
   left to right, row by row (the order in media.html) */
.gallery.is-arranged {
  position: relative;
  columns: auto;
}

.gallery.is-arranged li {
  position: absolute;
  margin: 0;
}

.gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #141414;
  cursor: zoom-in;
}

.gallery__item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s var(--ease-out), filter 0.3s var(--ease-out);
}

.gallery__item:hover img {
  transform: scale(1.035);
  filter: brightness(1.06);
}

.gallery__item:focus-visible { outline-offset: 3px; border-radius: 10px; }

/* ---------- Photo viewer ---------- */

html.lightbox-open { overflow: hidden; }

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop { background: rgba(0, 0, 0, 0.97); }

.lightbox__figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.lightbox__img {
  display: block;
  width: auto;
  height: auto;
  /* leave room at the sides for the arrow buttons */
  max-width: min(calc(100vw - 160px), 1200px);
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  border-radius: 6px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  animation: lb-in 0.3s var(--ease-out);
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.lightbox__count {
  color: var(--text-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}

.lightbox__btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 20, 20, 0.85);
  color: var(--white);
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.lightbox__btn:hover {
  background: rgba(60, 60, 60, 0.95);
  border-color: rgba(255, 255, 255, 0.7);
}

.lightbox__btn:focus-visible { border-radius: 50%; }

.lightbox__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.lightbox__next  { right: 16px; top: 50%; transform: translateY(-50%); }

/* Phones: arrows sit at the bottom, out of the photo's way */
@media (max-width: 599px) {
  .lightbox__prev,
  .lightbox__next { top: auto; bottom: 20px; transform: none; }
  .lightbox__prev { left: calc(50% - 64px); }
  .lightbox__next { right: calc(50% - 64px); }
  .lightbox__img {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .player.is-playing .track[aria-current="true"] .track__num { animation: none; }
  .lightbox__img { animation: none; }
}
