/* Textus Receptus — KJV audio library */

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

.site-nav a.is-active {
    color: var(--gold);
    border-bottom: 1px solid rgba(212, 168, 75, 0.65);
    padding-bottom: 0.1rem;
}

.tr-page {
    padding: 0.65rem 0 0;
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    /* Leave room for site header + scripture/copyright bars */
    height: calc(100dvh - 4.75rem - 3.25rem);
    max-height: calc(100dvh - 4.75rem - 3.25rem);
    min-height: 16rem;
    box-sizing: border-box;
}

.tr-head {
    text-align: center;
    margin-bottom: 0.55rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    background: transparent;
}

.tr-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #d4a84b;
    font-weight: 700;
}

.tr-title {
    margin: 0 0 0.3rem;
    font-family: Cinzel, serif;
    font-size: clamp(1.35rem, 3.5vw, 1.85rem);
    font-weight: 700;
    color: #f0e8d4;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.tr-seo-lead {
    margin: 0 auto 0.85rem;
    max-width: 34rem;
    color: rgba(220, 210, 190, 0.78);
    font-size: 0.9rem;
    line-height: 1.45;
}

.tr-lead {
    margin: 0 auto 1.25rem;
    max-width: 34rem;
    color: rgba(220, 210, 190, 0.72);
    font-size: 0.98rem;
    line-height: 1.5;
}

.tr-search-wrap {
    max-width: 28rem;
    margin: 0 auto;
}

.tr-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 168, 75, 0.35);
    background: rgba(6, 4, 12, 0.72);
    color: #f0e8d4;
    font-size: 0.95rem;
    outline: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.tr-search::placeholder {
    color: rgba(200, 190, 170, 0.45);
}

.tr-search:focus {
    border-color: rgba(212, 168, 75, 0.65);
    box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.12), 0 8px 28px rgba(0, 0, 0, 0.35);
}

.tr-count {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: rgba(200, 190, 170, 0.55);
}

.tr-library {
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    flex: 1 1 auto;
    min-height: 0; /* allow flex child to scroll */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* No top padding — sticky titles sit flush at scroll top */
    padding: 0 0.45rem 1rem 0.1rem;
    scrollbar-gutter: stable;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 75, 0.16);
    background: rgba(10, 8, 18, 0.80);
    /* Clip scrolled rows so they never paint outside the panel */
    overflow-clip-margin: 0;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 168, 75, 0.55) rgba(8, 6, 14, 0.65);
}

/* WebKit / Chromium / Safari / mobile Chrome */
.tr-library::-webkit-scrollbar {
    width: 10px;
}

.tr-library::-webkit-scrollbar-track {
    background: rgba(8, 6, 14, 0.75);
    border-radius: 999px;
    margin: 4px 0;
}

.tr-library::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(232, 197, 106, 0.75), rgba(180, 130, 50, 0.7));
    border-radius: 999px;
    border: 2px solid rgba(8, 6, 14, 0.75);
}

.tr-library::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(240, 210, 130, 0.9), rgba(200, 150, 60, 0.85));
}

.tr-testament {
    margin-bottom: 2rem;
}

.tr-testament-title {
    margin: 0 0 0.85rem;
    font-family: Cinzel, serif;
    font-size: 1.15rem;
    color: #e8c56a;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(212, 168, 75, 0.28);
    padding-bottom: 0.45rem;
}

.tr-book {
    margin-bottom: 1.25rem;
}

.tr-book.is-hidden,
.tr-testament.is-hidden,
.tr-track.is-hidden {
    display: none !important;
}

.tr-book-title {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: rgba(240, 232, 212, 0.95);
    padding: 0.55rem 0.65rem 0.5rem;
    /* Full opaque bar, flush to scroll top — no gap for text to leak above */
    border-radius: 0;
    background: rgba(10, 8, 18, 0.82);
    border: none;
    border-bottom: 1px solid rgba(212, 168, 75, 0.28);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.55);
}

.tr-book-title + .tr-track-list {
    margin-top: 0.45rem;
}

.tr-track-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.tr-track {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(212, 168, 75, 0.14);
    background: rgba(6, 4, 12, 0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.tr-track.is-playing {
    border-color: rgba(212, 168, 75, 0.55);
    background: rgba(30, 18, 8, 0.52);
    box-shadow: 0 0 24px rgba(212, 168, 75, 0.12);
}

.tr-track-main {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.tr-track-title {
    color: #f0e8d4;
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tr-track-dur {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: rgba(200, 190, 170, 0.5);
    font-variant-numeric: tabular-nums;
}

.tr-track-actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.4rem;
}

.tr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tr-play {
    color: #1a1208;
    background: linear-gradient(180deg, #e8c56a, #c49a3c);
    border-color: rgba(255, 220, 140, 0.35);
}

.tr-play:hover {
    filter: brightness(1.06);
}

.tr-track.is-playing .tr-play {
    background: linear-gradient(180deg, #f0d080, #d4a84b);
}

.tr-track.is-playing .tr-play::after {
    content: none;
}

.tr-share {
    color: #e8c56a;
    background: rgba(8, 6, 14, 0.55);
    border-color: rgba(212, 168, 75, 0.4);
}

.tr-share:hover {
    background: rgba(212, 168, 75, 0.12);
}

.tr-empty {
    text-align: center;
    color: rgba(200, 190, 170, 0.65);
    margin: 2rem 0;
}

.tr-empty.is-hidden {
    display: none;
}

#trAudio {
    display: none;
}

@media (max-width: 600px) {
    .tr-page {
        padding-top: 0.45rem;
        /* Taller bottom chrome on small screens */
        height: calc(100dvh - 4.25rem - 3.5rem);
        max-height: calc(100dvh - 4.25rem - 3.5rem);
    }
    .tr-library {
        padding: 0 0.3rem 0.85rem 0.05rem;
        scrollbar-gutter: auto;
    }
    .tr-library::-webkit-scrollbar {
        width: 8px;
    }
    .tr-track {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .tr-track-actions {
        width: 100%;
    }
    .tr-btn {
        flex: 1;
        padding: 0.55rem 0.75rem;
    }
    .tr-book-title {
        top: 0;
    }
}


/* iOS / autoplay-blocked: one-tap play after Holy Scripture link */
.tr-play-prompt {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12000;
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    opacity: 0;
    transform: translateY(110%);
    transition: opacity 0.2s ease, transform 0.22s ease;
}
.tr-play-prompt.is-visible {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}
.tr-play-prompt-inner {
    position: relative;
    max-width: 28rem;
    margin: 0 auto;
    padding: 1rem 1.1rem 1.05rem;
    border-radius: 16px;
    border: 1px solid rgba(212, 168, 75, 0.45);
    background: rgba(8, 6, 14, 0.96);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    text-align: center;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.tr-play-prompt-text {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: rgba(230, 220, 200, 0.8);
    line-height: 1.35;
}
.tr-play-prompt-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #1a1208;
    background: linear-gradient(180deg, #f0d080, #d4a84b);
    box-shadow: 0 4px 18px rgba(212, 168, 75, 0.35);
    -webkit-tap-highlight-color: transparent;
}
.tr-play-prompt-btn:active {
    transform: scale(0.98);
}
.tr-play-prompt-dismiss {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 0.35rem;
    right: 0.45rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(230, 220, 200, 0.55);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}
