/* Styles for the ChordPro HTML output rendered inside .song-page.
   The HTML structure emitted by the chordpro CLI is typically:

     <div class="song-page">
       <div class="title">…</div>
       <div class="verse">…</div>
       <div class="chorus">…</div>
       <table class="songline">
         <tr class="chords"><td>…</td>…</tr>
         <tr class="lyrics"><td>…</td>…</tr>
       </table>
     </div>

   Important:
   Each song line is rendered as a separate table.
   Therefore .songline must NOT use width: 100% with table-layout: fixed,
   otherwise chords and lyric fragments get spread across the whole page.
*/

.song-page {
  max-width: 900px;
  margin: 0 auto;
}

/* General song typography */

.song-page .song {
  font-size: 1.1em;
  line-height: 1.5;
  color: #222;
}

.song-page .title {
  font-size: 1.6em;
  font-weight: 600;
  margin: 0 0 1em 0;
  padding-bottom: 0.3em;
  border-bottom: 2px solid #3f51b5;
  color: #1a237e;
}

/* Sections */

.song-page .verse {
  margin: 0 0 1.2em 0;
}

.song-page .chorus {
  display: inline-block;
  margin: 0 0 1.2em 1.5em;
  padding: 0.4em 0.8em;
  border-left: 4px solid #3f51b5;
  background: #f5f5ff;
  max-width: 100%;
  box-sizing: border-box;
}

/* ChordPro line tables */

.song-page .songline {
  border-collapse: collapse;
  margin: 0;
  width: max-content;
  max-width: 100%;
  table-layout: auto;
}

/* Cells must keep exact spacing from ChordPro output */

.song-page .songline td {
  padding: 0 0.08em 0 0;
  vertical-align: bottom;
  white-space: pre;
}

/* Chords */

.song-page .songline tr.chords td {
  font-family: "Courier New", "DejaVu Sans Mono", monospace;
  font-weight: bold;
  color: #c62828;
  font-size: 1.4em;
  line-height: 1.1;
  padding-bottom: 0;
}

/* Lyrics */

.song-page .songline tr.lyrics td {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3em;
  line-height: 1.35;
  color: #222;
}

/* Small vertical spacing between rendered song lines */

.song-page .songline + .songline {
  margin-top: 0.1em;
}

/* Empty cells should not create extra padding */

.song-page .songline tr.chords td:empty,
.song-page .songline tr.lyrics td:empty {
  padding-right: 0;
}

/* Hide empty chord rows.
   This removes the vertical gap above lyric-only lines.

   Supported in current Firefox, Chrome, Edge and Safari.
*/

.song-page .songline:has(tr.chords td:only-child:empty) tr.chords {
  display: none;
}

/* If ChordPro emits indent cells, preserve them but avoid excessive width */

.song-page .songline td.indent {
  white-space: pre;
}

/* Last section should not leave a dangling bottom margin */

.song-page > .song > .verse:last-child,
.song-page > .song > .chorus:last-child,
.song-page > .verse:last-child,
.song-page > .chorus:last-child {
  margin-bottom: 0;
}

/* Song list */

.akordy-list {
  list-style: none;
  padding: 0;
  margin: 1.5em 0;
  columns: 2;
  column-gap: 2em;
}

.akordy-list li {
  padding: 0.4em 0;
  border-bottom: 1px dotted #ccc;
  break-inside: avoid;
}

.akordy-list li a {
  text-decoration: none;
  color: #1a237e;
  font-weight: 500;
}

.akordy-list li a:hover {
  text-decoration: underline;
  color: #3f51b5;
}

/* Mobile layout */

@media (max-width: 600px) {
  .song-page {
    max-width: 100%;
    margin: 0;
  }

  .song-page .song {
    font-size: 1em;
  }

  .song-page .title {
    font-size: 1.4em;
  }

  .song-page .chorus {
    display: block;
    margin-left: 0.8em;
    padding: 0.35em 0.6em;
  }

  .song-page .songline {
    max-width: 100%;
  }

  .song-page .songline tr.chords td {
    font-size: 0.85em;
  }

  .song-page .songline tr.lyrics td {
    font-size: 1em;
  }

  .akordy-list {
    columns: 1;
  }
}
