/* ==========================================================================
   gh-audio-player — styles

   Theme it entirely by setting these custom properties on .gh-audio-player
   (or any ancestor). Fallbacks assume a light background.

     --gh-accent        main brand colour (play button, fills, viz)  [red]
     --gh-accent-dark   darker accent for the play-button hover
     --gh-text          primary text colour
     --gh-tan           secondary/label colour
     --gh-bg            panel background
     --gh-radius        corner radius
     --gh-font          serif font for the track title

   Faint greys are neutral rgba() (fine on light backgrounds). For a dark
   theme, override the element rules or set the greys explicitly.
   ========================================================================== */

.gh-audio-player {
  --gh-progress-h: 1.5rem;   /* progress-row height; the volume pins to its centreline */
  --gh-gutter: 2.75rem;      /* space reserved on the right for the volume slider */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: stretch;
  margin: 2.5rem 0;
}
.gh-audio-player > audio { display: none; }

/* --- Now Playing panel --------------------------------------------------- */
.gh-audio-player__display {
  background: var(--gh-bg, #ffffff);
  border: 1px solid rgba(61, 53, 48, 0.15);
  border-radius: var(--gh-radius, 6px);
  padding: clamp(1.25rem, 3vw, 2rem);
  padding-right: var(--gh-gutter);   /* reserve the gutter for the volume slider */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Controls + progress grouped so the volume can pin to the progress bar. */
.gh-audio-player__transport {
  position: relative;                 /* anchors the vertical volume */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.gh-audio-player__now {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.gh-audio-player__label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gh-tan, #C4A882);
}
.gh-audio-player__title {
  font-family: var(--gh-font, Georgia, 'Times New Roman', serif);
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  color: var(--gh-text, #3D3530);
  line-height: 1.25;
  min-height: 1.25em;
}

/* --- Controls ------------------------------------------------------------ */
.gh-audio-player__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
.gh-audio-player__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: rgba(61, 53, 48, 0.5);
  transition: color 0.2s ease, transform 0.2s ease;
  border-radius: 50%;
}
.gh-audio-player__btn svg { pointer-events: none; }
.gh-audio-player__btn--prev svg,
.gh-audio-player__btn--next svg { width: 28px; height: 28px; }
.gh-audio-player__btn:hover { color: var(--gh-accent, #8B1A1A); transform: scale(1.1); }
.gh-audio-player__btn:disabled { color: rgba(61, 53, 48, 0.2); pointer-events: none; }
.gh-audio-player__btn--play {
  width: 52px;
  height: 52px;
  background: var(--gh-accent, #8B1A1A);
  color: #ffffff;
  border-radius: 50%;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.gh-audio-player__btn--play svg { width: 26px; height: 26px; }
.gh-audio-player__btn--play:hover {
  background: var(--gh-accent-dark, #6b1414);
  box-shadow: 0 4px 16px rgba(139, 26, 26, 0.3);
  transform: scale(1.05);
  color: #ffffff;
}

/* --- Progress + time ----------------------------------------------------- */
.gh-audio-player__progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: var(--gh-progress-h);   /* centred track line for the volume to meet */
}
.gh-audio-player__time {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(61, 53, 48, 0.7);
  min-width: 2.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- Range inputs (scrubber + volume share the thumb look) --------------- */
.gh-audio-player__scrubber {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  flex: 1;
  --pct: 0%;
}
.gh-audio-player__scrubber::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--gh-accent, #8B1A1A) var(--pct), rgba(61, 53, 48, 0.15) var(--pct));
}
.gh-audio-player__scrubber::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(61, 53, 48, 0.15);
}
.gh-audio-player__scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gh-accent, #8B1A1A);
  margin-top: -5px;
  box-shadow: 0 0 6px rgba(139, 26, 26, 0.35);
  transition: transform 0.2s ease;
}
.gh-audio-player__scrubber::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gh-accent, #8B1A1A);
  border: none;
  box-shadow: 0 0 6px rgba(139, 26, 26, 0.35);
}
.gh-audio-player__scrubber:hover::-webkit-slider-thumb { transform: scale(1.25); }

/* --- Volume: small vertical slider, bottom flush with the progress bar ---- */
.gh-audio-player__volume {
  position: absolute;
  bottom: calc(var(--gh-progress-h) / 2);   /* bottom flush with the progress track */
  right: calc(0.85rem - var(--gh-gutter));  /* 0.85rem in from the panel edge, in the gutter */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.gh-audio-player__volume-icon {
  width: 15px;
  height: 15px;
  color: rgba(61, 53, 48, 0.5);
  flex-shrink: 0;
}
.gh-audio-player__volume-input {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 14px;
  height: 80px;
  --pct: 80%;
  background: transparent;
  cursor: pointer;
}
.gh-audio-player__volume-input::-webkit-slider-runnable-track {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(to top, var(--gh-accent, #8B1A1A) var(--pct), rgba(61, 53, 48, 0.12) var(--pct));
}
.gh-audio-player__volume-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gh-accent, #8B1A1A);
  margin-left: -5px;
  box-shadow: 0 0 6px rgba(139, 26, 26, 0.35);
}
.gh-audio-player__volume-input::-moz-range-track {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: rgba(61, 53, 48, 0.12);
}
.gh-audio-player__volume-input::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gh-accent, #8B1A1A);
  border: none;
}

/* --- Visualiser ---------------------------------------------------------- */
.gh-audio-player__viz {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 90px;
}

/* --- Track list ---------------------------------------------------------- */
.gh-audio-player__tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gh-audio-player__track {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--gh-radius, 6px);
  cursor: pointer;
  transition: background 0.15s ease;
}
.gh-audio-player__track:hover { background: rgba(61, 53, 48, 0.05); }
.gh-audio-player__track.is-active { background: rgba(61, 53, 48, 0.08); }
.gh-audio-player__track:focus-visible { outline: 2px solid var(--gh-accent, #8B1A1A); outline-offset: -2px; }
.gh-audio-player__track-num {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: rgba(61, 53, 48, 0.62);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gh-audio-player__track-title {
  font-size: 1rem;
  color: var(--gh-text, #3D3530);
}
.gh-audio-player__track.is-active .gh-audio-player__track-title { font-weight: 600; }
.gh-audio-player__track-duration {
  font-size: 0.8rem;
  color: rgba(61, 53, 48, 0.62);
  letter-spacing: 0.04em;
  min-width: 2.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Small screens ------------------------------------------------------- */
@media (max-width: 720px) {
  .gh-audio-player { grid-template-columns: 1fr; }
  .gh-audio-player__display { padding-right: clamp(1.25rem, 3vw, 2rem); }
  .gh-audio-player__volume { display: none; } /* use device volume */
}
