/* style.css — Echo visual design */

/* ============================================
   COLOR PALETTE
   ============================================ */
:root {
  --bg: #0a0a0f;
  --bg-gradient: radial-gradient(ellipse at 50% 50%, #12121f 0%, #0a0a0f 70%);
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.3);

  /* Ethereal palette */
  --cyan: #5ce0d8;
  --amber: #e8b94a;
  --violet: #a78bdf;
  --coral: #e8706a;
  --sage: #7ec89b;
  --rose: #df8bbb;
  --sky: #6bb8e8;
  --gold: #d4a843;
  --mint: #6bd8b0;
  --lavender: #9b8bdf;

  --primary: var(--cyan);
  --glow-primary: rgba(92, 224, 216, 0.15);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);

  --font-xs: 0.75rem;
  --font-sm: 0.8125rem;
  --font-base: 0.875rem;
  --font-lg: 1.125rem;
  --font-xl: 1.5rem;
  --font-2xl: 2rem;
}

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
}

/* ============================================
   HEADER / WORDMARK
   ============================================ */
.echo-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  pointer-events: none;
}

.echo-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.echo-logo {
  color: var(--primary);
  opacity: 0.8;
}

.echo-title {
  font-size: var(--font-sm);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.reset-btn {
  pointer-events: auto;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

/* ============================================
   PARTICLE CANVAS
   ============================================ */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   GRAPH
   ============================================ */
#graphContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#graphSvg {
  width: 100%;
  height: 100%;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.empty-state.fade-out {
  opacity: 0;
}

.empty-rings {
  position: absolute;
  width: 400px;
  height: 400px;
}

.empty-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid var(--primary);
  transform: translate(-50%, -50%);
}

.ring-1 {
  width: 80px;
  height: 80px;
  opacity: 0.25;
  animation: ringPulse 4s ease-in-out infinite;
}

.ring-2 {
  width: 160px;
  height: 160px;
  opacity: 0.15;
  animation: ringPulse 4s ease-in-out 0.5s infinite;
}

.ring-3 {
  width: 260px;
  height: 260px;
  opacity: 0.08;
  animation: ringPulse 4s ease-in-out 1s infinite;
}

.ring-4 {
  width: 380px;
  height: 380px;
  opacity: 0.04;
  animation: ringPulse 4s ease-in-out 1.5s infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: var(--ring-opacity, 0.15); }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: calc(var(--ring-opacity, 0.15) * 1.5); }
}

.ring-1 { --ring-opacity: 0.25; }
.ring-2 { --ring-opacity: 0.15; }
.ring-3 { --ring-opacity: 0.08; }
.ring-4 { --ring-opacity: 0.04; }

.empty-title {
  font-size: var(--font-2xl);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 12px;
  animation: breathe 4s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.empty-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.7;
  max-width: 340px;
  position: relative;
  z-index: 1;
}

@keyframes breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ============================================
   MIC BUTTON
   ============================================ */
.mic-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

.mic-btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mic-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.06);
}

.mic-btn.recording {
  background: rgba(232, 112, 106, 0.15);
  border-color: rgba(232, 112, 106, 0.4);
  box-shadow: 0 0 30px rgba(232, 112, 106, 0.2), 0 4px 24px rgba(0, 0, 0, 0.3);
}

.mic-btn.recording .mic-icon { display: none; }
.mic-btn.recording .stop-icon { display: block !important; }

/* Ripples */
.mic-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  pointer-events: none;
}

.mic-btn.recording .ripple-1 {
  animation: rippleOut 2s ease-out 0s infinite;
}

.mic-btn.recording .ripple-2 {
  animation: rippleOut 2s ease-out 0.5s infinite;
}

.mic-btn.recording .ripple-3 {
  animation: rippleOut 2s ease-out 1s infinite;
}

@keyframes rippleOut {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* ============================================
   RECORDING OVERLAY
   ============================================ */
.recording-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.waveform-canvas {
  width: 240px;
  height: 64px;
  opacity: 0.7;
}

.recording-timer {
  font-size: var(--font-lg);
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   RECORDING BORDER
   ============================================ */
.recording-border {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  pointer-events: none;
  border: 2px solid transparent;
  animation: borderGlow 2s ease-in-out infinite;
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(92, 224, 216, 0.05); box-shadow: inset 0 0 40px rgba(92, 224, 216, 0.03); }
  50% { border-color: rgba(92, 224, 216, 0.12); box-shadow: inset 0 0 60px rgba(92, 224, 216, 0.06); }
}

/* ============================================
   STATUS BAR
   ============================================ */
.status-bar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.status-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--text-muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
  position: fixed;
  z-index: 90;
  padding: 8px 14px;
  background: rgba(18, 18, 31, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  pointer-events: none;
  max-width: 220px;
  line-height: 1.5;
  white-space: normal;
}

/* ============================================
   GRAPH NODE STYLES (via SVG)
   ============================================ */
.node-group {
  cursor: pointer;
}

.node-circle {
  transition: r 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-glow {
  pointer-events: none;
}

.node-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  fill: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  text-anchor: middle;
  user-select: none;
}

.cluster-hull {
  pointer-events: none;
}

.link-line {
  pointer-events: none;
}

.link-line-hover {
  pointer-events: stroke;
  cursor: default;
}

/* ============================================
   FOOTER
   ============================================ */
.echo-footer {
  position: fixed;
  bottom: 12px;
  right: 16px;
  z-index: 50;
  font-size: 10px;
  color: var(--text-muted);
}

.echo-footer a {
  transition: color 0.2s;
}

.echo-footer a:hover {
  color: var(--text-secondary);
}

/* ============================================
   MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 600px) {
  .empty-title {
    font-size: 1.5rem;
  }
  
  .empty-subtitle {
    font-size: 0.75rem;
    max-width: 280px;
  }

  .empty-rings {
    width: 300px;
    height: 300px;
  }

  .ring-3 { width: 200px; height: 200px; }
  .ring-4 { width: 280px; height: 280px; }

  .mic-container {
    bottom: 28px;
  }

  .mic-btn {
    width: 56px;
    height: 56px;
  }

  .echo-header {
    padding: 14px 16px;
  }

  .waveform-canvas {
    width: 180px;
    height: 48px;
  }

  .node-label {
    font-size: 10px;
  }
}

/* ============================================
   PLAYING STATE ON NODE
   ============================================ */
.node-playing .node-circle {
  filter: brightness(1.5) drop-shadow(0 0 8px currentColor);
}

@keyframes nodeAppear {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   SVG FILTER DEFINITIONS (glow)
   ============================================ */
