/* PP Reels — kafelki i odtwarzacz.
   Zmienne na górze, żeby motyw mógł je nadpisać bez ruszania reszty. */

.pp-reels {
    --pp-accent: #e6007e;
    --pp-ring: linear-gradient(135deg, #e6007e, #ff8bc4);
    --pp-tile: 76px;
    --pp-gap: 18px;
}

/* ---------- kafelki ---------- */

.pp-reels__tiles {
    display: flex;
    gap: var(--pp-gap);
    margin: 0;
    padding: 4px 0 10px;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.pp-reels__tiles::-webkit-scrollbar { display: none; }

/* Pasek przewijania jest ukryty, wiec przy wiekszej liczbie kafelkow nic nie
   sygnalizowaloby, ze rzad jedzie dalej. Gasnaca krawedz to pokazuje. */
.pp-reels { position: relative; }
.pp-reels::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 10px;
    width: 46px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.92));
}
.pp-reels.is-overflowing:not(.is-at-end)::after { opacity: 1; }
.pp-reels__tile { flex: 0 0 auto; }

.pp-reels__open {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: calc(var(--pp-tile) + 14px);
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.pp-reels__open:focus-visible { outline: 2px solid var(--pp-accent); outline-offset: 3px; border-radius: 10px; }

.pp-reels__ring {
    display: grid;
    place-items: center;
    width: var(--pp-tile);
    height: var(--pp-tile);
    border-radius: 50%;
    background: var(--pp-ring);
    padding: 3px;
}
.pp-reels__thumb {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0 0 2px #fff inset;
}
.pp-reels__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

.pp-reels__name {
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .02em;
    word-break: break-word;
}

/* ---------- popup ---------- */

.pp-reels-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    background: rgba(12, 8, 14, .82);
    backdrop-filter: blur(3px);
    padding: 16px;
}
.pp-reels-modal[hidden] { display: none !important; }

/* Atrybut `hidden` przegrywa z jawnym `display` w regule klasy — a prawie kazdy
   element kadru takie ma. Bez tego ukrywanie ceny, nadpisu, podnazwy i przycisku
   koszyka po prostu nie dzialalo: film bez produktu pokazywal "Dodaj do koszyka". */
.pp-reels-modal [hidden] { display: none !important; }

.pp-reels-stage {
    position: relative;
    /* Szerokosc ustala flex, nie procent: wewnatrz .pp-reels-wrap o szerokosci
       automatycznej "100%" odwolywaloby sie do rodzica zaleznego od dziecka
       i kadr zapadal sie do zera. */
    flex: 1 1 auto;
    min-width: 0;
    /* Druga skladowa pilnuje, zeby kadr o proporcji 9:16 nie byl wyzszy niz okno:
       przy niskim oknie zwezamy go, zamiast pozwolic mu wyjsc poza ekran. */
    max-width: min(462px, calc((100vh - 32px) * 9 / 16));
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.pp-reels-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    display: block;
}

/* pasek segmentowy */
.pp-reels-bars {
    position: absolute;
    top: 10px; left: 10px; right: 10px;
    display: flex;
    gap: 4px;
    /* Nad nakladka opisowa — inaczej rozciagnieta do gory nakrywa pasek. */
    z-index: 8;
}
.pp-reels-bar {
    position: relative;
    flex: 1;
    height: 3px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: rgba(255, 255, 255, .35);
    overflow: visible;
    cursor: pointer;
}
/* Pasek ma 3 px wysokosci — bez powiekszonego pola trafienia byloby to
   nie do klikniecia, a na dotyku nie do trafienia w ogole. */
.pp-reels-bar::after {
    content: '';
    position: absolute;
    inset: -10px -2px;
}
.pp-reels-bar:hover { background: rgba(255, 255, 255, .55); }
.pp-reels-bar:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.pp-reels-bar i {
    display: block;
    height: 100%;
    border-radius: 2px;
    overflow: hidden;
}
.pp-reels-bar i {
    width: 0;
    background: #fff;
}
.pp-reels-bar.is-done i { width: 100%; }

/* górny rząd sterowania — widoczny zawsze */
.pp-reels-top {
    position: absolute;
    top: 22px; left: 10px; right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 9;
    pointer-events: none;
}
.pp-reels-top button { pointer-events: auto; }

.pp-reels-icon {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .38);
    color: #fff;
    cursor: pointer;
    line-height: 1;
}
.pp-reels-icon:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.pp-reels-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* strefy przewijania */
.pp-reels-edge {
    position: absolute;
    top: 56px; bottom: 96px;
    width: 26%;
    z-index: 3;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.pp-reels-edge--prev { left: 0; }
.pp-reels-edge--next { right: 0; }
.pp-reels-edge:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

/* nakładki ujawniane przy interakcji */
.pp-reels-overlay {
    position: absolute;
    left: 0; right: 0;
    z-index: 5;
    /* Nakladki sa dekoracja + tekstem; klikalne elementy wlaczaja wskaznik
       z powrotem u siebie. Bez tego blok opisowy zjadal klikniecia w kadr,
       w pasek postepu i w sterowanie pod nim. */
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease;
}
.pp-reels-stage.is-revealed .pp-reels-overlay { opacity: 1; visibility: visible; }

.pp-reels-head {
    top: 0;
    /* Zaczynamy przy samej krawedzi, a tresc spychamy paddingiem pod pasek
       postepu i ikony — inaczej gora kadru zostawala nieprzyciemniona. */
    padding: 62px 18px 18px;
    text-align: center;
    color: #fff;
    transform: translateY(-6px);
    background: linear-gradient(rgba(0,0,0,.72) 38%, rgba(0,0,0,0));
}
.pp-reels-stage.is-revealed .pp-reels-head { transform: none; }
.pp-reels-eyebrow { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.pp-reels-title { display: block; font-size: 17px; font-weight: 700; margin-top: 3px; }
.pp-reels-subtitle { display: block; font-size: 12px; opacity: .85; margin-top: 2px; }
.pp-reels-price {
    display: inline-block;
    margin-top: 9px;
    padding: 6px 16px;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-weight: 700;
    font-size: 14px;
}

.pp-reels-foot {
    bottom: 0;
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    transform: translateY(8px);
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.62));
}
.pp-reels-stage.is-revealed .pp-reels-foot { transform: none; }

.pp-reels-add,
.pp-reels-more { pointer-events: auto; }

.pp-reels-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 210px;
    padding: 13px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--pp-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.pp-reels-add[disabled] { opacity: .75; cursor: default; }
.pp-reels-add.is-done { background: #2c6a4c; }
.pp-reels-add:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.pp-reels-more {
    color: #fff;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* kupon — pojawia się w zadanej sekundzie, niezależnie od nakładek */
.pp-reels-coupon {
    position: absolute;
    left: 50%;
    bottom: 108px;
    transform: translate(-50%, 10px);
    /* Nad nakladkami i nad wideo — kupon musi byc pewnym celem dotyku. */
    z-index: 10;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    /* 44 px to minimalny sensowny cel palca; wczesniej kupon mial ok. 40 px
       razem z obramowaniem i dotkniecie latwo lądowalo obok, czyli na wideo. */
    min-height: 46px;
    padding: 12px 24px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: 2px dashed #fff;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .06em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, transform .22s ease;
}
.pp-reels-coupon.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.pp-reels-coupon.is-copied { border-style: solid; background: #2c6a4c; }

.pp-reels-status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 7;
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, .45);
    text-align: center;
    padding: 24px;
}
.pp-reels-status[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .pp-reels-overlay,
    .pp-reels-coupon { transition: none; }
}

/* ---------- strzałki na desktopie ---------- */

.pp-reels-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    /* 462 px kadru + dwie strzalki po 44 px + dwa odstepy po 16 px = 582 px.
       Bez podniesienia limitu strzalki zabieralyby szerokosc kadrowi. */
    max-width: 600px;
}

.pp-reels-arrow {
    flex: 0 0 auto;
    display: none;              /* pokazujemy tylko tam, gdzie jest kursor */
    place-items: center;
    width: 44px; height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #111;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    transition: transform .15s ease, opacity .15s ease;
}
.pp-reels-arrow:hover { transform: scale(1.06); }
.pp-reels-arrow:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.pp-reels-arrow[disabled] { opacity: .3; cursor: default; transform: none; }
.pp-reels-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) and (min-width: 620px) {
    .pp-reels-arrow { display: grid; }
    /* Przy widocznych strzałkach niewidzialne strefy przy krawędziach
       tylko przeszkadzałyby — na dotyku zostają. */
    .pp-reels-edge { display: none; }
}

/* ---------- głośność ---------- */

.pp-reels-sound {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px 0 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, .38);
}
.pp-reels-sound .pp-reels-icon { background: none; }

.pp-reels-volume {
    width: 0;
    opacity: 0;
    height: 4px;
    margin: 0;
    padding: 0;
    appearance: none;
    background: rgba(255, 255, 255, .4);
    border-radius: 2px;
    cursor: pointer;
    transition: width .18s ease, opacity .18s ease;
}
.pp-reels-sound:hover .pp-reels-volume,
.pp-reels-sound:focus-within .pp-reels-volume { width: 76px; opacity: 1; }

@media (hover: none) {
    /* Bez kursora nie ma czym najechać — suwak zostaje widoczny. */
    .pp-reels-volume { width: 64px; opacity: 1; }
}

.pp-reels-volume::-webkit-slider-thumb {
    appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}
.pp-reels-volume::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    cursor: pointer;
}
.pp-reels-volume:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .pp-reels-arrow,
    .pp-reels-volume { transition: none; }
}
