/* Song workspaces inherit the library's palettes and control vocabulary. */
[data-scroll-cue] {
  mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top, 0px), #000 calc(100% - var(--fade-bottom, 0px)), transparent);
}

.lyrics-sheet {
  width: min(880px, calc(100% - 48px));
  height: min(820px, calc(100dvh - 64px));
  border: 0;
  background: var(--panel);
}

.lyrics-sheet .sheet-head {
  align-items: center;
  padding: 22px 32px 20px;
}

.lyrics-sheet .sheet-head h2 { font-size: 23px; }
.lyrics-sheet .sheet-sub { margin-top: 4px; font-size: 14px; }
.lyrics-sheet .sheet-head .btn { flex: none; }

.song-steps {
  display: flex;
  flex: none;
  gap: 22px;
  margin: 0;
  padding: 0 32px;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.song-steps li { display: flex; flex: 1; min-width: 0; }

.song-steps button {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  min-height: 44px;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.song-steps button > span {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.song-steps [aria-current="step"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.song-steps [aria-current="step"] > span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.song-steps .is-complete button > span { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.song-steps button:disabled { cursor: default; }
.song-steps button:disabled:not([aria-current]) { opacity: 0.5; }
.song-steps button:hover:not(:disabled) { color: var(--accent); border-bottom-color: var(--accent); }

.song-stage-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex: none;
  padding: 22px 32px 12px;
}
.song-stage-heading h3 { margin: 0; font-size: 20px; font-weight: 600; }
.song-stage-heading p { margin: 0; flex: none; color: var(--muted); font-size: 13px; }
.lyrics-sheet .sheet-body { padding: 4px 32px 24px; }
.lyrics-sheet .lyrics-step { min-height: 100%; }
.lyrics-sheet .lyrics-search { gap: 12px; }
.lyrics-sheet .lyrics-search .modal-input { min-height: 46px; }
.lyrics-sheet .modal-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lyrics-sheet .lyrics-search .btn { padding-inline: 22px; }
.lyrics-sheet .lyrics-results { gap: 0; margin-top: 20px; }

.song-search-intro { margin: 44px auto 32px; max-width: 380px; text-align: center; }
.song-search-intro > .icon { width: 32px; height: 32px; margin-inline: auto; color: var(--muted); }
.song-search-intro h4 { margin: 16px 0 8px; font-size: 20px; font-weight: 600; }
.song-search-intro p { margin: 0; color: var(--muted); line-height: 1.6; }
.lyrics-sheet .lyric-credit { padding-top: 24px; font-size: 13px; text-align: left; }
.lyrics-sheet .lyric-hit {
  position: relative;
  min-width: 0;
  padding: 14px 12px;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.lyrics-sheet .lyric-hit:hover { background: var(--panel-2); }
.lyrics-sheet .lyric-hit.is-picked { background: var(--accent-soft); }
.lyrics-sheet .lyric-hit-meta { font-size: 14px; }
.lyrics-sheet .lyric-draft { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.lyrics-sheet .lyric-draft .lyric-hit { flex: 1; border-bottom: 0; }
.lyrics-sheet .lyric-draft-bin { flex: none; color: var(--muted); }
.lyrics-sheet .lyric-draft-bin:hover { color: var(--danger); }
.lyrics-sheet .lyric-hit .badge { align-self: flex-start; }
.lyrics-sheet .lyric-empty { margin: 24px 0; font-size: 16px; max-width: 60ch; }
/* the song a search was probably meant to be, over the list it came back with */
.lyric-meant { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.link-button { padding: 0; font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { text-decoration-thickness: 2px; }
/* the hits that hardly answer the search, a tap away under the ones that do */
.lyrics-sheet .lyric-more { align-self: flex-start; margin-top: 12px; color: var(--muted); }
.song-editor-help, .song-section-help { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.lyrics-sheet .lyrics-text { padding: 20px; font-size: 16px; line-height: 1.7; min-height: 220px; }
.lyrics-sheet .chords-text { font-size: 14px; line-height: 1.6; }
.lyrics-sheet .lyrics-dest { margin-top: 24px; padding: 16px; font-size: 14px; }
.lyrics-sheet .lyrics-dest-label { display: block; }
.lyrics-sheet .lyrics-dest strong { overflow-wrap: anywhere; }

.lyrics-sheet .sheet-pages { padding-block: 4px; }

/* ---------------------------------------- the chord sheet, set up -- */

/*
 * The last screen of the chord sheet: its settings down one side, the pages
 * they make beside them, set again as they move. The settings are the chord
 * site's Print / PDF, and the pictures on them are its own, drawn here in this
 * app's colours and type. The dialog widens to hold both; the settings scroll
 * on their own, and the pages take the height that is left.
 */
.lyrics-sheet:has(.sheet-setup:not([hidden])) { width: min(1180px, calc(100% - 48px)); height: min(940px, calc(100dvh - 64px)); }
.lyrics-sheet .sheet-body:has(> .sheet-setup:not([hidden])) { overflow: hidden; }
.lyrics-sheet .sheet-setup { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 28px; height: 100%; min-height: 0; }
.sheet-setup-controls { display: flex; flex-direction: column; gap: 16px; min-height: 0; margin-right: -12px; padding: 2px 12px 2px 2px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-setup-pages { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.sheet-setup-pages .sheet-view { flex: 1; min-height: 0; }
.sheet-setup .lyrics-dest { flex: none; margin-top: 0; padding: 10px 14px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.setup-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.setup-details .field-label { margin-top: 0; }
.setup-details .modal-input { width: 100%; }

/* the key the song sounds in and where the capo sits, each a number between
   two arrows, and a way back to both as the tab had them */
.setup-key { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.setup-key:has(> #chords-capo-option[hidden]) { grid-template-columns: minmax(0, 1fr) auto; }
.key-stepper { display: flex; align-items: center; justify-content: space-between; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel-2); }
.key-stepper .icon-choice { border-color: transparent; background: transparent; }
.key-readout { display: grid; min-width: 0; padding: 2px 0; line-height: 1.2; text-align: center; }
.key-readout strong { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.key-readout span { color: var(--muted); font-size: 12px; white-space: nowrap; }
/* the spelling is a sign rather than a picture: ♯ and ♭ at the size of an icon,
   and Auto in the size of a label so it fits the button */
.spell-choice { font-size: 20px; line-height: 1; }
.spell-choice span { font-size: 12px; font-weight: 600; }

.setup-section { display: flex; flex-direction: column; padding-top: 12px; border-top: 1px solid var(--line); }
.setup-section h4 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.setup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 6px 0; }
.setup-row.is-idle .setup-label { opacity: 0.6; }
.setup-label { color: var(--muted); font-size: 14px; }
/* the boxes row holds which way up the boxes stand and, apart, which hand they
   are for, both to the right of the label */
#chords-boxes-row .setup-label { margin-right: auto; }

/* a picture for each choice: side by side where they are one choice, apart
   with a tick in the corner where each is on or off by itself */
.icon-choices { display: flex; flex: none; gap: 6px; }
.icon-choice {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 6px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.icon-choice svg { display: block; width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-choice svg.icon { stroke-width: 1.7; }
.icon-choice svg text { font-family: var(--font-body); }
.icon-choice[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.icon-choice:disabled { opacity: 0.45; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .icon-choice:hover:not(:disabled):not([aria-pressed="true"]) { color: var(--text); border-color: var(--field-line); }
}
.independent .icon-choice { padding-bottom: 12px; }
:is(.independent .icon-choice, .fit-choice)::before { content: ""; position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; box-sizing: border-box; background: var(--panel); border: 1px solid var(--field-line); border-radius: 3px; pointer-events: none; }
:is(.independent .icon-choice, .fit-choice)[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
:is(.independent .icon-choice, .fit-choice)[aria-pressed="true"]::after { content: ""; position: absolute; right: 6px; bottom: 7px; width: 6px; height: 4px; box-sizing: border-box; border-left: 1.5px solid var(--accent-ink); border-bottom: 1.5px solid var(--accent-ink); rotate: -45deg; pointer-events: none; }
/* one choice of several reads as one control; its ends are the first and last
   shown, which with a piano are not the first and last there are */
.exclusive { gap: 0; }
.exclusive .icon-choice { border-radius: 0; }
.exclusive .icon-choice:not([hidden]) ~ .icon-choice { border-left: 0; }
.exclusive .icon-choice:not([hidden]):not(.icon-choice:not([hidden]) ~ *) { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.exclusive .icon-choice:not([hidden]):not(:has(~ .icon-choice:not([hidden]))) { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.exclusive .icon-choice[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.key-stepper .icon-choice { width: 34px; height: 40px; padding: 4px; }
.setup-key > .icon-choice { width: 40px; height: 40px; }

/* the chord site's own pictures: a real chord box, a C7, a headstock */
.icon-choice .sample-box { stroke: none; }
.icon-choice .sample-box .string, .icon-choice .sample-box .fret { stroke: currentColor; stroke-width: 1.1; opacity: 0.7; }
.icon-choice .sample-box .nut { stroke: currentColor; stroke-width: 3.8; }
.icon-choice .sample-box .dot, .icon-choice .sample-box .mark { fill: currentColor; }
.icon-choice .sample-box .mark { font: 7px var(--font-body); text-anchor: middle; }
.icon-choice .chord-c7 { display: inline-flex; align-items: flex-start; justify-content: center; gap: 1px; width: 25px; height: 25px; padding-top: 2px; }
.icon-choice .chord-c7 b { font-size: 16px; line-height: 20px; font-weight: 700; }
.icon-choice .chord-c7 sup { font-size: 9px; line-height: 13px; font-weight: 600; }
.icon-choice:has(.instrument-icon) { padding: 4px; }
.icon-choice svg.instrument-icon { width: 30px; height: 30px; stroke-width: 1.35; }
.independent .icon-choice:has(.instrument-icon)::before { width: 10px; height: 10px; right: 2px; bottom: 2px; }

/* how big the words are set: the largest that fits, or a size of their own */
.setup-size { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 0; }
.setup-size > span { display: grid; place-items: center; color: var(--muted); }
.setup-size > span svg { width: 20px; height: 20px; }
.setup-size > span svg text { font-family: var(--font-body); }
.setup-size input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.setup-size input.is-idle { opacity: 0.45; }
.setup-size output { min-width: 5ch; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.setup-size output:empty { display: none; }
.fit-choice { min-width: 44px; min-height: 44px; padding: 6px 6px 12px; border-radius: 8px; }
.fit-choice svg { stroke-width: 1.7; }
.fit-choice[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.fit-choice:hover:not(:disabled) { background: var(--accent-soft); }
.fit-choice:disabled { opacity: 0.45; cursor: default; }

/* the sheet set again: the pages on screen stay, a shade out of date, until
   their replacement has been laid out behind them */
.sheet-frame[data-stale] > .pdf-container:not(.is-incoming) { opacity: 0.55; transition: opacity 0.2s var(--ease); }
.sheet-frame > .pdf-container.is-incoming { visibility: hidden; }

.lyrics-sheet .sheet-foot {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 12px;
  padding: 12px 32px 16px;
}
.song-draft-note { grid-column: 1 / -1; margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.song-draft-note:empty { display: none; }
.lyrics-sheet .sheet-foot > .btn-ghost { grid-column: 2; }
.lyrics-sheet .sheet-foot > .btn-primary { grid-column: 3; }
.lyrics-sheet .sheet-foot > .btn { min-height: 40px; }

@media (max-width: 720px) {
  .lyrics-layer { padding: 0; }
  .lyrics-sheet, .lyrics-sheet:has(.sheet-setup:not([hidden])) {
    width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0;
  }
  .lyrics-sheet .sheet-head { padding: calc(16px + var(--safe-t)) 20px 12px; }
  .lyrics-sheet .sheet-head h2 { font-size: 23px; }
  .song-steps { gap: 12px; padding-inline: 20px; }
  .song-steps button { gap: 6px; font-size: 13px; }
  .song-steps button > span { width: 20px; height: 20px; font-size: 13px; }
  .song-stage-heading { padding: 18px 20px 10px; }
  .song-stage-heading h3 { font-size: 20px; }
  .song-stage-heading p { font-size: 13px; }
  .lyrics-sheet .sheet-body { padding: 4px 20px 20px; }
  .lyrics-sheet .lyrics-search { gap: 8px; }
  .lyrics-sheet .lyrics-search .btn { padding-inline: 14px; }
  .song-search-intro { margin-top: 36px; }
  .lyrics-sheet .lyrics-text { padding: 14px; }
  .lyrics-sheet .chords-text { font-size: 16px; }
  .lyrics-sheet .sheet-foot { grid-template-columns: 1fr auto auto; gap: 4px 8px; padding: 10px 20px calc(12px + var(--safe-b)); }
  .song-draft-note { margin-bottom: 4px; font-size: 13px; }
  .lyrics-sheet .sheet-foot > .btn { min-height: 44px; font-size: 14px; }
  .lyrics-sheet .sheet-pages .btn, .lyrics-sheet .sheet-head .btn { min-height: 44px; min-width: 44px; }
  .lyrics-sheet .lyric-draft-bin { min-width: 44px; min-height: 44px; }
}

@media (max-width: 370px) {
  .song-steps { gap: 8px; }
  .song-steps button { flex-direction: column; align-items: flex-start; gap: 4px; }
  .lyrics-sheet .sheet-foot { grid-template-columns: 1fr 1fr; }
  .lyrics-sheet .sheet-foot > .btn-danger { grid-column: 1 / -1; min-height: 44px; }
  .lyrics-sheet .sheet-foot > .btn-primary { grid-column: 2; }
}

@media (max-height: 560px) and (min-width: 721px) {
  .lyrics-sheet, .lyrics-sheet:has(.sheet-setup:not([hidden])) { height: calc(100dvh - 20px); }
  .lyrics-sheet .sheet-head { padding-block: 10px; }
  .lyrics-sheet .sheet-sub { display: none; }
  .song-steps button { padding-block: 6px; }
  .song-stage-heading { padding-top: 10px; }
  .lyrics-sheet .sheet-foot { padding-block: 8px; }
}

/* on a phone the settings come first and the pages after them, the whole
   screen scrolling as one, since neither column has room of its own */
@media (max-width: 720px) {
  .lyrics-sheet .sheet-body:has(> .sheet-setup:not([hidden])) { overflow: auto; }
  .lyrics-sheet .sheet-setup { grid-template-columns: minmax(0, 1fr); height: auto; gap: 20px; }
  .sheet-setup-controls { margin-right: 0; padding: 2px; overflow: visible; }
  .sheet-setup-pages .sheet-view { flex: none; height: min(78dvh, 640px); }
  .setup-details { grid-template-columns: minmax(0, 1fr); }
}

.song-steps button:disabled { cursor: default; opacity: 1; }
.song-steps button:not(:disabled):hover { color: var(--accent); background: var(--accent-soft); }
.key-control { display: grid; min-width: 0; gap: 2px; }
.key-control input[type="range"] { width: 100%; min-width: 0; min-height: 28px; margin: 0; accent-color: var(--accent); }
.setup-key > .icon-choice { align-self: start; }
@media (max-width: 720px) {
  .key-control input[type="range"] { min-height: 44px; }
  .key-stepper .icon-choice { min-width: 44px; min-height: 44px; }
  .setup-key { grid-template-columns: minmax(0, 1fr) auto; }
  .setup-key > .key-control { grid-column: 1; }
  .setup-key > .icon-choice { grid-column: 2; grid-row: 1; min-width: 44px; min-height: 44px; }
}
