:root {
  --paper: #f7f2ea;
  --ink: #211d35;
  --spark: #d96b62;
  --translation: #615C55;
  --chord: #7F786F;
  --meta: #837e78;
  --rule: color-mix(in srgb, #837e78 22%, var(--paper));
  --mono: "Roboto Mono", ui-monospace, "Cascadia Mono", monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.index {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.index-brand {
  margin-bottom: 48px;
}

.index-brand a {
  display: block;
  width: min(100%, 22rem);
  color: var(--ink);
  text-decoration: none;
  transition: color 0.22s ease;
}

.index-brand a:hover {
  color: var(--spark);
}

.index-logo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 280px;
}

.index h1 {
  margin: 0 0 0.4rem;
  font-size: 2.15rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.index-lead {
  margin-bottom: 48px;
  color: var(--meta);
}

.index-group + .index-group {
  margin-top: 48px;
}

.index-group h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--meta);
}

.index-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -1.25rem 0.5rem;
  padding: 0.7rem 1.25rem 0.85rem;
  background: var(--paper);
}

.index-sticky h2 {
  margin-bottom: 12px;
}

.index-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
}

.index-sticky .index-filters {
  margin: 0;
}

.chip {
  appearance: none;
  margin: 0;
  padding: 0.2rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--meta) 35%, var(--paper));
  border-radius: 999px;
  background: transparent;
  color: var(--meta);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

button.chip {
  cursor: pointer;
}

button.chip:hover,
button.chip:focus-visible {
  color: var(--spark);
  border-color: color-mix(in srgb, var(--spark) 45%, var(--paper));
}

.chip[aria-pressed="true"] {
  color: var(--spark);
  border-color: color-mix(in srgb, var(--spark) 55%, var(--paper));
  background: color-mix(in srgb, var(--spark) 10%, var(--paper));
}

.index-empty {
  margin: 0.75rem 0 0;
  color: var(--meta);
  font-size: 0.95rem;
}

.index-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.index-group a {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.6rem 0;
  border-radius: 0.3rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  transition: background 0.33s ease, color 0.22s ease, padding 0.33s ease;
}

.index-group a::after {
  content: "";
  flex-shrink: 0;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.4em;
  opacity: 0;
  pointer-events: none;
  background: currentColor;
  transform: translateX(-0.2em);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2 9 6l-4.5 4' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2 9 6l-4.5 4' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.index-group a:hover,
.index-group a:focus-visible {
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  color: var(--spark);
  background: color-mix(in srgb, var(--spark) 8%, var(--paper));
}

.index-group a:hover::after,
.index-group a:focus-visible::after {
  opacity: 1;
  transform: translateX(0);
}

.sheet {
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.8rem;
}

.sheet-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--meta);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.22s ease;
}

.sheet-back-arrow {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sheet-listen,
.sheet-share {
  color: var(--meta);
  text-decoration: none;
  transition: color 0.22s ease;
}

.sheet-share {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.sheet-share:disabled {
  cursor: default;
  opacity: 0.7;
}

.sheet-back:hover,
.sheet-listen:hover,
.sheet-share:hover:not(:disabled),
.sheet-share:focus-visible {
  color: var(--spark);
}

.sheet-head h1 {
  margin: 0 0 0.75rem;
  font-size: 1.85rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  margin: 0 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.88rem;
  color: var(--meta);
}

.sheet-byline,
.sheet-source,
.sheet-facts,
.sheet-lyricist,
.sheet-dedication {
  margin: 0;
}

.sheet-byline p + p {
  margin-top: 0.33rem;
}

.sheet-key-name {
  font-weight: 600;
}

@media (min-width: 40rem) {
  .sheet-facts {
    margin-left: auto;
    text-align: right;
  }
}

.sheet-body {
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.45;
}

.stanza-break {
  height: 1.15rem;
}

.pair {
  margin: 0 0 0.15rem;
  overflow-x: auto;
}

.pair .line {
  white-space: pre;
}

.sheet.is-capturing {
  padding: 24px;
}

.sheet.is-capturing .sheet-top,
.sheet.is-capturing .is-capture-hidden,
.sheet.is-capturing-continued .sheet-meta {
  display: none;
}

.sheet.is-capturing-continued .sheet-head {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.sheet.is-capturing-continued .sheet-head h1 {
  margin-bottom: 0;
}

.sheet.is-capturing .sheet-meta {
  margin-bottom: 0;
}

.sheet.is-capturing .sheet-meta {
  margin-bottom: 0;
}

.sheet.is-capturing .sheet-body {
  padding-top: 1rem;
}

/* Stronger ink so JPEG / chat recompression keeps diacritics. */
.sheet.is-capturing .chords,
.sheet.is-capturing .line--leader,
.sheet.is-capturing .line--translation {
  color: #5c564e;
}

.chords {
  position: relative;
  height: 1.3em;
  color: var(--chord);
  font-weight: 500;
}

.chord {
  position: absolute;
  left: calc(var(--col) * 1ch);
  top: 0;
}

.line {
  margin: 0 0 0.15rem;
  font-weight: 400;
  white-space: pre-wrap;
}

.line--refrain {
  font-weight: 500;
}

.line--leader {
  color: var(--chord);
}

.line--translation {
  font-family: var(--mono);
  font-weight: 400;
  font-style: italic;
  color: var(--translation);
  margin: 0 0 0.75rem;
  white-space: normal;
}

.pair + .line--translation,
.line--lyric + .line--translation,
.line--refrain + .line--translation,
.line--leader + .line--translation {
  margin-top: 0.33rem;
}

.line--instruction {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--meta);
  margin: 0.33rem 0;
  white-space: normal;
}

.verse-no {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--meta);
  margin-left: 0.6em;
  white-space: nowrap;
}

.line--note {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  margin: 1.5rem 0 0.5rem;
  white-space: normal;
  line-height: 1.5;
}

.line--footnote {
  font-family: var(--sans);
  color: var(--meta);
  white-space: normal;
}

@media print {
  html,
  body {
    background: #fff;
  }

  .sheet-top {
    display: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .sheet {
    max-width: none;
    padding: 0;
  }
}
