/* «Ролики» — вертикальная видео-лента (/reels).
   Рукописный CSS (не Tailwind) → не зависит от пересборки/пуржа app.min.css.
   Акцент — золото темы через rgb(var(--color-gold)); фон ленты — чёрный (видео). */

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

/* Колонка ленты: на мобилке во всю ширину, на десктопе — «телефон» по центру. */
.reels-wrap {
    position: relative;
    max-width: 460px;
    margin: 0 auto;
    padding: 0;
}

/* Собственная зона скролла с вертикальным snap. Высота = вьюпорт минус шапка+
   крошки (--reels-chrome). dvh — учитывает адресную строку мобильных браузеров. */
.reels-feed {
    --reels-chrome: 6rem;
    height: calc(100dvh - var(--reels-chrome));
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #000;
    scrollbar-width: none;                 /* Firefox */
}
.reels-feed::-webkit-scrollbar { display: none; }   /* WebKit */

@media (min-width: 640px) {
    .reels-wrap { margin: 1rem auto 0; }
    .reels-feed {
        --reels-chrome: 8rem;
        border-radius: 0.75rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        overflow: hidden auto;
    }
}

/* Один ролик на экран. */
.reel {
    position: relative;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.reel-video {
    position: relative;
    z-index: 1;                   /* поверх размытой заливки .reel-bg */
    width: 100%;
    height: 100%;
    object-fit: contain;          /* клинок целиком, без обрезки; поля закрывает .reel-bg */
    display: block;               /* без background:#000 — иначе перекрыл бы заливку в полях */
}

/* Размытая заливка леттербокса: увеличенная размытая копия постера кадра под
   видео — вместо мёртвого чёрного поля (полноэкранный премиальный вид). blur
   статичный (GPU-композитинг, не по кадрам видео) → нулевая доп-нагрузка. */
.reel-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(30px) brightness(0.5);
    transform: scale(1.2);        /* прячем размытые края за границей кадра */
    pointer-events: none;
}

/* Спиннер буферизации: виден, пока активный ролик грузится (класс на .reel). */
.reel-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 46px; height: 46px;
    margin: -23px 0 0 -23px;
    z-index: 4;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    animation: reel-spin 0.8s linear infinite;
}
.reel.is-buffering .reel-spinner { opacity: 1; }
@keyframes reel-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .reel-spinner { animation: none; }
}

/* Затемнение снизу + подпись товара и переход в карточку. */
.reel-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 2;                   /* поверх видео (z1) и размытой заливки (z0) */
    padding: 1rem 1rem 1.25rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
    pointer-events: none;         /* тап по видео проходит сквозь фон оверлея */
}
.reel-cta {
    pointer-events: auto;         /* но сама ссылка кликабельна */
    display: inline-flex;
    flex-direction: column;
    gap: 0.15rem;
    max-width: 100%;
    text-decoration: none;
    color: #fff;
}
.reel-name {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.25;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    overflow-wrap: break-word;
}
.reel-price {
    color: rgb(var(--color-gold));
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.reel-go {
    margin-top: 0.5rem;
    align-self: flex-start;
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: rgb(var(--color-gold));
    color: #1a1a10;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Тумблер звука — фиксирован в правом верхнем углу колонки. */
.reels-mute {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 5;
    width: 42px; height: 42px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(2px);
    transition: background 0.15s;
}
.reels-mute:hover { background: rgba(0, 0, 0, 0.7); }
.reels-mute svg { width: 22px; height: 22px; }
.reels-mute .reels-mute-on  { display: none; }
.reels-mute .reels-mute-off { display: block; }
.reels-mute.is-on .reels-mute-on  { display: block; }
.reels-mute.is-on .reels-mute-off { display: none; }

/* Подсказка «листайте вверх» — исчезает после первого скролла. */
.reels-hint {
    position: absolute;
    left: 50%; bottom: 5.5rem;
    transform: translateX(-50%);
    z-index: 5;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.4s;
    animation: reels-hint-bob 1.6s ease-in-out infinite;
}
.reels-hint.hidden { opacity: 0; }
@keyframes reels-hint-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    .reels-hint { animation: none; }
}

/* ── Вход №1: оверлей поверх карточки товара ──────────────────────────────
   Тот же движок/разметка, что и на странице /reels, но лента во весь экран.
   z-index 150 — выше модалок (100), ниже гейта 18+ (200). */
.reels-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: #000;
}
.reels-overlay .reels-wrap {
    height: 100%;
    margin: 0 auto;
}
.reels-overlay .reels-feed {
    --reels-chrome: 0rem;         /* хрома сайта под оверлеем нет — лента во всю высоту */
    height: 100dvh;
    border: 0;
    border-radius: 0;
}

/* Пока оверлей открыт — блокируем скролл страницы под ним (у ленты свой скролл). */
.reels-locked { overflow: hidden; }

/* Крестик закрытия — левый верхний угол (тумблер звука занимает правый). */
.reels-close {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 6;
    width: 42px; height: 42px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(2px);
    transition: background 0.15s;
}
.reels-close:hover { background: rgba(0, 0, 0, 0.7); }
.reels-close svg { width: 22px; height: 22px; }

/* Кнопка входа в ленту на карточке товара (в углу медиа-карусели). */
.reels-enter {
    position: absolute;
    left: 10px; bottom: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.reels-enter:hover {
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(255, 255, 255, 0.35);
}
.reels-enter svg {
    width: 14px; height: 14px;
    color: rgb(var(--color-gold));
    flex: none;
}

/* Заглушка/пусто. */
.reels-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 0.95rem;
    text-align: center;
    padding: 2rem;
}
