/* Gallery shell for Top-100 feed cards in AP home vitrine slots. */

.ap-home-feed-grid > li.ap-home-feed-slot--banner {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.ap-home-top100-gallery {
    /* Слот: высота по умолчанию auto; в ленте JS ставит px = соседний товар. */
    --ap-t100-photo: 148px;
    --ap-t100-height: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    height: var(--ap-t100-height);
    max-height: none;
    min-height: 0;
    align-self: stretch;
    border-radius: 16px;
    overflow: hidden;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.ap-home-top100-gallery__viewport {
    position: relative;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
}

.ap-home-top100-gallery__track {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
    will-change: transform;
    transition: transform 0.45s ease, opacity 0.35s ease;
}

.ap-home-top100-gallery.is-fading .ap-home-top100-gallery__track {
    opacity: 0.55;
}

.ap-home-top100-gallery__slide {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.ap-home-top100-gallery__slide > .ks-top100-feed-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    max-height: none;
    box-sizing: border-box;
}

.ap-home-top100-gallery__nav {
    position: absolute;
    top: calc(var(--ap-t100-photo, 148px) / 2);
    z-index: 3;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 1.5px solid #353433;
    border-radius: 50%;
    background: #F7F7F7;
    color: #353433;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ap-home-top100-gallery:hover .ap-home-top100-gallery__nav,
.ap-home-top100-gallery:focus-within .ap-home-top100-gallery__nav {
    opacity: 1;
}

.ap-home-top100-gallery__nav:hover {
    background: #FFFFFF;
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.ap-home-top100-gallery__nav--prev {
    left: 8px;
}

.ap-home-top100-gallery__nav--next {
    right: 8px;
}

@media (hover: none) {
    .ap-home-top100-gallery__nav {
        opacity: 0.85;
    }
}

/* Адаптив: стрелки не нужны — свайп с инерцией */
@media (max-width: 1000px) {
    .ap-home-top100-gallery__nav {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .ap-home-top100-gallery:not(.ap-home-top100-gallery--wide) {
        --ap-t100-photo: 132px;
    }
}

/* Wide mid-section: coverflow with side cards across full content width */
.ap-home-top100-gallery--wide {
    --ap-t100-photo: 160px;
    --ap-t100-height: 340px;
    --ap-t100-card-w: min(280px, 34vw);
    height: var(--ap-t100-height);
    max-height: none;
    border-radius: 0;
    overflow: visible;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__viewport {
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__track {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    transform: none !important;
    transition: none;
    will-change: auto;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide {
    position: absolute;
    top: 0;
    left: 50%;
    flex: none;
    width: var(--ap-t100-card-w);
    max-width: none;
    height: 100%;
    margin: 0;
    transform: translate3d(-50%, 0, 0) scale(0.7);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    border-radius: 24px;
    transition:
        transform 0.45s ease,
        opacity 0.35s ease;
    will-change: transform, opacity;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-active {
    transform: translate3d(-50%, 0, 0) scale(1);
    opacity: 1;
    pointer-events: auto;
    z-index: 5;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-prev {
    transform: translate3d(calc(-50% - 72%), 0, 0) scale(0.86);
    opacity: 0.92;
    pointer-events: auto;
    z-index: 4;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-next {
    transform: translate3d(calc(-50% + 72%), 0, 0) scale(0.86);
    opacity: 0.92;
    pointer-events: auto;
    z-index: 4;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-prev-prev {
    transform: translate3d(calc(-50% - 132%), 0, 0) scale(0.72);
    opacity: 0.55;
    z-index: 2;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-next-next {
    transform: translate3d(calc(-50% + 132%), 0, 0) scale(0.72);
    opacity: 0.55;
    z-index: 2;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-far {
    transform: translate3d(-50%, 0, 0) scale(0.6);
    opacity: 0;
    z-index: 0;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__nav {
    top: 50%;
    z-index: 6;
    opacity: 0.9;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__nav--prev {
    left: 4px;
}

.ap-home-top100-gallery--wide .ap-home-top100-gallery__nav--next {
    right: 4px;
}

@media (max-width: 767px) {
    .ap-home-top100-gallery--wide {
        --ap-t100-height: 320px;
        --ap-t100-photo: 140px;
        --ap-t100-card-w: min(240px, 58vw);
    }

    .ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-prev {
        transform: translate3d(calc(-50% - 58%), 0, 0) scale(0.82);
    }

    .ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-next {
        transform: translate3d(calc(-50% + 58%), 0, 0) scale(0.82);
    }

    .ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-prev-prev,
    .ap-home-top100-gallery--wide .ap-home-top100-gallery__slide.is-next-next {
        opacity: 0;
        pointer-events: none;
    }
}

/* Pending / spinner */
.ap-home-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(226, 55, 55, 0.2);
    border-top-color: #e23737;
    border-radius: 50%;
    animation: ap-home-spin 0.7s linear infinite;
}
@keyframes ap-home-spin {
    to { transform: rotate(360deg); }
}
.ap-home-top100-gallery--pending {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    background: #f3f4f6;
    border-radius: 16px;
}
.ap-home-top100-gallery--pending.ap-home-top100-gallery--wide {
    min-height: var(--ap-t100-height, 340px);
}
.ap-home-top100-gallery__pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-size: 14px;
}
.ap-home-feed-pending {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 180px;
    margin: 0 0 24px;
    padding: 24px;
    background: #f3f4f6;
    border-radius: 16px;
    color: #6b7280;
    font-size: 14px;
}
.ap-name-serp-extras-mount {
    margin-top: 8px;
}
