/**
 * visualizers.css
 * Canvas displays, physical wave animations, circular dials, overtone ladders, and modal keyboards.
 */

.canvas-wrapper {
  background: rgba(8, 11, 18, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Physics Stats Banner */
.physics-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-top: 0.85rem;
}

.physics-stats strong {
  color: var(--accent-cyan);
}

/* Harmonic Ladder */
.harmonics-ladder {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-top: 1rem;
}

.harmonic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  transition: all 0.2s ease;
}

.harmonic-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.harmonic-row.nature-triad {
  border-left: 3px solid var(--accent-amber);
}

.harmonic-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 1.1rem;
  min-width: 38px;
}

.harmonic-info {
  flex: 1;
}

.harmonic-title {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.harmonic-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

.btn-icon-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.btn-icon-play:hover {
  background: var(--accent-cyan);
  color: #000000;
  transform: scale(1.1);
}

/* Brightness Ladder (Modes) */
.brightness-ladder {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ladder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--mode-color, var(--accent-cyan));
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ladder-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ladder-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--mode-color, var(--accent-cyan));
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.ladder-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  min-width: 30px;
}

.ladder-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ladder-characteristic {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Piano Keyboard */
.piano-wrapper {
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.piano-keyboard {
  position: relative;
  height: 140px;
  width: 100%;
}

.white-keys-container {
  display: flex;
  height: 100%;
  width: 100%;
}

.white-key {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 0 0 5px 5px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 6px;
}

.white-key:hover {
  background: #e2e8f0;
}

.white-key.in-scale {
  background: #ffffff;
  box-shadow: inset 0 -4px 0 var(--accent-cyan);
}

.white-key .key-label {
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.black-key {
  position: absolute;
  width: 7.5%;
  height: 60%;
  background: #1e293b;
  border-radius: 0 0 4px 4px;
  z-index: 2;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
  transition: background 0.15s ease;
}

.black-key:hover {
  background: #334155;
}

.black-key.in-scale {
  background: #0f172a;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 -3px 0 var(--accent-cyan);
}

.degree-marker {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-bottom: 2px;
}

/* Key Details & Formula Card */
.key-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.key-stat-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Cultural Scale Pads */
.scale-pads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.scale-pad {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scale-pad:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.scale-pad.hit {
  background: var(--accent-cyan);
  transform: scale(0.96);
}

.scale-pad.hit * {
  color: #040812 !important;
}

.pad-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.pad-freq {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  margin-top: 0.25rem;
}

.pad-interval {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Traditions list */
.traditions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 480px;
  overflow-y: auto;
}

.tradition-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tradition-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tradition-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
}

.tradition-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.tradition-info {
  display: flex;
  flex-direction: column;
}

.tradition-region {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Drawbars */
.drawbars-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 250px;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.75rem 0.5rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  gap: 2px;
}

.drawbar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  height: 100%;
  flex: 1;
  min-width: 28px;
}

.drawbar-val {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
  user-select: none;
}

.drawbar-col input[type="range"].vertical-drawbar {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 20px !important;
  height: 155px !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: ns-resize;
  background: transparent !important;
  accent-color: var(--accent-cyan);
}

.drawbar-col input[type="range"].vertical-drawbar:hover {
  filter: brightness(1.25);
}

.drawbar-col input[type="range"].vertical-drawbar:active {
  filter: brightness(1.4);
}

.drawbar-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  user-select: none;
}

.drawbar-col.is-odd .drawbar-label {
  color: #38bdf8;
}

.drawbar-col.is-even .drawbar-label {
  color: #c084fc;
}

.drawbar-hint-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
