/* Player dock: the sticky bar (full size at the top, a small pill once scrolled) and its settings popover.
   Loaded on every page: the dock is kept alive between pages (assets/softnav.js) so the music never stops. */

/* ---- the player dock: a full bar at the top of the page that shrinks to a small pill once you scroll ---- */
html { scroll-padding-top: 4rem; }
#hd-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 90px; pointer-events: none; }
.hd-dock { position: sticky; top: 0; z-index: 40; height: 3.5rem; pointer-events: none; }  /* constant height: no layout jump when it shrinks */
.hd-bar {
  position: relative; pointer-events: auto; display: flex; align-items: center; gap: 0.55rem; overflow: hidden;
  width: 100%; height: 100%; margin: 0 0 0 auto; padding: 0 0.85rem;
  background: linear-gradient(180deg, rgba(16, 6, 9, 0.97), rgba(8, 3, 5, 0.93));
  border: 1px solid transparent; border-bottom-color: var(--line-hot); border-radius: 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px);
  transition: width 0.35s cubic-bezier(.2, .8, .2, 1), height 0.35s cubic-bezier(.2, .8, .2, 1), margin 0.35s cubic-bezier(.2, .8, .2, 1),
              padding 0.35s ease, border-radius 0.35s ease, box-shadow 0.35s ease;
}
/* scrolled: only play/pause, the volume slider and the settings cog remain, as a floating pill */
.hd-dock[data-compact] .hd-bar {
  width: 11.6rem; height: 3rem; margin: 0.3rem 0.75rem 0 auto; padding: 0 0.4rem; gap: 0; justify-content: space-between;
  border: 1px solid var(--line-hot); border-radius: 999px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), 0 0 20px -4px rgba(224, 38, 43, 0.55);
}
.hd-full { display: flex; align-items: center; gap: 0.55rem; min-width: 0; max-width: 60rem; overflow: hidden;
  transition: max-width 0.3s ease, opacity 0.2s ease, visibility 0s; }
.hd-rest { flex: 1; }
.hd-dock[data-compact] .hd-full { max-width: 0; opacity: 0; visibility: hidden; gap: 0; transition: max-width 0.3s ease, opacity 0.15s ease, visibility 0s 0.3s; }

.hd-btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 50%; color: var(--text);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-hot); transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease; }
.hd-btn svg { width: 19px; height: 19px; fill: currentColor; }
.hd-btn:hover:not(:disabled) { color: #fff; border-color: var(--red); box-shadow: 0 0 16px rgba(224, 38, 43, 0.45); }
.hd-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hd-meta { min-width: 0; flex: 1; line-height: 1.25; }
.hd-track { margin: 0; font-weight: 800; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-status { margin: 0; font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-cog { margin-left: auto; }
.hd-dock[data-compact] .hd-cog { margin-left: 0; }

.hd-scan { position: absolute; inset: 0; opacity: 0; pointer-events: none; border-right: 3px solid #ffb59a;
  background: linear-gradient(90deg, transparent 70%, rgba(255, 90, 60, 0.2)); box-shadow: 8px 0 20px 2px rgba(255, 90, 60, 0.55); }
.hd-bar.is-ignite .hd-scan { animation: hd-sweep 0.65s ease-out; }
@keyframes hd-sweep { 0% { opacity: 1; transform: translateX(-100%); } 100% { opacity: 0; transform: translateX(0); } }

.hd-play { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff; padding: 0;
  border: 1px solid rgba(255, 150, 120, 0.55);
  background: radial-gradient(circle at 35% 28%, #ff5a4a, var(--red) 45%, var(--red-deep) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 3px 0 #3d0306, 0 0 20px rgba(224, 38, 43, 0.45);
  transition: transform 0.15s ease, box-shadow 0.18s ease; }
.hd-play:hover:not(:disabled) { transform: translateY(-1px) scale(1.05); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.34), 0 4px 0 #3d0306, 0 0 30px rgba(255, 60, 40, 0.7); }
.hd-play:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.55), 0 0 16px rgba(224, 38, 43, 0.5); }
.hd-play:disabled { cursor: not-allowed; filter: grayscale(0.85) brightness(0.55); box-shadow: none; }
.hd-play svg { width: 22px; height: 22px; fill: currentColor; }
.hd-play .i-pause { display: none; }
.hd-bar[data-state="playing"] .hd-play .i-play { display: none; }
.hd-bar[data-state="playing"] .hd-play .i-pause { display: block; }
.hd-bar[data-state="loading"] .hd-play { animation: hd-breathe 1s ease-in-out infinite alternate; }
@keyframes hd-breathe { to { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 3px 0 #3d0306, 0 0 36px rgba(255, 90, 60, 0.85); } }
.hd-play::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #ff8a6a; opacity: 0; pointer-events: none; }
.hd-bar.is-ignite .hd-play::after { animation: hd-ring 0.7s ease-out; }
@keyframes hd-ring { 0% { opacity: .95; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }

.hd-eq { flex: none; display: flex; align-items: flex-end; gap: 3px; width: 6.2rem; height: 26px; }
.hd-eq { opacity: 0; transition: opacity 0.25s ease; }
.hd-bar[data-state="playing"] .hd-eq { opacity: 1; }
.hd-eq i { flex: 1; height: 100%; border-radius: 2px 2px 0 0; transform-origin: bottom;
  transform: scaleY(calc(0.08 + var(--l, 0) * 0.92));
  background: linear-gradient(180deg, #ff8a5c, var(--red) 45%, var(--crimson)); }

/* settings popover (native popover: Esc and outside-click close it; the fallback is the .no-popover rules) */
#hd-settings { position: fixed; inset: auto; top: 4rem; right: 0.75rem; margin: 0; width: min(21rem, calc(100vw - 1.5rem)); padding: 1rem 1.1rem 1.1rem; color: var(--text);
  background: linear-gradient(160deg, var(--surface-2), var(--bg-2)); border: 1px solid var(--line-hot); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 40px -10px rgba(224, 38, 43, 0.45); }
#hd-settings .tag { margin: 0 0 0.4rem; }
#hd-settings .note { margin: 0.5rem 0 0.9rem; }
.no-popover #hd-settings { display: none; }
.no-popover #hd-settings.open { display: block; }

/* volume: always in the bar (also in the compact pill). 100% sits in the middle, marked by a tick */
.hd-volume { flex: none; display: flex; align-items: center; gap: 0.4rem; }
.hd-vicon { flex: none; width: 18px; height: 18px; color: var(--muted); }
.hd-pct { min-width: 2.7rem; text-align: right; font: 800 0.78rem ui-monospace, Consolas, monospace; color: var(--link); }
.hd-vol-wrap { position: relative; width: 7rem; }
.hd-vol-wrap::after { content: ""; position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; margin-left: -1px; background: rgba(255, 150, 120, 0.5); pointer-events: none; }
.hd-vol { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 36px; margin: 0; background: transparent; cursor: pointer; touch-action: none; --p: 50%; }
.hd-vol::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; border: 1px solid var(--line-hot); background: linear-gradient(90deg, var(--ember), var(--red) var(--p), #241012 var(--p)); }
.hd-vol::-moz-range-track { height: 8px; border-radius: 4px; border: 1px solid var(--line-hot); background: #241012; }
.hd-vol::-moz-range-progress { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--ember), var(--red)); }
.hd-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; border: 2px solid #ffd3c4; background: radial-gradient(circle at 35% 30%, #ff6a5a, var(--red-deep)); box-shadow: 0 0 12px rgba(255, 60, 40, 0.7); }
.hd-vol::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #ffd3c4; background: radial-gradient(circle at 35% 30%, #ff6a5a, var(--red-deep)); box-shadow: 0 0 12px rgba(255, 60, 40, 0.7); }
.hd-vol:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; border-radius: 4px; }
.hd-dock[data-compact] .hd-vol-wrap { width: 5rem; }
.hd-dock[data-compact] .hd-vicon { display: none; }

@media (max-width: 30rem) {
  .hd-eq { display: none; }
  .hd-bar { padding: 0 0.5rem; gap: 0.35rem; }
  .hd-full { gap: 0.35rem; }
  .hd-vicon { display: none; }
  .hd-vol-wrap { width: 4.6rem; }
  .hd-volume { gap: 0; }
}

/* after an in-page navigation the focus lands on <main>, which needs no ring */
#main:focus { outline: none; }
