/* Tab text.
 *
 * A guitar tab is fixed-width ASCII art whose meaning is entirely positional:
 * `white-space: pre` and a monospace family are what keep a note over the beat
 * it belongs to. Wrapping is never acceptable, so long lines scroll sideways
 * inside their own box rather than reflowing or pushing the page wide. */
.tab-block,
.tab,
.tab-input {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  white-space: pre;
  tab-size: 4;
}

.tab-block {
  overflow-x: auto;
  margin: 0;
  padding: 0.75rem;
  background: var(--bs-tertiary-bg);
  border-radius: 0.375rem;
  line-height: 1.35;
}

.tab-input {
  overflow-x: auto;
}

/* A row of the section formset that is checked for deletion. Kept in the DOM
 * and still submitted -- the checkbox is how the deletion is recorded -- but
 * visibly out of the way. */
.section-form.is-deleted {
  opacity: 0.45;
}

/* --- Reading mode -------------------------------------------------------
 *
 * A separate layout, not a variation on the app's: this page is read from a
 * music stand at arm's length. The whole viewport is the tab except for one
 * compact bar. `dvh` rather than `vh` because mobile browsers shrink the
 * visual viewport when their own chrome appears, and `100vh` would leave the
 * last line under it. */
body.reading {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  color: #111;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.reading-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
  border-bottom: 1px solid #ddd;
  font-size: 0.85rem;
}

.reading-back {
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
}

.reading-heading {
  min-width: 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.reading-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reading-subtitle,
.reading-indicator {
  color: #666;
  white-space: nowrap;
}

.reading-indicator {
  margin-left: auto;
}

.reading-controls {
  display: flex;
  gap: 0.25rem;
}

.reading-controls button {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 0.25rem;
  padding: 0.15rem 0.5rem;
  font: inherit;
  cursor: pointer;
  /* Comfortably hittable with a finger you have just taken off the strings. */
  min-width: 2.5rem;
  min-height: 2rem;
}

#reading-sections {
  flex: 1 1 auto;
  overflow-y: auto;
  /* One section per screenful. `proximity` rather than `mandatory`: mandatory
   * fights you when a section is taller than the viewport and you are trying
   * to scroll to the middle of it. */
  scroll-snap-type: y proximity;
}

.reading-section {
  scroll-snap-align: start;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid #eee;
}

.reading-section-head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0 0.75rem 0.35rem;
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reading-warning {
  color: #8a5300;
  text-transform: none;
  letter-spacing: 0;
}

.reading .tab {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.4;
  /* Set by static/js/reading.js, which measures the longest line and picks the
   * largest size that fits. The value here is only what shows before the
   * script runs. */
  font-size: 16px;
}

@media print {
  .reading-bar,
  .reading-controls {
    display: none;
  }
  body.reading {
    height: auto;
    overflow: visible;
  }
}
