/* ============================================================
   Scale Explorer — page-specific styles
   Dark theme, uses design tokens from /css/styles.css
   ============================================================ */

.scale-page {
  --bg: #0C1A14;
  --bg-card: #12251B;
  --bg-card-border: #1F4B34;
  --text: #E8F5EE;
  --text-dim: #7CA88E;
  --accent: #10B981;
  --accent-hover: #059669;
  --root-color: #10B981;
  --note-color: #38bdf8;
  --note-text: #000;
  --fret-wire: #C0A070;
  --nut-color: #F5E6C8;
  --string-bass: #B8A080;
  --string-treble: #D0C0A0;
}

/* ── Layout ── */
.scale-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  background: var(--bg);
  min-height: 100vh;
}

body:has(.scale-page) { background: #0C1A14; }
body:has(.scale-page) .nav { background: rgba(12, 26, 20, 0.92); border-bottom-color: #1F4B34; }
body:has(.scale-page) .nav__menu a { color: #7CA88E; }
body:has(.scale-page) .nav__menu a:hover,
body:has(.scale-page) .nav__menu a.active { color: #10B981; }
body:has(.scale-page) .footer { background: #0A1610; color: #7CA88E; }
body:has(.scale-page) .footer h4 { color: #E8F5EE; }
body:has(.scale-page) .footer a { color: #7CA88E; }
body:has(.scale-page) .footer a:hover { color: #10B981; }
body:has(.scale-page) .footer__bottom { border-top-color: #1F4B34; color: #5A8A6E; }
body:has(.scale-page) .footer__brand p,
body:has(.scale-page) .footer .loc { color: #5A8A6E; }

.scale-page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
}
.scale-page .page-subtitle {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 32px;
  text-align: center;
}
.scale-page .page-subtitle strong { color: var(--text); font-weight: 500; }

/* ── Card ── */
.se-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── Controls ── */
.se-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.se-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-weight: 500;
}
.se-select {
  appearance: none;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237CA88E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.se-select:focus {
  outline: none;
  border-color: var(--accent);
}
.se-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: var(--bg-card-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.se-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}
.se-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}
.se-toggle {
  background: transparent;
  border: 1px solid var(--bg-card-border);
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.se-toggle:hover { border-color: var(--accent); color: var(--accent); }
.se-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.se-btn--play {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}
.se-btn--play:hover { background: var(--accent-hover); }
.se-btn--play:disabled { opacity: 0.4; cursor: not-allowed; }
.se-btn--play.playing { background: #EF4444; }

/* ── Fretboard ── */
.se-fretboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.se-fretboard {
  display: grid;
  grid-template-columns: 48px repeat(15, 1fr);
  min-width: 780px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.se-fret-numbers {
  display: contents;
}
.se-fret-num {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-dim);
  padding: 4px 0;
  font-family: var(--font-mono);
}
.se-fret-num:first-child {
  /* open string column label */
}

.se-string-row {
  display: contents;
}

.se-open-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  position: relative;
  height: 36px;
}
.se-open-label:hover { color: var(--accent); }

.se-cell {
  position: relative;
  height: 36px;
  border-left: 1.5px solid var(--fret-wire);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
/* Nut (first fret) */
.se-string-row .se-cell:first-of-type {
  border-left: 3px solid var(--nut-color);
}

/* String line */
.se-cell::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: var(--string-w, 1.5px);
  background: var(--string-color, var(--string-treble));
  pointer-events: none;
}

/* Fret markers */
.se-cell[data-marker]::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.se-cell[data-marker="double"]::after {
  box-shadow: 0 -30px 0 rgba(255,255,255,0.06);
}

/* Scale note dot */
.se-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  z-index: 2;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.se-dot:hover {
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}
.se-dot--root {
  background: var(--root-color);
  color: #fff;
}
.se-dot--root:hover {
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}
.se-dot--note {
  background: var(--note-color);
  color: var(--note-text);
}
.se-dot--playing {
  transform: scale(1.25);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.7);
}

/* Open string dot (in label column) */
.se-open-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: transform 0.1s;
}
.se-open-dot:hover { transform: scale(1.15); }
.se-open-dot--root { background: var(--root-color); color: #fff; }
.se-open-dot--note { background: var(--note-color); color: var(--note-text); }

/* ── Scale Info Panel ── */
.se-info-panel {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}
.se-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.se-info-block h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.se-info-value {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}
.se-info-block--wide {
  grid-column: span 4;
}

/* ── Info Sections ── */
.se-info {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-top: 20px;
  color: var(--text);
}
.se-info h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  color: var(--text);
  margin-bottom: 16px;
}
.se-info ol {
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.8;
}
.se-info ol strong { color: var(--text); font-weight: 500; }
.se-info p {
  color: var(--text-dim);
  line-height: 1.7;
}
.se-info p strong { color: var(--text); font-weight: 500; }
.se-info--links p { font-size: 0.9375rem; }
.se-info a { color: var(--accent); text-decoration: none; }
.se-info a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .scale-page { padding: 32px 16px 64px; }
  .se-card { padding: 16px; }
  .se-controls { gap: 10px; }
  .se-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .se-info-block--wide {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .se-controls { flex-direction: column; align-items: stretch; }
  .se-ctrl { justify-content: space-between; }
  .se-select { flex: 1; }
  .se-btn--play { margin-left: 0; width: 100%; padding: 10px; }
  .se-info-grid {
    grid-template-columns: 1fr;
  }
  .se-info-block--wide {
    grid-column: span 1;
  }
}
