:root {
  --bg: #000;
  --fg: #fff;
  --dim: #6b6b6b;
  --line: #262626;
  --live: #ff2d2d;
  /* Brand face first; Helvetica Neue (Apple devices) and Inter are the closest stand-ins. */
  --brand: "Neue Haas Grotesk Text Pro", "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  /* Equal top/bottom padding keeps the player centred while clearing the fixed logo. */
  padding: 140px 16px;
}

.logo {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  line-height: 0;
  z-index: 1;
}
.logo img { display: block; width: 172px; height: auto; }

/* Mirrors the logo: fixed, centred, 60px from the bottom. */
.social {
  position: fixed;
  bottom: 52px; /* + 8px link padding = icons sit 60px from the bottom */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1;
}
.social a {
  display: block;
  padding: 8px; /* bigger tap target than the icon itself */
  color: var(--fg);
  line-height: 0;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.social a:hover { opacity: 1; }
.social a:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }
.social svg { fill: currentColor; }
/* Sized by eye so the square and the wide cloud feel equally heavy. */
.icon-instagram { width: 18px; height: 18px; }
.icon-soundcloud { width: 36px; height: 16.2px; }

/* --- player --- */

.title {
  /* Reserves one line so the player doesn't jump when a title appears. */
  min-height: 1.2em;
  max-width: 340px;
  font: 700 18px/1.2 var(--brand);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  color: var(--fg);
  text-wrap: balance;
  overflow-wrap: anywhere;
  transition: opacity 0.4s;
}
.player[data-state="offline"] .title { opacity: 0; }

.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.player .title { margin-bottom: 8px; }

.toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
}
.toggle:hover:not(:disabled) { border-color: var(--fg); }
.toggle:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.toggle:disabled { opacity: 0.3; cursor: default; }

.icon { width: 20px; height: 20px; fill: currentColor; }
.icon-pause { display: none; }
.player[data-state="playing"] .icon-play,
.player[data-state="loading"] .icon-play { display: none; }
.player[data-state="playing"] .icon-pause,
.player[data-state="loading"] .icon-pause { display: block; }
.player[data-state="loading"] .toggle { animation: pulse 1.2s ease-in-out infinite; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 11px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
}
.player:not([data-state="offline"]) .dot {
  background: var(--live);
  animation: pulse 2s ease-in-out infinite;
}
.player:not([data-state="offline"]) .status { color: var(--fg); }

.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 16px;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.player[data-state="playing"] .volume { opacity: 1; }
.volume::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
.volume::-moz-range-track { height: 1px; background: var(--line); }
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px; height: 9px; margin-top: -4px;
  border-radius: 50%; background: var(--fg); border: 0;
}
.volume::-moz-range-thumb {
  width: 9px; height: 9px;
  border-radius: 50%; background: var(--fg); border: 0;
}

/* Phones control volume with hardware buttons; iOS ignores it from JS anyway. */
@media (hover: none) {
  .volume { display: none; }
}

/* --- listeners --- */

.listeners {
  color: var(--dim);
  font-size: 11px;
}
.listeners { transition: opacity 0.4s, visibility 0.4s; }
/* visibility (not display) keeps the player from shifting when the count appears. */
.listeners.is-hidden { opacity: 0; visibility: hidden; }
.listeners .count { color: var(--fg); font-variant-numeric: tabular-nums; }

@keyframes pulse {
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
