/* ==========================================================
   Quick dock: floating Store / Tickets / Music launcher.
   The buttons fan out in a quarter circle around the main
   "+" button (it sits in the bottom-right corner).
   Uses the site's tokens from style.css (--panel, --line,
   --accent, --accent-2, --text, --bg).

   Each item sets:
     --a  angle around the main button (-90deg = up, 180deg = left)
     --ld how far its label sits from the item's center (outward)
     --i  animation order
   ========================================================== */

.quick-dock {
  --size: 60px;      /* main button */
  --item: 52px;      /* small buttons */
  --r: 100px;        /* distance of the small buttons from the center */

  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 999;
  width: var(--size);
  height: var(--size);
  font-family: "Poppins", Arial, sans-serif;
}

/* ---------- Menu items ---------- */
.quick-dock-menu {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.quick-dock.is-open .quick-dock-menu {
  pointer-events: auto;
}

.quick-dock-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--item);
  height: var(--item);
  margin: calc(var(--item) / -2) 0 0 calc(var(--item) / -2);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  opacity: 0;
  /* Closed: tucked behind the main button */
  transform: rotate(var(--a)) translateX(0) rotate(calc(-1 * var(--a))) scale(0.4);
  transition:
    opacity 200ms ease,
    transform 380ms cubic-bezier(0.34, 1.4, 0.64, 1);
  transition-delay: calc(var(--i) * 50ms);
}

/* Open: pushed out along its angle */
.quick-dock.is-open .quick-dock-item {
  opacity: 1;
  transform: rotate(var(--a)) translateX(var(--r)) rotate(calc(-1 * var(--a))) scale(1);
}

.quick-dock-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent);
  font-size: 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    color 180ms ease;
}

/* Label sits on the outer side of each button, so labels never overlap */
.quick-dock-label {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 8, 13, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transform:
    translate(-50%, -50%)
    rotate(var(--a)) translateX(var(--ld)) rotate(calc(-1 * var(--a)));
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.quick-dock-item:hover .quick-dock-icon,
.quick-dock-item:focus-visible .quick-dock-icon {
  border-color: rgba(88, 240, 255, 0.6);
  color: var(--text);
  transform: scale(1.08);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(88, 240, 255, 0.35);
}

.quick-dock-item:hover .quick-dock-label,
.quick-dock-item:focus-visible .quick-dock-label {
  opacity: 1;
}

.quick-dock-item:focus-visible {
  outline: none;
}

/* Touch screens have no hover: show the labels once the menu has opened */
@media (hover: none) {
  .quick-dock.is-open .quick-dock-label {
    opacity: 1;
    transition-delay: 250ms;
  }
}

/* ---------- Equalizer icon (Music) ---------- */
.quick-dock-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.quick-dock-eq span {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform-origin: bottom;
  transform: scaleY(0.45);
  animation: quick-dock-eq 1s ease-in-out infinite;
  animation-play-state: paused;
}

.quick-dock-eq span:nth-child(2) { transform: scaleY(0.85); animation-delay: -0.3s; }
.quick-dock-eq span:nth-child(3) { transform: scaleY(0.6);  animation-delay: -0.6s; }
.quick-dock-eq span:nth-child(4) { transform: scaleY(0.75); animation-delay: -0.15s; }

.quick-dock.is-playing .quick-dock-eq span {
  animation-play-state: running;
}

@keyframes quick-dock-eq {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1); }
}

/* ---------- Main toggle button ---------- */
.quick-dock-toggle {
  position: relative;
  z-index: 1; /* closed items hide behind it */
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #05060a;
  cursor: pointer;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(88, 240, 255, 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.quick-dock-toggle:hover {
  transform: scale(1.05);
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(88, 240, 255, 0.55);
}

.quick-dock-toggle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

/* Plus icon that turns into an X */
.quick-dock-toggle-icon {
  position: relative;
  width: 20px;
  height: 20px;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.quick-dock-toggle-icon::before,
.quick-dock-toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2.5px;
  margin-top: -1.25px;
  border-radius: 2px;
  background: currentColor;
}

.quick-dock-toggle-icon::after {
  transform: rotate(90deg);
}

.quick-dock.is-open .quick-dock-toggle-icon {
  transform: rotate(135deg);
}

/* Soft ring that invites the first click */
.quick-dock-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(88, 240, 255, 0.6);
  animation: quick-dock-ring 2.6s ease-out infinite;
  pointer-events: none;
}

.quick-dock.is-open .quick-dock-toggle::before {
  animation: none;
  opacity: 0;
}

@keyframes quick-dock-ring {
  0%   { transform: scale(1);    opacity: 0.8; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* "Now playing" dot on the toggle while music plays */
.quick-dock-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 200ms ease;
}

.quick-dock.is-playing .quick-dock-toggle::after {
  transform: scale(1);
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  .quick-dock {
    --size: 54px;
    --item: 48px;
    --r: 90px;
  }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .quick-dock-item,
  .quick-dock-toggle-icon,
  .quick-dock-label {
    transition: none;
  }

  .quick-dock-toggle::before,
  .quick-dock-eq span {
    animation: none;
  }
}
