/* Chords page css. The page hero, tabs, practice card, option buttons, note chips, Play button and score come from
   page.css, the keyboard and its case from piano.css. */

/* Base */


.tab-break {
  margin-left: 10px;
}

/* Mobile */

.tab-label {
  display: block;
  padding: 0 var(--pad) 8px;
}

.chord-visuals {
  display: grid;
  gap: 18px;
  margin: 4px 0;
}

.chord-score svg {
  max-width: 220px;
  margin-inline: auto;
}

.chord-group+.chord-group {
  margin-top: 28px;
}

.group-title {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* the viewer: the chord's name large (.note-chip in page.css; Play, at the foot of the keyboard, in piano.css) */
.chord-viewer {
  scroll-margin-top: 84px; /* a card below opens its chord here: keep the title clear of the sticky header */
}

.chord-viewer h2 {
  margin: 0 0 4px;
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.chord-viewer .note-chips {
  margin-top: 12px;
}

.chord-keys .case-foot {
  margin-top: 10px;
}

/* the two octaves fit a phone with white keys of 18px; on the narrowest phones they scroll sideways, as on the key
   pages, instead of widening the page */
#chord-keys {
  overflow-x: auto;
}

#chord-keys .piano-static {
  min-width: calc(var(--whites) * 18px);
}

/* the chords on the root: each card opens its chord in the viewer above; the one shown there is picked out */
.chord-card {
  position: relative;
  border-radius: 14px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.chord-open {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chord-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.chord-open:focus-visible {
  outline: none;
}

.chord-card:has(.chord-open:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chord-card.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.chord-card .score svg {
  max-width: 170px;
}

.chord-card .score {
  margin-bottom: 8px;
}

@media (hover: hover) {
  .chord-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-lift);
  }

  .chord-card.is-current:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-lift);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chord-card,
  .chord-card:hover {
    transition: none;
    transform: none;
  }
}

/* the link to the key page, under the fingering, when the chord is a major or minor triad (.go-link in page.css) */
.practice-foot .go-link {
  align-self: flex-start;
  font-size: 0.88rem;
}

.chord-guide {
  padding: 0 var(--pad) 56px;
}

.guide-cards {
  display: grid;
  gap: 12px;
}

.guide-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.guide-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.guide-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

/* Tablet */
@media (min-width: 768px) {
  .chord-visuals {
    grid-template-columns: minmax(180px, 220px) minmax(0, 480px);
    justify-content: center;
    align-items: center;
    gap: 28px;
    margin: 8px 0;
  }

  #chord-list .scale-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .guide-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .chord-guide {
    padding-bottom: 64px;
  }
}

/* Desktop */
@media (min-width: 1024px) {

  .tab-label,
  .chord-guide {
    padding-inline: var(--gutter);
  }

  .chord-visuals {
    grid-template-columns: 240px minmax(0, 560px);
    gap: 48px;
  }

  #chord-list .scale-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .guide-cards {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .chord-guide {
    padding-bottom: 88px;
  }
}