/* =================================================================
   HYDRASONIC — style.css
   Glassmorphic / neon UI for the audio-reactive visualizer.
   Theme accent colors are driven by CSS custom properties
   (--accent-a / --accent-b) which JS updates live from CONFIG.
================================================================= */

:root {
  /* Default theme (overwritten at runtime by JS) */
  --accent-a: #00e5ff;
  --accent-b: #ff00e5;

  --bg: #05060a;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --stroke: rgba(255, 255, 255, 0.14);
  --text: #eef1f7;
  --text-dim: rgba(238, 241, 247, 0.55);

  --radius: 18px;
  --blur: 18px;

  /* Cursor positions (updated via JS transform) */
  --cx: 50vw;
  --cy: 50vh;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  cursor: none; /* hide native cursor; custom cursor used */
}

/* On touch devices, restore the native cursor and hide custom one */
@media (hover: none) {
  body { cursor: auto; }
  #cursor, #cursor-trail { display: none !important; }
}

/* ---------------- Fixed background layers ---------------- */
#bg-canvas,
#overlay-2d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}
#bg-canvas { z-index: 0; }
#overlay-2d { z-index: 1; pointer-events: none; }

#vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 120% at 50% 45%, transparent 55%, rgba(0,0,0,0.55) 100%);
  mix-blend-mode: multiply;
}

/* ---------------- Custom cursor ---------------- */
#cursor, #cursor-trail {
  position: fixed;
  top: 0; left: 0;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform, opacity, width, height;
}
#cursor {
  width: 10px; height: 10px;
  background: #fff;
  box-shadow: 0 0 14px var(--accent-a);
}
#cursor-trail {
  width: 38px; height: 38px;
  background: radial-gradient(circle, var(--accent-a) 0%, transparent 70%);
  opacity: 0.35;
  filter: blur(2px);
}

/* ---------------- Top bar ---------------- */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 30px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 2px; }
.logo-mark {
  font-size: 22px;
  color: var(--accent-a);
  text-shadow: 0 0 16px var(--accent-a);
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-text { font-size: 18px; }
.logo-text b { color: var(--accent-b); font-weight: 700; }

.ghost-btn {
  background: var(--glass);
  border: 1px solid var(--stroke);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  font-size: 13px;
  letter-spacing: 1px;
  cursor: none;
  transition: border-color .3s, background .3s;
}

/* ---------------- Glass panel base ---------------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 18px 50px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ---------------- Control panel ---------------- */
#control-panel {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  width: min(920px, calc(100vw - 36px));
  padding: 16px 20px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 18px 50px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

.transport {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: #05060a;
  font-size: 20px;
  display: grid; place-items: center;
  cursor: none;
  box-shadow: 0 0 24px rgba(0,229,255,0.35);
  flex: 0 0 auto;
}
.play-btn .icon-pause { display: none; }
body.is-playing .play-btn .icon-play { display: none; }
body.is-playing .play-btn .icon-pause { display: block; }

.track-block { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mini-label { font-size: 10px; letter-spacing: 2px; color: var(--text-dim); }

.track-select select {
  background: var(--glass-strong);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: none;
  outline: none;
}
.file-btn {
  background: var(--glass-strong);
  border: 1px dashed var(--stroke);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: none;
  transition: border-color .3s, color .3s;
}
.file-btn:hover { border-color: var(--accent-a); color: var(--accent-a); }

.volume-block { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Range inputs (neon) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  outline: none;
  cursor: none;
}
#volume { width: 120px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px var(--accent-a);
  cursor: none;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: none;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 10px var(--accent-a); cursor: none;
}

/* Presets */
.presets { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-btn {
  flex: 1 1 auto;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: none;
  transition: color .3s, border-color .3s, background .3s;
}
.preset-btn.is-active {
  color: #05060a;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border-color: transparent;
  font-weight: 700;
}

/* ---------------- Customization panel ---------------- */
#customize-panel {
  position: fixed;
  top: 0; right: 0;
  z-index: 40;
  width: min(340px, 88vw);
  height: 100vh;
  padding: 26px 24px;
  background: var(--glass);
  border-left: 1px solid var(--stroke);
  backdrop-filter: blur(calc(var(--blur) + 6px));
  -webkit-backdrop-filter: blur(calc(var(--blur) + 6px));
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
  transform: translateX(100%);
  overflow-y: auto;
}
.close-btn {
  position: absolute; top: 18px; right: 18px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--glass-strong);
  color: var(--text);
  cursor: none;
  font-size: 14px;
}
.panel-title {
  font-size: 20px; letter-spacing: 1px; margin-bottom: 22px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.ctrl-group { margin-bottom: 22px; }
.ctrl-label {
  display: flex; justify-content: space-between;
  font-size: 12px; letter-spacing: 1px; color: var(--text-dim);
  margin-bottom: 10px;
}
.ctrl-val { color: var(--accent-a); font-weight: 700; }
.ctrl-group input[type="range"] { width: 100%; }

.theme-row { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-dot {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--a), var(--b));
  cursor: none;
  box-shadow: 0 0 14px rgba(0,0,0,0.4);
  transition: transform .25s, border-color .25s;
}
.theme-dot.is-active { border-color: #fff; transform: scale(1.12); }

/* ---------------- Drag & drop hint ---------------- */
#drop-hint {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  place-items: center;
  background: rgba(5,6,10,0.78);
  backdrop-filter: blur(6px);
  border: 3px dashed var(--accent-a);
}
#drop-hint.show { display: grid; }
#drop-hint span {
  font-size: 22px; letter-spacing: 2px;
  color: var(--accent-a);
}

/* ---------------- Scrollable content ---------------- */
#content {
  position: relative;
  z-index: 20;
  pointer-events: none; /* let clicks pass to controls; re-enable on text */
}
.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 8vw;
  max-width: 900px;
}
.hero-title {
  font-size: clamp(42px, 9vw, 120px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -2px;
}
.hero-title span {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  margin-top: 22px;
  font-size: clamp(15px, 2vw, 20px);
  color: var(--text-dim);
  max-width: 540px;
  line-height: 1.5;
}
.scroll-cue {
  margin-top: 40px;
  font-size: 13px; letter-spacing: 4px;
  color: var(--accent-a);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); opacity: 0.5; } }

.info {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8vw;
  max-width: 760px;
}
.info h3 {
  font-size: clamp(24px, 4vw, 40px);
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.info p { font-size: 17px; line-height: 1.7; color: var(--text-dim); }
.info code {
  background: var(--glass-strong);
  padding: 2px 7px; border-radius: 6px;
  color: var(--accent-a); font-size: 14px;
}

.credits {
  min-height: 60vh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 8px; padding: 0 8vw 120px;
  color: var(--text-dim); font-size: 13px; letter-spacing: 0.5px;
}

/* Re-enable pointer events for interactive children */
#content a, #content button { pointer-events: auto; }

/* ---------------- Toast (capture hints / errors) ---------------- */
#toast {
  position: fixed;
  left: 50%; bottom: 120px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(440px, 88vw);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0.3px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
  #topbar { padding: 16px 18px; }
  .ghost-btn { padding: 8px 12px; font-size: 12px; }
  #control-panel { bottom: 12px; padding: 12px 14px; gap: 10px; }
  .transport { gap: 12px; }
  .volume-block { margin-left: 0; width: 100%; }
  #volume { width: 100%; }
  .preset-btn { font-size: 12px; padding: 9px 8px; }
  .hero { padding: 0 6vw; }
}
