:root {
  --navy: #10233f;
  --navy-deep: #091629;
  --ink: #182231;
  --muted: #697383;
  --paper: #fbfaf7;
  --panel: #f2f0ea;
  --gold: #c49a43;
  --gold-soft: #ead8ad;
  --line: #ddd9cf;
  --lyric-size: 1.3rem;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .7rem 1rem; color: white; background: var(--navy); border-radius: .3rem; }
.skip-link:focus { top: 1rem; }

.community-header-wrap { background: linear-gradient(180deg,#f5f1fa 0,#fbfaf7 100%); border-top: 6px solid transparent; border-image: linear-gradient(90deg,#3c2861,#62458f 70%,#e9b949) 1; }
.community-header-wrap { display: none; }
.sitebar { max-width: 1180px; margin: auto; padding: 28px 24px 24px; font-family: "DM Sans",system-ui,sans-serif; }
.community-brand { display: flex; align-items: center; gap: 16px; color: #21172f; text-decoration: none; }
.community-mark { width: 54px; height: 54px; flex: 0 0 auto; border-radius: 16px; background: #3c2861; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(60,40,97,.24); }
.community-mark svg { width: 32px; height: 32px; }
.community-title { display: block; margin: 0; font-family: "Libre Franklin",sans-serif; font-size: clamp(1.3rem,3vw,2rem); font-weight: 700; letter-spacing: -.04em; }
.sitebar nav { display: flex; gap: 8px; margin-top: 20px; padding: 5px; border: 1px solid #ded9e5; border-radius: 13px; background: rgba(255,255,255,.72); }
.sitebar nav a { padding: 10px 14px; border-radius: 9px; color: #6c6574; font-size: .92rem; font-weight: 700; text-decoration: none; }
.sitebar nav a:hover { color: #3c2861; background: #f1ecf7; }
.sitebar nav a[aria-current="page"] { color: white; background: #3c2861; }

.topbar { height: 6rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 0 clamp(1.25rem, 4vw, 4rem); color: white; background: var(--navy); border-bottom: 3px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 1rem; }
.brand-mark { width: 2.6rem; height: 2.6rem; fill: none; stroke: var(--gold-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 .15rem; color: var(--gold-soft); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.hymnal-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.45rem, 2.2vw, 2rem); font-weight: 500; letter-spacing: .01em; }
.top-actions { display: flex; align-items: center; gap: .55rem; }
.icon-button, .present-button { min-height: 2.65rem; border: 1px solid rgba(255,255,255,.28); border-radius: .35rem; color: white; background: rgba(255,255,255,.07); }
.icon-button { min-width: 2.8rem; padding: 0 .65rem; font-weight: 700; }
.present-button { padding: 0 1rem; }
.icon-button:hover, .present-button:hover { background: rgba(255,255,255,.14); }
.icon-button:focus-visible, .present-button:focus-visible, .song-link:focus-visible, .song-nav button:focus-visible, .close-present:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: minmax(18rem, 25rem) minmax(0, 1fr); height: calc(100vh - 6rem); }
.library { display: flex; min-height: 0; flex-direction: column; padding: 1.5rem 1.25rem; background: var(--panel); border-right: 1px solid var(--line); }
.search-wrap { position: relative; flex: 0 0 auto; }
.search-wrap svg { position: absolute; left: .9rem; top: 50%; width: 1.2rem; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-wrap input { width: 100%; min-height: 3rem; padding: .65rem 2.6rem .65rem 2.8rem; border: 1px solid #cbc7bd; border-radius: .4rem; color: var(--ink); background: white; font-size: 1rem; }
.search-wrap input:focus { outline: 3px solid rgba(196,154,67,.27); border-color: var(--gold); }
kbd { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: #8b8b86; font-family: inherit; font-size: .75rem; }
.list-heading { display: flex; justify-content: space-between; padding: 1.45rem .4rem .65rem; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.song-list { overflow-y: auto; padding-right: .35rem; scrollbar-color: #bbb7ae transparent; }
.song-link { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: .65rem; width: 100%; padding: .85rem .75rem; border: 0; border-left: 3px solid transparent; color: inherit; background: transparent; text-align: left; }
.song-link:hover { background: rgba(255,255,255,.58); }
.song-link.active { border-left-color: var(--gold); background: white; box-shadow: 0 1px 7px rgba(16,35,63,.06); }
.list-number { color: var(--gold); font-family: Georgia, serif; font-size: 1.15rem; font-weight: 700; }
.list-title { overflow: hidden; align-self: center; font-size: .95rem; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.empty { margin: 2rem .5rem; color: var(--muted); line-height: 1.5; }

.song { overflow-y: auto; padding: clamp(2.2rem, 5vw, 5rem) clamp(1.5rem, 8vw, 8rem) 3rem; scroll-behavior: smooth; }
.song-head { display: flex; align-items: flex-start; justify-content: space-between; max-width: 54rem; margin: 0 auto; padding-bottom: 1.8rem; border-bottom: 1px solid var(--gold-soft); }
.song-number { margin: 0 0 .45rem; color: var(--gold); font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h2 { max-width: 45rem; margin: 0; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 2.7vw, 1.85rem); font-weight: 500; line-height: 1.18; }
.song-body { max-width: 54rem; margin: 2.5rem auto 0; font-family: Georgia, "Times New Roman", serif; font-size: var(--lyric-size); line-height: 1.7; }
.stanza { margin: 0 0 2rem; }
.stanza p { margin: 0; }
.stanza.chorus { margin-left: -1.25rem; padding: 1.1rem 1.25rem 1.2rem; border-left: 3px solid var(--gold); background: linear-gradient(90deg, rgba(234,216,173,.24), transparent 72%); }
.stanza-label { display: block; margin-bottom: .45rem; color: #8c6b28; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.credits { max-width: 54rem; margin: 2.8rem auto 0; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.song-nav { display: flex; justify-content: space-between; max-width: 54rem; margin: 3rem auto 0; }
.song-nav button { padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .3rem; color: var(--navy); background: transparent; }
.song-nav button:hover { border-color: var(--gold); background: white; }
.song-nav button:disabled { cursor: default; opacity: .35; }
.close-present { display: none; width: 3rem; height: 3rem; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: white; background: transparent; font-size: 1.8rem; }

body.presentation { overflow: hidden; background: var(--navy-deep); }
body.presentation .sitebar, body.presentation .topbar, body.presentation .library { display: none; }
body.presentation .shell { display: block; height: 100vh; }
body.presentation .song { height: 100vh; padding: clamp(2rem, 5vh, 4rem) clamp(2rem, 8vw, 9rem); color: #f8f5ec; background: radial-gradient(circle at top right, #19375f 0, var(--navy-deep) 48%); }
body.presentation .song-head { max-width: 70rem; border-bottom-color: rgba(234,216,173,.32); }
body.presentation h2 { max-width: 61rem; color: white; font-size: clamp(2.4rem, 5vw, 5rem); }
body.presentation .song-number { color: var(--gold-soft); }
body.presentation .song-body { max-width: 70rem; font-size: clamp(1.7rem, 3.3vw, 3.45rem); line-height: 1.45; }
body.presentation .stanza { margin-bottom: 1.5em; }
body.presentation .stanza.chorus { background: linear-gradient(90deg, rgba(196,154,67,.16), transparent 72%); }
body.presentation .stanza-label { color: var(--gold-soft); }
body.presentation .credits, body.presentation .song-nav { display: none; }
body.presentation .close-present { display: block; flex: 0 0 auto; }

@media (max-width: 760px) {
  .sitebar { padding: 26px 24px 24px; }
  .community-mark { width: 46px; height: 46px; border-radius: 14px; }
  .sitebar nav { width: 100%; overflow-x: auto; }
  .sitebar nav a { flex: 1; text-align: center; white-space: nowrap; }
  .topbar { height: auto; min-height: 5.2rem; padding: .9rem 1rem; }
  .eyebrow { display: none; }
  .brand-mark { width: 2.1rem; }
  .present-button { width: 2.8rem; padding: 0; font-size: 0; }
  .present-button span { font-size: 1rem; }
  .shell { display: block; height: auto; }
  .library { max-height: 18.5rem; padding: 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .song-list { display: flex; gap: .4rem; overflow-x: auto; overflow-y: hidden; padding: 0 0 .4rem; }
  .song-link { min-width: 12rem; grid-template-columns: 2.4rem minmax(0,1fr); border-left: 0; border-bottom: 3px solid transparent; }
  .song-link.active { border-bottom-color: var(--gold); }
  .song { min-height: 60vh; overflow: visible; padding: 2.2rem 1.35rem 3rem; }
  .song-body { font-size: var(--lyric-size); }
  .stanza.chorus { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) { .song { scroll-behavior: auto; } }

/* Keep the heading centered independently of the controls. */
.topbar{display:grid;grid-template-columns:1fr auto 1fr;gap:1rem}
.topbar .brand{grid-column:2;justify-content:center;text-align:center}
.topbar .top-actions{grid-column:3;justify-self:end}
@media(max-width:900px){.topbar{grid-template-columns:1fr;height:auto;padding:1rem}.topbar .brand,.topbar .top-actions{grid-column:1;justify-self:center}}
