/* Last updated: 2026-11-11 */
/* Лента сторис. Подключается только когда секция есть на странице. */

.stories {
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.stories.is-overflowing::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, var(--color-bg));
    pointer-events: none;
    z-index: 1;
}

.stories__list {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.stories__list::-webkit-scrollbar {
    display: none;
}

.stories__list > li {
    display: flex;
    flex: none;
}

.stories__item {
    position: relative;
    flex: none;
    width: 104px;
    height: 104px;
    padding: 0;
    border: 3px solid var(--color-accent);
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: #fff;
}

.stories__item.is-seen {
    border-color: var(--color-text-tertiary);
}

.stories__item:focus-visible,
.stories__next:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: -6px;
}

.stories__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stories__title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 6px 6px;
    background: linear-gradient(to top, rgba(44, 45, 46, 0.85), rgba(44, 45, 46, 0));
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    line-height: 15px;
    text-align: left;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    pointer-events: none;
}

.stories__next {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 16, 61, 0.16);
    cursor: pointer;
    z-index: 2;
}

@media (min-width: 768px) {
    .stories__list {
        gap: 12px;
    }

    .stories__item {
        width: 150px;
        height: 150px;
        border-radius: 14px;
    }

    .stories__title {
        padding: 20px 8px 8px;
        font-size: 14px;
        line-height: 18px;
    }
}

@media (min-width: 1280px) {
    .stories__list {
        max-width: calc(100% - 60px);
    }

    .stories__item {
        width: 180px;
        height: 180px;
    }

    .stories__next {
        display: inline-flex;
        position: static;
        flex: none;
        transform: none;
    }

    .stories.is-overflowing::after {
        right: 60px;
    }
}

/* Просмотрщик. Подключается вместе с лентой. */

.stories-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.stories-viewer-open {
    overflow: hidden;
}

body.stories-viewer-open #cookieBanner,
body.stories-viewer-open jdiv,
body.stories-viewer-open #jivo-iframe-container,
body.stories-viewer-open #jivo_chat_widget {
    display: none !important;
}

.story-viewer {
    padding: 0;
    border: 0;
    background: transparent;
    max-width: none;
    max-height: none;
}

.story-viewer[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: visible;
}

.story-viewer::backdrop {
    background: rgba(44, 45, 46, 0.9);
}

.story-viewer__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--color-text, #2C2D2E);
    cursor: pointer;
    flex: none;
}

.story-viewer__icon-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    flex: none;
}

.story-viewer__vote {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    flex: none;
}

.story-viewer__sound {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: rgba(44, 45, 46, 0.45);
    color: #fff;
    cursor: pointer;
    flex: none;
}

.story-viewer__arrow:disabled {
    opacity: 0.4;
    cursor: default;
}

.story-viewer__arrow:focus-visible,
.story-viewer__icon-btn:focus-visible,
.story-viewer__vote:focus-visible,
.story-viewer__sound:focus-visible,
.story-viewer__cta:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.story-viewer__card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: min(90vh, 1013px);
    width: auto;
    max-width: calc(100vw - 144px);
    aspect-ratio: 9 / 16;
    border-radius: 16px;
    overflow: hidden;
    background: #2C2D2E;
    color: #fff;
}

.story-viewer__card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: linear-gradient(to bottom, rgba(44, 45, 46, 0.4), rgba(44, 45, 46, 0));
    pointer-events: none;
    z-index: 2;
}

.story-viewer__card.is-theme-dark {
    color: var(--color-text, #2C2D2E);
}

.story-viewer__progress {
    position: absolute;
    z-index: 3;
    top: calc(8px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    display: flex;
    gap: 4px;
    height: 3px;
}

.story-viewer__segment {
    flex: 1;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
}

.story-viewer__fill {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
}

.story-viewer__segment.is-done .story-viewer__fill {
    transform: scaleX(1);
}

.story-viewer__segment.is-active:not(.is-video) .story-viewer__fill {
    animation-name: story-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.story-viewer.is-paused .story-viewer__segment.is-active .story-viewer__fill {
    animation-play-state: paused;
}

.story-viewer.is-reduced .story-viewer__segment.is-active .story-viewer__fill,
.story-viewer__segment.is-video .story-viewer__fill {
    animation: none;
}

.story-viewer.is-reduced .story-viewer__segment.is-active:not(.is-video) .story-viewer__fill {
    transform: scaleX(1);
}

@keyframes story-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.story-viewer__top {
    position: absolute;
    z-index: 3;
    top: calc(16px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
}

/* Заголовок с flex:1 прижимает кнопки вправо. Без заголовка элемент
   скрыт ([hidden]), поэтому авто-отступ на первой кнопке держит пару
   пауза/закрыть у правого края. */
.story-viewer__top > .story-viewer__icon-btn:first-of-type {
    margin-left: auto;
}

.story-viewer__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    background: rgba(255, 255, 255, 0.2);
}

.story-viewer__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
    line-height: 18px;
    color: #fff;
}

.story-viewer__name[hidden] {
    display: none;
}

.story-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    touch-action: none;
}

.story-viewer__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #2C2D2E;
}

.story-viewer__media-bg,
.story-viewer__media-fg,
.story-viewer__media video {
    width: 100%;
    height: 100%;
}

.story-viewer__media-bg {
    position: absolute;
    inset: 0;
    display: block;
    object-fit: cover;
    transform: scale(1.08);
    filter: blur(24px);
    opacity: 0.85;
    pointer-events: none;
}

.story-viewer__media-fg {
    position: relative;
    z-index: 1;
    display: block;
    object-fit: contain;
    background: transparent;
}

.story-viewer__media video {
    position: relative;
    z-index: 1;
    display: block;
    object-fit: cover;
    background: #2C2D2E;
}

.story-viewer__bottom {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 48px calc(12px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    background: linear-gradient(to top, rgba(44, 45, 46, 0.88), rgba(44, 45, 46, 0));
    pointer-events: none;
}

.story-viewer__bottom > * {
    pointer-events: auto;
}

.story-viewer__card.is-theme-dark .story-viewer__bottom {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0));
}

.story-viewer__heading {
    margin: 0;
    font-size: 20px;
    line-height: 24px;
    font-weight: 600;
}

.story-viewer__text {
    margin: 0;
    font-size: 15px;
    line-height: 20px;
}

.story-viewer__cta[hidden],
.story-viewer__heading[hidden],
.story-viewer__text[hidden],
.story-viewer__sound[hidden],
.story-viewer__state[hidden],
.story-viewer__avatar[hidden] {
    display: none;
}

.story-viewer__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 8px;
    background: #fff;
    color: #3774AB;
    font-weight: 500;
    font-size: 16px;
    line-height: 20px;
    text-decoration: none;
}

.story-viewer__card.is-theme-dark .story-viewer__cta {
    background: var(--color-accent, #005FF9);
    color: #fff;
}

.story-viewer__tools {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.story-viewer__sound {
    margin-left: auto;
}

.story-viewer__vote[aria-pressed="true"] {
    background: var(--color-accent, #005FF9);
    border-color: transparent;
    border-width: 0;
    color: #fff;
}

.story-viewer__state {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(44, 45, 46, 0.72);
    color: #fff;
    font-weight: 600;
}

.story-viewer__vote svg {
    width: 24px;
    height: 24px;
    display: block;
    flex: none;
}

.story-viewer__vote[aria-pressed="true"] svg path:nth-child(2) {
    fill: rgba(255, 255, 255, 0.25);
}

@media (max-width: 767px) {
    .story-viewer[open] {
        position: fixed;
        inset: 0;
        box-sizing: border-box;
        display: flex;
        align-items: stretch;
        justify-content: stretch;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 0;
    }

    .story-viewer__card {
        flex: 1 1 auto;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        aspect-ratio: auto;
        border-radius: 0;
    }

    .story-viewer__progress {
        top: calc(8px + env(safe-area-inset-top, 0px));
        left: calc(12px + env(safe-area-inset-left, 0px));
        right: calc(12px + env(safe-area-inset-right, 0px));
    }

    .story-viewer__top {
        top: calc(16px + env(safe-area-inset-top, 0px));
        padding-right: calc(12px + env(safe-area-inset-right, 0px));
        padding-left: calc(12px + env(safe-area-inset-left, 0px));
    }

    .story-viewer__bottom {
        padding:
            48px
            calc(12px + env(safe-area-inset-right, 0px))
            calc(16px + env(safe-area-inset-bottom, 0px))
            calc(12px + env(safe-area-inset-left, 0px));
    }

    .story-viewer__arrow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .story-viewer__segment.is-active .story-viewer__fill {
        animation: none;
    }

    .story-viewer__segment.is-active:not(.is-video) .story-viewer__fill {
        transform: scaleX(1);
    }
}

.story-preview {
    --color-accent: #005FF9;
    --color-text: #2C2D2E;
    --color-text-tertiary: #AAADB3;
    --color-bg: #F5F5F5;
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.story-preview__mode {
    margin: 12px 16px;
    font-size: 14px;
}

.story-preview__form-stub {
    margin: 16px;
    padding: 16px;
    border: 1px solid rgba(0, 16, 61, 0.12);
    border-radius: 14px;
    background: #fff;
}

.story-preview--mobile .story-viewer[open] {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
}

.story-preview--mobile .story-viewer__card {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

.story-preview--mobile .story-viewer__arrow {
    display: none;
}

.story-preview--desktop .story-viewer__arrow {
    display: inline-flex;
}

.story-preview--desktop .story-viewer__card {
    height: min(90vh, 1013px);
    width: auto;
    aspect-ratio: 9 / 16;
    border-radius: 16px;
}
