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

.vpiano-page {
  --bg: #0C1A14;
  --bg-card: #12251B;
  --bg-card-border: #1F4B34;
  --text: #E8F5EE;
  --text-dim: #7CA88E;
  --accent: #10B981;
  --accent-hover: #059669;
  --red: #EF4444;
  --white-key: #F5F0E8;
  --white-key-active: #d4eadd;
  --black-key: #1a1a1a;
  --black-key-active: #2d5a3f;
}

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

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

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

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

/* ── Controls ── */
.vp-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.vp-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-weight: 500;
}
.vp-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-card-border);
  outline: none;
  cursor: pointer;
}
.vp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.vp-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.vp-toggle {
  padding: 6px 14px;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}
.vp-toggle:hover { border-color: var(--accent); color: var(--text); }
.vp-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.vp-octave-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.vp-octave-btn:hover { border-color: var(--accent); color: var(--text); }
.vp-octave-label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
  min-width: 60px;
  text-align: center;
}

/* ── Loading Overlay ── */
.vp-keyboard-wrap { position: relative; }
.vp-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(12, 26, 20, 0.75);
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
}
.vp-loading__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  transition: background 0.2s;
}
.vp-loading__btn:hover { background: var(--accent-hover); }
.vp-loading__btn:disabled { opacity: 0.6; cursor: not-allowed; }
.vp-loading__status {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* ── Piano Keyboard ── */
.vp-keyboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.vp-keyboard {
  display: flex;
  position: relative;
  height: 220px;
  min-width: fit-content;
  margin: 0 auto;
  user-select: none;
  touch-action: none;
}

/* ── White Keys ── */
.vp-key-white {
  position: relative;
  width: 48px;
  height: 220px;
  background: var(--white-key);
  border: 1px solid #c8c0b0;
  border-radius: 0 0 6px 6px;
  cursor: pointer;
  flex-shrink: 0;
  z-index: 1;
  transition: background 0.06s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
}
.vp-key-white:hover { background: #ebe5d8; }
.vp-key-white.active {
  background: var(--white-key-active);
  box-shadow: inset 0 -4px 8px rgba(16, 185, 129, 0.3);
}

/* ── Black Keys ── */
.vp-key-black {
  position: absolute;
  width: 30px;
  height: 140px;
  background: var(--black-key);
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.06s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}
.vp-key-black:hover { background: #2a2a2a; }
.vp-key-black.active {
  background: var(--black-key-active);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ── Key Labels ── */
.vp-key-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.vp-key-white .vp-key-label { color: #666; }
.vp-key-black .vp-key-label { color: #999; }
.vp-keyboard.show-labels .vp-key-label { opacity: 1; }

.vp-key-shortcut {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  margin-top: 2px;
}
.vp-key-white .vp-key-shortcut { color: #999; }
.vp-key-black .vp-key-shortcut { color: #777; }
.vp-keyboard.show-keys .vp-key-shortcut { opacity: 1; }

/* ── Sustain Indicator ── */
.vp-sustain-indicator {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: center;
  margin-top: 8px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.2s;
}
.vp-sustain-indicator.on {
  opacity: 1;
  color: var(--accent);
}

/* ── Info Sections ── */
.vp-info {
  margin-top: 32px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
}
.vp-info + .vp-info { margin-top: 20px; }
.vp-info h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  color: var(--text);
  margin-bottom: 16px;
}
.vp-info ol, .vp-info ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.8;
}
.vp-info ol strong { color: var(--text); font-weight: 500; }
.vp-info p {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
}
.vp-info p:first-of-type { margin-top: 0; }
.vp-info a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.vp-info a:hover { opacity: 0.8; }
.vp-info--links { background: transparent; border: none; padding: 0 4px; text-align: center; }
.vp-info--links p { opacity: 0.6; font-size: 0.85rem; }

/* ── Keyboard Shortcuts Table ── */
.vp-keys-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
}
.vp-keys-grid kbd {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-align: center;
}
.vp-keys-grid span { color: var(--text-dim); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .vpiano-page { padding: 32px 12px 64px; }
  .vp-card { padding: 16px 12px; }
  .vp-keyboard { height: 180px; }
  .vp-key-white { width: 38px; height: 180px; }
  .vp-key-black { width: 24px; height: 110px; }
  .vp-controls { gap: 10px; }
}
@media (max-width: 480px) {
  .vp-key-white { width: 32px; height: 160px; }
  .vp-key-black { width: 20px; height: 100px; }
  .vp-keyboard { height: 160px; }
}
