/* Dose of Spirit: vinyl record player (hero, right edge) and floating mini player.
   Markup and behaviour live in vinyl.js. UI colours use the tokens from styles.css;
   the record itself is a physical object, so its black vinyl and paper label are fixed colours. */

.vinyl {
  --vn-d: clamp(250px, 46vh, 360px);
  --vn-label: #f4f1ea;
  --vn-label-ink: #111111;
  --vn-sheen: 255, 255, 255;
  position: absolute; z-index: 6;
  right: 0; top: 50%;
  width: var(--vn-d); height: var(--vn-d);
  margin-top: calc(var(--vn-d) / -2);
  pointer-events: none;
  animation: vnFade .9s ease 1.2s both;
}
@keyframes vnFade { from { opacity: 0; } to { opacity: 1; } }

/* the disc slides: 46% hidden at rest, 30% hidden while playing */
.vn-slide {
  position: absolute; inset: 0;
  transform: translateX(46%);
  transition: transform .9s var(--ease) .45s;
}
.vinyl.is-on .vn-slide { transform: translateX(30%); transition-delay: 0s; }

.vn-disc {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%;
  border-radius: 50%;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.vn-lift {
  position: absolute; inset: 0; display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line), 0 24px 50px rgb(0 0 0 / calc(.3 * var(--sh)));
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.vn-disc:hover .vn-lift, .vn-disc:focus-visible .vn-lift {
  transform: translateY(-5px);
  box-shadow: 0 0 0 1px var(--line), 0 32px 56px rgb(0 0 0 / calc(.34 * var(--sh)));
}
.vinyl.is-on .vn-disc:hover .vn-lift { transform: none; }

.vn-rot { position: absolute; inset: 0; display: block; border-radius: 50%; will-change: transform; }
.vn-svg { width: 100%; height: 100%; }

.vn-label { fill: var(--vn-label); }
.vn-label-fill { fill: var(--vn-label-ink); }
.vn-label-line { stroke: var(--vn-label-ink); stroke-opacity: .55; }
.vn-label-tx { fill: var(--vn-label-ink); font-family: "Inter Tight", system-ui, sans-serif; }

/* light that sweeps over the grooves (it does not spin with the disc) */
.vn-sheen {
  position: absolute; inset: 0; display: block; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 20deg,
    transparent 0 5%, rgba(var(--vn-sheen), .2) 10%, transparent 17%,
    transparent 50%, rgba(var(--vn-sheen), .14) 58%, transparent 66%);
  -webkit-mask: radial-gradient(circle, transparent 0 17%, #000 18% 98%, transparent 100%);
  mask: radial-gradient(circle, transparent 0 17%, #000 18% 98%, transparent 100%);
  animation: vnSheen 9s ease-in-out infinite alternate;
}
@keyframes vnSheen { from { transform: rotate(-20deg); } to { transform: rotate(24deg); } }

/* candle glow on the label, bar mode only */
.vn-candle {
  position: absolute; left: 33%; top: 33%; width: 34%; height: 34%;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 46% 42%, rgba(255, 200, 120, .6), rgba(255, 150, 60, .2) 58%, transparent 74%);
  mix-blend-mode: soft-light;
  transition: opacity .6s ease;
}

/* tonearm: pivot sits above the top right of the disc */
.vn-arm {
  position: absolute;
  left: calc(var(--vn-d) * .76); top: calc(var(--vn-d) * -.17);
  width: calc(var(--vn-d) * .2); height: var(--vn-d);
  transform-origin: 70% 13%;
  transform: rotate(-28deg);
  transition: transform .7s var(--ease);
  pointer-events: none;
  filter: drop-shadow(0 6px 5px rgb(0 0 0 / calc(.28 * var(--sh))));
}
.vinyl.is-on .vn-arm { transform: rotate(4deg); transition-delay: .3s; }
.vn-arm-svg { width: 100%; height: 100%; overflow: visible; }
.vn-arm-fill { fill: var(--ink); }
.vn-arm-tube { stroke: var(--ink-2); }
.vn-arm-base { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }

/* tag under the disc */
.vn-tag {
  position: absolute; right: 14px; top: calc(100% + 12px);
  display: inline-flex; align-items: center; gap: 8px;
  max-width: calc(var(--vn-d) - 14px);
  padding: 5px 13px 5px 5px; border-radius: 999px;
  background: var(--pill-bg); color: var(--ink);
  box-shadow: 0 10px 30px rgb(0 0 0 / calc(.1 * var(--sh))), inset 0 0 0 1px var(--line);
  font-size: 12px; font-weight: 600; line-height: 1.2; letter-spacing: .01em;
  pointer-events: auto; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .3s var(--ease);
}
.vn-tag:hover { transform: translateY(-2px); }
.vn-tag-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-ic {
  position: relative; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink);
}
.vn-ic-play { display: grid; place-items: center; padding-left: 1px; }
.vn-eq { display: none; align-items: flex-end; gap: 2px; height: 10px; }
.vn-eq i {
  display: block; width: 2px; height: 100%; border-radius: 1px; background: currentColor;
  transform-origin: bottom; transform: scaleY(.4);
  animation: vnEq .9s ease-in-out infinite;
}
.vn-eq i:nth-child(2) { animation-duration: .7s; animation-delay: -.3s; }
.vn-eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -.6s; }
@keyframes vnEq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.vinyl.is-on .vn-ic-play { display: none; }
.vinyl.is-on .vn-eq { display: flex; }

.vn-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- mini player ---------- */
.vn-mini {
  position: fixed; z-index: 50; left: 16px; bottom: 16px;
  display: flex; align-items: center;
  border-radius: 999px;
  background: var(--pill-bg);
  box-shadow: 0 12px 32px rgb(0 0 0 / calc(.2 * var(--sh))), inset 0 0 0 1px var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  pointer-events: none;
  transition: opacity .35s ease, transform .45s var(--ease), visibility 0s linear .45s;
}
.vn-mini.on {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
  transition: opacity .35s ease, transform .45s var(--ease), visibility 0s;
}
.vn-mini-btn {
  position: relative; flex: none;
  width: 56px; height: 56px; border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.vn-mini-rot { position: absolute; inset: 0; display: block; border-radius: 50%; will-change: transform; }
.vn-mini-rot .vn-svg { filter: drop-shadow(0 2px 4px rgb(0 0 0 / .25)); }
.vn-mini-ic {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 0 0 2px var(--vn-label);
}
.vn-mini-btn:focus-visible { outline-offset: 2px; }
.vn-vol {
  display: flex; align-items: center; overflow: hidden;
  width: 0; opacity: 0; padding: 0;
  transition: width .35s var(--ease), opacity .25s ease, padding .35s var(--ease);
}
.vn-mini:hover .vn-vol, .vn-mini:has(:focus-visible) .vn-vol {
  width: 116px; opacity: 1; padding: 0 16px 0 6px;
}
.vn-range { width: 94px; height: 22px; margin: 0; accent-color: var(--ink); cursor: pointer; }
@media (hover: none) {
  .vn-vol { width: 116px; opacity: 1; padding: 0 16px 0 6px; }
}

/* ---------- bar mode: warm reflections, candle-lit label ---------- */
html[data-light="bar"] .vinyl { --vn-label: #f1d6a0; --vn-sheen: 255, 178, 92; }
html[data-light="bar"] .vn-sheen {
  background:
    conic-gradient(from 20deg,
      transparent 0 4%, rgba(255, 178, 92, .34) 10%, rgba(255, 140, 50, .1) 15%, transparent 20%,
      transparent 48%, rgba(255, 178, 92, .26) 58%, transparent 68%),
    radial-gradient(circle at 70% 24%, rgba(255, 178, 92, .16), transparent 52%);
}
html[data-light="bar"] .vn-candle { opacity: 1; animation: vnCandle 3.7s ease-in-out infinite; }
@keyframes vnCandle { 0%, 100% { opacity: .85; } 30% { opacity: 1; } 55% { opacity: .72; } 80% { opacity: .95; } }
html[data-light="bar"] .vn-lift {
  box-shadow: 0 0 0 1px rgba(255, 178, 92, .22), 0 24px 56px rgba(255, 120, 30, .18), 0 24px 50px rgb(0 0 0 / .35);
}
html[data-light="bar"] .vn-mini { --vn-label: #f1d6a0; }

/* ---------- dark mode: a faint rim so the black disc reads on a dark wall ---------- */
html[data-theme="dark"] .vn-lift { box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 24px 50px rgb(0 0 0 / .5); }

.vn-mini { --vn-label: #f4f1ea; --vn-label-ink: #111111; --vn-sheen: 255, 255, 255; }

/* ---------- smaller screens: smaller disc, lower so it clears the hero card ---------- */
@media (max-width: 820px) {
  .vinyl { --vn-d: clamp(210px, 32vh, 260px); top: 40%; }
}
@media (max-width: 560px) {
  /* sit above the hero card (about 350px tall plus its margin), the tag needs about 44px under the disc */
  .vinyl { --vn-d: clamp(120px, calc(max(100svh, 560px) - 410px - 92px), 200px); top: auto; bottom: 410px; margin-top: 0; }
  .vn-tag { right: 10px; }
}
@media (max-width: 560px) and (max-height: 620px) {
  .vinyl { --vn-d: 120px; top: 76px; bottom: auto; }
  .vn-tag { display: none; }
}

/* ---------- reduced motion: no spin, no slide animation, a static equaliser ---------- */
@media (prefers-reduced-motion: reduce) {
  .vinyl { animation: none; }
  .vn-slide, .vn-arm, .vn-lift, .vn-tag, .vn-mini, .vn-vol { transition: none !important; }
  .vn-sheen, .vn-candle { animation: none; }
  .vn-eq i { animation: none; }
  .vn-eq i:nth-child(1) { transform: scaleY(.55); }
  .vn-eq i:nth-child(2) { transform: scaleY(1); }
  .vn-eq i:nth-child(3) { transform: scaleY(.75); }
}
