/* music-site — implements spec/DESIGN.md (gilt-stamped cloth hymnal) */

@font-face { font-family: 'Cormorant'; font-weight: 600; font-style: normal;
  font-display: swap; src: url('fonts/cormorant-600.woff2?v=766e1b19') format('woff2'); }
@font-face { font-family: 'Cormorant'; font-weight: 700; font-style: normal;
  font-display: swap; src: url('fonts/cormorant-700.woff2?v=766e1b19') format('woff2'); }
@font-face { font-family: 'Spectral'; font-weight: 400; font-style: normal;
  font-display: swap; src: url('fonts/spectral-400.woff2?v=cf8daee3') format('woff2'); }
@font-face { font-family: 'Spectral'; font-weight: 600; font-style: normal;
  font-display: swap; src: url('fonts/spectral-600.woff2?v=33faca8b') format('woff2'); }
@font-face { font-family: 'Fragment Mono'; font-weight: 400; font-style: normal;
  font-display: swap; src: url('fonts/fragmentmono.woff2?v=44c4e39b') format('woff2'); }

:root {
  --page: #f4ecd8;
  --page-edge: #ece0c4;
  --ink: #191510;
  --cloth: #223c30;
  --cloth-deep: #152619;
  --gild: #b98a34;
  --gild-bright: #d8ab52;
  --rule: #d3c4a1;
  --muted: #726b52;
  --maxw: 780px;

  --display: 'Cormorant', Georgia, 'Times New Roman', serif;
  --body: 'Spectral', Georgia, serif;
  --mono: 'Fragment Mono', ui-monospace, Menlo, monospace;
  font-size: 17px;
}

/* fonts point at the local bundle at repo root when served from /assets/ */
@font-face { font-family: 'Cormorant-a'; src: local('Cormorant'); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
a { color: var(--cloth); text-underline-offset: 2px; }

.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.72rem; color: var(--gild); margin: 0 0 6px;
}
/* Clickable category "breadcrumb" in a song's eyebrow. */
.eyebrow .cat-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--gild); }
.eyebrow .cat-link:hover { color: var(--gild-bright); border-bottom-color: var(--gild-bright); }

/* ---- header / footer cloth bands ---- */
.site-head {
  background: linear-gradient(180deg, var(--cloth), var(--cloth-deep));
  border-bottom: 3px solid var(--gild);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.4rem;
  color: var(--page); text-decoration: none; letter-spacing: 0.01em;
}
.brand b { color: var(--gild-bright); font-weight: 700; }
.nav a { font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: #d8cdae; margin-left: 20px; text-decoration: none; }
.nav a:hover { color: var(--gild-bright); }

.site-foot {
  background: linear-gradient(180deg, var(--cloth), var(--cloth-deep));
  color: #cfc6a8; margin-top: 48px; padding: 26px 0;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em;
  border-top: 3px solid var(--gild);
}
.site-foot a { color: var(--gild-bright); text-decoration: none; }

/* ---- song header ---- */
.song-head { padding: 30px 0 6px; }
#song-title { font-family: var(--display); font-weight: 700; font-size: 2.15rem;
  line-height: 1.05; margin: 0 0 8px; }
#song-meta { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }

/* ---- controls ---- */
.controls {
  position: sticky; top: 0; z-index: 5; background: var(--page);
  border-bottom: 1px solid var(--rule);
  padding: 12px 0; margin: 18px 0 4px;
  display: flex; flex-wrap: wrap; gap: 22px; align-items: center;
}
.ctl-group { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted); }
.seg { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-left: 1px solid var(--rule); }
.seg button:first-of-type { border-left: 0; }
button.btn, .seg button, .step button {
  font-family: var(--mono); font-size: 0.82rem; cursor: pointer;
  background: var(--page); color: var(--ink); padding: 7px 13px; border-radius: 0;
}
.step button { border: 1px solid var(--rule); border-radius: 6px; min-width: 34px;
  font-weight: 400; }
.seg button[aria-pressed="true"] { background: var(--cloth); color: var(--gild-bright); }
#scroll-toggle[aria-pressed="true"] { background: var(--cloth); color: var(--gild-bright); border-color: var(--cloth); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gild-bright); outline-offset: 2px; }
.pill { font-family: var(--mono); padding: 3px 12px; border-radius: 999px;
  background: var(--cloth); color: var(--gild-bright); font-size: 0.82rem; }

/* ---- chord palette (the signature plates) ---- */
.palette { display: flex; flex-wrap: wrap; gap: 14px; padding: 18px 0 8px; }
.chordcard {
  margin: 0; text-align: center; padding: 8px 8px 6px;
  background: var(--page);
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 2px rgba(185,138,52,0.18);
  border-radius: 3px;
  transition: opacity 140ms ease;
}
.palette.swapping .chordcard { opacity: 0; }
.chordcard figcaption { font-family: var(--mono); font-size: 0.8rem; color: var(--gild);
  margin-bottom: 4px; }
.diagram { display: block; margin: 0 auto; }
.diagram.fret { width: 58px; height: auto; }
.diagram.piano { width: 118px; height: auto; }
.omark { font: 400 9px 'Fragment Mono', monospace; text-anchor: middle; fill: var(--muted); }
.fretnum { font: 8px 'Fragment Mono', monospace; fill: var(--muted); }

/* ---- the sheet ---- */
.sheet { padding: 12px 0 40px; }
.sheet .section {
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--gild); margin: 26px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.sheet .section::after { content: ""; flex: 1; height: 1px; background: var(--gild); opacity: 0.4; }
.sheet .line { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 3px 0; }
.sheet .unit { display: inline-flex; flex-direction: column; }
.sheet .chord { font-family: var(--mono); color: var(--gild); font-size: 0.86rem;
  height: 1.35em; white-space: pre; letter-spacing: 0.02em; }
.sheet .lyric { font-family: var(--body); white-space: pre; font-size: 1.12rem; }
.sheet .spacer { height: 14px; width: 100%; }
.sheet .chord:not(:empty) { cursor: help; }

/* ---- chord hover popover (mini diagram, current instrument) ---- */
.chord-pop {
  position: fixed; z-index: 50; text-align: center;
  padding: 8px 10px 6px; background: var(--page); border: 1px solid var(--rule);
  border-radius: 3px; pointer-events: none;
  box-shadow: 0 4px 14px rgba(21,38,25,0.28), inset 0 0 0 2px rgba(185,138,52,0.18);
}
.chord-pop[hidden] { display: none; }
.chord-pop .cap { display: block; font-family: var(--mono); font-size: 0.8rem;
  color: var(--gild); margin-bottom: 4px; }

/* ---- ad plate ---- */
.ad-slot { min-height: 96px; border: 1px dashed var(--rule); border-radius: 4px;
  margin: 20px 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--mono); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.12em; }
#song-source { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }

/* ---- home / browse ---- */
.hero { padding: 46px 0 8px; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: 3rem;
  line-height: 1.02; margin: 6px 0 12px; }
.hero .lede { font-size: 1.18rem; color: var(--ink); max-width: 54ch; }
.hero-demo { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
  padding: 26px 0 6px; }
.hero-demo .chordcard { padding: 10px; }
.hero-demo .cap { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted); margin-top: 6px; }
.hero-demo figure { text-align: center; margin: 0; }

.search { width: 100%; font-family: var(--mono); font-size: 0.9rem; padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--page-edge);
  margin: 26px 0 16px; color: var(--ink); }
.count { font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; }
/* Section headings on browse/category pages: display serif, gold hairline under. */
.browse-h2, .browse-title { font-family: var(--display); font-weight: 700; }
.browse-h2 { font-size: 1.5rem; margin: 28px 0 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.browse-title { font-size: 2.4rem; line-height: 1.05; margin: 6px 0 10px; }
.browse .lede { font-size: 1.1rem; color: var(--ink); max-width: 60ch; margin: 0 0 18px; }

/* Category chips — cloth-bordered "spine tabs", gold count badge. */
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 0.8rem; text-decoration: none;
  color: var(--ink); background: var(--page-edge);
  border: 1px solid var(--rule); border-radius: 6px; padding: 7px 12px; }
.chip:hover { background: var(--cloth); color: var(--gild-bright);
  border-color: var(--cloth-deep); }
.chip .chipcount { font-size: 0.7rem; color: var(--gild); }
.chip:hover .chipcount { color: var(--gild-bright); }

/* Hero trust line — mono, muted, under the three-instrument demo. */
.hero-stat { font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin: 14px 0 0; }

/* Filter pills — spine-tabs that toggle the list in place (buttons, not links).
   Active pill flips to cloth green + gold, the way a chosen tab reads. */
.filter-pills { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
.pill { display: inline-flex; align-items: baseline; gap: 8px; cursor: pointer;
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink);
  background: var(--page-edge); border: 1px solid var(--rule); border-radius: 6px;
  padding: 7px 12px; transition: background 120ms, color 120ms, border-color 120ms; }
.pill:hover { border-color: var(--cloth); }
.pill:focus-visible { outline: 2px solid var(--gild-bright); outline-offset: 2px; }
.pill .pillcount { font-size: 0.7rem; color: var(--gild); }
.pill.is-active { background: var(--cloth); color: var(--gild-bright);
  border-color: var(--cloth-deep); }
.pill.is-active .pillcount { color: var(--gild-bright); }
.pill-easy { border-style: dashed; }
@media (prefers-reduced-motion: reduce) { .pill { transition: none; } }

/* Seasonal shelf — a paper well with a gold spine rule; hidden off-season. */
.season-shelf { border: 1px solid var(--rule); border-left: 3px solid var(--gild);
  background: var(--page-edge); border-radius: 4px; padding: 14px 18px 8px;
  margin: 22px 0 6px; }
.season-title { font-family: var(--display); font-weight: 700; font-size: 1.4rem;
  margin: 0 0 4px; }
.season-eyebrow { font-family: var(--mono); font-size: 0.68rem; color: var(--gild);
  text-transform: uppercase; letter-spacing: 0.14em; display: block; font-weight: 400; }
.season-songlist li:last-child { border-bottom: none; }
.season-more { font-family: var(--mono); font-size: 0.74rem; cursor: pointer;
  color: var(--cloth); background: none; border: none; padding: 8px 4px; margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.1em; }
.season-more:hover { color: var(--gild); }
.season-more:focus-visible { outline: 2px solid var(--gild-bright); outline-offset: 2px; }

/* Text path to the indexable category pages (SEO crawl + power browse). */
.browse-all { margin: 18px 0 0; }
.browse-all a { font-family: var(--mono); font-size: 0.78rem; color: var(--cloth);
  text-decoration: none; }
.browse-all a:hover { color: var(--gild); }

.songlist { list-style: none; padding: 0; margin: 8px 0 0; }
.songlist li { border-bottom: 1px solid var(--rule); }
.songlist a { display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; padding: 15px 4px; text-decoration: none; color: var(--ink); }
.songlist a:hover { background: var(--page-edge); }
.songlist .t { font-family: var(--display); font-weight: 700; font-size: 1.3rem; }
.songlist .m { font-family: var(--mono); color: var(--muted); font-size: 0.76rem;
  text-align: right; white-space: nowrap; }

/* ---- prose pages ---- */
.prose { padding: 30px 0 20px; max-width: 66ch; }
.prose h1 { font-family: var(--display); font-weight: 700; font-size: 2.3rem; margin: 0 0 4px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 1.45rem; margin: 1.7em 0 0.3em; }
.prose p, .prose li { font-size: 1.06rem; }

@media (max-width: 560px) {
  :root { font-size: 16px; }
  .hero h1 { font-size: 2.3rem; }
  #song-title { font-size: 1.8rem; }
  .controls { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .chordcard { transition: none; }
  .palette.swapping .chordcard { opacity: 1; }
}

@media print {
  .site-head, .site-foot, .controls, .ad-slot, .nav, .hero-demo { display: none !important; }
  body { background: #fff; color: #000; }
  .sheet .chord, .chordcard figcaption { color: #000; }
  .diagram circle { fill: #000 !important; }
  .diagram rect[fill="var(--accent)"], .diagram rect[fill="var(--gild)"] { fill: #000 !important; }
  .sheet { padding-top: 0; }
  .chordcard { box-shadow: none; border-color: #999; }
}
