/* Akordim. Layout: a slim site header, then the page; on a song page a sticky toolbar holds
   transpose / capo / video and a floating bar at the bottom runs the auto-scroll. */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #17202c; --muted: #5b6676; --line: #dde3ea;
  --chord: #1d5aa6; --chord-bg: #e7eef8; --accent: #1d5aa6; --accent-ink: #ffffff; --star: #d39a12; --ok: #1f7a4a; --err: #b42318;
  --f-display: "Frank Ruhl Libre", "David", "Times New Roman", serif;
  --f-body: "Heebo", "Arial Hebrew", "Segoe UI", Arial, sans-serif;
  --f-chord: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --panel: #161d27; --ink: #e8edf3; --muted: #95a1b2; --line: #263142;
    --chord: #f2b84b; --chord-bg: #2a2416; --accent: #f2b84b; --accent-ink: #1a1408; --star: #f2b84b; --ok: #5fd39a; --err: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --panel: #161d27; --ink: #e8edf3; --muted: #95a1b2; --line: #263142;
  --chord: #f2b84b; --chord-bg: #2a2416; --accent: #f2b84b; --accent-ink: #1a1408; --star: #f2b84b; --ok: #5fd39a; --err: #ff8a80;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.inner { max-width: 900px; margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* site header */
.site { background: var(--panel); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.site .inner { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-family: var(--f-display); font-size: 24px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 12px; display: block; line-height: 1; font-family: var(--f-chord); letter-spacing: .08em; }
.site nav { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.site nav a, .iconbtn { text-decoration: none; font-size: 14px; color: var(--muted); padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; }
.site nav a:hover, .iconbtn:hover { border-color: var(--line); color: var(--ink); }

main { padding-block: 16px 90px; }
h1 { font-family: var(--f-display); font-weight: 700; line-height: 1.1; text-wrap: balance; margin: 0; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 65ch; }

/* library */
.lib-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.lib-head h1 { font-size: 28px; }
.search input { width: 100%; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 5px 12px; font-size: 14px; color: var(--muted); white-space: nowrap; text-decoration: none; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { font-size: 12px; opacity: .75; margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
.count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; min-width: 0; height: 100%; }
.item:hover { border-color: var(--accent); }
.item .txt { flex: 1; min-width: 0; }
.item .t { font-weight: 700; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .a { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key { font-family: var(--f-chord); font-size: 13px; color: var(--chord); background: var(--chord-bg); border-radius: 6px; padding: 2px 7px; direction: ltr; flex: none; }
.star { color: var(--star); flex: none; font-size: 14px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* song page */
.crumbs { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.songhead { display: flex; align-items: flex-start; gap: 12px; margin-top: 8px; }
.songhead .meta { flex: 1; min-width: 0; }
.songhead h1 { font-size: clamp(26px, 6vw, 40px); }
.songhead .by { color: var(--muted); margin-top: 4px; }
.songhead .by a { color: var(--accent); text-decoration: none; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.facts b { font-family: var(--f-chord); color: var(--chord); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.fav { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 11px; font-size: 18px; line-height: 1; flex: none; color: var(--muted); }
.fav[aria-pressed="true"] { color: var(--star); border-color: var(--star); }

.toolbar { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); margin: 12px 0 10px; padding-block: 8px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ctl { display: flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.ctl .lab { font-size: 13px; color: var(--muted); padding-inline: 8px 4px; }
.ctl button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bg); font-size: 18px; line-height: 1; }
.ctl button:disabled { opacity: .35; cursor: default; }
.ctl .v { min-width: 38px; text-align: center; font-family: var(--f-chord); font-weight: 700; color: var(--chord); font-size: 14px; direction: ltr; }
.pill { height: 40px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; font-size: 14px; }
.pill[aria-expanded="true"], .pill[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.vid { margin-top: 8px; display: flex; justify-content: center; }
.vid .frame { width: min(100%, calc(30vh * 16 / 9)); aspect-ratio: 16 / 9; max-width: 100%; background: #000; border-radius: 10px; overflow: hidden; }
.vid iframe { width: 100%; height: 100%; border: 0; display: block; }
.settings { margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 10px; }
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: thin; }
.strip figure { margin: 0; flex: none; text-align: center; }
.strip figcaption, .pop h3 { font-family: var(--f-chord); font-weight: 700; color: var(--chord); font-size: 14px; direction: ltr; }
.dg { width: 66px; height: 82px; display: block; }
.dg-s, .dg-f { stroke: var(--muted); stroke-width: 1; }
.dg-nut { stroke: var(--ink); stroke-width: 3; }
.dg-d { fill: var(--ink); }
.dg-o { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.dg-x, .dg-fr, .dg-na { fill: var(--muted); font-size: 10px; font-family: var(--f-chord); }
.dg-na { font-size: 22px; }

.sheet { --fs: 19px; font-size: var(--fs); line-height: 1.25; }
.ln { display: flex; flex-wrap: wrap; align-items: flex-end; margin-bottom: .6em; }
.sg { display: inline-flex; flex-direction: column; }
.sg .cs { display: flex; gap: .55em; min-height: 1.3em; padding-inline-end: .45em; }
.sg .t { white-space: pre; min-height: 1.25em; }
.c { font-family: var(--f-chord); font-weight: 700; font-size: .8em; color: var(--chord); background: none; border: 0; padding: 0; unicode-bidi: isolate; white-space: nowrap; line-height: 1.6; }
.c:hover { text-decoration: underline; }
.chordtext { font-family: var(--f-chord); font-weight: 700; font-size: .8em; color: var(--chord); direction: ltr; unicode-bidi: isolate; white-space: pre-wrap; }
.sec { font-weight: 700; color: var(--muted); font-size: .8em; letter-spacing: .02em; margin: 1em 0 .4em; }
.blank { height: .7em; }
.songnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 14px; }
.songnav a { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 12px; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; text-decoration: none; }
.foot { color: var(--muted); font-size: 13px; margin-top: 22px; }
.foot a { color: var(--accent); }

/* chord pop-up */
.pop { position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 30px rgba(0,0,0,.18); border-radius: 16px 16px 0 0; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); text-align: center; }
.pop h3 { font-size: 26px; margin: 0 0 6px; }
.pop .dg { width: 150px; height: 186px; margin: 0 auto; }
.pop .x { position: absolute; top: 10px; inset-inline-end: 12px; border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }

/* auto-scroll bar */
.scrollbar { position: fixed; z-index: 10; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); inset-inline-start: max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px; box-shadow: 0 6px 22px rgba(0,0,0,.18); }
.scrollbar .go { height: 44px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); padding: 0 16px; font-weight: 700; font-size: 15px; }
.scrollbar .go[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.scrollbar .sp { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); font-size: 18px; }
.scrollbar .v { min-width: 30px; text-align: center; font-family: var(--f-chord); font-weight: 700; font-size: 14px; }

/* contact */
.form { display: grid; gap: 12px; max-width: 560px; margin-top: 14px; }
.form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.form input, .form textarea, .form select { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.form textarea { min-height: 140px; resize: vertical; }
.form .send { justify-self: start; height: 44px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); padding: 0 22px; font-weight: 700; }
.form .send:disabled { opacity: .6; }
.status { font-size: 14px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }

.sitefoot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding-block: 18px calc(80px + env(safe-area-inset-bottom, 0px)); }
.sitefoot .inner { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.sitefoot a { text-decoration: none; }
.sitefoot a:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .brand b { font-size: 21px; }
  .site nav a.hide-sm { display: none; }
  .ctl .lab { padding-inline: 6px 2px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .site, .toolbar, .scrollbar, .strip, .songnav, .sitefoot, .fav { display: none !important; } }
