/* ============================================
   MvF Devices — flexgroove-demo.css
   Interactive FlexGroove demo component
   ============================================ */

.fg-demo {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  user-select: none;
  -webkit-user-select: none;
}

/* --- Main layout: curve+steps left, strength meter right --- */
.fg-demo__main {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.fg-demo__body {
  flex: 1;
  min-width: 0;
}

/* --- Curve Area --- */
.fg-demo__curve {
  position: relative;
  width: 100%;
  height: 200px;
  margin-bottom: var(--space-lg);
  touch-action: none;
}

.fg-demo__svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fg-demo__center-line {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.5;
}

.fg-demo__grid-line {
  stroke: var(--accent-muted);
  stroke-width: 1;
  opacity: 0.22;
  pointer-events: none;
}

.fg-demo__curve-path {
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fg-demo__point {
  fill: var(--accent);
  cursor: grab;
  filter: drop-shadow(0 0 4px rgba(212, 168, 67, 0.3));
  transition: r 0.15s ease, filter 0.15s ease;
}

.fg-demo__point:hover {
  r: 12;
  filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.5));
}

.fg-demo__point--active {
  r: 13;
  cursor: grabbing;
  filter: drop-shadow(0 0 12px rgba(212, 168, 67, 0.6));
}

/* --- Step Display --- */
.fg-demo__steps {
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  height: 40px;
  align-items: center;
}

.fg-demo__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 12px;
}

.fg-demo__step-line {
  width: 1px;
  height: 16px;
  background-color: var(--border);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.fg-demo__step:nth-child(4n+1) .fg-demo__step-line {
  height: 26px;
  background-color: var(--accent-muted);
  opacity: 0.5;
}

.fg-demo__step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, background-color 0.1s ease;
}

.fg-demo__step--active .fg-demo__step-dot {
  background-color: var(--accent);
  transform: translateX(var(--shift, 0)) scale(1.5);
  box-shadow: 0 0 8px rgba(212, 168, 67, 0.6);
}

/* --- Strength Meter (vertical slider) --- */
.fg-demo__strength {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 36px;
  flex-shrink: 0;
}

.fg-demo__strength-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.fg-demo__strength-track {
  position: relative;
  width: 24px;
  flex: 1;
  background-color: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.fg-demo__strength-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--accent-muted), var(--accent));
  border-radius: 0 0 3px 3px;
  opacity: 0.6;
  pointer-events: none;
  transition: height 0.1s ease;
}

.fg-demo__strength-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
}

.fg-demo__strength-value {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 2em;
  text-align: center;
}

/* --- Mute Hint (iOS) --- */
.fg-demo__mute-hint {
  font-size: var(--text-xs);
  color: var(--accent-muted);
  text-align: center;
  padding: var(--space-xs) 0;
}

/* --- Controls --- */
.fg-demo__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.fg-demo__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-accent);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fg-demo__btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-muted);
  background-color: var(--accent-glow);
}

.fg-demo__btn--play {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
}

.fg-demo__btn--play svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.fg-demo__icon-stop {
  display: none;
}

.fg-demo--playing .fg-demo__icon-play {
  display: none;
}

.fg-demo--playing .fg-demo__icon-stop {
  display: block;
}

.fg-demo--playing .fg-demo__btn--play {
  color: var(--accent);
  border-color: var(--accent);
}

.fg-demo__btn--kick {
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-family: var(--font-family);
  opacity: 0.45;
}

.fg-demo__btn--kick-on {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent-muted);
}

.fg-demo__btn--reset {
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-family: var(--font-family);
}

.fg-demo__bpm-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.fg-demo__bpm-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border-accent);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.fg-demo__bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.fg-demo__bpm-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.fg-demo__bpm-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.fg-demo__bpm-slider::-moz-range-track {
  height: 4px;
  background: var(--border-accent);
  border-radius: 2px;
}

.fg-demo__bpm-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 5.5em;
}

/* --- Responsive --- */
@media (max-width: 639px) {
  .fg-demo {
    padding: var(--space-md);
  }

  .fg-demo__curve {
    height: 160px;
  }

  .fg-demo__point {
    r: 13;
  }

  .fg-demo__steps {
    padding: 0 16px;
  }

  .fg-demo__step-dot {
    width: 6px;
    height: 6px;
  }

  .fg-demo__controls {
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .fg-demo__btn--play {
    width: 40px;
    height: 40px;
  }

  .fg-demo__btn--kick,
  .fg-demo__btn--reset {
    padding: 0.3rem 0.6rem;
    font-size: var(--text-xs);
  }

  .fg-demo__bpm-slider {
    width: 50px;
  }

  .fg-demo__bpm-label {
    font-size: var(--text-xs);
    min-width: 4.5em;
  }
}
