/* IWW Little Red Songbook — static site stylesheet */
/* Palette: IWW red #C8101E, black #111, parchment #FAF6EF */

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

:root {
  --red:      #C8101E;
  --red-dark: #8B0000;
  --red-wash: #E9C8BF;
  --black:    #111111;
  --ink:      #1E1E1E;
  --paper:    #FAF6EF;
  --ruled:    #E8E2D6;
  --panel:    #FFFDF8;
  --muted:    #6B6255;
  --max-w:    740px;
}

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  background:
    radial-gradient(circle at top, rgba(200,16,30,0.04), transparent 35%),
    linear-gradient(180deg, #FCF8F1 0%, var(--paper) 14rem);
  color: var(--ink);
  line-height: 1.7;
  padding: 0 1rem 4rem;
}

a { color: var(--red-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Site header ── */
.site-header {
  border-bottom: 4px solid var(--black);
  padding: 2rem 0 1.25rem;
  margin-bottom: 2rem;
  max-width: var(--max-w);
  margin-inline: auto;
}
.site-header .edition-flag {
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.35rem;
}
.site-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--black);
}
.site-header .subtitle {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ── Search ── */
.search-wrap {
  max-width: var(--max-w);
  margin: 0 auto 1.75rem;
}
#song-search {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  font-family: system-ui, sans-serif;
  border: 2px solid var(--black);
  border-radius: 3px;
  background: white;
  color: var(--ink);
  outline-offset: 3px;
}
#song-search:focus { outline: 3px solid var(--red); }

/* ── Alpha index ── */
.song-index { max-width: var(--max-w); margin-inline: auto; }

.alpha-group { margin-bottom: 2rem; }
.alpha-group[hidden] { display: none; }

.alpha-heading {
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--ruled);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}

.song-list { list-style: none; }

.song-entry {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
}
.song-entry:hover { border-bottom-color: var(--ruled); }
.song-entry[hidden] { display: none; }

.song-entry a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}
.song-entry a:hover { color: var(--red-dark); }

.song-entry .attr-hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.lang-tag {
  font-family: system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--red);
  color: white;
  padding: 0.1em 0.45em;
  border-radius: 2px;
  flex-shrink: 0;
}
.lang-tag.secondary { background: var(--muted); }

.reading-order {
  max-width: var(--max-w);
  margin: 0 auto 2.2rem;
  padding: 1rem 1.05rem;
  background: var(--panel);
  border: 1px solid var(--ruled);
  border-top: 3px solid var(--red);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.04);
}
.reading-order h2 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.reading-order-intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}
.reading-order-list {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}
.reading-order-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem 0.9rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--ruled);
}
.reading-order-item:last-child { border-bottom: 0; }
.page-chip {
  min-width: 3.6rem;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.page-chip.unresolved { color: var(--red-dark); }
.reading-order-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
}
.reading-order-copy a {
  font-weight: 700;
  color: var(--ink);
}
.reading-order-copy a:hover { color: var(--red-dark); }
.reading-order-copy .placement-note {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Song page ── */
.song-page { max-width: var(--max-w); margin-inline: auto; }

.back-link {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 1.5rem 0 1rem;
}
.back-link:hover { color: var(--red-dark); }

.song-title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.15;
  color: var(--black);
  margin-bottom: 0.65rem;
}

.song-meta {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 1.4rem;
  padding: 0.9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--ruled);
  border-top: 3px solid var(--red);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.04);
}
.song-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: baseline;
}
.song-meta-label {
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.song-meta-value {
  font-size: 0.95rem;
  color: var(--ink);
}

.editorial-note {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  background: #FFF8E6;
  border: 1px solid #E8D080;
  border-left: 4px solid #C8A000;
  border-radius: 4px;
  color: #5A4800;
}
.editorial-note-label {
  font-family: system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: inherit;
  margin-bottom: 0.4rem;
}
.editorial-note p {
  margin: 0;
  line-height: 1.65;
}

.attribution {
  border-left: 4px solid var(--red);
  padding: 0.5rem 0 0.5rem 1rem;
  margin-bottom: 1.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
}
.attribution .attr-row { display: block; }
.attribution .attr-label {
  font-style: normal;
  font-weight: 700;
  color: var(--ink);
  margin-right: 0.3em;
}

/* ── Sections (verse / chorus) ── */
.sections { margin-bottom: 2rem; }

.section {
  margin-bottom: 1.5rem;
}
.section:last-child { margin-bottom: 0; }

.section-label {
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.section.chorus .section-label { color: var(--red); }

.lyrics {
  padding-left: 1.25rem;
  border-left: 3px solid var(--ruled);
}
.section.chorus .lyrics {
  border-left-color: var(--red);
  font-weight: 600;
  background: linear-gradient(90deg, rgba(200,16,30,0.06), transparent 70%);
  padding: 0.35rem 0 0.35rem 1rem;
  border-radius: 0 4px 4px 0;
}

.lyrics p {
  margin: 0;
  line-height: 1.75;
}

/* ── Scan image ── */
.scan-ref {
  margin: 2rem 0;
  padding: 1rem;
  background: white;
  border: 1px solid var(--ruled);
  border-radius: 4px;
}
.scan-ref .scan-label {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.scan-thumbnails {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.scan-thumbnails img {
  max-height: 280px;
  width: auto;
  border: 1px solid var(--ruled);
  cursor: zoom-in;
}
.scan-thumbnails img:hover { border-color: var(--red); }

/* ── Notation stub notice ── */
.notation-notice {
  font-family: system-ui, sans-serif;
  font-size: 0.83rem;
  background: #FFF8E6;
  border: 1px solid #E8D080;
  border-left: 4px solid #C8A000;
  padding: 0.6rem 0.9rem;
  border-radius: 3px;
  margin-bottom: 1.5rem;
  color: #5A4800;
}

/* ── Song nav (prev / next) ── */
.song-nav {
  display: flex;
  justify-content: space-between;
  border-top: 2px solid var(--ruled);
  padding-top: 1.25rem;
  margin-top: 2rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  gap: 1rem;
}
.song-nav a { color: var(--muted); }
.song-nav a:hover { color: var(--red-dark); }
.song-nav .nav-next { text-align: right; }

/* ── Site footer ── */
.site-footer {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  border-top: 2px solid var(--ruled);
  padding-top: 1rem;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ── No-content notice ── */
.no-content {
  font-size: 0.92rem;
  color: var(--muted);
  padding: 1rem;
  background: #FFF7E8;
  border: 1px solid #E5D5AC;
  border-left: 4px solid #C8A000;
  border-radius: 4px;
}

/* ── Stave header strip ── */
.stave-header {
  width: calc(100% + 2rem);
  margin-left: -1rem;
  margin-bottom: 1.75rem;
  overflow: hidden;
  max-height: 110px;
  background: white;
  border-bottom: 2px solid var(--ruled);
}
.stave-header img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.55;
  display: block;
  mix-blend-mode: multiply;
}

/* ── Music viewer (Verovio) ── */
.music-viewer {
  margin: 2rem 0;
  border: 1px solid var(--ruled);
  border-radius: 4px;
  background: white;
  overflow: hidden;
}
.music-viewer-label {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 1rem 0;
}
#verovio-output {
  padding: 0.5rem 0.5rem 0.75rem;
  overflow-x: auto;
}
#verovio-output svg {
  max-width: 100%;
  height: auto;
}

/* ── Responsive ── */
@media (min-width: 600px) {
  body { padding: 0 2rem 4rem; }
  .scan-thumbnails img { max-height: 380px; }
  .stave-header { width: calc(100% + 4rem); margin-left: -2rem; }
}
