/* =====================================================
   Sermon library (sermons.html). Builds on styles.css:
   same tokens, header, cards and player, plus search and filters.
   ===================================================== */

.lib-head { padding-top: 120px; padding-bottom: 8px; }
.lib-head .section-header { margin-bottom: 28px; }

/* Header: a small "live" link back to the player */
.lib-live-link {
    display: inline-flex; align-items: center; gap: .45rem;
    height: 40px; padding: 0 .85rem; border-radius: 12px;
    text-decoration: none; font-weight: 700; font-size: .92rem;
    color: var(--text); background: var(--glass); border: 1px solid var(--line);
    transition: transform .3s var(--ease-out), background .3s;
}
.lib-live-link:hover { transform: translateY(-3px); background: var(--glass-hover); }

/* Channel tabs */
.lib-tabs {
    display: flex; justify-content: center; gap: 6px; width: max-content; max-width: 100%;
    margin: 0 auto 22px; padding: 5px; border-radius: 16px;
    background: var(--glass); border: 1px solid var(--line);
}
.lib-tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .6rem 1.1rem; border: 0; border-radius: 12px; cursor: pointer;
    font: 700 .98rem var(--font-body); color: var(--text-dim); background: transparent;
    transition: background .3s, color .3s;
}
.lib-tab img { height: 20px; width: auto; }
.lib-tab:hover { color: var(--strong); }
.lib-tab[aria-selected="true"] { color: var(--ink); background: linear-gradient(135deg, var(--amber-2), var(--amber)); }
.lib-tab.youth[aria-selected="true"] { color: #f1e5df; background: linear-gradient(135deg, #641201, #984902); }

/* Search + filters panel */
.lib-tools {
    display: grid; gap: 14px; max-width: 980px; margin: 0 auto;
    padding: 16px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line);
}
.lib-tools.is-empty { display: none; }

.lib-search {
    position: relative; display: flex; align-items: center;
    border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
    transition: border-color .3s, box-shadow .3s;
}
.lib-search:focus-within { border-color: rgba(63, 224, 197, .55); box-shadow: 0 0 0 4px rgba(63, 224, 197, .12); }
.lib-search svg { position: absolute; right: 14px; width: 20px; height: 20px; color: var(--text-dim); pointer-events: none; }
.lib-search input {
    width: 100%; min-width: 0; padding: .9rem 2.9rem .9rem 2.6rem;
    border: 0; outline: 0; background: transparent;
    font: 500 1.05rem var(--font-body); color: var(--text);
}
.lib-search input::placeholder { color: var(--text-dim); opacity: .85; }
.lib-search input::-webkit-search-cancel-button { display: none; }
.lib-clear {
    position: absolute; left: 8px; width: 32px; height: 32px; border-radius: 50%;
    border: 0; cursor: pointer; font-size: 1.3rem; line-height: 1;
    color: var(--text); background: var(--glass-hover);
}

.lib-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .45rem .9rem; border-radius: 999px; cursor: pointer;
    font: 700 .92rem var(--font-body); color: var(--text);
    background: var(--glass); border: 1px solid var(--line);
    transition: background .3s, border-color .3s, color .3s;
}
.lib-chip small { font-size: .78rem; font-weight: 700; color: var(--text-dim); }
.lib-chip:hover { background: var(--glass-hover); }
.lib-chip[aria-pressed="true"] { color: var(--ink); background: var(--teal-glow); border-color: transparent; }
.lib-chip[aria-pressed="true"] small { color: var(--ink); opacity: .7; }

.lib-selects { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; gap: 10px; }
.lib-select { display: grid; gap: 4px; min-width: 0; }
.lib-select span { font-size: .8rem; font-weight: 700; color: var(--text-dim); }
.lib-select select {
    width: 100%; min-width: 0; padding: .65rem .8rem; border-radius: 12px; cursor: pointer;
    font: 500 .98rem var(--font-body); color: var(--text);
    background: var(--glass); border: 1px solid var(--line);
}
.lib-select select option { color: #0b2423; background: #fff; }

/* Results */
.lib-results { padding: 20px 0 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.lib-count { margin: 0 4px 14px; font-weight: 700; color: var(--text-dim); }
.lib-count:empty { display: none; }
.lib-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

/* Library cards: calmer than the home page (no drifting thumbnails, no pulsing rings) */
.lib-card .card-thumbnail img { animation: none; }
.lib-card .play-overlay::before { display: none; }
.lib-card .card-content { padding: .85rem 1rem 1rem; }
.lib-card .card-title { font-size: 1rem; }
.lib-speaker { margin-top: .3rem; font-size: .9rem; font-weight: 700; color: var(--amber-text); }
.lib-speaker:empty { display: none; }
.lib-card .card-date { margin-top: .15rem; font-size: .82rem; }

.lib-dur, .lib-kind {
    position: absolute; z-index: 2; bottom: 8px;
    padding: .1rem .5rem; border-radius: 8px;
    font-size: .78rem; font-weight: 700; line-height: 1.6;
}
.lib-dur { left: 8px; direction: ltr; color: #fff; background: rgba(0, 0, 0, .72); }
.lib-kind { right: 8px; color: var(--ink); background: rgba(255, 255, 255, .88); }
.lib-dur:empty, .lib-kind:empty { display: none; }

.lib-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 1rem; padding: 3rem 1rem; text-align: center; color: var(--text-dim); font-size: 1.05rem; }

.lib-more-wrap { display: flex; justify-content: center; padding: 28px 0 0; }
.lib-more-wrap [hidden], .lib-clear[hidden] { display: none; }

/* Player: title plus a link out to YouTube */
.lib-modal-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lib-yt-link { flex: none; font-size: .9rem; color: var(--amber-text); text-decoration: none; }
.lib-yt-link:hover { text-decoration: underline; }

.lib-footer { padding-top: 80px; }
.lib-footer .footer-social { justify-content: center; }
.lib-home { display: inline-block; margin-bottom: .6rem; color: var(--text-dim); text-decoration: none; font-weight: 700; }
.lib-home:hover { color: var(--strong); }

@media (max-width: 600px) {
    .lib-head { padding-top: 96px; }
    .lib-tools { padding: 12px; gap: 12px; }
    .lib-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
    .lib-chips::-webkit-scrollbar { display: none; }
    .lib-chip { flex: none; }
    /* Two compact rows: the two name lists, then year and order */
    .lib-selects { grid-template-columns: 1fr 1fr; gap: 6px; }
    .lib-select span { font-size: .74rem; }
    .lib-select select { padding: .55rem .4rem; font-size: .88rem; }
    .lib-head .section-header { margin-bottom: 20px; }
    .lib-head .section-sub { font-size: .95rem; }
    .lib-grid { gap: 14px; }
    .lib-live-link span:last-child { display: none; }
    .lib-live-link { width: 38px; height: 38px; padding: 0; justify-content: center; }
    .lib-tab { padding: .55rem .8rem; font-size: .92rem; }
}
@media (max-width: 380px) {
    .lib-grid { grid-template-columns: 1fr; }
}
