/* Блок «Похожие букеты» внизу карточки товара (04.10.2026).
   Разметка - local/include/similar_products.php, поведение - similar_products.js.
   Один файл на оба шаблона (десктоп и aspro-lite-mobile), узкий экран - медиазапросом. */

.ship-sim {
    --ss-pink: var(--theme-base-color, #e8a2e1);
    --ss-pink-deep: #d27fca;
    --ss-ink: #1c1820;
    --ss-muted: #7d7684;
    --ss-line: #ece8ef;
    --ss-field: #f4f3f6;
    --ss-ok: #2bb24c;
    --ss-gap: 16px;
    --ss-per: 5.35;               /* сколько карточек видно: дробная часть - край следующей */
    margin: 8px 0 48px;
    color: var(--ss-ink);
}
.ship-sim [hidden] { display: none !important; }

.ship-sim__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.ship-sim__title {
    margin: 0;
    font-size: 32px;
    line-height: 1.1;
    font-weight: 600;
}
.ship-sim__count {
    margin-left: 10px;
    font-size: 17px;
    font-weight: 400;
    color: var(--ss-muted);
}
.ship-sim__nav { display: flex; gap: 12px; flex: none; }
.ship-sim__arrow {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--ss-line);
    background: #fff;
    color: var(--ss-ink);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.ship-sim__arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ship-sim__arrow:hover:not(:disabled) { background: var(--ss-pink); border-color: var(--ss-pink); color: #fff; }
.ship-sim__arrow:disabled { opacity: .35; cursor: default; }

.ship-sim__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}
.ship-sim__tabs::-webkit-scrollbar { display: none; }
.ship-sim__tab {
    flex: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .03em;
    border: 2px solid var(--ss-pink);
    color: var(--ss-pink);
    background: transparent;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.ship-sim__tab:hover { background: rgba(232, 162, 225, .12); }
.ship-sim__tab[aria-selected="true"] { background: var(--ss-pink); color: #fff; }

.ship-sim__arrow:focus-visible,
.ship-sim__tab:focus-visible,
.ship-sim__add:focus-visible,
.ship-sim__name:focus-visible { outline: 2px solid var(--ss-ink); outline-offset: 2px; }

.ship-sim__viewport { position: relative; }
.ship-sim__viewport::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 16px;
    width: 56px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff);
    pointer-events: none;
    transition: opacity .2s;
}
.ship-sim__viewport.is-end::after { opacity: 0; }

.ship-sim__track {
    display: flex;
    gap: var(--ss-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 16px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    cursor: grab;
}
.ship-sim__track::-webkit-scrollbar { display: none; }
.ship-sim__track.is-drag { cursor: grabbing; scroll-snap-type: none; }
.ship-sim__track.is-drag a { pointer-events: none; }

.ship-sim__card {
    flex: 0 0 calc((100% - var(--ss-gap) * (var(--ss-per) - 0.35)) / var(--ss-per));
    min-width: 0;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    user-select: none;
}
.ship-sim__ph {
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 10px;
    overflow: hidden;
    background: var(--ss-field);
}
.ship-sim__ph img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
    -webkit-user-drag: none;
}
.ship-sim__card:hover .ship-sim__ph img { transform: scale(1.04); }
.ship-sim__name {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--ss-ink);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* всегда две строки: иначе у коротких названий цена и доставка встают выше, чем у соседей */
    min-height: 2.5em;
}
.ship-sim__name:hover { color: var(--ss-pink-deep); }
.ship-sim__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}
.ship-sim__price {
    font-size: 19px;
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ship-sim__add {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: var(--ss-pink);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.ship-sim__add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ship-sim__add:hover { background: var(--ss-pink-deep); }
.ship-sim__add:active { transform: scale(.92); }
.ship-sim__add.is-loading { opacity: .6; pointer-events: none; }
.ship-sim__add.is-done { background: var(--ss-ok); }
.ship-sim__dl {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ss-pink-deep);
}

.ship-sim__prog {
    position: relative;
    height: 3px;
    margin-top: 4px;
    border-radius: 3px;
    background: var(--ss-line);
    overflow: hidden;
}
.ship-sim__prog i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 30%;
    border-radius: 3px;
    background: var(--ss-pink);
    transition: left .15s linear, width .15s linear;
}

@media (max-width: 1199px) { .ship-sim { --ss-per: 4.3; } }
@media (max-width: 991px)  { .ship-sim { --ss-per: 3.3; } }
@media (max-width: 600px) {
    .ship-sim { --ss-per: 2.25; --ss-gap: 10px; margin: 28px 0 32px; }
    .ship-sim__head { align-items: center; margin-bottom: 14px; }
    .ship-sim__title { font-size: 22px; }
    .ship-sim__count { display: none; }
    .ship-sim__nav { display: none; }
    .ship-sim__tabs { margin: 0 -16px 16px; padding: 0 16px; }
    .ship-sim__tab { font-size: 11px; padding: 6px 12px; }
    .ship-sim__track { margin: 0 -16px; padding: 0 16px 14px; scroll-padding-inline: 16px; }
    .ship-sim__viewport::after { right: -16px; width: 40px; }
    .ship-sim__card { flex-basis: calc((100vw - 32px - var(--ss-gap)) / var(--ss-per)); }
    .ship-sim__name { font-size: 14px; }
    .ship-sim__price { font-size: 16px; }
    .ship-sim__add { width: 34px; height: 34px; }
    .ship-sim__add svg { width: 15px; height: 15px; }
    .ship-sim__dl { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .ship-sim *, .ship-sim *::after { transition: none !important; }
}
