:root {
  --bg: #08080c;
  --ink: #e8e6e1;
  --muted: rgba(232, 230, 225, 0.4);
  --line: rgba(232, 230, 225, 0.12);
  --pink: #ff4fa3;
  --orange: #ff8a3d;
  --violet: #7b5cff;
  --cyan: #35e0d8;
  --house: #ff4fa3;
  --disco: #ff8a3d;
  --electronic: #9b8cff;
  --strobe-r: 255;
  --strobe-g: 79;
  --strobe-b: 163;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow: hidden;
  transition: background 0.6s ease, color 0.4s ease;
}

canvas#waves {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.strobe {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(var(--strobe-r), var(--strobe-g), var(--strobe-b), 0.22), transparent 42%),
    radial-gradient(circle at 30% 70%, rgba(var(--strobe-r), var(--strobe-g), var(--strobe-b), 0.08), transparent 50%),
    radial-gradient(circle at 70% 65%, rgba(53, 224, 216, 0.06), transparent 45%);
  transition: opacity 0.035s ease-out;
}
body.mode-night.beat .strobe { opacity: 1; }

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  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='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
  transition: opacity 0.5s;
}
body.mode-day .grain { opacity: 0.3; }

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

.stage {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 5vw, 56px);
}

body.mode-night .icon-sun { display: block; }
body.mode-night .icon-moon { display: none; }
body.mode-day .icon-sun { display: none; }
body.mode-day .icon-moon { display: block; }

.hero {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vh, 16px);
  padding-bottom: clamp(40px, 8vh, 80px); /* offset footer so ONDA sits optically centred */
}

.title {
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: clamp(56px, 14vw, 160px);
  line-height: 0.92;
  display: flex;
  letter-spacing: -0.02em;
  transition: filter 0.04s ease-out, transform 0.04s ease-out;
}

/* day — multicolour gradient letters */
body.mode-day .title span {
  background: linear-gradient(120deg, var(--pink), var(--orange), var(--violet), var(--cyan));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hue 8s ease-in-out infinite;
}
body.mode-day .title span:nth-child(1) { animation-delay: 0s; }
body.mode-day .title span:nth-child(2) { animation-delay: -2s; }
body.mode-day .title span:nth-child(3) { animation-delay: -4s; }
body.mode-day .title span:nth-child(4) { animation-delay: -6s; }
@keyframes hue {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* night — white type, beat pulse */
body.mode-night .title span { color: var(--ink); }
body.mode-night.beat .title {
  filter: brightness(1.5) drop-shadow(0 0 28px rgba(var(--strobe-r), var(--strobe-g), var(--strobe-b), 0.55));
  transform: scale(1.012);
}

.genres {
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: lowercase;
}
body.mode-day .genres { color: rgba(244, 241, 234, 0.75); }

.tagline {
  color: var(--muted);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.65;
  max-width: 280px;
}

/* ---------- controls ---------- */
.controls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.controls-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
}

.ctrl {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.ctrl:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.ctrl .icon-pause { display: none; }

body.mode-day.playing .play {
  background: linear-gradient(135deg, var(--pink), var(--orange));
  color: #0a0a14;
  box-shadow: 0 0 20px rgba(255, 79, 163, 0.4);
}
body.mode-night.playing .play {
  background: var(--ink);
  color: var(--bg);
}
body.playing .play .icon-play { display: none; }
body.playing .play .icon-pause { display: block; }

.mixer { width: 100%; display: flex; justify-content: center; }

.knobs {
  display: flex;
  gap: clamp(18px, 4vw, 32px);
  padding: 14px 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.knob {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  outline: none;
}
.knob:focus-visible .knob-face {
  box-shadow: 0 0 0 2px rgba(232, 230, 225, 0.25);
}
.knob.dragging .knob-face {
  border-color: rgba(232, 230, 225, 0.35);
  transform: scale(1.04);
}
body.mode-day .knob.dragging .knob-face {
  box-shadow: 0 0 16px rgba(255, 79, 163, 0.25);
}

.knob-face {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.knob-face::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(232, 230, 225, 0.05);
}
.knob-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 10px;
  margin: -5px 0 0 -1.5px;
  border-radius: 2px;
  transform: rotate(var(--angle, -135deg)) translateY(-17px);
  transform-origin: center center;
  pointer-events: none;
}
.knob[data-genre="house"] .knob-dot { background: var(--house); box-shadow: 0 0 8px rgba(255, 79, 163, 0.5); }
.knob[data-genre="disco"] .knob-dot { background: var(--disco); box-shadow: 0 0 8px rgba(255, 138, 61, 0.5); }
.knob[data-genre="electronic"] .knob-dot { background: var(--electronic); box-shadow: 0 0 8px rgba(155, 140, 255, 0.5); }
.knob[data-genre="filter"] .knob-dot { background: var(--muted); }

.knob-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: lowercase;
}

/* ---------- footer ---------- */
.bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.vinyl { width: 56px; height: 56px; }
.disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: repeating-radial-gradient(circle, #111 0 1px, transparent 1px 3px);
  display: grid;
  place-items: center;
  animation: spin 5s linear infinite;
  animation-play-state: paused;
  transition: filter 0.04s ease-out, box-shadow 0.04s ease-out;
}
body.mode-day .disc {
  background: repeating-radial-gradient(circle at 50% 50%, #16161f 0 2px, #0c0c15 2px 4px);
}
body.mode-day .disc-label {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(var(--pink), var(--orange), var(--violet), var(--cyan), var(--pink));
}
body.playing .disc { animation-play-state: running; }
body.mode-night.beat .disc {
  filter: brightness(1.35);
  box-shadow: 0 0 20px rgba(var(--strobe-r), var(--strobe-g), var(--strobe-b), 0.4);
}
@keyframes spin { to { transform: rotate(360deg); } }

.links { display: flex; gap: clamp(14px, 3vw, 28px); }
.links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  transition: color 0.2s;
}
.links a:hover { color: var(--ink); }
body.mode-day .links a:hover { color: var(--pink); }

.fineprint {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ---------- marquee (day only) ---------- */
.marquee {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}
body.mode-day .marquee { opacity: 0.08; }
.marquee-inner {
  display: flex;
  white-space: nowrap;
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: clamp(50px, 9vw, 110px);
  animation: scroll 40s linear infinite;
}
@keyframes scroll { to { transform: translateX(-50%); } }

@media (max-height: 700px) {
  html, body { overflow-y: auto; }
  .stage { height: auto; min-height: 100dvh; padding-bottom: 40px; }
}

@media (max-width: 520px) {
  .bottom { flex-direction: column; align-items: center; gap: 16px; }
  .vinyl { display: none; }
  .knobs { padding: 12px 16px; gap: 14px; }
  .knob { width: 44px; }
  .knob-face { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .marquee-inner, .disc, .strobe, .title, .title span { animation: none !important; transition: none !important; }
  body.mode-night.beat .title, body.mode-night.beat .disc { filter: none; transform: none; box-shadow: none; }
}
