/* ==========================================================================
   Teoxane Production – lecteur audio partagé (Home + Music)
   Codes du site : #0d0e0d / #252525, bordures #4c4d4c, Montserrat, angles nets.
   ========================================================================== */

.tpp {
    --tpp-bg: rgba(13, 14, 13, .97);
    --tpp-line: #4c4d4c;
    --tpp-muted: #a7a8a7;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    font-family: 'Montserrat', sans-serif;
    color: #fff;
}
.tpp[hidden] { display: none; }
.tpp *, .tpp *::before, .tpp *::after { box-sizing: border-box; }
.tpp button { font: inherit; color: inherit; }

/* Place réservée en bas de page pour ne rien cacher sous le lecteur */
html.tpp-open body { padding-bottom: var(--tpp-space, 80px); }

/* ---------- Barre ---------- */
.tpp-bar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    padding: 10px max(16px, calc((100vw - 1220px) / 2));
    background: var(--tpp-bg);
    border-top: 1px solid var(--tpp-line);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: tppIn .35s cubic-bezier(.2, .7, .2, 1);
}
@keyframes tppIn { from { transform: translateY(100%); } to { transform: none; } }

.tpp-track {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.tpp-cover-wrap { position: relative; flex-shrink: 0; width: 56px; height: 56px; border: 1px solid var(--tpp-line); background: #1b1b1b; }
.tpp-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpp-eq {
    position: absolute;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding-bottom: 12px;
    background: rgba(0, 0, 0, .45);
}
.tpp.is-playing .tpp-eq { display: flex; }
.tpp-eq i { width: 3px; height: 30%; background: #fff; animation: tppEq 1s ease-in-out infinite; }
.tpp-eq i:nth-child(2) { animation-delay: -.35s; }
.tpp-eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes tppEq { 0%, 100% { height: 25%; } 50% { height: 70%; } }
.tpp-meta { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tpp-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpp-artist { font-size: 12px; color: var(--tpp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpp-track:hover .tpp-title { text-decoration: underline; }

.tpp-center { display: flex; align-items: center; gap: 18px; min-width: 0; }
.tpp-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tpp-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: 0;
    color: #d6d6d6;
    cursor: pointer;
    transition: color .2s, opacity .2s;
}
.tpp-icon svg { width: 20px; height: 20px; }
.tpp-icon:hover { color: #fff; }
.tpp-icon:disabled { opacity: .3; cursor: default; }
.tpp-play {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    color: #0d0e0d !important;
    border: 0;
    cursor: pointer;
    transition: transform .2s;
}
.tpp-play svg { width: 20px; height: 20px; }
.tpp-play:hover { transform: scale(1.06); }
.tpp.is-loading .tpp-play::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    animation: tppSpin .8s linear infinite;
}
@keyframes tppSpin { to { transform: rotate(360deg); } }
.tpp button:focus-visible, .tpp a:focus-visible, .tpp-wave:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.tpp-timeline { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tpp-time { width: 38px; flex-shrink: 0; font-size: 11px; color: var(--tpp-muted); font-variant-numeric: tabular-nums; }
.tpp-cur { text-align: right; }
.tpp-wave { position: relative; flex: 1; height: 40px; min-width: 60px; cursor: pointer; touch-action: none; }
.tpp-wave canvas { display: block; width: 100%; height: 100%; }
.tpp-hover-time {
    position: absolute;
    top: -22px;
    transform: translateX(-50%);
    padding: 2px 6px;
    font-size: 10px;
    background: #fff;
    color: #0d0e0d;
    pointer-events: none;
    white-space: nowrap;
}

.tpp-right { display: flex; align-items: center; gap: 4px; }
.tpp-links { display: flex; align-items: center; gap: 2px; margin-right: 6px; }
.tpp-link { display: grid; place-items: center; width: 32px; height: 32px; color: #d6d6d6; transition: color .2s; }
.tpp-link svg { width: 18px; height: 18px; }
.tpp-link:hover { color: #fff; }
.tpp-link-spotify:hover { color: #1ed760; }
.tpp-link-deezer:hover { color: #a238ff; }
.tpp-link-beatport:hover { color: #01ff95; }
.tpp-volume { display: flex; align-items: center; }
.tpp-volume input {
    -webkit-appearance: none;
    appearance: none;
    width: 84px;
    height: 4px;
    margin: 0 8px 0 2px;
    background: linear-gradient(to right, #fff 0, #fff var(--tpp-vol, 100%), #4c4d4c var(--tpp-vol, 100%), #4c4d4c 100%);
    border-radius: 2px;
    cursor: pointer;
}
.tpp-volume input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
.tpp-volume input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
.tpp.is-expanded .tpp-queue-btn { color: #fff; }

/* ---------- Fiche "en cours de lecture" ---------- */
.tpp-panel {
    position: absolute;
    right: max(16px, calc((100vw - 1220px) / 2));
    bottom: calc(100% + 8px);
    width: 380px;
    max-height: calc(100vh - var(--tpp-space, 80px) - 90px); /* reste sous l'en-tête du site */
    display: flex;
    flex-direction: column;
    background: rgba(13, 14, 13, .98);
    border: 1px solid var(--tpp-line);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
    animation: tppPanel .3s cubic-bezier(.2, .7, .2, 1);
}
.tpp-panel[hidden] { display: none; }
@keyframes tppPanel { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tpp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 16px;
    border-bottom: 1px solid var(--tpp-line);
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--tpp-muted);
}
.tpp-panel-body { overflow-y: auto; padding: 16px; }
.tpp-panel-cover { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 1px solid var(--tpp-line); background: #1b1b1b; }
.tpp-panel-info { padding: 16px 0 4px; }
.tpp-panel-kicker { margin: 0 0 6px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--tpp-muted); }
.tpp-panel-title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; color: #fff; }
.tpp-panel-artist { display: inline-block; margin-top: 4px; font-size: 15px; color: #d6d6d6; text-decoration: none; }
.tpp-panel-artist:hover { color: #fff; text-decoration: underline; }
.tpp-panel-meta { margin: 8px 0 0; font-size: 12px; color: var(--tpp-muted); }
.tpp-panel-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.tpp-panel-links .tpp-link {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    height: auto;
    padding: 9px 10px;
    border: 1px solid var(--tpp-line);
    font-size: 12px;
    text-decoration: none;
}
.tpp-panel-links .tpp-link:hover { border-color: #fff; }
.tpp-panel-nolinks { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--tpp-muted); }
.tpp-queue { margin-top: 18px; border-top: 1px solid var(--tpp-line); padding-top: 12px; }
.tpp-queue-title { margin: 0 0 8px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--tpp-muted); }
.tpp-queue-list { list-style: none; margin: 0; padding: 0; }
.tpp-queue-list button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.tpp-queue-list button:hover { background: #1f1f1f; }
.tpp-queue-list button.is-current { background: #252525; }
.tpp-queue-list img { width: 38px; height: 38px; object-fit: cover; flex-shrink: 0; border: 1px solid #333; }
.tpp-queue-list span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tpp-queue-list strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpp-queue-list small { font-size: 11px; color: var(--tpp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpp-queue-list em { font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #fff; }

.tpp-toast {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    padding: 8px 14px;
    background: #fff;
    color: #0d0e0d;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.tpp-toast[hidden] { display: none; }

/* ---------- Cartes des releases : titre en cours ---------- */
.play-button.is-current.is-playing {
    border-width: 0;
    width: 11px;
    height: 14px;
    border-left: 4px solid #fff;
    border-right: 4px solid #fff;
    box-sizing: border-box;
}
.title-play.is-current p { font-weight: 700; }
/* Le calque des titres s'affiche aussi au clavier, et reste visible sur la release en cours */
.music-overlay:focus-within,
article.is-current .music-overlay { opacity: 1; }
.play-button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
article.is-current img { border-color: #fff !important; }

/* ---------- Tablette ---------- */
@media (max-width: 1000px) {
    .tpp-links, .tpp-volume { display: none; }
    .tpp-bar { grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 16px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
    .tpp-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "track controls" "timeline timeline";
        gap: 6px 10px;
        padding: 8px 12px 6px;
    }
    .tpp-track { grid-area: track; }
    .tpp-cover-wrap { width: 44px; height: 44px; }
    .tpp-center { display: contents; }
    .tpp-controls { grid-area: controls; }
    .tpp-timeline { grid-area: timeline; gap: 8px; }
    .tpp-wave { height: 30px; }
    .tpp-time { width: 32px; font-size: 10px; }
    .tpp-prev { display: none; }
    .tpp-play { width: 40px; height: 40px; }
    .tpp-right { position: absolute; top: 6px; right: 6px; }
    .tpp-right .tpp-queue-btn { display: none; }
    .tpp-right [data-act="close"] { width: 26px; height: 26px; }
    .tpp-right [data-act="close"] svg { width: 14px; height: 14px; }
    .tpp-controls { margin-right: 22px; }
    /* Fiche plein écran */
    .tpp-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: var(--tpp-space, 90px);
        width: auto;
        max-height: none;
        border: 0;
        border-bottom: 1px solid var(--tpp-line);
    }
    .tpp-panel-cover { max-width: 360px; margin: 0 auto; }
    .tpp-hover-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tpp-bar, .tpp-panel { animation: none; }
    .tpp-eq i { animation: none; height: 50%; }
}
