/* ===========================================================
   Плавающие кнопки мессенджеров (Telegram / MAX)
   Разметку генерирует /js/messengers.js — ссылки задаются там же.
   Единицы — px: блок фиксированный и живёт вне em-сетки сайта
   (root font-size у нас меняется по брейкпоинтам).
   z-index 40 — ниже шапки (50) и оверлея мобильного меню (98/99),
   поэтому при открытом бургере пузыри прячутся сами.
   =========================================================== */

.msg-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.msg-fab__btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transform: translateY(10px);
}

.msg-fab__btn.is-shown {
    opacity: 1;
    transform: translateY(0);
}

.msg-fab__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.msg-fab__btn:focus-visible {
    outline: 2px solid #CAFB00;
    outline-offset: 3px;
}

.msg-fab__ico {
    display: block;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* --- подпись, выезжает при наведении (десктоп) --- */
.msg-fab__label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    white-space: nowrap;
    background: #17081F;
    color: #DBDBDB;
    font-family: "TildaSans Semibold", Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1;
    padding: 7px 11px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.msg-fab__btn:hover .msg-fab__label,
.msg-fab__btn:focus-visible .msg-fab__label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* --- Вариант A: фирменные цвета мессенджеров --- */
.msg-fab--brand .msg-fab__btn { background: #FFFFFF; }
.msg-fab--brand .msg-fab__ico--tg  { background-image: url("/svg/tg-fab.svg"); }
.msg-fab--brand .msg-fab__ico--max { background-image: url("/svg/max.svg"); }

/* --- Вариант B: в палитре сайта (тёмный + лайм) --- */
.msg-fab--site .msg-fab__btn {
    background: #341246;
    border: 1px solid rgba(202, 251, 0, 0.45);
}

.msg-fab--site .msg-fab__ico {
    background-color: #CAFB00;
    background-image: none;
}

.msg-fab--site .msg-fab__ico--tg {
    -webkit-mask: url("/svg/tg.svg") center / contain no-repeat;
    mask: url("/svg/tg.svg") center / contain no-repeat;
}

.msg-fab--site .msg-fab__ico--max {
    -webkit-mask: url("/svg/max.svg") center / contain no-repeat;
    mask: url("/svg/max.svg") center / contain no-repeat;
}

/* --- Статичные образцы (страница-песочница): тот же компонент, но в потоке.
       Раскладка один в один как в углу экрана, чтобы сравнивать было честно.
       padding-left — место под подпись, она позиционируется слева от кнопки. --- */
.msg-fab--inline {
    position: static;
    align-items: flex-end;
    padding-left: 170px;
}

.msg-fab--inline .msg-fab__btn {
    opacity: 1;
    transform: none;
}

.msg-fab--inline .msg-fab__label {
    opacity: 1;
    transform: translateY(-50%);
}

@media (max-width: 479px) {
    .msg-fab { right: 14px; bottom: 14px; gap: 10px; }
    .msg-fab__btn { width: 50px; height: 50px; }
    .msg-fab__ico { width: 30px; height: 30px; }
    .msg-fab__label { display: none; }
    .msg-fab--inline .msg-fab__label { display: block; font-size: 12px; padding: 6px 9px; }
}

@media print {
    .msg-fab { display: none !important; }
}
