/* =============================================
   СЧЁТЧИКИ ПРОСЛУШИВАНИЙ
   Общий: полоса над шапкой (.listen-strip) и ярлык у правого края (.listen-tab).
   В карточках каталога — после языка (.products-grid__listens / .products-slider__listens),
   в карточке книги — под названием (.product-detail__listens).
   Цифры подставляет js/listen-counter.js.
   ============================================= */

.listen-ico {
    display: block;
    flex: 0 0 auto;
    fill: currentColor;
}

.js-listens-num {
    font-variant-numeric: lining-nums tabular-nums;
}

/* ---------- Полоса над шапкой ---------- */
.listen-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 34px;
    padding: 0 16px;
    background: #005C67;
    color: #FFFFFF;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.3px;
    text-decoration: none;
    white-space: nowrap;
}

.listen-strip .listen-ico {
    width: 16px;
    height: 16px;
}

.listen-strip b {
    font-weight: 700;
}

.listen-strip__short {
    display: none;
}

.listen-strip__text {
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.3s ease;
}

.listen-strip:hover .listen-strip__text {
    text-decoration-color: currentColor;
}

.listen-strip:active .listen-strip__text {
    color: #F6881B;
}

@media (max-width: 540px) {
    .listen-strip {
        height: 30px;
        font-size: 13px;
    }

    .listen-strip__long {
        display: none;
    }

    .listen-strip__short {
        display: inline;
    }
}

/* ---------- Ярлык у правого края ---------- */
.listen-tab {
    position: fixed;
    right: 0;
    /* сразу под липкой шапкой (+24 px, на мобилке +16); точное значение ставит js/listen-counter.js */
    top: var(--listen-tab-top, 160px);
    z-index: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 74px;
    padding: 14px 9px 12px;
    box-sizing: border-box;
    border: 1px solid #005C67;
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: #005C67;
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-family: "tt-commons-pro", sans-serif;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

/* Пока скрипт не поставил ярлык под шапку — не показываем, чтобы не прыгал */
.listen-tab:not(.is-placed) {
    opacity: 0;
    visibility: hidden;
}

.listen-tab:hover {
    background: #FFFFFF;
    color: #005C67;
}

.listen-tab:active {
    border-color: #F6881B;
    background: #F6881B;
    color: #FFFFFF;
}

/* Под всплывающими карточками, меню, поиском и плеером — уезжает за край */
.listen-tab.is-hidden {
    transform: translateX(110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.listen-tab .listen-ico {
    width: 24px;
    height: 24px;
}

.listen-tab__num {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.listen-tab__word {
    font-size: 9px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Планшет и мобилка: компактная капсула «🎧 21 209» — меньше перекрывает баннер и контент */
@media (max-width: 1024px) {
    .listen-tab {
        flex-direction: row;
        gap: 6px;
        min-width: 0;
        padding: 9px 12px;
        border-radius: 20px 0 0 20px;
    }

    .listen-tab .listen-ico {
        width: 18px;
        height: 18px;
    }

    .listen-tab__num {
        font-size: 15px;
    }

    .listen-tab__word {
        display: none;
    }
}


@media print {
    .listen-strip,
    .listen-tab {
        display: none;
    }
}

/* ---------- Карточки каталога: «Аудио-книга 🔊 RU | 🎧 845» ---------- */
.products-grid__listens,
.products-slider__listens {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding-left: 12px;
    border-left: 1px solid #C3C7C3;
    color: #111;
    white-space: nowrap;
}

.products-grid__listens[hidden],
.products-slider__listens[hidden],
.product-detail__listens[hidden] {
    display: none;
}

.products-grid__listens .listen-ico,
.products-slider__listens .listen-ico {
    width: 17px;
    height: 17px;
    color: #005C67;
}

/* Когда счётчик есть: тип и язык не переносятся по словам; если строка не помещается
   (узкая карточка, несколько языков) — счётчик целиком уходит на следующую строку без черты */
.products-grid__meta:has(> .products-grid__listens:not([hidden])),
.products-slider__meta:has(> .products-slider__listens:not([hidden])) {
    flex-wrap: wrap;
    row-gap: 6px;
}

.products-grid__meta:has(> .products-grid__listens:not([hidden])) > *,
.products-slider__meta:has(> .products-slider__listens:not([hidden])) > * {
    flex-shrink: 0;
    white-space: nowrap;
}

.products-grid__listens.is-wrapped,
.products-slider__listens.is-wrapped {
    flex-basis: 100%;  /* остаётся своей строкой и без черты */
    padding-left: 0;
    border-left: 0;
}

@media (max-width: 420px) {
    .products-grid__meta:has(> .products-grid__listens:not([hidden])),
    .products-slider__meta:has(> .products-slider__listens:not([hidden])) {
        column-gap: 9px;
    }

    .products-grid__listens,
    .products-slider__listens {
        padding-left: 9px;
    }
}

/* ---------- Карточка книги ----------
   Вид выбирается в шаблоне catalog.element/my_catalog ($listensView). */

/* Штамп с числом прослушиваний на обложке («sticker»): бирюзовый круг, белая кромка, пунктирное кольцо, наклон;
   значок и число, слово «прослушиваний» — во всплывающей подсказке (ставит js/listen-counter.js).
   Всё внутри масштабируется от диаметра --d. */
.listens-seal {
    --d: 104px;
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2em;
    width: var(--d);
    height: var(--d);
    box-sizing: border-box;
    border-radius: 50%;
    background: #005C67;
    color: #FFFFFF;
    box-shadow: 0 0 0 3px #FFFFFF, 0 6px 18px rgba(0, 0, 0, 0.18);
    font-size: calc(var(--d) / 10);
    line-height: 1;
    text-align: center;
    transform: rotate(-8deg);
    transition: transform 0.4s ease;
    /* «прихлопывается», когда появляется число */
    animation: pdListensIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.listens-seal[hidden] {
    display: none;
}

.listens-seal__ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.listens-seal__ring circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1.1;
    stroke-dasharray: 2.4 2.2;
}

.listens-seal .listen-ico {
    width: 2.1em;
    height: 2.1em;
}

.listens-seal__num {
    font-family: "PT Astra Serif", serif;
    font-size: 2.9em;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

@keyframes pdListensIn {
    from {
        opacity: 0;
        transform: rotate(-40deg) scale(0.4);
    }
}

@media (hover: hover) {
    .product-gallery__main:hover .listens-seal--cover {
        transform: rotate(0deg) scale(1.05);
    }
}

/* «sticker» — компактный штамп на обложке, в левом нижнем углу (напротив скидки) */
.listens-seal--cover {
    --d: 76px;
    left: 36px;
    bottom: 34px;
}

@media (max-width: 1600px) {
    .listens-seal--cover {
        --d: 70px;
        left: 32px;
        bottom: 30px;
    }
}

@media (max-width: 1200px) {
    .listens-seal--cover {
        --d: 62px;
        left: 26px;
        bottom: 26px;
        box-shadow: 0 0 0 2px #FFFFFF, 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 1024px) {
    .listens-seal--cover {
        --d: 58px;
        left: 22px;
        bottom: 22px;
    }
}

@media (max-width: 360px) {
    .listens-seal--cover {
        --d: 52px;
        left: 18px;
        bottom: 18px;
    }

    /* обложка 260 px: рядом со скидкой места нет — штамп над ней */
    .listens-seal--cover.listens-seal--discount {
        bottom: 106px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .listens-seal {
        animation: none;
        transition: none;
    }
}

/* «row» (по умолчанию) — в строке под названием через черту после рейтинга: «★ 4,8 5 отзывов | 🎧 1 200 прослушиваний».
   Строка и черта — в reviews.css (.product-detail__stats) */
.product-detail__listens {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 16px;
    color: #5F5F5F;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 16px;
    line-height: 1;
}

.product-detail__listens .js-listens-num {
    color: #222322;
    font-weight: 600;
}

.product-detail__listens .listen-ico {
    width: 17px;
    height: 17px;
    color: #005C67;
}

/* «chip» — плашка под названием, рядом с рейтингом */
.product-detail__listens--chip {
    display: inline-flex;
    gap: 7px;
    padding: 7px 14px 7px 11px;
    border-radius: 100px;
    background: #E8F1F2;
    color: #005C67;
    white-space: nowrap;
}

.product-detail__listens--chip .js-listens-num {
    color: inherit;
    font-weight: 700;
}

/* плашка рядом с рейтингом — без разделительной черты (правило строки рейтинга в reviews.css) */
.product-detail__info-col .product-detail__stats .product-detail__rating + .product-detail__listens--chip,
.product-detail__info-col .product-detail__stats .product-detail__listens--chip.is-wrapped {
    padding-left: 11px;
    border-left: 0;
}

/* «proof» — строка под кнопками: значок в кружке + «Эту книгу слушали 1 200 раз» */
.product-detail__proof {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #222322;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.3;
}

.product-detail__proof[hidden] {
    display: none;
}

.product-detail__proof-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #005C67;
    color: #FFFFFF;
}

.product-detail__proof-icon .listen-ico {
    width: 20px;
    height: 20px;
}

.product-detail__proof b {
    color: #005C67;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 540px) {
    .product-detail__proof {
        font-size: 16px;
    }

    .product-detail__proof-icon {
        width: 38px;
        height: 38px;
    }
}

/* ---------- Компактные карточки (серия, «Вам также может понравиться», оформление заказа,
   всплывающие карточки товара и корзины): в строке с ценой, через черту — «559 ₽ | 🎧 389» ---------- */
.product-series__listens {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 5px;
    padding-left: 12px;
    border-left: 1px solid #C3C7C3;
    color: #111;
    font-family: "tt-commons-pro", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
}

.product-series__listens[hidden] {
    display: none;
}

.product-series__listens.is-wrapped {
    flex-basis: 100%;
    padding-left: 0;
    border-left: 0;
}

.product-series__listens .listen-ico {
    width: 17px;
    height: 17px;
    color: #005C67;
}

@media (max-width: 1024px) {
    .product-series__listens {
        font-size: 14px;
    }
}

/* На бирюзовом фоне всплывающих карточек — белым */
.product-sticky-card .product-series__listens,
.product-sticky-card .product-series__listens .listen-ico {
    color: #FFFFFF;
}

.product-sticky-card .product-series__listens {
    border-left-color: rgba(255, 255, 255, 0.4);
}
