/* Playlists (src/Playlists.php, templates/playlists/). Built from the design tokens (hymn_library/design/tokens.css); the buttons are the
   site's own (.mp-play, .hp-cta--play) and the "+" on a recording is drawn exactly like the other icons of a row (table.tracks a.icon). */

/* ---- covers: the first albums' art as a 2x2 mosaic, one image alone, or a typeset cover (name + the frieze) ---- */
.pl-cover { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--ts-radius-card); background: var(--ts-sand); border: 1px solid var(--ts-border); }
.pl-cover--mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--ts-umber); }
.pl-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pl-cover--typeset { background: linear-gradient(160deg, var(--ts-brown), var(--ts-umber)); color: var(--ts-gold-pale); display: flex; flex-direction: column; justify-content: space-between; padding: 12% 10% 0; }
.pl-cover-t { font-family: var(--ts-font-display); font-size: 22px; line-height: 1.15; letter-spacing: .01em; overflow-wrap: break-word; }
.pl-cover--typeset .pl-cover-f { display: block; color: var(--ts-bronze); width: 120%; flex: none; margin: 0 -10%; align-self: flex-start; }
.pl-cover--lg .pl-cover-t { font-size: 34px; }
.pl-cover--s .pl-cover-t { font-size: 14px; } .pl-cover--s .pl-cover-f { --ts-size-frieze: 32px; }

/* ---- badges ---- */
.pl-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: var(--ts-radius-pill); font-size: 12.5px; font-weight: 600; border: 1px solid var(--ts-border-control); color: var(--ts-text-muted); background: var(--ts-white); white-space: nowrap; }
.pl-badge--public { color: #3d6b3d; border-color: currentColor; }
.pl-badge--unlisted { color: var(--ts-brown); border-color: var(--ts-bronze); background: var(--ts-gold-pale); }
.pl-link { color: var(--ts-link); }
.pl-danger { color: var(--ts-cinnabar) !important; }

/* ---- the "+" in a recording row: the same icon as the row's text and download icons (table.tracks a.icon, hymn_page.css) ---- */
.pl-addwrap { position: relative; display: inline-block; }
button.pl-add { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none;
    color: var(--ts-gold); font-size: 18px; line-height: 1; text-decoration: none; cursor: pointer; }
button.pl-add::after { content: ""; position: absolute; inset: -3px; }               /* a 46 px tap target, nothing to see */
button.pl-add:hover, button.pl-add:focus-visible, button.pl-add[aria-expanded=true] { background: var(--ts-cream); color: var(--ts-brown); }
button.pl-add:focus-visible { outline: var(--ts-size-focus-ring) solid var(--ts-focus); outline-offset: 2px; }
table.tracks td.track-add { width: 46px; text-align: center; padding: 0; }
.hp-rec { grid-template-columns: 36px minmax(0, 1.2fr) minmax(0, 1fr) 56px 90px 40px; }
.hp-rec .pl-addwrap { justify-self: end; }

/* ---- the popover (on a phone a sheet from the bottom) ---- */
.pl-pop { position: absolute; z-index: 1050; top: 44px; right: -6px; width: 300px; padding: 14px 14px 12px; background: var(--ts-white); border: 1px solid var(--ts-border-control); border-radius: var(--ts-radius-md);
    box-shadow: 0 2px 8px rgba(60, 40, 10, .14); text-align: left; font-family: var(--ts-font-sans); font-size: 16px; font-weight: 400; line-height: 1.35; color: var(--ts-text); }
.pl-pop h3 { margin: 0 0 2px; font: 700 16px var(--ts-font-sans); color: var(--ts-brown); }
.pl-pop .pl-pop-what { margin: 0 0 8px; font-size: 14px; color: var(--ts-text-muted); }
.pl-pop ul { list-style: none; margin: 0 -4px; padding: 0; max-height: 210px; overflow: auto; border-top: 1px solid var(--ts-border); }
.pl-pop li label { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--ts-border); cursor: pointer; }
.pl-pop li label:hover { background: var(--ts-surface-raised); }
.pl-pop input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ts-gold); flex: none; }
.pl-pop .pl-n { margin-left: auto; font-size: 13.5px; color: var(--ts-text-muted); font-variant-numeric: tabular-nums; }
.pl-pop .pl-new { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 8px 4px; border: 0; background: none; color: var(--ts-link); font: 600 15.5px var(--ts-font-sans); cursor: pointer; text-align: left; }
.pl-pop .pl-new-form { display: flex; gap: 6px; margin-top: 8px; }
.pl-pop .pl-new-form input { flex: 1; min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid var(--ts-border-control); border-radius: var(--ts-radius-sm); font: 16px var(--ts-font-sans); }
.pl-pop .pl-new-form button { min-height: 38px; padding: 0 14px; font-size: 15px; }
.pl-pop .pl-saved { margin: 8px 0 0; font-size: 14px; color: #3d6b3d; }
.pl-pop .pl-saved--err { color: var(--ts-cinnabar); }
.pl-pop .pl-signin-p { margin: 6px 0 12px; line-height: 1.45; }
.pl-pop .pl-signin-s { margin: 10px 0 0; font-size: 14px; color: var(--ts-text-muted); }
.pl-pop .mp-play { text-decoration: none; }
.pl-pop::before { content: ""; position: absolute; top: -7px; right: 16px; width: 12px; height: 12px; background: var(--ts-white); border-left: 1px solid var(--ts-border-control); border-top: 1px solid var(--ts-border-control); transform: rotate(45deg); }
.pl-scrim { display: none; }
@media (max-width: 640px) {
    .pl-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 16px 16px 0 0; padding: 18px 18px 22px; }
    .pl-pop::before { display: none; }
    .pl-scrim { display: block; position: fixed; inset: 0; z-index: 1049; background: rgba(40, 25, 5, .38); }
    .pl-pop ul { max-height: 38vh; }
}

/* ---- the rows of a playlist page (an album page's table, with the albums named under the title) ---- */
table.tracks td.mediatitle .pl-sub { display: block; margin-top: 2px; font-family: var(--ts-font-sans); font-size: 14.5px; color: var(--ts-text-muted); }
table.tracks td.mediatitle .pl-sub a { color: inherit; text-decoration: none; }
table.tracks td.mediatitle .pl-sub a:hover { color: var(--ts-link); text-decoration: underline; }
table.tracks tr.pl-gone td.mediatitle, table.tracks tr.pl-gone td.duration { color: var(--ts-text-muted); cursor: default; font-style: italic; }
table.tracks .number.pl-off { background: var(--ts-sand); color: var(--ts-text-muted); }
.pl-pubwrap { padding-bottom: 150px; }
.pl-pub { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--ts-space-8); align-items: end; padding-bottom: var(--ts-space-5); border-bottom: 1px solid var(--ts-border); }
.pl-pub h1 { margin: 6px 0 0; font-family: var(--ts-font-display); font-weight: 400; font-size: var(--ts-display-m-size, 36px); line-height: 1.12; color: var(--ts-title); overflow-wrap: anywhere; }
.pl-kicker { font: 600 13px var(--ts-font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ts-text-muted); }
.pl-by-line { margin: 8px 0 0; font-size: 17px; color: var(--ts-text-muted); }
.pl-by-line a { color: var(--ts-link); }
.pl-desc { margin: 12px 0 0; max-width: 62ch; font-size: 17.5px; line-height: 1.55; color: var(--ts-text); white-space: pre-line; overflow-wrap: anywhere; }
.pl-facts { margin: 12px 0 0; font-size: 15.5px; color: var(--ts-text-muted); }
.pl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pl-head .pl-actions { margin: 0; }
.pl-head + .pl-toast { margin-top: 16px; }
.pl-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 20px; margin: 22px 0 0; font-size: 14.5px; color: var(--ts-text-muted); }
.pl-toast { margin: 0 0 14px; padding: 9px 14px; background: #eef6ea; border: 1px solid #b9d3b0; border-radius: var(--ts-radius-sm); color: #2f5a27; font-size: 15px; }
.pl-gone-tag { font: 600 12.5px var(--ts-font-sans); color: var(--ts-cinnabar); border: 1px solid currentColor; border-radius: var(--ts-radius-pill); padding: 0 8px; margin-left: 8px; font-style: normal; }

/* ---- cards (My playlists, Community playlists) ---- */
.pl-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; padding-bottom: var(--ts-space-4); border-bottom: 1px solid var(--ts-border); }
.pl-head h1 { margin: 0; font-family: var(--ts-font-display); font-weight: 400; font-size: var(--ts-display-m-size, 34px); color: var(--ts-title); }
.pl-head p { margin: 4px 0 0; color: var(--ts-text-muted); }
.pl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 22px 18px; margin: var(--ts-space-6) 0 0; padding: 0; list-style: none; }
.pl-card { position: relative; min-width: 0; }
.pl-card a.pl-card-a { display: block; color: inherit; text-decoration: none; }
.pl-card h2 { margin: 10px 0 0; font: 700 17.5px/1.25 var(--ts-font-sans); color: var(--ts-brown); overflow-wrap: anywhere; }
.pl-card a.pl-card-a:hover h2 { text-decoration: underline; }
.pl-card .pl-meta, .pl-card .pl-by { margin: 3px 0 0; font-size: 14.5px; color: var(--ts-text-muted); }
.pl-card .pl-badge { margin-top: 7px; }
.pl-note { margin: var(--ts-space-8) 0 0; padding: 12px 16px; background: var(--ts-surface-raised); border: 1px solid var(--ts-border); border-radius: var(--ts-radius-card); color: var(--ts-text-muted); font-size: 15.5px; }
.pl-pager { display: flex; justify-content: center; gap: 20px; margin: var(--ts-space-8) 0 0; color: var(--ts-text-muted); }
.pl-newform { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: var(--ts-space-5) 0 0; padding: 12px 16px; background: var(--ts-surface-raised); border: 1px solid var(--ts-border); border-radius: var(--ts-radius-card); }
.pl-newform label { font: 700 14.5px var(--ts-font-sans); color: var(--ts-brown); }
.pl-newform input[type=text] { flex: 1 1 240px; min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--ts-border-control); border-radius: var(--ts-radius-sm); font: 17px var(--ts-font-sans); }
.pl-what { font-size: 17px; }
.pl-checks { list-style: none; margin: 0 0 16px; padding: 0; max-width: 420px; border-top: 1px solid var(--ts-border); }
.pl-checks label { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--ts-border); }
.pl-checks .pl-n { margin-left: auto; color: var(--ts-text-muted); }
.pl-addform .pl-field { max-width: 420px; }

/* ---- the editor ---- */
.pl-edit { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--ts-space-8); margin-top: var(--ts-space-6); align-items: start; }
.pl-panel { padding: 18px; background: var(--ts-surface-raised); border: 1px solid var(--ts-border); border-radius: var(--ts-radius-card); }
.pl-panel .pl-cover { margin-bottom: 16px; }
.pl-field { margin: 0 0 16px; }
.pl-field > label, .pl-field > legend { display: block; margin: 0 0 5px; padding: 0; font: 700 14.5px var(--ts-font-sans); color: var(--ts-brown); }
.pl-field input[type=text], .pl-field textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--ts-border-control); border-radius: var(--ts-radius-sm); background: var(--ts-white); font: 17px/1.4 var(--ts-font-sans); color: var(--ts-text); }
.pl-field textarea { min-height: 150px; resize: vertical; }
.pl-field .pl-count { float: right; font-weight: 400; color: var(--ts-text-muted); }
.pl-field .pl-help { margin: 4px 0 0; font-size: 13.5px; color: var(--ts-text-muted); line-height: 1.4; }
.pl-vis { border: 0; padding: 0; margin: 0 0 12px; }
.pl-radio { display: flex; gap: 10px; padding: 9px 10px; margin: 0 0 6px; border: 1px solid var(--ts-border); border-radius: var(--ts-radius-sm); background: var(--ts-white); cursor: pointer; line-height: 1.35; }
.pl-radio input { margin-top: 3px; accent-color: var(--ts-gold); }
.pl-radio b { display: block; font-size: 15.5px; color: var(--ts-text); }
.pl-radio > span { display: block; }
.pl-radio span span { display: block; font-size: 13.5px; color: var(--ts-text-muted); }
.pl-radio.is-on { border-color: var(--ts-bronze); background: var(--ts-gold-pale); }
.pl-savebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.pl-rows-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin: 0 0 6px; }
.pl-rows-h h2 { margin: 0; font: 400 21px var(--ts-font-display); color: var(--ts-title); }
.pl-rows-h span { color: var(--ts-text-muted); font-size: 15px; }
.pl-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ts-border); }
.pl-row { display: grid; grid-template-columns: 34px 28px minmax(0, 1fr) 54px 38px; gap: 0 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--ts-border); background: var(--ts-white); }
.pl-row .pl-grip { width: 34px; height: 34px; padding: 0; border: 0; background: none; color: var(--ts-border-control); text-align: center; cursor: grab; font-size: 18px; touch-action: none; }
.pl-row:hover .pl-grip, .pl-row .pl-grip:focus-visible { color: var(--ts-brown); }
.pl-row .pl-pos { color: var(--ts-text-muted); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.pl-row .pl-t { min-width: 0; }
.pl-row .pl-t b { display: block; font: 600 17px/1.3 var(--ts-font-serif); color: var(--ts-text); overflow-wrap: anywhere; }
.pl-row .pl-t span { display: block; font-size: 14.5px; color: var(--ts-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row .pl-len { text-align: right; font-size: 14px; color: var(--ts-text-muted); font-variant-numeric: tabular-nums; }
.pl-row .pl-rm { margin: 0; }
.pl-row .pl-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--ts-text-muted); cursor: pointer; font-size: 17px; }
.pl-row .pl-x:hover, .pl-row .pl-x:focus-visible { background: var(--ts-surface-raised); color: var(--ts-cinnabar); }
.pl-row.is-drag { border: 1px solid var(--ts-bronze); position: relative; z-index: 2; background: var(--ts-gold-pale); box-shadow: 0 1px 4px rgba(60, 40, 10, .18); }
.pl-row.is-gap { box-shadow: inset 0 3px 0 var(--ts-gold); }
.pl-row.pl-gone .pl-t b { color: var(--ts-text-muted); font-style: italic; font-weight: 400; }
.pl-nojs { display: contents; }
.pl-nojs form { display: inline; margin: 0; }
.pl-nojs button { border: 0; background: none; color: var(--ts-text-muted); cursor: pointer; font-size: 14px; padding: 4px; }
.pl-empty { margin: 14px 4px; color: var(--ts-text-muted); }
.pl-addmore { margin-top: 14px; color: var(--ts-text-muted); font-size: 15px; line-height: 1.9; }

/* ---- share sheet ---- */
.pl-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(40, 25, 5, .45); display: grid; place-items: center; padding: 16px; }
.pl-overlay[hidden] { display: none; }
.pl-sheet { width: 440px; max-width: 100%; background: var(--ts-white); border-radius: var(--ts-radius-md); padding: 22px 22px 20px; border: 1px solid var(--ts-border-control); font-family: var(--ts-font-sans); }
.pl-sheet h2 { margin: 0 0 2px; font: 400 24px var(--ts-font-display); color: var(--ts-title); }
.pl-sheet .pl-sheet-s { margin: 0 0 14px; color: var(--ts-text-muted); font-size: 15px; }
.pl-sheet .pl-sheet-top { display: flex; gap: 14px; align-items: center; margin: 0 0 16px; }
.pl-sheet .pl-sheet-top .pl-cover { width: 64px; flex: none; }
.pl-sheet .pl-sheet-top b { display: block; font-size: 17px; color: var(--ts-brown); line-height: 1.25; overflow-wrap: anywhere; }
.pl-sheet .pl-sheet-top span { font-size: 14px; color: var(--ts-text-muted); }
.pl-linkbox { display: flex; gap: 8px; margin: 0 0 16px; }
.pl-linkbox input { flex: 1; min-width: 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--ts-border-control); border-radius: var(--ts-radius-sm); background: var(--ts-surface-raised); font: 15px var(--ts-font-sans); color: var(--ts-text); }
.pl-ch { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.pl-ch a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border: 1px solid var(--ts-border); border-radius: var(--ts-radius-card); color: var(--ts-brown); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.pl-ch a[hidden] { display: none; }
.pl-ch a i { font-size: 22px; }
.pl-ch a:hover { background: var(--ts-surface-raised); }
.pl-ch .pl-wa i { background: #1f9d55; color: #fff; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; text-align: center; font-size: 16px; }
.pl-sheet-close { float: right; border: 0; background: none; font-size: 22px; color: var(--ts-text-muted); cursor: pointer; margin: -6px -6px 0 0; }

/* ---- shelves on the home page ---- */
.pl-shelf { margin: var(--ts-space-10) 0 0; }
.pl-shelf > .ts-cord { margin: 0 0 18px; }
.pl-shelf-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.pl-shelf-h h2 { margin: 0; font: 400 24px var(--ts-font-display); color: var(--ts-title); }
.pl-shelf-h a { font-size: 15.5px; color: var(--ts-link); white-space: nowrap; }
.pl-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 12px 0 0; padding: 0; list-style: none; }
.pl-strip .pl-card h2 { font-size: 16.5px; }
.pl-shelf .pl-note { margin-top: 22px; }

/* ---- Arabic / right to left ---- */
[dir=rtl] .pl-pub { direction: rtl; }
[dir=rtl] .pl-sub { text-align: right; }
[dir=rtl] .pl-facts, [dir=rtl] .pl-desc, [dir=rtl] .pl-by-line { font-family: var(--ts-font-arabic); line-height: 1.8; }
[dir=rtl] .pl-pub h1 { font-family: var(--ts-font-arabic); font-weight: 600; line-height: 1.4; }

/* ---- phone ---- */
@media (max-width: 760px) {
    .pl-edit { grid-template-columns: 1fr; gap: var(--ts-space-6); }
    .pl-pub { grid-template-columns: 1fr; gap: 16px; align-items: start; }
    .pl-pub .pl-cover { width: 160px; }
    .pl-pub h1 { font-size: 30px; }
    .pl-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
    .pl-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
    .pl-row { grid-template-columns: 34px minmax(0, 1fr) 46px 34px; }
    .pl-row .pl-pos { display: none; }
    .pl-row .pl-t span { white-space: normal; }
    .pl-overlay { align-items: end; padding: 0; }
    .pl-sheet { border-radius: 16px 16px 0 0; width: 100%; }
    .pl-actions .mp-play, .pl-actions .hp-cta { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 767px) { table.tracks td.track-add { width: 42px; } }
@media (max-width: 767px) {
    .hp-rec { grid-template-columns: 36px minmax(0, 1fr) auto 40px; }
    .hp-rec .pl-addwrap { grid-column: 4; grid-row: 1; }
    .hp-rec .ra-lesson, .hp-rec-len { grid-column: 3; }
}

.pl-vis > label.pl-radio { display: flex; margin: 0 0 6px; font: inherit; color: inherit; }
.pl-row .pl-t span.pl-gone-tag { display: inline-block; overflow: visible; }

.pl-cover--s .pl-cover-t { font-size: 10px; line-height: 1.15; overflow: hidden; max-height: 3.5em; }
@media (max-width: 767px) {
    .pl-pub .pl-cover--lg .pl-cover-t { font-size: 19px; }
    .pl-sub .pl-album { display: none; }
}
