/* =====================================================================
   ОНИКС — видео-сторис (лента карточек + полноэкранный плеер)
   ===================================================================== */

.stories {
    --st-accent: var(--brand-purple, #6c4ec8);
    --st-accent-2: var(--brand-purple-bright, #a185ff);
    --st-card-w: 150px;
}

/* ---------- Лента ---------- */
.stories-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 4px 2px 12px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.stories-track::-webkit-scrollbar { height: 6px; }
.stories-track::-webkit-scrollbar-thumb { background: rgba(108, 78, 200, .35); border-radius: 3px; }

.story-card {
    flex: 0 0 var(--st-card-w);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
}
.story-card-media {
    position: relative;
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    padding: 3px;
    background: linear-gradient(160deg, var(--st-accent-2), var(--st-accent) 55%, #3b2a7a);
    transition: transform .25s ease;
}
.story-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 11px;
    background: #111;
}
.story-card-media::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.65));
    pointer-events: none;
}
.story-card-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 1;
    transition: background .2s ease;
}
.story-card-play::before {
    content: "";
    margin-left: 4px;
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #fff;
}
.story-card-time {
    position: absolute;
    left: 10px;
    bottom: 9px;
    z-index: 1;
    font: 600 11px/1 "JetBrains Mono", ui-monospace, monospace;
    color: #fff;
    letter-spacing: .03em;
}
.story-card-title {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
}
.story-card:hover .story-card-media,
.story-card:focus-visible .story-card-media { transform: translateY(-3px); }
.story-card:hover .story-card-play { background: var(--st-accent); }
.story-card:focus-visible { outline: none; }
.story-card:focus-visible .story-card-media { box-shadow: 0 0 0 3px var(--st-accent-2); }

.stories--dark .story-card-title { color: #fff; }
.stories--light .story-card-title { color: #1c1a26; }

@media (max-width: 575px) {
    .stories { --st-card-w: 128px; }
}

/* ---------- Плеер ---------- */
.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 7, 13, .94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.story-viewer[hidden] { display: none; }
.story-stage {
    position: relative;
    height: min(100dvh, 860px);
    aspect-ratio: 9 / 16;
    max-width: 100vw;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    touch-action: none;
}
@media (max-width: 575px) {
    .story-stage { height: 100dvh; width: 100vw; border-radius: 0; aspect-ratio: auto; }
}
.story-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.story-top {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 3;
    padding: 12px 12px 30px;
    background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
}
.story-progress { display: flex; gap: 4px; margin-bottom: 10px; }
.story-progress span {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,.3);
    overflow: hidden;
}
.story-progress i {
    display: block;
    height: 100%;
    width: 0;
    background: #fff;
}
.story-head { display: flex; align-items: center; gap: 10px; color: #fff; }
.story-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--brand-purple, #6c4ec8);
    font: 700 14px/1 "Unbounded", sans-serif;
}
.story-meta { min-width: 0; flex: 1; }
.story-meta b { display: block; font-size: 13px; }
.story-meta span { display: block; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,.14);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.story-btn:hover, .story-btn:focus-visible { background: rgba(255,255,255,.28); outline: none; }
.story-btn svg { width: 18px; height: 18px; }

.story-zone {
    position: absolute;
    top: 80px;
    bottom: 110px;
    z-index: 2;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}
.story-zone--prev { left: 0; width: 33%; }
.story-zone--next { right: 0; width: 67%; }
.story-zone:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: -4px; }

.story-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 40px 14px 16px;
    background: linear-gradient(0deg, rgba(0,0,0,.7), rgba(0,0,0,0));
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.story-cta {
    flex: 1 1 auto;
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    font: 600 14px/1.2 "Plus Jakarta Sans", system-ui, sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.story-cta--main { background: var(--brand-purple, #6c4ec8); color: #fff; }
.story-cta--main:hover { background: var(--brand-purple-light, #8d70ed); color: #fff; }
.story-cta--ghost { background: rgba(255,255,255,.16); color: #fff; }
.story-cta--ghost:hover { background: rgba(255,255,255,.28); color: #fff; }

.story-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,.14);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.story-nav:hover { background: rgba(255,255,255,.28); }
.story-nav--prev { left: calc(50% - min(100dvh, 860px) * 9 / 32 - 64px); }
.story-nav--next { right: calc(50% - min(100dvh, 860px) * 9 / 32 - 64px); }
@media (max-width: 767px) { .story-nav { display: none; } }

body.story-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .story-card-media, .story-card-play { transition: none; }
}

/* Секция на главной */
.stories-section {
    background-color: #0A0812;
    border-top: 1px solid var(--border-color, rgba(255,255,255,.08));
    position: relative;
    z-index: 2;
}
