/* Chords › Build a progression (js/buildchords.js): its row under the parts in the Chords drawer, and the layer it
   opens. Nick's side. It sits on Moon, in the drawer or in a Moon-toned sheet (drill.css), and borrows the Band
   layers' frame from guitar.css (the bar, the rail, the levels, "More", the "i") and Moon's keys from chords.css
   (.mkey). Colour only means music: a chord's key (--c) is its step in the key, as in the stage and the planet. */

/* ---------- the row: first in the drawer, above the chords, in the part rows' look (chords.css .cpart) ---------- */

.drawer-chords > .cbuild {
  flex: 1 1 100%;
  min-width: 0;
  margin: -6px 0 4px;
  border-bottom: 1px solid var(--moon-line);
  transition: opacity 220ms var(--ease-out);
}

.cbuild-h {
  margin: 0;
  font: inherit;
}

.cbuild-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 50px;
  padding: 0 0 0 2px;
  border-radius: 10px;
  color: var(--moon-ink);
  text-align: left;
}

.cbuild-name {
  font-size: 15px;
  font-weight: 500;
}

.cbuild-sum {
  flex: 1;
  min-width: 0;
  color: var(--moon-mtext);
  font-size: 14px;
}

.cbuild-row .pm {
  color: var(--moon-mtext);
}

.cbuild-row[aria-expanded="true"] .pm-v {
  opacity: 0;
}

.cbuild-row:focus-visible {
  outline-offset: 0;
}

.cbuild-chev {
  display: none;
  width: 16px;
  height: 16px;
  color: var(--moon-mtext);
}

@media (hover: hover) {
  .cbuild-row:hover {
    background-color: color-mix(in srgb, var(--moon-ink) 4%, transparent);
  }
}

@media (max-width: 639px) {
  .cbuild-row .pm {
    display: none;
  }

  .cbuild-chev {
    display: block;
  }
}

/* ---------- the layer ---------- */

.bld-layer :is(.gtr-more, .mkey):disabled {
  opacity: .38;
  pointer-events: none;
}

/* Undo and Start over, beside "Your chords": quiet text keys. */
.bld-tools {
  display: inline-flex;
  gap: 2px;
  margin: -10px -10px -10px 0;
}

.bld-tools .gtr-more {
  min-height: 40px;
  margin: 0;
}

/* ---------- a chord: the song builder's card (js/chordcard.js, songbuilder.css .cc) ----------
   Build a progression drew its own key until 2026-11-17, with the number over the name. Now it's the one card: the
   name with its number under it, its notes or its job under the card. Only the layout is set here. */

.bld-slot,
.bld-chord {
  transition: scale var(--t) ease, box-shadow var(--t) ease, translate var(--t) ease;
}

.bld-slot:active,
.bld-chord:active {
  scale: .97;
}

:is(.bld-slot, .bld-chord):focus-visible {
  outline: 2px solid var(--moon-ink);
  outline-offset: 3px;
}

/* ---------- Your chords: the slots ---------- */

.bld-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@container gtrplay (min-width: 520px) {
  .bld-slots {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  }
}

/* Drag a chord card to move it (js/buildchords.js, Nick 2026-11-14). The card under the finger is lifted and
   follows it; the page doesn't scroll from a card, so the drag can go any way. */
.bld-slot[data-slot]:not(.bld-add) {
  touch-action: none;
  cursor: grab;
}

.bld-slot.is-dragging {
  z-index: 5;
  cursor: grabbing;
  scale: 1.06;
  transition: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 color-mix(in srgb, var(--c, #2A2E3A) 72%, #000), 0 0 0 1.5px var(--starlight);
}

.bld-slots.is-sorting li {
  position: relative;
}

/* The picked slot wears a ring, and so does the chord the band is on (songbuilder.css .cc.is-now), as in the song
   builder. */
.bld-slot[aria-pressed="true"]:not(.bld-add) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 color-mix(in srgb, var(--c, #2A2E3A) 72%, #000), 0 0 0 2px var(--moon-body), 0 0 0 4px var(--starlight);
}

/* The "+": where the next chord goes. A dashed well, not a card. */
.bld-add {
  display: grid;
  place-items: center;
  width: 100%;
  height: 56px;
  border: 1.5px dashed var(--sb-line2);
  border-radius: 11px;
  color: var(--moon-mtext);
}

.bld-add[aria-pressed="true"] {
  border-color: var(--moon-ink);
  color: var(--moon-ink);
}

.bld-plus {
  width: 20px;
  height: 20px;
}

.bld-under {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-top: 10px;
}

.bld-cue {
  margin: 0;
  color: var(--moon-mtext);
  font-size: 13px;
  line-height: 1.4;
}

.bld-edit {
  display: flex;
  gap: 6px;
}

.bld-edit[hidden] {
  display: none;
}

.bld-ed {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

/* ---------- Chords in this key ---------- */

.bld-keywrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: -4px -8px -4px 0;
}

.bld-key {
  gap: 4px;
  padding: 0 10px 0 14px;
}

.bld-keychev {
  width: 16px;
  height: 16px;
  rotate: 90deg;
  transition: rotate var(--t) ease;
}

.bld-key[aria-expanded="true"] .bld-keychev {
  rotate: -90deg;
}

.bld-keypanel {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--moon-line);
}

.bld-keypanel[hidden] {
  display: none;
}

.bld-modes {
  display: flex;
  gap: 6px;
}

.bld-notes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@container gtrplay (min-width: 520px) {
  .bld-notes {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

.bld-note {
  justify-content: center;
  padding: 0;
}

.bld-mode {
  min-height: 36px;
}

.bld-keyline {
  margin: 0;
  color: var(--moon-mtext);
  font-size: 13px;
}

/* What songs do next, in words. Two lines are kept so the keys don't jump when it arrives. */
.bld-hint {
  min-height: 2.8em;
  margin: 0 0 10px;
  color: var(--moon-ink);
  font-size: 13.5px;
  line-height: 1.4;
  transition: opacity var(--t) ease;
}

.bld-hint.is-waiting {
  opacity: .4;
}

.bld-fam {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@container gtrplay (min-width: 520px) {
  .bld-fam {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  /* A minor key's row holds eight, the seven and its V: two lines of four, then one line once there's room. */
  .bld-fam.has-v {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@container gtrplay (min-width: 640px) {
  .bld-fam.has-v {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .bld-fam.has-v .bld-chord {
    padding-inline: 7px;
  }
}

.bld-fam {
  align-items: start;
}

/* How often songs go here next: a bar under the card. */
.bld-meter {
  height: 3px;
  margin: 1px 2px 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--moon-ink) 16%, transparent);
  opacity: 0;
  transition: opacity var(--t) ease;
}

.bld-meter i {
  display: block;
  width: calc(var(--m, 0) * 100%);
  height: 100%;
  border-radius: 2px;
  background: var(--moon-ink);
  transition: width 240ms var(--ease-out, ease);
}

.bld-chordbox.has-m .bld-meter {
  opacity: 1;
}

/* A job can run to two lines ("the pull home"). */
.bld-chordbox .cc-word {
  white-space: normal;
}

/* More chords: the further tiers, each with its line. */
.bld-more {
  display: grid;
  gap: 16px;
  margin-top: 6px;
}

.bld-more[hidden] {
  display: none;
}

.bld-th {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 500;
}

.bld-tnote {
  max-width: 62ch;
  margin: 0 0 10px;
  color: var(--moon-mtext);
  font-size: 13px;
  line-height: 1.45;
}

.bld-fam-more {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@container gtrplay (min-width: 520px) {
  .bld-fam-more {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

.bld-any {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.bld-anyin {
  flex: 1;
  min-width: 0;
  max-width: 220px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--moon-raised);
  box-shadow: inset 0 0 0 1px var(--moon-raised-edge);
  color: var(--moon-ink);
  font: inherit;
  font-size: 16px;
}

.bld-anyin::placeholder {
  color: var(--moon-mtext);
}

/* ---------- Start from a classic ---------- */

.bld-classics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@container gtrplay (min-width: 520px) {
  .bld-classics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bld-classics[hidden] {
  display: none;
}

.bld-classics-more {
  margin-top: 8px;
}

.bld-classic {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  padding: 11px 14px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--moon-raised), var(--moon-raised-lo));
  box-shadow: inset 0 1px 0 var(--moon-raised-hl), 0 2px 0 var(--moon-raised-edge), 0 7px 11px -7px rgba(0, 0, 0, .3), 0 0 0 1px var(--moon-raised-rim);
  color: var(--moon-ink);
  text-align: left;
  transition: scale var(--t) ease;
}

.bld-classic:active {
  scale: .99;
}

.bld-cname {
  font-size: 15px;
  font-weight: 500;
}

/* Its chords in your key, as small cards, with the numbers that stay the same in every key under them. */
.bld-cchords {
  display: block;
  min-width: 0;
}

.cc-row.bld-ccards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bld-csteps {
  color: var(--moon-mtext);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}

.bld-cline {
  color: var(--moon-mtext);
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- Songs with these chords ---------- */

.bld-songs {
  padding: 2px 0 6px;
}

.bld-shead {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
}

.bld-snote {
  margin: 0 0 10px;
  color: var(--moon-mtext);
  font-size: 13px;
  line-height: 1.45;
}

.bld-slist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bld-song {
  display: grid;
  gap: 1px;
  padding: 9px 0;
  border-top: 1px solid var(--moon-line);
}

.bld-stitle {
  font-size: 14.5px;
  font-weight: 500;
}

.bld-sartist {
  color: var(--moon-mtext);
  font-size: 13px;
}

.bld-ssecs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  align-items: center;
  margin-top: 2px;
  font-size: 13px;
}

.bld-ssecs a,
.bld-ask {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--moon-ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--moon-raised-edge);
  text-underline-offset: 3px;
}

@media (hover: hover) {
  .bld-classic:hover {
    filter: brightness(1.02);
  }

  :is(.bld-slot, .bld-chord):hover {
    translate: 0 -1px;
  }

  .bld-add:hover {
    translate: none;
    color: var(--moon-ink);
  }

  .bld-ssecs a:hover,
  .bld-ask:hover {
    text-decoration-color: var(--moon-ink);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bld-slot,
  .bld-chord,
  .bld-classic,
  .bld-meter i {
    transition: none;
  }
}

/* ---------- where these chords go: your progression, a part of the song, or a new progression ---------- */

.bld-where {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--moon-line);
  border-radius: 12px;
  background: var(--moon-body-hi);
}

.bld-where[hidden],
.bld-take[hidden],
.bld-new[hidden],
.bld-back[hidden],
.bld-which[hidden] {
  display: none;
}

.bld-wtext {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
  color: var(--moon-mtext);
  font-size: 13.5px;
  line-height: 1.4;
}

.bld-wname {
  display: block;
  color: var(--moon-ink);
  font-size: 15px;
  font-weight: 600;
}

.bld-wacts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}

.bld-wacts .gtr-more {
  min-height: 44px;
  margin: 0;
}

/* The one clear step on from here: a solid key. */
.bld-take {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--starlight);
  color: var(--space);
  font-size: 14px;
  font-weight: 600;
}

.bld-take:focus-visible {
  outline: 2px solid var(--moon-ink);
  outline-offset: 3px;
}

.bld-new {
  min-height: 44px;
}

.bld-which {
  flex: 1 1 100%;
  padding-top: 10px;
  border-top: 1px solid var(--moon-line);
}

.bld-whichh {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
}

.bld-whichrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bld-whichrow .mkey {
  min-height: 44px;
}

.bld-whichnote {
  margin: 8px 0 0;
  color: var(--moon-mtext);
  font-size: 13px;
  line-height: 1.4;
}

/* A new progression's own Play holds both pictures: the one that shows is its data-on. */
.bld-layer .gtr-go[hidden],
.bld-draftgo[data-on="false"] > .bld-ico-pause,
.bld-draftgo[data-on="true"] > .bld-ico-play {
  display: none;
}

@media (hover: hover) {
  .bld-take:hover {
    background: #fff;
  }
}
