/* ============================================================
   MP3 Player — bouton « écouter l'extrait »
   Utilise les tokens du site (variables.css) :
   --color-accent: #F80610 · --color-bg: #070707 · --color-text: #f4f4f4
   ============================================================ */

.mp3-player {
    display: inline-block;
    margin-top: 1.25rem;
}

.mp3-btn {
    --mp3-accent: var(--color-accent, #F80610);
    --mp3-accent-rgb: var(--color-accent-rgb, 248, 6, 16);

    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 3rem;
    padding: 0 1.6rem 0 0.9rem;
    border: 1px solid rgba(var(--mp3-accent-rgb), 0.55);
    border-radius: 100px;
    background: rgba(var(--mp3-accent-rgb), 0.08);
    color: var(--color-text, #f4f4f4);
    font-family: var(--font-primary, sans-serif);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition:
        background 0.35s ease,
        border-color 0.35s ease,
        color 0.35s ease,
        box-shadow 0.35s ease,
        transform 0.35s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Halo doux pendant la lecture */
.mp3-btn:focus-visible {
    outline: 2px solid var(--mp3-accent);
    outline-offset: 3px;
}

.mp3-btn:hover {
    transform: translateY(-2px);
    border-color: var(--mp3-accent);
    background: rgba(var(--mp3-accent-rgb), 0.16);
    box-shadow: 0 10px 30px rgba(var(--mp3-accent-rgb), 0.25);
}

/* Icône play / pause */
.mp3-btn-icon {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--mp3-accent);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(var(--mp3-accent-rgb), 0.45);
    transition: background 0.35s ease, transform 0.35s ease;
}

.mp3-btn-icon svg {
    width: 0.95rem;
    height: 0.95rem;
    display: block;
}

/* Play visible par défaut, pause masqué */
.mp3-btn .mp3-icon-pause { display: none; }
.mp3-btn.is-playing .mp3-icon-pause { display: block; }
.mp3-btn.is-playing .mp3-icon-play { display: none; }

.mp3-btn.is-playing {
    border-color: var(--mp3-accent);
    background: rgba(var(--mp3-accent-rgb), 0.14);
}

/* Ondulation de l'icône pendant la lecture */
.mp3-btn.is-playing .mp3-btn-icon {
    animation: mp3-pulse 1.8s ease-in-out infinite;
}

@keyframes mp3-pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(var(--mp3-accent-rgb), 0.45), 0 0 0 0 rgba(var(--mp3-accent-rgb), 0.45); }
    50%      { box-shadow: 0 4px 14px rgba(var(--mp3-accent-rgb), 0.45), 0 0 0 9px rgba(var(--mp3-accent-rgb), 0); }
}

/* Barre de progression fine au bas du bouton */
.mp3-btn-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 0%;
    background: var(--mp3-accent);
    border-radius: 2px;
    transition: width 0.2s linear;
    pointer-events: none;
}

/* Petit égaliseur animé devant le libellé pendant la lecture */
.mp3-btn-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 0.8rem;
    flex: 0 0 auto;
}

.mp3-btn.is-playing .mp3-btn-eq { display: inline-flex; }

.mp3-btn-eq span {
    width: 2px;
    border-radius: 1px;
    background: var(--mp3-accent);
    animation: mp3-eq 0.9s ease-in-out infinite;
}

.mp3-btn-eq span:nth-child(1) { height: 40%; animation-delay: 0s; }
.mp3-btn-eq span:nth-child(2) { height: 100%; animation-delay: 0.25s; }
.mp3-btn-eq span:nth-child(3) { height: 60%; animation-delay: 0.5s; }

@keyframes mp3-eq {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1); }
}

/* Mobile */
@media (max-width: 640px) {
    .mp3-btn {
        min-height: 2.75rem;
        padding: 0 1.25rem 0 0.75rem;
        font-size: 0.68rem;
        letter-spacing: 0.1em;
    }

    .mp3-btn-icon {
        width: 1.9rem;
        height: 1.9rem;
    }
}

/* Accessibilité : pas d'animation si l'utilisateur la refuse */
@media (prefers-reduced-motion: reduce) {
    .mp3-btn,
    .mp3-btn-icon,
    .mp3-btn-eq span,
    .mp3-btn-progress {
        animation: none !important;
        transition: none !important;
    }
}
