/* App styles — layered on top of Pico.css */

/* ---------- Layout ---------- */
.site-header,
.site-footer { padding-block: 0.75rem; }
.site-footer { opacity: 0.6; text-align: center; }

.theme-btn {
  background: transparent;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  color: inherit;
  padding: 0.25rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 0.4rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Library / index ---------- */
.library h1 { margin-bottom: 1rem; }
.chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0.75rem 0 1.25rem;
}
.chip {
  background: transparent;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  color: inherit;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}
.chip.is-active {
  background: var(--pico-primary, #1a73e8);
  border-color: var(--pico-primary, #1a73e8);
  color: white;
}

.song-list { list-style: none; padding: 0; margin: 0; }
.song-row { border-bottom: 1px solid var(--pico-muted-border-color, #eee); }
.song-row a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 0.7rem 0.25rem;
  text-decoration: none;
  color: inherit;
}
.song-row a:hover { background: var(--pico-card-sectioning-background-color, #f7f7f7); }
.song-row-title { font-weight: 600; font-size: 1.05rem; }
.song-row-sub {
  grid-column: 1; font-size: 0.85rem; opacity: 0.85;
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.35rem 0.6rem;
}
.song-row-artist { opacity: 0.7; }
.song-row-sub .song-row-tags {
  display: inline-flex; flex-wrap: wrap; gap: 0.25rem;
  margin: 0;
}
.song-row-sub .tag-pill {
  font-size: 0.7rem;
  padding: 0.05rem 0.45rem;
}
.song-row-key {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.85;
  align-self: center;
}

/* ---------- Song page ---------- */
.song-header h1 { margin-bottom: 0.25rem; }
.song-header .artist { margin: 0 0 0.5rem; opacity: 0.75; font-size: 1.1rem; }

/* Definition-list metadata strip — no bullets, no overlap. */
.meta-strip {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem;
  font-size: 0.95rem;
}
.meta-strip > div { display: flex; align-items: baseline; gap: 0.35rem; }
.meta-strip dt {
  opacity: 0.6;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.meta-strip dd { margin: 0; font-weight: 600; }

/* Tag pills (built-in tags from .cho directives) */
.song-tags, .song-row-tags {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin: 0.25rem 0 0.5rem;
}
.tag-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--pico-card-sectioning-background-color, #eef);
  color: inherit;
  opacity: 0.85;
}
.tag-pill.personal {
  background: transparent;
  border: 1px dashed var(--pico-muted-border-color, #999);
}
.tag-pill .tag-remove {
  cursor: pointer;
  margin-left: 0.3rem;
  opacity: 0.6;
}
.tag-pill .tag-remove:hover { opacity: 1; }
.personal-tags {
  display: flex; align-items: center; gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.tag-add-btn {
  background: transparent;
  border: 1px dashed var(--pico-muted-border-color, #999);
  color: inherit;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Chord diagrams collapsible */
.chord-diagrams {
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  border-radius: 0.4rem;
  padding: 0.4rem 0.6rem;
}
.chord-diagrams > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.chord-diagrams > summary::-webkit-details-marker { display: none; }
.chord-diagrams > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4em;
  transition: transform 0.15s;
}
.chord-diagrams[open] > summary::before { transform: rotate(90deg); }
.diagram-toggle { display: inline-flex; gap: 0.25rem; }
.instr-btn {
  background: transparent;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  color: inherit;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 0.3rem;
  cursor: pointer;
}
.instr-btn.is-active {
  background: var(--pico-primary, #1a73e8);
  border-color: var(--pico-primary, #1a73e8);
  color: white;
}
.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.diagram-cell { display: flex; justify-content: center; }
.diagram svg { width: 100%; height: auto; max-width: 90px; color: inherit; }

.transport {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--pico-background-color, #fff);
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  display: flex; gap: 0.5rem; align-items: center;
  border-bottom: 1px solid var(--pico-muted-border-color, #eee);
}
.transport button {
  background: transparent; color: inherit;
  border: 1px solid var(--pico-muted-border-color, #ccc);
  border-radius: 0.4rem; padding: 0.3rem 0.7rem; cursor: pointer;
  line-height: 1.2;
}
#scroll-speed {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  min-width: 7ch;
  text-align: center;
}

.chip-count { opacity: 0.65; font-size: 0.85em; margin-left: 0.15em; }

/* ---------- ChordSheetJS HTML ---------- */
.chordsheet {
  font-size: 1.15rem;
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.chordsheet .row {
  display: flex;
  flex-wrap: wrap;
  /* Baseline alignment is the only approach that survives subpixel rounding
     differences across all mobile browsers (Chrome/Firefox/Safari and Vivaldi
     on Android, where grid-row heights of 1.2em rounded inconsistently and
     made lyrics "jump" between columns). */
  align-items: baseline;
}
/* Each column is an inline-block with a fixed-height padding-top that
   reserves space for the chord. The chord is absolutely positioned into
   that space. The lyric flows as the column's normal content, so its
   baseline participates in `align-items: baseline` on the row above. */
.chordsheet .column {
  display: inline-block;
  position: relative;
  padding-top: 1.4em;
  vertical-align: baseline;
}
.chordsheet .chord {
  position: absolute;
  top: 0;
  left: 0;
  font-weight: 700;
  color: var(--chord-color, #c0392b);
  line-height: 1.2em;
  white-space: pre;
  padding-right: 0.4em;
}
.chordsheet .lyrics {
  white-space: pre-wrap;
  line-height: 1.4em;
}
.chordsheet .paragraph { break-inside: avoid; page-break-inside: avoid; margin-bottom: 1rem; }
.chordsheet .paragraph.chorus { padding-left: 1rem; border-left: 3px solid var(--pico-primary, #1a73e8); }
.chordsheet .comment { font-style: italic; opacity: 0.75; margin: 0.5rem 0; }
.chordsheet h3, .chordsheet .section-label {
  font-family: var(--pico-font-family, system-ui);
  font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 1rem 0 0.25rem; opacity: 0.8;
}

/* Tab/fingerpicking blocks: scroll horizontally instead of wrapping.
   Wrapped tab is unreadable. The formatter emits <br> between strings;
   white-space: pre keeps spaces, overflow-x scrolls long lines. */
.chordsheet .paragraph.tab .literal {
  display: block;
  white-space: pre;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
  line-height: 1.25;
  -webkit-overflow-scrolling: touch;
}

[data-theme="dark"] .chordsheet .chord { color: #ff8a75; }

/* ---------- Layout: single column on every viewport ----------
   Auto-scroll only works smoothly with a single linear flow. Keeping
   one column also avoids the "scroll down, back up, down again"
   problem on desktop. We just cap line-length for readability. */
.chordsheet {
  max-width: 48rem;
}
.chordsheet .paragraph,
.chordsheet .row { break-inside: avoid; }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .transport { display: none !important; }
  .chordsheet { columns: 22rem 2; column-gap: 1.5rem; max-width: none; }
  body { color: black; background: white; }
  .chordsheet .chord { color: black; }
}
