/* ==========================================================================
   H&T Library Audio Player — Home Page Section
   ========================================================================== */

/* ── Section wrapper ─────────────────────────────────────────────────────── */
.ht-library-audio {
  padding-block:       clamp(4rem, 8vw, 6.5rem);
  position:            relative;
  overflow:            hidden;
  background-color:    var(--dark-ink);
  background-image:
    /* top-left terracotta bloom */
    radial-gradient(ellipse 55% 50% at -5% 10%,  rgba(183, 83, 61, .22) 0%, transparent 65%),
    /* bottom-right warm accent */
    radial-gradient(ellipse 50% 55% at 108% 90%, rgba(140, 111, 94, .16) 0%, transparent 60%),
    /* centre depth */
    radial-gradient(ellipse 80% 60% at 50%  50%, rgba(58,  34,  20, .55) 0%, transparent 75%),
    /* texture image */
    url('../images/cta-bg.jpeg');
  background-size:     auto, auto, auto, cover;
  background-position: left top, right bottom, center, center top;
  background-repeat:   no-repeat;
}

/* Dark gradient mask so the image reads as atmosphere, not decoration */
.ht-library-audio::before {
  content:    '';
  position:   absolute;
  inset:      0;
  background: linear-gradient(
    160deg,
    rgba(20, 12, 6, .93) 0%,
    rgba(20, 12, 6, .78) 45%,
    rgba(20, 12, 6, .90) 100%
  );
  z-index:    0;
  pointer-events: none;
}

/* Thin warm top border line */
.ht-library-audio::after {
  content:    '';
  position:   absolute;
  top:        0;
  left:       0;
  right:      0;
  height:     2px;
  background: linear-gradient(to right, transparent, rgba(183, 83, 61, .55), transparent);
  z-index:    1;
  pointer-events: none;
}

/* ── Section header ──────────────────────────────────────────────────────── */
.ht-library-audio__header {
  text-align:    center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  position:      relative;
  z-index:       2;
}

.ht-library-audio__eyebrow {
  display:        inline-block;
  font-size:      .75rem;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color:          var(--primary-light);
  margin-bottom:  .9rem;
}

.ht-library-audio__title {
  font-family:    var(--bpt-heading-font);
  font-size:      clamp(1.9rem, 3vw + .5rem, 2.8rem);
  font-weight:    700;
  color:          #FFF7F0;
  margin:         0 0 .85rem;
  letter-spacing: -.02em;
}

.ht-library-audio__subtitle {
  font-size:     clamp(.9rem, 1vw + .55rem, 1.05rem);
  line-height:   1.8;
  color:         rgba(255, 247, 240, .6);
  max-width:     480px;
  margin-inline: auto;
}

/* ── Two-panel player wrapper ────────────────────────────────────────────── */
.ht-library-audio__player {
  display:       grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  background:    rgba(255, 247, 240, .04);
  border:        1px solid rgba(255, 247, 240, .08);
  border-radius: var(--bpt-radius-lg);
  overflow:      hidden;
  min-height:    460px;
  position:      relative;
  z-index:       2;
  max-width:     100%;
}


/* ══════════════════════════════════════════════════════════════════════════
   NOW PLAYING PANEL (left)
   ══════════════════════════════════════════════════════════════════════════ */
.ht-library-np {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  padding:        2rem 1.75rem;
  gap:            1.25rem;
  border-right:   1px solid rgba(255, 247, 240, .08);
  background:     rgba(255, 247, 240, .02);
  min-width:      0;
}

/* Artwork */
.ht-library-np__artwork {
  width:                   160px;
  height:                  160px;
  border-radius:           16px;
  background:              rgba(255, 247, 240, .07) center / cover no-repeat;
  position:                relative;
  overflow:                hidden;
  flex-shrink:             0;
  box-shadow:              0 8px 32px rgba(0, 0, 0, .45);
  display:                 flex;
  align-items:             center;
  justify-content:         center;
  color:                   rgba(255, 247, 240, .25);
}

/* EQ bars overlay on artwork */
.ht-library-eq {
  position:        absolute;
  inset:           0;
  display:         flex;
  align-items:     flex-end;
  justify-content: center;
  gap:             4px;
  padding:         14px;
  background:      rgba(20, 12, 6, .52);
  opacity:         0;
  transition:      opacity .3s;
  pointer-events:  none;
}
.ht-library-audio__player.is-playing .ht-library-eq { opacity: 1; }

.ht-library-eq span {
  display:       block;
  width:         4px;
  background:    var(--primary-light);
  border-radius: 2px;
  height:        8px;
}
.ht-library-audio__player.is-playing .ht-library-eq span:nth-child(1) { animation: ht-library-eq .9s  ease-in-out         infinite; }
.ht-library-audio__player.is-playing .ht-library-eq span:nth-child(2) { animation: ht-library-eq .7s  ease-in-out .10s    infinite; }
.ht-library-audio__player.is-playing .ht-library-eq span:nth-child(3) { animation: ht-library-eq 1.1s ease-in-out .20s    infinite; }
.ht-library-audio__player.is-playing .ht-library-eq span:nth-child(4) { animation: ht-library-eq .8s  ease-in-out .05s    infinite; }
.ht-library-audio__player.is-playing .ht-library-eq span:nth-child(5) { animation: ht-library-eq .95s ease-in-out .15s    infinite; }

@keyframes ht-library-eq {
  0%, 100% { height: 5px;  }
  50%       { height: 28px; }
}

/* Info */
.ht-library-np__info  { text-align: center; width: 100%; }

.ht-library-np__label {
  display:        block;
  font-size:      .68rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color:          var(--primary-light);
  margin-bottom:  .4rem;
}

.ht-library-np__title {
  font-family:    var(--bpt-heading-font);
  font-size:      clamp(.95rem, 1.4vw + .2rem, 1.15rem);
  font-weight:    700;
  color:          #FFF7F0;
  margin:         0 0 .3rem;
  line-height:    1.3;
}

.ht-library-np__cat {
  font-size: .8rem;
  color:     rgba(255, 247, 240, .45);
  margin:    0;
}

/* Progress bar */
.ht-library-np__progress { width: 100%; }

.ht-library-np__bar {
  position:      relative;
  height:        4px;
  background:    rgba(255, 247, 240, .12);
  border-radius: 2px;
  margin-bottom: .45rem;
}

.ht-library-np__fill {
  position:      absolute;
  top:           0;
  left:          0;
  height:        100%;
  background:    var(--primary-light);
  border-radius: 2px;
  pointer-events: none;
  transition:    width .15s linear;
}

.ht-library-np__seek {
  position: absolute;
  inset:    -10px 0;
  width:    100%;
  opacity:  0;
  cursor:   pointer;
  margin:   0;
  z-index:  2;
}

.ht-library-np__times {
  display:              flex;
  justify-content:      space-between;
  font-size:            .72rem;
  color:                rgba(255, 247, 240, .35);
  font-variant-numeric: tabular-nums;
}

/* Controls */
.ht-library-np__controls {
  display:     flex;
  align-items: center;
  gap:         .75rem;
}

.ht-library-np__btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           38px;
  height:          38px;
  border-radius:   50%;
  background:      transparent;
  border:          none;
  color:           rgba(255, 247, 240, .6);
  cursor:          pointer;
  transition:      color var(--bpt-t), background var(--bpt-t);
  flex-shrink:     0;
}
.ht-library-np__btn:hover { color: #FFF7F0; background: rgba(255, 247, 240, .08); }

.ht-library-np__btn--play {
  width:      52px;
  height:     52px;
  background: var(--primary);
  color:      #fff;
  box-shadow: 0 4px 16px rgba(183, 83, 61, .4);
}
.ht-library-np__btn--play:hover { background: var(--primary-dark); color: #fff; }

.ht-library-np__btn--sm { width: 30px; height: 30px; }

/* Volume */
.ht-library-np__volume {
  display:     flex;
  align-items: center;
  gap:         .65rem;
  width:       100%;
}

.ht-library-np__vol-input {
  flex:              1;
  height:            4px;
  -webkit-appearance: none;
  appearance:        none;
  background:        rgba(255, 247, 240, .14);
  border-radius:     2px;
  outline:           none;
  cursor:            pointer;
}
.ht-library-np__vol-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width:              13px;
  height:             13px;
  border-radius:      50%;
  background:         var(--primary-light);
  cursor:             pointer;
}
.ht-library-np__vol-input::-moz-range-thumb {
  width:         13px;
  height:        13px;
  border-radius: 50%;
  background:    var(--primary-light);
  cursor:        pointer;
  border:        none;
}


/* ══════════════════════════════════════════════════════════════════════════
   PLAYLIST PANEL (right)
   ══════════════════════════════════════════════════════════════════════════ */
.ht-library-playlist {
  display:        flex;
  flex-direction: column;
  max-height:     560px;
  min-width:      0;
}

.ht-library-playlist__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         1.25rem 1.5rem;
  border-bottom:   1px solid rgba(255, 247, 240, .08);
  flex-shrink:     0;
}

.ht-library-playlist__heading {
  display:     flex;
  align-items: center;
  gap:         .5rem;
  font-size:   .85rem;
  font-weight: 600;
  color:       rgba(255, 247, 240, .80);
  margin:      0;
}

.ht-library-playlist__count {
  font-size:   .72rem;
  color:       rgba(255, 247, 240, .35);
  background:  rgba(255, 247, 240, .06);
  padding:     .2rem .65rem;
  border-radius: 50px;
}

/* Track list */
.ht-library-track-list {
  list-style:      none;
  padding:         .5rem 0;
  margin:          0;
  flex:            1;
  min-height:      0; /* required for a flex child to actually scroll instead of overflowing its container */
  overflow-y:      auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(183, 83, 61, .3) transparent;
}
.ht-library-track-list::-webkit-scrollbar       { width: 4px; }
.ht-library-track-list::-webkit-scrollbar-thumb { background: rgba(183, 83, 61, .3); border-radius: 2px; }

/* Track item */
.ht-library-track {
  display:     flex;
  align-items: center;
  gap:         .85rem;
  padding:     .65rem 1.5rem;
  cursor:      pointer;
  transition:  background var(--bpt-t);
  border-left: 2.5px solid transparent;
  outline:     none;
}
.ht-library-track:hover               { background: rgba(255, 247, 240, .04); }
.ht-library-track:focus-visible       { background: rgba(255, 247, 240, .06); }
.ht-library-track.is-active           { background: rgba(183, 83, 61, .12); border-left-color: var(--primary-light); }

.ht-library-track__num {
  font-size:            .72rem;
  color:                rgba(255, 247, 240, .28);
  width:                18px;
  text-align:           center;
  flex-shrink:          0;
  font-variant-numeric: tabular-nums;
}
.ht-library-track.is-active .ht-library-track__num { color: transparent; }

.ht-library-track__thumb {
  width:           64px;
  height:          64px;
  border-radius:   8px;
  overflow:        hidden;
  background:      rgba(255, 247, 240, .08);
  flex-shrink:     0;
  position:        relative;
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           rgba(255, 247, 240, .25);
}
.ht-library-track__thumb img {
  width:       100%;
  height:      100%;
  object-fit:  cover;
  display:     block;
}

/* Mini EQ on active track thumbnail */
.ht-library-track__eq {
  position:        absolute;
  inset:           0;
  display:         flex;
  align-items:     flex-end;
  justify-content: center;
  gap:             2px;
  padding:         7px;
  background:      rgba(20, 12, 6, .58);
  opacity:         0;
  pointer-events:  none;
}
.ht-library-audio__player.is-playing .ht-library-track.is-active .ht-library-track__eq { opacity: 1; }
.ht-library-track__eq span {
  display:       block;
  width:         3px;
  background:    var(--primary-light);
  border-radius: 1px;
  height:        5px;
}
.ht-library-audio__player.is-playing .ht-library-track.is-active .ht-library-track__eq span:nth-child(1) { animation: ht-library-eq .9s  ease-in-out         infinite; }
.ht-library-audio__player.is-playing .ht-library-track.is-active .ht-library-track__eq span:nth-child(2) { animation: ht-library-eq .7s  ease-in-out .10s    infinite; }
.ht-library-audio__player.is-playing .ht-library-track.is-active .ht-library-track__eq span:nth-child(3) { animation: ht-library-eq 1.1s ease-in-out .20s    infinite; }

.ht-library-track__info {
  flex:      1;
  min-width: 0;
}
.ht-library-track__title {
  display:       block;
  font-size:     .875rem;
  font-weight:   500;
  color:         rgba(255, 247, 240, .70);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  margin-bottom: .15rem;
  transition:    color var(--bpt-t);
}
.ht-library-track.is-active .ht-library-track__title { color: #FFF7F0; }

.ht-library-track__cat {
  font-size: .72rem;
  color:     rgba(255, 247, 240, .30);
  transition: color var(--bpt-t);
}
.ht-library-track.is-active .ht-library-track__cat { color: var(--primary-light); }

.ht-library-track__duration {
  font-size:            .72rem;
  color:                rgba(255, 247, 240, .28);
  flex-shrink:          0;
  font-variant-numeric: tabular-nums;
}

/* ── Fast / Slow speed toggle ─────────────────────────────────────────────── */
.ht-library-track__speed {
  display:      flex;
  align-items:  center;
  gap:          3px;
  flex-shrink:  0;
  margin-left:  -.4rem;
  margin-right: 20px;
}
.ht-library-track__speed-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           32px;
  height:          32px;
  border:          none;
  border-radius:   8px;
  background:      rgba(255, 247, 240, .06);
  color:           rgba(255, 247, 240, .55);
  cursor:          pointer;
  padding:         0;
  transition:      background var(--bpt-t), color var(--bpt-t);
}
.ht-library-track__speed-btn svg {
  width:  17px;
  height: 17px;
}
.ht-library-track__speed-btn:hover {
  background: rgba(255, 247, 240, .12);
  color:      rgba(255, 247, 240, .85);
}
.ht-library-track__speed-btn--fast.is-active {
  color:      #f59e0b;
  background: rgba(245, 158, 11, .18);
}
.ht-library-track__speed-btn--slow.is-active {
  color:      #a78bfa;
  background: rgba(167, 139, 250, .18);
}
.ht-library-track__speed-btn--slow:not([data-has-slow]) {
  opacity: 0.35;
  cursor:  default;
  pointer-events: none;
}
.ht-library-track--locked .ht-library-track__speed-btn {
  cursor:         default;
  pointer-events: none;
  background:     rgba(255, 247, 240, .03);
  color:          rgba(255, 247, 240, .18);
}
.ht-library-track--locked .ht-library-track__speed-btn.is-active {
  background: rgba(255, 247, 240, .03);
  color:      rgba(255, 247, 240, .18);
}

.ht-library-track__play {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          30px;
  border-radius:   50%;
  background:      rgba(255, 247, 240, .07);
  border:          none;
  color:           rgba(255, 247, 240, .55);
  cursor:          pointer;
  flex-shrink:     0;
  transition:      background var(--bpt-t), color var(--bpt-t);
}

.ht-library-track__lock {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          30px;
  flex-shrink:     0;
  color:           rgba(255, 247, 240, .25);
}
.ht-library-track__play:hover,
.ht-library-track.is-active .ht-library-track__play { background: var(--primary); color: #fff; }


/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .ht-library-track__thumb { width: 48px; height: 48px; }
  .ht-library-audio__player {
    grid-template-columns: 1fr;
  }
  .ht-library-np {
    border-right:  none;
    border-bottom: 1px solid rgba(255, 247, 240, .08);
    padding:       1.5rem 1.25rem;
  }
  .ht-library-playlist    { max-height: 340px; }
}

@media (max-width: 640px) {
  /* Constrain track list height on mobile so it scrolls within the player */
  .ht-library-track-list { max-height: 300px; }
  .ht-library-playlist   { max-height: none; }
}

@media (max-width: 480px) {
  .ht-library-track__thumb         { width: 40px; height: 40px; }
  .ht-library-track                { padding-inline: 1rem; gap: .6rem; }
  .ht-library-track__num           { display: none; }
  .ht-library-track__duration      { display: none; }
  .ht-library-track__speed,
  .ht-library-track__lock          { margin-left: auto; }
  .ht-library-track__speed         { margin-right: 0; }
}


/* ══════════════════════════════════════════════════════════════════════════
   MINI PLAYER — fixed bottom strip
   ══════════════════════════════════════════════════════════════════════════ */
.ht-library-mini {
  position:        fixed;
  bottom:          0;
  left:            0;
  right:           0;
  z-index:         9999;
  background:      rgba(26, 15, 8, .97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top:      1px solid rgba(232, 213, 182, .12);
  box-shadow:      0 -8px 40px rgba(26, 15, 8, .55);
  transform:       translateY(100%);
  transition:      transform .32s cubic-bezier(.4, 0, .2, 1);
}

.ht-library-mini--visible { transform: translateY(0); }

/* ── Body row ────────────────────────────────────────────────────────────── */
.ht-library-mini__body {
  display:     flex;
  align-items: center;
  gap:         1rem;
  height:      68px;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

/* Track info */
.ht-library-mini__track {
  display:    flex;
  align-items: center;
  gap:        .75rem;
  flex:       0 0 auto;
  max-width:  220px;
  min-width:  0;
}

.ht-library-mini__thumb {
  width:           44px;
  height:          44px;
  border-radius:   8px;
  background:      rgba(232, 213, 182, .10) center / cover no-repeat;
  flex-shrink:     0;
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           rgba(232, 213, 182, .30);
  overflow:        hidden;
}

.ht-library-mini__info {
  min-width:      0;
  display:        flex;
  flex-direction: column;
  gap:            .15rem;
}

.ht-library-mini__title {
  display:       block;
  font-size:     .875rem;
  font-weight:   700;
  color:         rgba(232, 213, 182, .90);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  max-width:     160px;
}

.ht-library-mini__cat {
  font-size:      .68rem;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color:          var(--primary-light);
}

/* Controls */
.ht-library-mini__controls {
  display:     flex;
  align-items: center;
  gap:         .4rem;
  flex-shrink: 0;
}

.ht-library-mini__btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           36px;
  height:          36px;
  border-radius:   50%;
  border:          none;
  background:      transparent;
  color:           rgba(232, 213, 182, .60);
  cursor:          pointer;
  transition:      color .2s, background .2s;
  flex-shrink:     0;
}
.ht-library-mini__btn:hover { color: rgba(232, 213, 182, .95); background: rgba(232, 213, 182, .08); }

.ht-library-mini__btn--play {
  width:      46px;
  height:     46px;
  background: var(--primary);
  color:      #fff;
  box-shadow: 0 3px 14px rgba(183, 83, 61, .40);
}
.ht-library-mini__btn--play:hover { background: var(--primary-dark); color: #fff; }

/* Middle progress bar (wider screens) */
.ht-library-mini__progress {
  display:     flex;
  align-items: center;
  gap:         .6rem;
  flex:        1;
  min-width:   0;
}

.ht-library-mini__time {
  font-size:            .72rem;
  font-weight:          600;
  color:                rgba(232, 213, 182, .38);
  flex-shrink:          0;
  font-variant-numeric: tabular-nums;
}

.ht-library-mini__bar {
  flex:          1;
  height:        4px;
  background:    rgba(232, 213, 182, .12);
  border-radius: 2px;
  position:      relative;
  cursor:        pointer;
}

.ht-library-mini__bar-fill {
  position:       absolute;
  top: 0; left: 0;
  height:         100%;
  background:     var(--primary);
  border-radius:  2px;
  pointer-events: none;
  transition:     width .15s linear;
}

.ht-library-mini__bar-seek {
  position: absolute;
  inset:    -10px 0;
  width:    100%;
  opacity:  0;
  cursor:   pointer;
  margin:   0;
  z-index:  2;
}

/* Volume */
.ht-library-mini__vol {
  display:     flex;
  align-items: center;
  gap:         .5rem;
  flex-shrink: 0;
  color:       rgba(232, 213, 182, .40);
}

.ht-library-mini__vol-input {
  width:              80px;
  height:             3px;
  -webkit-appearance: none;
  appearance:         none;
  background:         rgba(232, 213, 182, .14);
  border-radius:      2px;
  outline:            none;
  cursor:             pointer;
}
.ht-library-mini__vol-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width:  12px; height: 12px;
  border-radius: 50%;
  background: var(--primary-light);
  cursor: pointer;
}
.ht-library-mini__vol-input::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary-light);
  cursor: pointer;
  border: none;
}

/* Close button */
.ht-library-mini__close {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:           30px;
  height:          30px;
  border-radius:   50%;
  border:          none;
  background:      transparent;
  color:           rgba(232, 213, 182, .38);
  cursor:          pointer;
  flex-shrink:     0;
  transition:      color .2s, background .2s;
}
.ht-library-mini__close:hover { color: rgba(232, 213, 182, .80); background: rgba(232, 213, 182, .08); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .ht-library-mini__progress { display: none; }
  .ht-library-mini__vol      { display: none; }
  .ht-library-mini__track    { max-width: 55vw; }
}

@media (max-width: 400px) {
  .ht-library-mini__track { max-width: 42vw; }
  .ht-library-mini__title { max-width: 110px; }
}
