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

.pchord-page {
  --bg: #0C1A14;
  --bg-card: #12251B;
  --bg-card-border: #1F4B34;
  --text: #E8F5EE;
  --text-dim: #7CA88E;
  --accent: #10B981;
  --accent-hover: #059669;
  --white-key: #F5F0E8;
  --white-key-hl: #86efac;
  --white-key-root: #10B981;
  --black-key: #1a1a1a;
  --black-key-hl: #38bdf8;
  --black-key-root: #059669;
}

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

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

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

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

/* ── Controls ── */
.pc-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.pc-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-weight: 500;
}
.pc-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;
}
.pc-select:focus { outline: none; border-color: var(--accent); }
.pc-select--wide { min-width: 180px; }
.pc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px; height: 4px;
  background: var(--bg-card-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.pc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
}
.pc-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; border: none; cursor: pointer;
}
.pc-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;
}
.pc-btn--play:hover { background: var(--accent-hover); }

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

.pc-key-white {
  position: relative;
  width: 44px;
  height: 200px;
  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.08s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
}
.pc-key-white:hover { background: #ebe5d8; }
.pc-key-white.active {
  background: var(--white-key-active, #d4eadd);
  box-shadow: inset 0 -4px 8px rgba(16, 185, 129, 0.3);
}
.pc-key-white.hl {
  background: var(--white-key-hl);
}
.pc-key-white.hl-root {
  background: var(--white-key-root);
}

.pc-key-black {
  position: absolute;
  width: 28px;
  height: 128px;
  background: var(--black-key);
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.08s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}
.pc-key-black:hover { background: #2a2a2a; }
.pc-key-black.hl {
  background: var(--black-key-hl);
  box-shadow: 0 4px 8px rgba(56, 189, 248, 0.3);
}
.pc-key-black.hl-root {
  background: var(--black-key-root);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

/* Key labels */
.pc-key-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.pc-key-white .pc-key-label { color: #555; }
.pc-key-black .pc-key-label { color: #ccc; }
.pc-key-white.hl .pc-key-label,
.pc-key-white.hl-root .pc-key-label,
.pc-key-black.hl .pc-key-label,
.pc-key-black.hl-root .pc-key-label { opacity: 1; }

/* Interval badges */
.pc-key-interval {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  margin-top: 2px;
}
.pc-key-white .pc-key-interval { color: #333; }
.pc-key-black .pc-key-interval { color: #ddd; }
.pc-key-white.hl .pc-key-interval,
.pc-key-white.hl-root .pc-key-interval,
.pc-key-black.hl .pc-key-interval,
.pc-key-black.hl-root .pc-key-interval { opacity: 1; }

/* ── Info Panel ── */
.pc-info-panel {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}
.pc-info-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 20px;
}
.pc-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;
}
.pc-info-value {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}
.pc-info-value--large {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-display);
}
.pc-info-block--wide {
  grid-column: 1 / -1;
}

/* ── Quick Chord Grid ── */
.pc-chord-grid-card { margin-top: 20px; }
.pc-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.pc-chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}
.pc-chord-btn {
  padding: 8px 4px;
  background: var(--bg);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.pc-chord-btn:hover { border-color: var(--accent); color: var(--accent); }
.pc-chord-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Info Sections ── */
.pc-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);
}
.pc-info h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 16px;
  color: var(--text);
}
.pc-info ol {
  padding-left: 20px;
  color: var(--text-dim);
  line-height: 1.8;
}
.pc-info ol strong { color: var(--text); font-weight: 500; }
.pc-info p {
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 10px;
}
.pc-info p:last-child { margin-bottom: 0; }
.pc-info p strong { color: var(--text); font-weight: 500; }
.pc-info--links p { font-size: 0.9375rem; }
.pc-info a { color: var(--accent); text-decoration: none; }
.pc-info a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .pchord-page { padding: 32px 16px 64px; }
  .pc-card { padding: 16px; }
  .pc-keyboard { height: 170px; }
  .pc-key-white { width: 36px; height: 170px; }
  .pc-key-black { width: 22px; height: 108px; }
  .pc-info-grid { grid-template-columns: 1fr 1fr; }
  .pc-info-block--wide { grid-column: span 2; }
}
@media (max-width: 480px) {
  .pc-controls { flex-direction: column; align-items: stretch; }
  .pc-ctrl { justify-content: space-between; }
  .pc-select { flex: 1; }
  .pc-select--wide { min-width: unset; }
  .pc-btn--play { margin-left: 0; width: 100%; padding: 10px; }
  .pc-key-white { width: 30px; height: 150px; }
  .pc-key-black { width: 20px; height: 96px; }
  .pc-keyboard { height: 150px; }
  .pc-info-grid { grid-template-columns: 1fr; }
  .pc-info-block--wide { grid-column: span 1; }
}
