/* ============================================================
   Rail de partage (.share-rail)
   Desktop ≥1024 : rail vertical collant à gauche.
   < 1024 : barre basse fixe.
   ============================================================ */

.share-rail {
    position: fixed;
    z-index: 900;
}

.share-rail__list {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.share-rail__item {
    margin: 0;
}

.share-rail__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--color-border-grey, #D5E3EC);
    border-radius: 50%;
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}

.share-rail__btn:hover {
    background: var(--color-nav);
    border-color: var(--color-nav);
    color: #fff;
    transform: translateY(-2px);
    text-decoration: none;
}

.share-rail__btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Bouton de partage natif (mobile) : masqué par défaut, révélé par JS si supporté. */
.share-rail__native {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    border: none;
    border-radius: 22px;
    background: var(--color-nav);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}

.share-rail__native svg {
    width: 18px;
    height: 18px;
}

/* Tooltip « Lien copié » */
.share-rail__tooltip {
    position: absolute;
    white-space: nowrap;
    background: var(--color-text);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.share-rail__btn--copy.is-copied .share-rail__tooltip {
    opacity: 1;
}

/* ---------- Desktop : rail vertical à gauche ---------- */
@media (min-width: 1024px) {
    .share-rail {
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
    }
    .share-rail__list {
        flex-direction: column;
    }
    /* Rail à droite -> tooltip à gauche du bouton (évite le hors-écran). */
    .share-rail__tooltip {
        right: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
    }
}

/* ---------- < 1024 : barre basse fixe ---------- */
@media (max-width: 1023px) {
    .share-rail {
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        border-top: 1px solid var(--color-border-grey, #D5E3EC);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    }
    .share-rail__list {
        flex-direction: row;
        justify-content: center;
    }
    .share-rail__tooltip {
        left: 50%;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
    }

    /* Partage natif dispo : un seul bouton « Partager », on masque les icônes. */
    .share-rail--has-native .share-rail__list {
        display: none;
    }
    .share-rail--has-native .share-rail__native {
        display: flex;
        width: 100%;
    }

    /* Remonte le « retour en haut » au-dessus de la barre de partage. */
    .has-share-rail .back-to-top {
        bottom: 76px;
    }

    /* Évite que la barre masque le bas du footer. */
    body.has-share-rail {
        padding-bottom: 64px;
    }
}
