
/* =========================================================
   A Re Opeleng — Warm Blush Light Theme
   Palette: Cinnamon Wood · Burnt Peach · Powder Blush
            Lavender Blush · Dusty Rose · Smoky Rose
   ========================================================= */

/* ---------- Color palette & theme ---------- */

:root {
  --cinnamon-wood: #b26848;
  --burnt-peach: #d7846f;
  --powder-blush: #e8a597;
  --lavender-blush: #fdecea;
  --dusty-rose: #b57477;
  --smoky-rose: #81525e;

  /* Theme */
  --bg: #fffaf8;
  --surface: #fff7f5;
  --paper: #ffffff;

  --ink: #39272b;
  --muted: #765e61;
  --rule: #e8c9c5;

  --accent: var(--smoky-rose);
  --accent-ink: #ffffff;
  --gold: var(--cinnamon-wood);
  --focus: var(--cinnamon-wood);

  /* Typography — the site's four fonts. Change a name here (and in the
     Google Fonts <link> in index.html and hymn.html); nothing else needs editing. */
  --font-brand:   "Cormorant Garamond", Georgia, serif;   /* 1. A Re Opeleng wordmark + slogan */
  --font-display: "Cormorant Garamond", Georgia, serif;   /* 2. headings, hymn titles, numbers */
  --font-ui:      "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif; /* 3. buttons, labels, body */
  --font-lyrics:  "EB Garamond", Georgia, serif;          /* 4. verses + all text inside the score */

  /* Layout */
  --radius: 10px;

  --shadow:
    0 1px 2px rgba(129, 82, 94, .05),
    0 6px 24px rgba(129, 82, 94, .08);

  color-scheme: light;
}


/* ---------- Global ---------- */

* {
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* ---------- Header / footer ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  flex-wrap: wrap;
}

.brand-name {
  font: 700 1.5rem/1 var(--font-brand);
  letter-spacing: .01em;
}

.brand-slogan {
  font: italic 500 1.05rem/1 var(--font-brand);
  color: var(--cinnamon-wood);
}

.site-footer {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .9rem;
}


/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: 56px 0 40px;
}

.hero h1 {
  margin: 0;
  font: 700 clamp(2.6rem, 8vw, 4.2rem)/1 var(--font-brand);
  letter-spacing: .01em;
  color: var(--smoky-rose);
}

.slogan {
  margin: 10px 0 0;
  font: italic 500 clamp(1.3rem, 3.5vw, 1.7rem)/1.2 var(--font-brand);
  color: var(--cinnamon-wood);
}

.slogan::before,
.slogan::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin: 0 14px;
  opacity: .6;
}

.intro {
  max-width: 34em;
  margin: 22px auto 0;
  color: var(--muted);
}


/* ---------- Catalogue ---------- */

.catalogue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--smoky-rose);
  padding-bottom: 10px;
}

.catalogue-head h2 {
  margin: 0;
  font: 700 1.9rem/1 var(--font-display);
  color: var(--smoky-rose);
}

.search {
  flex: 1 1 260px;
  max-width: 360px;
}

.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}

.search input::placeholder {
  color: var(--muted);
  opacity: .75;
}

.search input:focus {
  border-color: var(--cinnamon-wood);
  outline: none;
  box-shadow: 0 0 0 3px rgba(178, 104, 72, .18);
}

#result-count {
  font-size: .9rem;
  margin: 10px 0 4px;
  color: var(--muted);
}

.hymn-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-heading {
  margin: 28px 0 0;
  padding: 0 8px 8px;
  font: 600 .78rem/1 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.book-heading:first-child {
  margin-top: 12px;
}

.hymn-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}

.hymn-row:hover {
  background: var(--lavender-blush);
}

.hymn-num {
  font: 700 1.6rem/1 var(--font-display);
  color: var(--dusty-rose);
  text-align: right;
}

.hymn-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hymn-title {
  font: 600 1.3rem/1.2 var(--font-display);
  color: var(--smoky-rose);
}

.hymn-tunes {
  font-size: .82rem;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--dusty-rose);
  color: var(--smoky-rose);
  background: rgba(232, 165, 151, .12);
}

.badge.off {
  border-color: var(--rule);
  color: var(--muted);
  opacity: .6;
  text-decoration: line-through;
  background: transparent;
}

.empty {
  padding: 24px 8px;
  color: var(--muted);
}


/* ---------- Hymn catalogue responsive ---------- */

@media (max-width: 560px) {
  .hymn-row {
    grid-template-columns: 2.6rem 1fr;
  }

  .badges {
    grid-column: 2;
    justify-content: flex-start;
  }
}


/* ---------- Hymn page ---------- */

.back {
  display: inline-block;
  margin: 24px 0 8px;
  text-decoration: none;
  font-size: .95rem;
  color: var(--cinnamon-wood);
}

.back:hover {
  color: var(--smoky-rose);
}

.hymn-header {
  padding: 8px 0 20px;
  border-bottom: 2px solid var(--smoky-rose);
  margin-bottom: 24px;
}

.hymn-ref {
  margin: 0;
  font-size: .85rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dusty-rose);
  font-weight: 600;
}

.hymn-header h1 {
  margin: 6px 0 4px;
  font: 700 clamp(2rem, 6vw, 3rem)/1.05 var(--font-display);
  color: var(--smoky-rose);
}

.hymn-header .muted {
  margin: 0;
}

.hymn-theme {
  margin: 10px 0 0;
  font: italic 600 1.25rem/1.2 var(--font-display);
  color: var(--cinnamon-wood);
}

/* Credits under the hymn title (Mafoko / Thanolo / Molodi) */
.credits {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
  margin: 14px 0 0;
  font-size: .92rem;
}

.credits dt {
  font-weight: 600;
  color: var(--muted);
}

.credits dt span {
  font-weight: 400;
  font-style: italic;
}

.credits dd {
  margin: 0;
}


/* ---------- Panels ---------- */

.panel {
  margin-bottom: 28px;
}

.panel-label {
  margin: 0 0 8px;
  font: 600 .78rem/1 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}


/* ---------- Segmented controls ---------- */

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg {
  font: 600 .95rem/1.2 var(--font-ui);
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  transition:
    background .15s ease,
    border-color .15s ease,
    color .15s ease;
}

.seg small {
  font-weight: 400;
  font-size: .76rem;
  color: var(--muted);
}

.seg:hover:not(:disabled) {
  border-color: var(--cinnamon-wood);
  background: var(--lavender-blush);
}

.seg[aria-checked="true"] {
  background: var(--smoky-rose);
  border-color: var(--smoky-rose);
  color: var(--accent-ink);
}

.seg[aria-checked="true"] small {
  color: inherit;
  opacity: .85;
}

.seg:disabled {
  cursor: not-allowed;
  opacity: .55;
}


/* ---------- Score toolbar ---------- */

.score-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--smoky-rose);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--cinnamon-wood);
  background: var(--lavender-blush);
}

.icon-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.zoom-level {
  min-width: 3.2em;
  text-align: center;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.text-btn {
  margin-left: 8px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--smoky-rose);
  transition: border-color .15s ease, background .15s ease;
}

.text-btn:hover {
  border-color: var(--cinnamon-wood);
  background: var(--lavender-blush);
}

.text-btn.primary {
  background: var(--smoky-rose);
  border-color: var(--smoky-rose);
  color: var(--accent-ink);
}

.text-btn.primary:hover {
  background: var(--dusty-rose);
  border-color: var(--dusty-rose);
}

.text-btn[hidden] {
  display: none;
}

.icon-btn svg {
  vertical-align: middle;
}


/* ---------- Sheet music / paper ---------- */

.paper {
  background: var(--paper);
  color: #1a1a1a;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 8px;
  min-height: 220px;
  overflow-x: auto;
}

.score-status {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.score-status[hidden] {
  display: none;
}


/* ---------- Extra verses under the score ---------- */

.verses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 22px 28px;
  padding: 20px 24px 12px;
  margin: 8px 8px 0;
  border-top: 1px solid var(--rule);
  font: 400 1.12rem/1.5 var(--font-lyrics);
  color: #1a1a1a;
}

.verses[hidden] {
  display: none;
}

.verse {
  display: flex;
  gap: 8px;
}

.verse-num {
  font-weight: 700;
  min-width: 1.6em;
  text-align: right;
  color: var(--smoky-rose);
}

.verse p {
  margin: 0;
}


/* ---------- Fullscreen score ---------- */

.fs-exit {
  display: none;
}

.is-fullscreen .fs-enter {
  display: none;
}

.is-fullscreen .fs-exit {
  display: inline;
}

.score-stage.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--paper);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 env(safe-area-inset-bottom);
}

.score-stage:fullscreen {
  background: var(--paper);
}

.is-fullscreen .score-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 250, 248, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  align-items: center;
}

.is-fullscreen .panel-label {
  display: none;
}

.is-fullscreen .paper {
  box-shadow: none;
  border-radius: 0;
  max-width: 1100px;
  margin: 0 auto;
}

body.fs-lock {
  overflow: hidden;
}


/* ---------- Recordings ---------- */

.recordings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.recording {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.rec-label {
  display: flex;
  flex-direction: column;
  color: var(--smoky-rose);
}

.rec-label span {
  font-size: .85rem;
  color: var(--muted);
}

.recording audio {
  width: 100%;
  accent-color: var(--smoky-rose);
}


/* ---------- Recordings responsive ---------- */

@media (max-width: 560px) {
  .recording {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}


/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .back,
  .tools,
  .segmented,
  .panel-label,
  #rec-label,
  .recordings {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #1a1a1a;
  }

  .paper {
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  .hymn-header {
    border-bottom-color: #333333;
  }
}
