/* hearIt - monochrome, minimal, mechanical */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
  --ink:    #0a0a0b;
  --ink-2:  #131316;
  --ink-3:  #1b1b1f;
  --line:   #26262a;
  --dim:    #63636b;
  --mid:    #9c9ca4;
  --paper:  #eceae6;
  --white:  #fff;

  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-arm: cubic-bezier(.65, 0, .25, 1);
  --gut: 22px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

/* A class that sets `display` outbids the UA's [hidden] rule, which would
   otherwise leave .focusbar, .now and .people showing when hidden is set. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* film grain over everything ------------------------------------------- */
body::after {
  content: '';
  position: fixed; inset: -50%;
  z-index: 999; pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.1s steps(4) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -2%); }
  100% { transform: translate(0, 0); }
}

/* type ------------------------------------------------------------------ */
h1, h2, h3 { font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }

.eyebrow {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim); font-weight: 500;
}
.mono { font-family: var(--mono); }
.dim  { color: var(--dim); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* wordmark -------------------------------------------------------------- */
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 700; letter-spacing: -.045em;
  color: var(--paper); text-decoration: none;
}
.wordmark .dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--ink) 0 14%, var(--paper) 15% 34%, var(--ink) 35% 44%, var(--paper) 45%);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons --------------------------------------------------------------- */
button, .btn {
  font: inherit; font-weight: 500; color: var(--paper);
  background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 20px;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), transform .14s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
button:hover, .btn:hover { border-color: var(--mid); background: var(--ink-3); }
button:active, .btn:active { transform: scale(.97); }
button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-solid:hover { background: var(--white); border-color: var(--white); color: var(--ink); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-icon { padding: 0; width: 42px; height: 42px; border-radius: 50%; }

:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

/* inputs ---------------------------------------------------------------- */
input[type=text] {
  font: inherit; color: var(--paper);
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; width: 100%;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
input[type=text]::placeholder { color: var(--dim); }
input[type=text]:focus { outline: none; border-color: var(--mid); background: var(--ink-3); }

/* ======================================================================
   THE RECORD
   ====================================================================== */
.deck { position: relative; width: 100%; aspect-ratio: 1; }

.platter {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #17171b 0%, #0d0d10 62%, #08080a 100%);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), inset 0 0 0 1px rgba(255,255,255,.05);
}

/* the part that actually turns */
.vinyl {
  position: absolute; inset: 0;
  border-radius: 50%;
  animation: spin 1.8s linear infinite;   /* 33 1/3 rpm */
  animation-play-state: paused;
  background:
    /* spindle hole */
    radial-gradient(circle at 50% 50%, var(--ink) 0 1.6%, transparent 1.7%),
    /* paper label */
    radial-gradient(circle at 50% 50%, #191920 0 30%, transparent 30.5%),
    /* lead-out + groove bands */
    repeating-radial-gradient(circle at 50% 50%,
      rgba(255,255,255,.055) 0 1px, rgba(255,255,255,0) 1px 4px),
    radial-gradient(circle at 50% 50%, transparent 0 31%, rgba(0,0,0,.55) 31.5% 33%, transparent 33.5%),
    radial-gradient(circle at 50% 50%, transparent 0 87%, rgba(0,0,0,.6) 88% 89.5%, transparent 90%),
    radial-gradient(circle at 50% 50%, #16161a 0 96%, #0b0b0d 96% 100%);
}
.deck.spinning .vinyl { animation-play-state: running; }

/* album art sits in the label and turns with it */
.label-art {
  position: absolute; left: 20%; top: 20%; width: 60%; height: 60%;
  border-radius: 50%; overflow: hidden;
  opacity: 0; transition: opacity .7s var(--ease);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0 49%, transparent 50%);
          mask-image: radial-gradient(circle at 50% 50%, #000 0 49%, transparent 50%);
}
.label-art.on { opacity: 1; }
.label-art img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.12) brightness(.82);
}
.label-art::after {   /* punch the spindle hole back through the art */
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 5.4%; height: 5.4%; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--ink);
  box-shadow: 0 0 0 1px rgba(0,0,0,.8);
}

/* fixed light source - does NOT turn with the record */
.sheen {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 210deg at 50% 50%,
    rgba(255,255,255,0) 0deg, rgba(255,255,255,.085) 32deg, rgba(255,255,255,0) 74deg,
    rgba(255,255,255,0) 180deg, rgba(255,255,255,.055) 212deg, rgba(255,255,255,0) 252deg);
  mix-blend-mode: screen;
}
.deck::after {  /* rim highlight */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.14), inset 0 -18px 40px rgba(0,0,0,.5);
}

/* tonearm --------------------------------------------------------------- */
/* Geometry is in deck units (the deck box is 100x100, record r=50, label
   r=30). The arm pivots at 88,8 - off the platter, like a real one - and
   hangs `height` long, so the stylus lands at:
       x = 88 - h*sin(a)     y = 8 + h*cos(a)
   At a=3deg that's r~40 from the centre: on the groove, clear of the label.
   At a=-10deg it swings out to r~52, parked just off the rim. */
.tonearm {
  position: absolute; inset: 0;
  pointer-events: none;
}
.tonearm .pivot {
  position: absolute; left: 88%; top: 8%;
  width: 8.5%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #434344, #17171a);
  box-shadow: 0 3px 11px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.26);
}
.tonearm .arm {
  position: absolute; left: 86.9%; top: 8%;
  width: 2.2%; height: 62%;
  transform-origin: 50% 0;
  transform: rotate(-10deg);
  transition: transform 1.15s var(--ease-arm);
  background: linear-gradient(90deg, #2c2c2e, #5b5b5e 42%, #222224);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.deck.spinning .tonearm .arm { transform: rotate(3deg); }

.tonearm .weight {          /* counterweight, behind the pivot */
  position: absolute; left: 50%; bottom: 100%;
  width: 330%; height: 11%;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, #4e4e51, #1d1d1f);
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.tonearm .head {            /* headshell, angled like the real thing */
  position: absolute; left: 50%; top: 100%;
  width: 300%; height: 8%;
  transform: translateX(-50%) rotate(-20deg);
  border-radius: 2px;
  background: linear-gradient(180deg, #565658, #242426);
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.tonearm .head::after {     /* stylus */
  content: ''; position: absolute; left: 50%; top: 100%;
  width: 7%; height: 46%;
  transform: translateX(-50%);
  background: var(--mid);
}

/* equalizer ------------------------------------------------------------- */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.eq i {
  display: block; width: 2px; height: 100%; background: var(--paper);
  transform-origin: bottom; transform: scaleY(.25);
  animation: eq .85s ease-in-out infinite alternate;
}
.eq i:nth-child(2) { animation-delay: .17s; }
.eq i:nth-child(3) { animation-delay: .34s; }
.eq i:nth-child(4) { animation-delay: .51s; }
@keyframes eq { from { transform: scaleY(.22); } to { transform: scaleY(1); } }
.paused .eq i { animation-play-state: paused; }

/* mini record (phones) --------------------------------------------------- */
.mini {
  width: 54px; height: 54px; flex: 0 0 54px; border-radius: 50%; position: relative;
  background:
    radial-gradient(circle at 50% 50%, var(--ink) 0 6%, transparent 7%),
    radial-gradient(circle at 50% 50%, #202028 0 34%, transparent 35%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.08) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% 50%, #16161a 0 96%, #0a0a0c 97%);
  animation: spin 1.8s linear infinite;
  animation-play-state: paused;
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  overflow: hidden;
}
.mini.spinning { animation-play-state: running; }
.mini img {
  position: absolute; left: 33%; top: 33%; width: 34%; height: 34%;
  border-radius: 50%; object-fit: cover;
  filter: grayscale(1) brightness(.85);
}


/* focus mode ------------------------------------------------------------ */
.focusbtn {
  height: 50px; padding: 0 20px; gap: 9px;
  font-size: 13.5px; letter-spacing: -.01em;
}
.focusbtn svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }
.focusbtn[aria-pressed="true"] {
  background: var(--paper); color: var(--ink); border-color: var(--paper);
}
.focusbtn[aria-pressed="true"]:hover { background: var(--white); border-color: var(--white); }

.focusbar {
  display: flex; align-items: center; justify-content: center; gap: 13px;
  margin: 18px auto 0; max-width: 300px;
  animation: up .34s var(--ease) both;
}
.focusbar .eyebrow { flex: 0 0 auto; }
.focusbar .mono {
  flex: 0 0 38px; text-align: right; font-size: 12.5px;
  font-variant-numeric: tabular-nums; color: var(--mid);
}

input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1 1 auto; height: 18px; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 2px; border-radius: 2px; background: var(--line);
}
input[type=range]::-moz-range-track {
  height: 2px; border-radius: 2px; background: var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; margin-top: -5.5px;
  border-radius: 50%; background: var(--paper); border: none;
  transition: transform .16s var(--ease);
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border: none;
  border-radius: 50%; background: var(--paper);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type=range]:active::-moz-range-thumb { transform: scale(1.25); }

/* while ducked, pull the room's visuals back too */
body.focused .ambient .frame { filter: grayscale(1) blur(34px) brightness(.16) contrast(1.1); }
body.focused .deck { opacity: .72; transition: opacity .5s var(--ease); }

/* ======================================================================
   VOTES
   ====================================================================== */
.votes { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.vote {
  width: 34px; height: 34px; padding: 0; border: none; border-radius: 10px;
  background: transparent; color: var(--dim);
  display: grid; place-items: center; position: relative;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.vote:hover { background: var(--ink-3); color: var(--paper); }
.vote svg { width: 16px; height: 16px; fill: currentColor; transition: transform .2s var(--ease); }
.vote.on { color: var(--paper); }
.vote.on svg { transform: scale(1.16); }
.vote.up.on   { background: rgba(255,255,255,.1); }
.vote.down.on { background: rgba(255,255,255,.055); color: var(--mid); }
.vote:active svg { transform: scale(.82); }

/* ripple when a vote lands */
.vote.pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px;
  border: 1px solid var(--paper); animation: ripple .55s var(--ease) forwards;
}
@keyframes ripple {
  from { transform: scale(.7); opacity: .9; }
  to   { transform: scale(1.7); opacity: 0; }
}

.score {
  min-width: 26px; text-align: center; font-family: var(--mono);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: transform .22s var(--ease);
}
.score.bumped { animation: bump .36s var(--ease); }
@keyframes bump {
  0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); }
}
.score.neg { color: var(--dim); }

/* ======================================================================
   QUEUE
   ====================================================================== */
.queue { list-style: none; }

.row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--ink-3);
  position: relative;
}
.row:last-child { border-bottom: none; }

.rank {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  width: 20px; flex: 0 0 20px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.art {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 7px;
  object-fit: cover; background: var(--ink-3);
  filter: grayscale(1) contrast(1.06) brightness(.88);
}
.meta { flex: 1 1 auto; min-width: 0; }
.meta .t { font-size: 14.5px; font-weight: 500; }
.meta .s { font-size: 11.5px; color: var(--dim); margin-top: 1px; }

.tag {
  display: inline-block; font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; margin-right: 6px; vertical-align: 1px;
}

.meta .w { font-size: 11px; color: var(--mid); margin-top: 2px; }
.meta .w[hidden] { display: none; }

/* the played queue: grayed out, but votes still pick what comes back first */
.row.played .meta, .row.played .art, .row.played .rank { opacity: .4; }

/* enter / leave / reorder */

.row.entering { animation: rowIn .5s var(--ease) both; }
@keyframes rowIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.row.leaving {
  animation: rowOut .34s var(--ease) both;
  pointer-events: none;
}
@keyframes rowOut {
  to { opacity: 0; transform: translateX(-16px); }
}
.row.promoted::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.07), transparent 62%);
  animation: sweep .8s var(--ease) forwards; pointer-events: none;
}
@keyframes sweep { to { opacity: 0; } }

/* empty state ----------------------------------------------------------- */
.empty {
  text-align: center; padding: 52px 20px; color: var(--dim);
  border: 1px dashed var(--line); border-radius: 14px;
}
.empty .big { font-size: 15px; color: var(--mid); margin-bottom: 5px; }

/* toast ----------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 900;
  transform: translate(-50%, 140%);
  opacity: 0;
  background: var(--paper); color: var(--ink);
  padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; max-width: calc(100vw - 40px);
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  transition: transform .42s var(--ease), opacity .42s var(--ease);
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.bad { background: var(--ink-3); color: var(--paper); border: 1px solid var(--line); }

/* misc ------------------------------------------------------------------ */
.rule { height: 1px; background: var(--ink-3); border: none; }
.stagger > * { animation: up .6s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .16s; }
.stagger > *:nth-child(4) { animation-delay: .23s; }
.stagger > *:nth-child(5) { animation-delay: .3s; }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    /* NOT .01ms: a transition that short gets dropped and the property is
       left at its START value, so anything fading in (the record label, a
       toast, the tonearm swinging down) would stay stuck hidden. */
    transition: none !important;
  }
  body::after { animation: none; }
  .eq i { transform: scaleY(.62); }   /* frozen bars still read as a meter */
}
