/* v2 horizontal scroll primitive — shared between home, category, etc. */

.v2-hscroll {
    position: relative;
    /* Clip horizontal overflow so off-screen tiles don't trigger body scroll.
       Стрелки висят inside-edge (left/right: 0) — не вылезают, не обрезаются. */
    overflow-x: clip;
    overflow-y: visible;
}
.v2-hscroll__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 320px;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 4px 0 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.v2-hscroll__track::-webkit-scrollbar { display: none; }
.v2-hscroll__track > * { scroll-snap-align: start; }

/* Drag-to-scroll (мышь): grab-курсор когда есть прокрутка, grabbing во время drag.
   На время перетаскивания снимаем snap/smooth — иначе scrollLeft дёргается. */
.v2-hscroll__track.is-grabbable { cursor: grab; }
.v2-hscroll__track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
    user-select: none;
}
.v2-hscroll__track.is-dragging img { pointer-events: none; }

.v2-hscroll__nav {
    position: absolute;
    top: calc(50% - 24px);
    transform: translateY(-50%);
    width: 44px; height: 44px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    display: grid;
    place-items: center;
    padding-bottom: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.15s, color 0.15s;
}
.v2-hscroll__nav:hover { background: var(--secondary-600); color: #fff; border-color: var(--secondary-600); }
.v2-hscroll__nav--prev { left: 4px; }
.v2-hscroll__nav--next { right: 4px; }
.v2-hscroll__nav[disabled] { opacity: 0.3; cursor: default; }

@media (hover: none) {
    .v2-hscroll::after {
        content: "";
        position: absolute;
        top: 0; bottom: 12px;
        right: 0;
        width: 32px;
        pointer-events: none;
        background: linear-gradient(to right, rgba(250,250,247,0), var(--bg-page));
    }
}

@media (max-width: 720px) {
    .v2-hscroll__nav { display: none; }
}

/* ---------- TILE (square image + caption below — used in any hscroll) ---------- */
.v2-tile {
    display: block;
    width: 320px;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.v2-tile__img {
    width: 320px;
    height: 320px;
    background: var(--bg-section);
    overflow: hidden;
    position: relative;
    border-radius: var(--radius);
}
.v2-tile__img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.v2-tile:hover .v2-tile__img img {
    transform: scale(1.03);
}
.v2-tile__caption {
    padding: 14px 4px 0;
}
.v2-tile__name {
    font-family: var(--ff-head);
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.2px;
}

/* ---------- TILE — portrait 3:4 modifier с name-overlay поверх фото
   (used: home Find Your Formula, category Shop by Goal sub-slider) ---------- */
.v2-tile--portrait { width: 260px; }
.v2-tile--portrait .v2-tile__img {
    width: 260px;
    height: 347px;
    border-radius: 12px;
    background: var(--bg-white);
}
.v2-tile--portrait:hover .v2-tile__img img { transform: scale(1.04); }
.v2-tile--portrait .v2-tile__img::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(30, 107, 63, 0.78) 0%, rgba(30, 107, 63, 0.45) 35%, transparent 65%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.v2-tile--portrait:hover .v2-tile__img::after { opacity: 0.55; }
.v2-tile__name-overlay {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 18px;
    z-index: 2;
    color: #fff;
    font-family: var(--ff-head);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

@media (max-width: 720px) {
    .v2-tile,
    .v2-tile__img { width: 200px; }
    .v2-tile__img { height: 200px; }
    .v2-tile__name { font-size: 16px; }
    .v2-tile__caption { padding-top: 10px; }

    .v2-tile--portrait { width: 180px; }
    .v2-tile--portrait .v2-tile__img { width: 180px; height: 240px; }
    .v2-tile__name-overlay { font-size: 14px; bottom: 14px; }
}
