/* Colours of our own that differ by theme. Bootstrap's variables follow
   the theme by themselves; these are the ones it has no name for. The
   light values are those of the printed sheet (theme "modern"). */
:root {
  --sf-chord: #0f6e84;
  --sf-direction: #c0392b;
  --sf-directive: #6f42c1;
  --sf-meta: #0a58ca;
  --sf-note: #8a5a00;
  --sf-quiet: #6c757d;
  --sf-melody-bar: #d39e00;
}
[data-bs-theme="dark"] {
  --sf-chord: #5cc8de;
  --sf-direction: #ff8a7a;
  --sf-directive: #b99cf0;
  --sf-meta: #7fb2ff;
  --sf-note: #e0b45c;
  --sf-quiet: #9aa2ab;
  --sf-melody-bar: #b88a00;
}

/* A drawn symbol (the <symbol>s at the top of base.html): takes the
   colour of the text, sized with it. */
.icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The menu shows the symbol of the chosen theme only. theme.js names the
   choice on <html> before the first paint, so nothing flickers. */
[data-theme-icon] {
  display: none;
}
[data-theme-choice="light"] [data-theme-icon="light"],
[data-theme-choice="dark"] [data-theme-icon="dark"],
[data-theme-choice="auto"] [data-theme-icon="auto"] {
  display: inline;
}

/* The help pages come from Markdown, so their tables carry no Bootstrap classes. */
.help-content table {
  margin-bottom: 1rem;
  border-collapse: collapse;
}
.help-content th,
.help-content td {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  vertical-align: top;
}

/* The ChordPro text of a song: one width per character, so that chords
   written above each other line up while typing. */
.song-source,
.song-source-view {
  font-family: var(--bs-font-monospace);
  font-size: 0.875rem;
  line-height: 1.45;
  tab-size: 4;
}
.song-source-view {
  white-space: pre-wrap;
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--bs-tertiary-bg);
}

/* The preview shows the pages of the PDF as images. */
.preview-page {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}
/* While a preview is on its way, the old one fades. */
#preview.htmx-request {
  opacity: 0.45;
  transition: opacity 0.2s;
}
/* Messages of the ChordPro tool keep their line breaks. */
.tool-messages {
  margin: 0;
  font-size: 0.8125rem;
  white-space: pre-wrap;
}

/* --- The editor ------------------------------------------------------------
   Text and preview fill the window down to a bar with the buttons, which
   stays at the lower edge so that nobody has to look for "Speichern". */
.editor-head {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}
.editor-head a {
  font-weight: 400;
}
.editor-page .navbar {
  margin-bottom: 0.75rem !important;
}
.editor-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}
/* One under the other on a narrow screen: the page scrolls as usual. */
.editor-pane + .editor-pane {
  margin-top: 1rem;
}

/* Side by side: the page is exactly as high as the window and does not
   scroll; the text field and the preview scroll on their own. */
@media (min-width: 768px) {
  .editor-page {
    display: flex;
    flex-direction: column;
    height: 100vh; /* for browsers without dvh */
    height: 100dvh;
  }
  .editor-page main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 0 !important;
  }
  .editor {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .editor-panes {
    flex: 1;
    /* Smaller than this (a low window with a long message above) and the
       page scrolls after all, instead of squeezing the text away. */
    min-height: 14rem;
  }
  .editor-pane {
    height: 100%;
  }
  .editor-pane + .editor-pane {
    margin-top: 0;
  }
  .editor-pane .song-source {
    height: 100%;
    /* The size follows the window; a handle to drag would fight with that. */
    resize: none;
  }
  .editor-pane .song-editor {
    height: 100%;
  }
  .editor-preview {
    height: 100%;
    overflow-y: auto;
  }
}

/* --- Colours of ChordPro in the editor --------------------------------------
   One class per kind of element (songs/static/songs/editor.js). Chords and
   directions for the band have the colours they have on the sheet; in the
   dark theme, lighter shades of the same. */
.cp-chord {
  color: var(--sf-chord);
  font-weight: 700;
}
.cp-annotation {
  color: var(--sf-direction);
  font-style: italic;
}
/* {name: ...}: braces and name. */
.cp-directive {
  color: var(--sf-directive);
}
/* {start_of_...} and {end_of_...}: where a section begins and ends. */
.cp-sectionmark {
  color: var(--sf-directive);
  font-weight: 700;
}
/* The heading of a section. */
.cp-section {
  color: var(--bs-body-color);
  font-weight: 700;
}
/* Title, key, capo: what describes the song. */
.cp-meta {
  color: var(--sf-meta);
  font-weight: 600;
}
/* {comment: ...}: a note for the band, printed on the sheet. */
.cp-note {
  color: var(--sf-note);
  font-style: italic;
}
.cp-argument {
  color: var(--bs-secondary-color);
}
/* "# ...": a note in the text, not printed. */
.cp-comment {
  color: var(--sf-quiet);
  font-style: italic;
}
/* "# chords:" and "# CHECK:" of the drafts: work that is still to do. */
.cp-todo {
  color: var(--bs-warning-text-emphasis);
  background: var(--bs-warning-bg-subtle);
}
.cp-markup {
  color: var(--sf-quiet);
}
/* A bracket or brace that is never closed. */
.cp-invalid {
  color: var(--bs-danger-text-emphasis);
  text-decoration: underline wavy var(--bs-danger);
}
.cp-abcfield {
  color: var(--sf-directive);
}
.cp-abc,
.cp-tab {
  color: var(--bs-body-color);
}
.cp-bar {
  color: var(--sf-quiet);
}

/* The lines of a section: a bar at the left and a light tint, so that the
   build of the song shows at a glance. The chorus has the bar it has on
   the sheet. The tints are see-through, so they work on both themes. */
.cm-line.cp-in-verse,
.cm-line.cp-in-other {
  box-shadow: inset 3px 0 0 var(--bs-border-color);
}
.cm-line.cp-in-chorus {
  background: rgba(15, 110, 132, 0.12);
  box-shadow: inset 3px 0 0 var(--sf-chord);
}
.cm-line.cp-in-bridge {
  background: rgba(111, 66, 193, 0.1);
  box-shadow: inset 3px 0 0 var(--sf-directive);
}
.cm-line.cp-in-abc {
  background: rgba(255, 193, 7, 0.1);
  box-shadow: inset 3px 0 0 var(--sf-melody-bar);
}
.cm-line.cp-in-tab,
.cm-line.cp-in-grid {
  background: var(--bs-tertiary-bg);
  box-shadow: inset 3px 0 0 var(--sf-quiet);
}

/* --- Setlists --------------------------------------------------------------- */
/* The handle to drag a song by; the rest of the row stays clickable. */
.setlist-handle {
  color: var(--bs-secondary-color);
  cursor: grab;
  user-select: none;
  /* A finger needs more to hold on to than a mouse. */
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.25rem -0.25rem -0.5rem;
  touch-action: none;
}
.setlist-number {
  min-width: 2rem;
  color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* The place where a dragged song would land. */
.setlist-ghost {
  opacity: 0.4;
  background: var(--bs-tertiary-bg);
}
/* A song that is in the trash: still in the setlist, but not printed. */
.setlist-in-trash a {
  color: var(--bs-secondary-color);
  text-decoration: line-through;
}
.setlist-note {
  padding-left: 0.75rem;
  border-left: 3px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
}
/* The songs to add: a box that scrolls on its own. setlist.js sets its
   height so that it ends at the lower edge of the window; it is never
   lower than this, so with a long setlist or a small screen it goes on
   below the edge and the page scrolls. The height is for no JavaScript. */
.setlist-songs {
  height: 22rem;
  min-height: 18rem;
  overflow-y: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
}
.setlist-songs .list-group-item {
  border-right: 0;
  border-left: 0;
}
/* The page of a setlist: little room below, so the box of songs can end
   close to the edge of the window. */
.setlist-page main {
  padding-bottom: 1rem !important;
}
.setlist-saved {
  color: var(--bs-success);
  white-space: nowrap;
}
/* A song that is in the setlist already: still to be added, but quieter. */
.setlist-song-in {
  color: var(--bs-secondary-color);
}
#pdf-status.htmx-request {
  opacity: 0.45;
  transition: opacity 0.2s;
}
