/* ============================================================
   CORPSEBLIGHTED · audio player
   Sits inside the chamfered .reel-frame from style.css. Type in
   4px steps, spacing in 8px steps, like the rest of the site.
   ============================================================ */

.player {
  --wave-bright: 216, 220, 226;   /* silver */
  --wave-accent: 127, 160, 194;   /* blue label */
  --wave-rest:   233, 238, 240;
  position: relative;
  padding: 32px;
}

.player button,
.mini button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.player button:disabled { cursor: default; }

.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: block; }

/* ---- Now playing ---- */

.np {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

/* Play: the site's angled button shape, in worn-metal blue */
.np-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 56px;
  color: var(--color-silver-primary);
  background: radial-gradient(ellipse at 30% 20%, #1f4870 0%, #14334f 55%, #0d2438 100%) !important;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  filter: drop-shadow(0 0 0.5px rgba(138, 152, 168, 0.9)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
  transition: filter 0.25s var(--ease);
}
.np-play:hover:not(:disabled) { background: radial-gradient(ellipse at 30% 20%, #275a8a 0%, #1E4D8C 55%, #123055 100%) !important; }
.np-play:disabled { opacity: 0.4; }
.np-play svg { width: 20px; height: 20px; fill: currentColor; }
.np-play .i-play { margin-left: 4px; }

.np-tag {
  margin-bottom: 8px;
  font: 500 12px/1.3 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-blue-label);
}
.np-title {
  font: 600 32px/1.1 var(--font-display);
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--color-silver-primary);
}
.np-composer {
  margin-top: 8px;
  font: 400 16px/1.4 var(--font-body);
  color: var(--color-silver-muted);
}
.np-composer:empty { display: none; }

.np-skip { display: flex; gap: 8px; }
.np-skip button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--color-silver-muted);
  transition: color 0.2s var(--ease);
}
.np-skip button:hover:not(:disabled) { color: var(--color-silver-primary); }
.np-skip button:disabled { opacity: 0.3; }
.np-skip svg { width: 16px; height: 16px; fill: currentColor; }

/* ---- Waveform ---- */

.wave-wrap { margin-top: 24px; }

.wave {
  position: relative;
  height: 88px;
  cursor: pointer;
  touch-action: pan-y;        /* vertical swipes still scroll the page */
  outline-offset: 8px;
}
.wave canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.wave:focus-visible { outline: 2px solid var(--color-blue-label); }

.wave-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  padding: 4px 8px;
  transform: translateX(-50%);
  font: 500 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--color-bg);
  background: var(--color-silver-primary);
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.np-time {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font: 500 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--color-silver-subdued);
}
.np-time .t-cur { color: var(--color-silver-body); }

/* ---- Track list ---- */

.tracks {
  list-style: none;
  margin-top: 32px;
  border-top: 1px solid var(--hairline);
}

.track { border-bottom: 1px solid var(--hairline); }

.track-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 16px;
}

.track-main {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 8px 0;
  text-align: left;
}

.track-state {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--color-silver-subdued);
}
.track-state .tri { width: 10px; height: 10px; fill: currentColor; opacity: 0; transition: opacity 0.2s var(--ease); }
button.track-main:hover .tri,
button.track-main:focus-visible .tri { opacity: 1; }

.eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { display: block; width: 2px; height: 35%; background: currentColor; }
.track.is-current .eq { display: flex; }
.track.is-current .tri { display: none; }
.track.is-current.is-playing .eq i { animation: eq 900ms ease-in-out infinite alternate; }
.track.is-current.is-playing .eq i:nth-child(2) { animation-delay: -300ms; animation-duration: 700ms; }
.track.is-current.is-playing .eq i:nth-child(3) { animation-delay: -600ms; animation-duration: 1100ms; }
@keyframes eq {
  from { height: 25%; }
  to   { height: 100%; }
}

.track-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track-title {
  font: 500 16px/1.35 var(--font-body);
  color: var(--color-silver-primary);
  transition: color 0.2s var(--ease);
}
.track-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 4px;
}
.track-composer { font: 400 16px/1.3 var(--font-body); color: var(--color-silver-muted); }
.track-tag,
.track-meta-dur {
  font: 500 12px/1.3 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-silver-subdued);
}
.track-meta-dur { display: none; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.track-status { font-size: 12px; color: var(--color-silver-subdued); }

button.track-main:hover .track-title { color: #fff; }
.track.is-current .track-title { color: #fff; }
.track.is-current .track-state { color: var(--color-blue-label); }

.track-main.is-disabled { cursor: default; }
.track-main.is-disabled .track-title,
.track-main.is-disabled .track-meta { opacity: 0.55; }

.track-dur {
  font: 500 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--color-silver-subdued);
}

.track-notes-space { width: 0; }
.track-notes-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  font: 500 12px/1 var(--font-body) !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-silver-subdued) !important;
  transition: color 0.2s var(--ease);
}
.track-notes-btn:hover { color: var(--color-silver-primary) !important; }
.track-notes-btn[aria-expanded="true"] { color: var(--color-blue-label) !important; }
.track-notes-btn svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.track-notes-btn .notes-icon { width: 12px; height: 12px; stroke-width: 1.1; }
.track-notes-btn .chev { width: 10px; height: 10px; stroke-width: 1.6; transition: transform 0.3s var(--ease-out); }
.track-notes-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Notes ease open by animating their row height from 0 to the text's height */
.track-notes {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 420ms var(--ease-out), visibility 0s linear 420ms;
}
.track-notes.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 420ms var(--ease-out), visibility 0s;
}
.track-notes-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 260ms ease;
}
.track-notes.is-open .track-notes-inner { opacity: 1; transition: opacity 360ms ease 80ms; }
.track-notes p {
  max-width: 64ch;
  padding: 0 64px 24px 32px;
  font: 400 16px/1.7 var(--font-body);
  color: var(--color-silver-muted);
}

/* ---- Load failure ---- */

.player-error {
  padding: 16px 0 8px;
  font-size: 16px;
  color: var(--color-silver-muted);
}
.player-error a { color: var(--color-blue-label); text-decoration: underline; text-underline-offset: 2px; }
.player.has-error .np,
.player.has-error .wave-wrap,
.player.has-error .tracks { display: none; }
.player.has-error .player-error { padding: 0; }

/* ---- Corner player ---- */

/* Bottom centre on desktop, clear of the bramble corners. Phones and tablets
   already show play/pause on the lock screen (Media Session metadata). */
.mini { display: none; }

@media (min-width: 900px) {
  .mini {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 250;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    width: 400px;
    padding: 8px 24px 8px 8px;
    overflow: hidden;
    background: rgba(20, 20, 23, 0.94);
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
    border: 1px solid var(--color-border-button);
    border-radius: 2px;
    box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, calc(100% + 40px));
    transition: transform 600ms var(--ease-out), opacity 400ms ease, visibility 0s linear 600ms;
  }
  .mini.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition: transform 600ms var(--ease-out), opacity 400ms ease, visibility 0s;
  }
}

.mini-play {
  display: grid;
  place-items: center;
  width: 48px;
  height: 40px;
  color: var(--color-silver-primary) !important;
  background: radial-gradient(ellipse at 30% 20%, #1f4870 0%, #14334f 55%, #0d2438 100%) !important;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
}
.mini-play svg { width: 16px; height: 16px; fill: currentColor; }
.mini-play .i-play { margin-left: 2px; }

.mini-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  text-align: left;
}
.mini-title {
  overflow: hidden;
  font: 600 16px/1.2 var(--font-display);
  color: var(--color-silver-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mini-sub {
  overflow: hidden;
  font: 400 12px/1.3 var(--font-body);
  color: var(--color-silver-subdued);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mini-time {
  font: 500 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--color-silver-subdued);
}
.mini-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: rgba(233, 233, 233, 0.1);
}
.mini-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--color-blue-label);
}

/* ---- Laptop and down ---- */

@media (max-width: 1199px) {
  .np-title { font-size: 28px; }
}

@media (max-width: 599px) {
  .player { padding: 16px; }

  /* Title above, transport centred below it */
  .np {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas:
      "meta meta meta"
      "prev play next";
    row-gap: 16px;
    text-align: center;
  }
  .np-meta { grid-area: meta; }
  .np-skip { display: contents; }
  .np-play { grid-area: play; }
  .np-prev { grid-area: prev; justify-self: end; }
  .np-next { grid-area: next; justify-self: start; }
  .np-title { font-size: 24px; }

  .wave { height: 64px; }
  .tracks { margin-top: 24px; }

  /* Time stays on the right, as on desktop */
  .track-row { column-gap: 8px; }
  .track-main { grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; }
  .track-state { width: 16px; }
  .track-notes-btn { min-width: 48px; padding: 0 8px; justify-content: center; }
  .track-notes-btn .notes-label { display: none; }
  .track-notes p { padding: 0 0 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .track.is-current.is-playing .eq i { animation: none; height: 70%; }
  .mini, .mini.is-shown { transition: none; }
  .track-notes, .track-notes.is-open,
  .track-notes-inner, .track-notes.is-open .track-notes-inner { transition: none; }
}
