/**
 * UStyle Homepage Recommendations Carousel
 * Served from backend — deploy = all stores updated instantly.
 */

/* Theme variables — the plugin can override these via inline style="--ustyle-..."
   on the container, so store owners can match their brand without forking CSS. */
.ustyle-recs-section {
    --ustyle-recs-text:         #1e293b;
    --ustyle-recs-subtle:       #94a3b8;
    --ustyle-recs-accent:       #6366f1;
    --ustyle-recs-ring-base:    #e5e7eb;
    --ustyle-recs-ring-accent:  #4a4a4a;
    --ustyle-recs-badge-bg:     rgba(0, 0, 0, 0.85);
    --ustyle-recs-badge-text:   #ffffff;
}

/* Section container */
.ustyle-recs-section {
    max-width: 100%;
    margin: 60px auto 40px;
    padding: 0 5%;
    position: relative;
    box-sizing: border-box;
}

.ustyle-recs-header {
    text-align: center;
    margin-bottom: 20px;
}

.ustyle-recs-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ustyle-recs-text);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.ustyle-recs-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0;
    font-weight: 400;
}

/* Track (scrollable row) */
.ustyle-recs__track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 8px 4px 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.ustyle-recs__track::-webkit-scrollbar { display: none; }
.ustyle-recs__track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

/* Tile — "Liquid Glass" treatment: a frosted-glass card with a hairline
   highlight border, soft inner glow, and a layered shadow that suggests
   depth without being heavy. */
.ustyle-recs__tile {
    flex: 0 0 200px;
    scroll-snap-align: start;
    text-decoration: none !important;
    color: inherit !important;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.65) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.9) inset,            /* top-edge highlight */
        0 -1px 0 rgba(0,0,0,0.04) inset,                /* bottom-edge subtle line */
        0 4px 18px rgba(15,23,42,0.06),                 /* soft card lift */
        0 2px 6px rgba(15,23,42,0.04);
    transition: transform 0.25s cubic-bezier(.2,.8,.2,1),
                box-shadow 0.25s ease,
                border-color 0.25s ease;
    cursor: pointer;
    display: block;
}
.ustyle-recs__tile:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.85);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.95) inset,
        0 -1px 0 rgba(0,0,0,0.04) inset,
        0 14px 36px rgba(15,23,42,0.14),
        0 4px 12px rgba(15,23,42,0.08);
    color: inherit !important;
    text-decoration: none !important;
}
.ustyle-recs__tile:active { transform: translateY(-1px); }
.ustyle-recs__tile:visited { color: inherit !important; }

/* Image */
.ustyle-recs__image-wrap {
    position: relative;
    width: 100%;
    /* 1:1 box. We use BOTH `aspect-ratio` (modern browsers) AND the
       padding-bottom-100% trick (every browser since 2010) because
       iOS Safari intermittently ignores `aspect-ratio` when the wrap
       is a child of a flex/scroll-snap track — it lets the wrap grow
       to match available height, then `object-fit: cover` crops the
       image to whatever fits, typically just the head/torso. The
       padding-trick gives the wrap a fixed intrinsic height so cover
       has the right viewport regardless of parent layout quirks. */
    height: 0;
    padding-bottom: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f5f5;
}
.ustyle-recs__image {
    /* Absolute-position so the image fills the (height: 0; padding) wrap. */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Slightly-above-center keeps the model's head visible when the
       source image is taller than the 1:1 wrap (e.g. portrait try-on
       outputs that haven't been padded to square). Center-center
       crops both the head and the feet equally. */
    object-position: center 30%;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease-in, transform 0.3s ease;
}
.ustyle-recs__tile:hover .ustyle-recs__image { transform: scale(1.03); }

/* Skeleton shimmer while the image is still downloading, then fade-in */
.ustyle-recs__tile--loading .ustyle-recs__image-wrap {
    background: linear-gradient(90deg, #f1f1f1 0%, #e5e5e5 50%, #f1f1f1 100%);
    background-size: 200% 100%;
    animation: ustyleRecsShimmer 1.4s linear infinite;
}
.ustyle-recs__tile--loaded .ustyle-recs__image { opacity: 1; }
@keyframes ustyleRecsShimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Badge — frosted glass pill */
.ustyle-recs__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--ustyle-recs-badge-bg);
    color: var(--ustyle-recs-badge-text);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 2px 8px rgba(0,0,0,0.18);
}

/* Sale badge — top-right corner, vibrant red so on-sale tiles get a
   second visual cue that's distinct from the source-of-rec badge. */
.ustyle-recs__sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    letter-spacing: 0.02em;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.25) inset,
        0 -1px 0 rgba(0,0,0,0.18) inset,
        0 4px 12px rgba(220, 38, 38, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.20);
    pointer-events: none;
}

/* Multi-item promo pill — appears UNDER the % badge when 2+ items in
   the outfit are on sale. Subtler dark glass to not compete visually
   with the percentage. */
.ustyle-recs__sale-count {
    position: absolute;
    top: 42px;
    right: 10px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    pointer-events: none;
}

/* Outfit items overlay (hover reveal with images) — frosted dark glass.
   Layout: header + scrollable items list + sticky CTA pinned at bottom.
   Without the sticky CTA, outfits with 4+ items push the "View outfit"
   button below the tile's overflow:hidden boundary on a small card. */
.ustyle-recs__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background:
        linear-gradient(180deg, rgba(15,23,42,0.55) 0%, rgba(15,23,42,0.78) 100%);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    padding: 12px 12px 0;       /* bottom 0; CTA carries its own padding */
    opacity: 0;
    transition: opacity 0.25s ease;
    display: flex;
    flex-direction: column;
    /* No `justify-content: center` — that pushed the CTA off-screen on
       overflow. Header/items take what they need; CTA pins to bottom. */
    pointer-events: none;
    overflow: hidden;
}
.ustyle-recs__tile:hover .ustyle-recs__overlay {
    opacity: 1;
    pointer-events: auto;
}
.ustyle-recs__overlay-header {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    font-weight: 500;
    text-align: center;
    flex: 0 0 auto;
}
.ustyle-recs__overlay-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;             /* takes the remaining space */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Hide the scrollbar — the list is short enough that a scroll affordance
       isn't worth the visual noise. */
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Soft fade at the bottom so the last item visually trails off into the
       CTA (only relevant when the list overflows). */
    mask-image: linear-gradient(180deg, #000 0%, #000 calc(100% - 14px), transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 calc(100% - 14px), transparent 100%);
}
.ustyle-recs__overlay-items::-webkit-scrollbar { display: none; }
.ustyle-recs__overlay-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}
.ustyle-recs__overlay-img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
}
.ustyle-recs__overlay-img--placeholder {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
}
.ustyle-recs__overlay-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.ustyle-recs__overlay-cat {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ustyle-recs__overlay-name {
    font-size: 0.68rem;
    color: #fff;
    font-weight: 400;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ustyle-recs__overlay-cta {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: #fff;
    font-weight: 600;
    text-align: center;
    opacity: 0.95;
    padding: 10px 0 12px;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.18);
    background: linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,0.4) 100%);
    /* Reserve space inside overlay's bottom padding so the CTA sits flush
       at the tile's edge with a tap target that's not crowded by tile
       chrome. */
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
}

/* Info */
.ustyle-recs__info { padding: 10px 12px 12px; }
.ustyle-recs__product-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}
.ustyle-recs__item-count {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

/* Lazy-load placeholder tile with the UStyle logo + spinning ring.
   Appears at the rightmost end of the track while a next-page fetch
   is in flight, then removed when the real tiles arrive. */
.ustyle-recs__loader-tile {
    /* Match the regular tile's sizing rules so the layout doesn't jump */
    background: linear-gradient(180deg, rgba(248,250,252,0.95) 0%, rgba(241,245,249,0.85) 100%);
    cursor: default !important;
    pointer-events: none;
}
.ustyle-recs__loader-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
}
.ustyle-recs__loader-spinner {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ustyle-recs__loader-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.18);
    border-top-color: var(--ustyle-recs-accent, #6366f1);
    animation: ustyle-loader-spin 0.85s linear infinite;
}
.ustyle-recs__loader-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    animation: ustyle-loader-pulse 1.4s ease-in-out infinite;
    filter: grayscale(0%) brightness(0.85);
}
@keyframes ustyle-loader-spin {
    to { transform: rotate(360deg); }
}
@keyframes ustyle-loader-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1.0; transform: scale(1.08); }
}

/* Navigation arrows — Apple-style Liquid Glass pills.
   Layered translucent base with a 135° gradient sheen, deep saturating blur,
   inner highlight on the top edge (refraction), and a soft outer shadow. */
.ustyle-recs__nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-30%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background:
        linear-gradient(135deg,
            rgba(255,255,255,0.50) 0%,
            rgba(255,255,255,0.32) 50%,
            rgba(255,255,255,0.45) 100%);
    backdrop-filter: blur(28px) saturate(200%) brightness(108%);
    -webkit-backdrop-filter: blur(28px) saturate(200%) brightness(108%);
    border: 1px solid rgba(255,255,255,0.55);
    box-shadow:
        /* Top-edge refraction highlight */
        inset 0 1px 1px rgba(255,255,255,0.95),
        /* Subtle bottom inner shadow */
        inset 0 -1px 1px rgba(0,0,0,0.06),
        /* Inner glow gives the "liquid" depth */
        inset 0 0 18px rgba(255,255,255,0.20),
        /* Outer floating shadow */
        0 8px 24px rgba(15,23,42,0.16),
        0 2px 6px rgba(15,23,42,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #1e293b;
    z-index: 2;
    transition: background 0.25s, box-shadow 0.25s, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    line-height: 1;
}
.ustyle-recs__nav-btn:hover {
    background:
        linear-gradient(135deg,
            rgba(255,255,255,0.65) 0%,
            rgba(255,255,255,0.48) 50%,
            rgba(255,255,255,0.60) 100%);
    transform: translateY(-30%) scale(1.08);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,1.00),
        inset 0 -1px 1px rgba(0,0,0,0.08),
        inset 0 0 22px rgba(255,255,255,0.28),
        0 12px 32px rgba(15,23,42,0.22),
        0 4px 10px rgba(15,23,42,0.12);
}
.ustyle-recs__nav-btn:disabled { opacity: 0; pointer-events: none; }
/* Position: arrows hug the track's edges instead of the full-bleed section.
   The section uses padding 5% (default desktop) or 8% (≥1401px); subtracting
   the arrow width keeps the arrow's far edge aligned with the track edge,
   with a few pixels of overlap so it reads as anchored to the cards. */
.ustyle-recs__nav-btn--prev { left: calc(5% - 38px); }
.ustyle-recs__nav-btn--next { right: calc(5% - 38px); }
@media (min-width: 1401px) {
    .ustyle-recs__nav-btn--prev { left: calc(8% - 38px); }
    .ustyle-recs__nav-btn--next { right: calc(8% - 38px); }
}

/* Loading: pulsing UStyle shield inside a spinning ring */
.ustyle-recs__loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    min-height: 200px;
}
.ustyle-recs__loader-inner {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ustyle-recs__loader-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    animation: ustyleRecsLoaderPulse 1.8s ease-in-out infinite;
}
.ustyle-recs__loader-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--ustyle-recs-ring-base);
    border-top-color: var(--ustyle-recs-ring-accent);
    border-radius: 50%;
    animation: ustyleRecsLoaderSpin 1s linear infinite;
}
@keyframes ustyleRecsLoaderSpin {
    to { transform: rotate(360deg); }
}
@keyframes ustyleRecsLoaderPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.08); }
}

/* Personalization indicator — glass pill with a soft glow */
.ustyle-recs__personalized-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--ustyle-recs-accent);
    font-weight: 600;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 1px 4px rgba(99,102,241,0.12);
}
.ustyle-recs__personalized-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ustyle-recs-accent);
    display: inline-block;
    box-shadow: 0 0 6px var(--ustyle-recs-accent);
}

/* Responsive — Mobile
 *
 * Tile sized so the first tile fills ~60% of viewport width, with the
 * second tile peeking ~30% — gives a clear "swipeable carousel"
 * affordance instead of a single hero card. Square aspect-ratio preserved
 * so the model+outfit photo doesn't crop. Verified on iPhone 15 Pro
 * (393×852) where the carousel section now fits comfortably within
 * one screen-height instead of dominating it.
 */
@media (max-width: 480px) {
    /* Section sits in the upper-third of the viewport, NOT the dominant
       element. Targets ~35% of an iPhone 15 Pro effective web viewport
       (~720px after browser chrome). Anything bigger and the carousel
       eats the homepage above the fold. */
    .ustyle-recs-section { margin: 14px auto; padding: 0 16px; }
    .ustyle-recs-header { margin-bottom: 4px; }
    .ustyle-recs-title { font-size: 0.95rem; margin: 0; line-height: 1.25; }
    .ustyle-recs-subtitle { font-size: 0.68rem; line-height: 1.3; }
    /* "Personalizzato" pill + "Scorri →" swipe hint are desktop niceties
       that just steal vertical space on mobile — dots already show
       position, and the title already implies personalisation. */
    .ustyle-recs__personalized-tag { display: none !important; }
    .ustyle-recs__swipe-hint { display: none !important; }
    /* 48vw with 160/200 caps → ~189px on iPhone 15 Pro (393×852).
       Two full tiles + a peek fit in the viewport at this size. */
    .ustyle-recs__tile { flex: 0 0 48vw; max-width: 200px; min-width: 160px; border-radius: 18px; }
    /* Bulletproof 1:1 image box. iOS Safari occasionally ignores
       `aspect-ratio` when the wrap is inside a flex/scroll-snap track,
       which lets the wrap grow tall and `object-fit: cover` then crops
       to the head. The padding-bottom-100% trick has worked in every
       browser since 2010. */
    .ustyle-recs__image-wrap {
        height: 0 !important;
        padding-bottom: 100% !important;
        aspect-ratio: auto !important;
    }
    .ustyle-recs__image-wrap > .ustyle-recs__image,
    .ustyle-recs__image-wrap > picture > .ustyle-recs__image {
        position: absolute !important;
        inset: 0 !important;
    }
    .ustyle-recs__nav-btn { display: none; }
    .ustyle-recs__product-title { font-size: 0.74rem; }
    .ustyle-recs__item-count { font-size: 0.62rem; }
    .ustyle-recs__info { padding: 6px 10px 8px; }
    .ustyle-recs__track { gap: 10px; padding: 2px 0 8px; scroll-padding-left: 16px; }
    .ustyle-recs__overlay-img { width: 44px; height: 44px; }
}

/* Mobile swipe dots */
.ustyle-recs__dots {
    display: none;
}
@media (max-width: 480px) {
    .ustyle-recs__dots {
        display: flex;
        justify-content: center;
        gap: 5px;
        padding: 12px 0 4px;
    }
    .ustyle-recs__dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(15,23,42,0.18);
        transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
    }
    .ustyle-recs__dot--active {
        background: var(--ustyle-recs-accent);
        transform: scale(1.5);
        box-shadow: 0 0 8px var(--ustyle-recs-accent);
    }
    .ustyle-recs__swipe-hint {
        text-align: center;
        font-size: 0.72rem;
        color: #94a3b8;
        padding: 6px 0;
        animation: ustyle-swipe-hint 1.5s ease-in-out 3;
        transition: opacity 0.5s;
    }
    @keyframes ustyle-swipe-hint {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(8px); }
    }
}

/* Responsive — Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .ustyle-recs-section { margin: 30px auto; padding: 0 20px; }
    .ustyle-recs-title { font-size: 1.3rem; }
    .ustyle-recs__tile { flex: 0 0 175px; }
    .ustyle-recs__nav-btn { display: none; }
}

/* Responsive — Desktop tile sizes are driven by `data-card-size` on the
   section ("small" / "medium" / "large"), settable from the placement
   admin. Defaults below match `data-card-size="medium"` so older configs
   without the field render at the medium preset. */
@media (min-width: 769px) and (max-width: 1400px) {
    .ustyle-recs__tile { flex: 0 0 280px; }
    .ustyle-recs__track { gap: 18px; }
    .ustyle-recs-section[data-card-size="small"]  .ustyle-recs__tile { flex: 0 0 200px; }
    .ustyle-recs-section[data-card-size="large"]  .ustyle-recs__tile { flex: 0 0 340px; }
}

/* Responsive — Large monitors */
@media (min-width: 1401px) {
    .ustyle-recs-section { padding: 0 8%; }
    .ustyle-recs__tile { flex: 0 0 320px; }
    .ustyle-recs__track { gap: 22px; }
    .ustyle-recs-section[data-card-size="small"]  .ustyle-recs__tile { flex: 0 0 230px; }
    .ustyle-recs-section[data-card-size="large"]  .ustyle-recs__tile { flex: 0 0 400px; }
}

@media (min-width: 1800px) {
    .ustyle-recs-section { padding: 0 10%; }
    .ustyle-recs__tile { flex: 0 0 360px; }
    .ustyle-recs-section[data-card-size="small"]  .ustyle-recs__tile { flex: 0 0 260px; }
    .ustyle-recs-section[data-card-size="large"]  .ustyle-recs__tile { flex: 0 0 460px; }
}

/* (Hero-shrink CSS removed — every variant collided with Uncode's runtime
 * layout. Use the page builder to change the homepage hero height ratio
 * or move the carousel above the hero — that's the structural fix the
 * user asked for instead of CSS glue.) */

/* ═══════════════════════════════════════════════════════════════════════
 * V4 MOBILE — Glass + Animated  (Cards v4.html port, 2026-04-28)
 * ═══════════════════════════════════════════════════════════════════════
 * Liquid-glass cards with deep frosted background, light-sweep shimmer,
 * breathing hero, animated price/title/badge, item chips strip below the
 * hero, expandable "Perché questo outfit?" reason, and a v4 loader tile
 * at the end of the track.
 *
 * Active state: only the centered tile (set via .is-active class by
 * carousel.js scroll handler) plays the breathe + shimmer + glow loops;
 * inactive tiles dim to 60% / scale 0.93 to create depth.
 *
 * Gated by `body.ustyle-v4-mobile` so we can roll back instantly if a
 * customer regression appears — set/unset on the section data-attr.
 */
@keyframes ustyle-v4-shimmer-edge { 0% { left: -60%; } 100% { left: 120%; } }
@keyframes ustyle-v4-hero-breath  { 0%,100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes ustyle-v4-card-float   { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1); } }
@keyframes ustyle-v4-badge-slide  { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ustyle-v4-title-rise   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ustyle-v4-price-pop    { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes ustyle-v4-chip-float   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes ustyle-v4-cta-glow     { 0%,100% { box-shadow: 0 4px 14px rgba(0,0,0,0.15); } 50% { box-shadow: 0 6px 24px rgba(26,24,20,0.30); } }
@keyframes ustyle-v4-bounce       { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes ustyle-v4-glow-red     { 0%,100% { box-shadow: 0 0 8px rgba(220,38,38,0.30); } 50% { box-shadow: 0 0 18px rgba(220,38,38,0.50); } }
@keyframes ustyle-v4-pulse-green  { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.30); } 50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } }
@keyframes ustyle-v4-spin         { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes ustyle-v4-blink        { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }
@keyframes ustyle-v4-wiggle       { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes ustyle-v4-breathe-dot  { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); } }

@media (max-width: 480px) {
    /* Surface — soft warm canvas behind the cards */
    .ustyle-recs-section[data-v4-mobile="1"] {
        background: linear-gradient(180deg, #faf8f4 0%, #f0eee9 100%);
        padding: 6px 0 14px !important;
        margin: 14px 0 !important;
    }

    /* Header — "Scelti per te" + glow Personalizzato pill */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs-header {
        padding: 16px 18px 4px;
        margin-bottom: 0;
        display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs-title {
        font-family: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
        font-size: 22px; font-weight: 700; color: #1a1814;
        letter-spacing: -0.6px; line-height: 1.15;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs-subtitle {
        font-size: 12px; color: #8a8580; font-weight: 400;
        line-height: 1.4; margin: 0; padding-left: 2px;
    }
    /* Personalizzato pill — gradient + glow dot, restored on mobile */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__personalized-tag {
        display: inline-flex !important; align-items: center; gap: 5px;
        font-size: 10.5px; font-weight: 700; color: #6366f1;
        padding: 4px 11px; border-radius: 999px; letter-spacing: 0.4px;
        background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.10));
        border: 1px solid rgba(99,102,241,0.18);
        box-shadow: 0 0 12px rgba(99,102,241,0.08);
        text-transform: none;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__personalized-tag::before {
        content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 999px;
        background: #6366f1; box-shadow: 0 0 8px rgba(99,102,241,0.5);
        animation: ustyle-v4-breathe-dot 2s ease-in-out infinite;
    }

    /* Track — fade edges + horizontal pan */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__track {
        gap: 12px !important;
        padding: 10px 16px 4px !important;
        scroll-snap-type: x mandatory;
        touch-action: pan-x;
        -webkit-overflow-scrolling: touch;
    }

    /* Glass card — bigger (306px so the next peeks), deep blur */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile {
        flex: 0 0 306px !important; max-width: 306px !important; min-width: unset !important;
        border-radius: 24px !important; overflow: hidden; position: relative;
        background: rgba(255,255,255,0.42);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border: 1px solid rgba(255,255,255,0.30);
        box-shadow: 0 4px 18px rgba(0,0,0,0.05), 0 1px 0 rgba(255,255,255,0.6) inset;
        transform: scale(0.93);
        opacity: 0.6;
        transition: transform 0.5s cubic-bezier(.2,.8,.2,1),
                    opacity   0.5s cubic-bezier(.2,.8,.2,1),
                    box-shadow 0.5s,
                    border-color 0.5s;
        scroll-snap-align: center;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active {
        transform: scale(1);
        opacity: 1;
        border-color: rgba(255,255,255,0.6);
        box-shadow: 0 20px 60px -12px rgba(0,0,0,0.18), 0 1px 0 rgba(255,255,255,0.5) inset;
        animation: ustyle-v4-card-float 4s ease-in-out infinite;
    }

    /* Shimmer light-sweep — only on active */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active::before {
        content: "";
        position: absolute; top: 0; bottom: 0; width: 40%; z-index: 10; pointer-events: none;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
        animation: ustyle-v4-shimmer-edge 2.5s ease-in-out infinite;
    }

    /* Hero — inset 8px, breathing zoom on active */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__image-wrap {
        margin: 8px !important; border-radius: 18px !important;
        height: 0 !important; padding-bottom: calc(100% - 16px) !important;
        aspect-ratio: auto !important;
        overflow: hidden; position: relative;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__image {
        animation: ustyle-v4-hero-breath 4s ease-in-out infinite;
    }
    /* Bottom gradient inside hero */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__image-wrap::after {
        content: "";
        position: absolute; left: 0; right: 0; bottom: 0; height: 60%;
        background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.10) 60%, transparent 100%);
        pointer-events: none; z-index: 1;
    }

    /* Glass badge — top-left of hero, slides in on active. Dark base
       (~55% black) instead of bright white-on-white-glass — Susanna
       reported the badge was invisible on light hero images, which
       happens whenever the try-on backdrop has any sky/wall/snow.
       Dark glass reads cleanly on every image; white border + text-
       shadow keep the badge legible at the edges. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__badge {
        position: absolute; top: 12px; left: 12px;
        background: rgba(0,0,0,0.55);
        backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255,255,255,0.30);
        color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
        padding: 5px 12px; border-radius: 999px; text-transform: uppercase;
        text-shadow: 0 1px 2px rgba(0,0,0,0.4);
        z-index: 3;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__badge {
        animation: ustyle-v4-badge-slide 0.4s 0.10s both;
    }

    /* Promo badge (-X%) — bouncy + glow on active. Top-right of hero. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__sale-badge {
        position: absolute; top: 16px; right: 16px;
        background: rgba(220,38,38,0.85);
        backdrop-filter: blur(14px);
        border: 1px solid rgba(255,255,255,0.20);
        color: #fff; font-size: 11px; font-weight: 700;
        padding: 5px 10px; border-radius: 999px; z-index: 3;
        box-shadow: 0 0 8px rgba(220,38,38,0.30);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__sale-badge {
        animation: ustyle-v4-bounce 2s ease-in-out infinite 1s,
                   ustyle-v4-glow-red 2s ease-in-out infinite 1s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__sale-count {
        display: none;  /* v4 collapses the secondary count pill into the badge */
    }

    /* Title overlay inside hero (bottom of image).
       Positioned relative to .ustyle-recs__image-wrap (which has margin:8px
       inside the card), so `left/right: 14, bottom: 12` mirrors the prototype's
       in-hero offsets exactly. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__hero-overlay {
        position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 2;
        color: #fff;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__hero-overlay-title {
        font-size: 19px; font-weight: 700; line-height: 1.2; color: #fff;
        text-shadow: 0 2px 10px rgba(0,0,0,0.35);
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__hero-overlay-title {
        animation: ustyle-v4-title-rise 0.45s 0.15s both;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__hero-overlay-row {
        margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__price-pill {
        display: inline-flex; align-items: center; gap: 6px;
        padding: 5px 12px; border-radius: 999px;
        background: rgba(255,255,255,0.18);
        backdrop-filter: blur(14px);
        border: 1px solid rgba(255,255,255,0.20);
        color: #fff; font-size: 13px; font-weight: 600;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__price-pill--promo {
        background: rgba(220,38,38,0.70);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__price-strike {
        text-decoration: line-through; opacity: 0.55; font-size: 12px; font-weight: 400;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__price-pill {
        animation: ustyle-v4-price-pop 0.35s 0.25s both;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__pieces-pill {
        display: inline-flex; align-items: center;
        background: rgba(255,255,255,0.12);
        backdrop-filter: blur(14px);
        border: 1px solid rgba(255,255,255,0.12);
        color: #fff; font-size: 11px; font-weight: 500;
        padding: 4px 10px; border-radius: 999px;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__pieces-pill {
        animation: ustyle-v4-price-pop 0.30s 0.30s both;
    }

    /* Hide the legacy product-title row + outer info block on v4
       (we put the title inside the hero overlay) */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__info {
        display: none !important;
    }
    /* The legacy hover overlay (with category items) is replaced by the
       items strip + reason accordion below. Hide it on mobile v4. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile .ustyle-recs__overlay {
        display: none !important;
    }

    /* Items strip — below hero, glass chips, staggered float */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__items-strip {
        padding: 6px 8px 2px;
        display: flex; gap: 8px; overflow-x: auto;
        scrollbar-width: none;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__items-strip::-webkit-scrollbar { display: none; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip {
        flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
        padding: 6px 10px 6px 6px; border-radius: 14px;
        background: rgba(255,255,255,0.7);
        border: 1px solid rgba(0,0,0,0.04);
        backdrop-filter: blur(8px);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip--main {
        background: rgba(26,24,20,0.05);
        border: 1.5px solid rgba(26,24,20,0.10);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-img {
        width: 36px; height: 36px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-img img {
        width: 100%; height: 100%; object-fit: cover; display: block;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-text { min-width: 0; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-cat {
        font-size: 8.5px; color: #8a8580; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.5px;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-name {
        font-size: 11.5px; font-weight: 500; color: #1a1814;
        white-space: nowrap; max-width: 90px;
        overflow: hidden; text-overflow: ellipsis;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip {
        animation: ustyle-v4-chip-float 3s ease-in-out infinite;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip:nth-child(1) { animation-delay: 0.4s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip:nth-child(2) { animation-delay: 0.8s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip:nth-child(3) { animation-delay: 1.2s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip:nth-child(4) { animation-delay: 1.6s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__chip:nth-child(5) { animation-delay: 2.0s; }

    /* CTA button — glow + shimmer + wiggling arrow on active */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__cta {
        margin: 6px 12px 12px; padding: 13px 20px; border-radius: 14px; border: none;
        background: #1a1814; color: #fff; font-size: 13px; font-weight: 600;
        cursor: pointer; letter-spacing: 0.2px; width: calc(100% - 24px);
        display: flex; align-items: center; justify-content: center; gap: 6px;
        box-shadow: 0 4px 14px rgba(0,0,0,0.15);
        position: relative; overflow: hidden;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__cta {
        animation: ustyle-v4-cta-glow 2.5s ease-in-out infinite 0.8s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__cta::after {
        content: "";
        position: absolute; top: 0; bottom: 0; width: 30%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
        animation: ustyle-v4-shimmer-edge 3s ease-in-out infinite 1.5s;
        pointer-events: none;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.is-active .ustyle-recs__cta-arrow {
        display: inline-block; animation: ustyle-v4-wiggle 2s ease-in-out infinite 0.5s;
    }

    /* V4 loader tile — applies to the existing loader-tile container */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__loader-tile,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile--loader {
        flex: 0 0 306px !important; max-width: 306px !important;
        background: rgba(255,255,255,0.4);
        backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
        border: 1px dashed rgba(0,0,0,0.10);
        border-radius: 24px; opacity: 1;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 14px; min-height: 420px; padding: 24px;
        box-shadow: none; transform: scale(0.96);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile--loader > * { width: 100%; text-align: center; }

    /* Pill dots + counter are hidden on v4 — the carousel is infinite-scroll
       (cyclic feed), so a finite "1/N" indicator is misleading. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__dots,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__dots-counter,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__dot {
        display: none !important;
    }

    /* Restore swipe hint on v4 */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__swipe-hint {
        display: block !important; text-align: center;
        font-size: 12px; color: #94a3b8; padding: 4px 0; font-weight: 500;
    }

    /* Side fade edges */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__track-wrap {
        position: relative;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__fade-left,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__fade-right {
        position: absolute; top: 0; bottom: 0; width: 24px; z-index: 2; pointer-events: none;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__fade-left  { left: 0;  background: linear-gradient(to right, #faf8f4, transparent); opacity: 0; transition: opacity 0.25s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__fade-right { right: 0; background: linear-gradient(to left,  #faf8f4, transparent); }
    .ustyle-recs-section[data-v4-mobile="1"][data-scrolled="1"] .ustyle-recs__fade-left { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════
 * v4 DESKTOP — viewports ≥ 481px, opt-in via data-v4-mobile="1".
 * Matches the v4 prototype DesktopCard:
 *   - Hero with bottom gradient + glass badge (top-left)
 *   - Title + price pill overlay at hero bottom
 *   - Frosted panel "items strip" that overlaps -14px into hero
 *   - 4 equal-flex compact 1:1 thumbs, category-only caption
 *   - No CTA button on desktop card (CTA is the whole tile click)
 * ════════════════════════════════════════════════════════════ */
@media (min-width: 481px) {

    /* Hide v4 CTA button on desktop — desktop card has no bottom CTA */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__cta {
        display: none !important;
    }

    /* Items strip — frosted panel that overlaps -14px upward into hero */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__items-strip {
        margin: -14px 8px 0;
        padding: 10px 8px 8px;
        background: rgba(255,255,255,0.65);
        backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
        border-radius: 0 0 16px 16px;
        border: 1px solid rgba(255,255,255,0.5);
        border-top: none;
        box-shadow: 0 8px 24px -8px rgba(0,0,0,0.08);
        display: flex; gap: 5px;
        justify-content: center;       /* center chips when count < 4 */
        position: relative; z-index: 2;
        overflow: visible;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__items-strip::-webkit-scrollbar {
        display: none;
    }

    /* Each chip = FIXED 54px wide column, regardless of chip count.
       Previously used `flex: 1 1 0` which stretched chips to fill the strip
       — so 2 chips were 2× the size of 4 chips. Now every chip is the same
       54×54 thumbnail no matter how many items are in the outfit.
       4 chips × 54 + 3 × 5px gap = 231px, fits the 232px strip cleanly.
       Strip uses `justify-content: flex-start` so smaller counts left-align. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip--main {
        flex: 0 0 54px; min-width: 54px; max-width: 54px;
        text-align: center;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        display: block;
        animation: ustyle-v4-chip-float 3s ease-in-out infinite;
        animation-delay: 0.2s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip:nth-child(2) { animation-delay: 0.8s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip:nth-child(3) { animation-delay: 1.4s; }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip:nth-child(4) { animation-delay: 2.0s; }

    /* Cap at 4 thumbs (prototype: [main, ...items].slice(0, 4)) */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip:nth-child(n+5) {
        display: none !important;
    }

    /* 1:1 thumbnail — full chip width, white border */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-img {
        display: block; width: 100%; height: auto;
        aspect-ratio: 1/1;
        border-radius: 10px; overflow: hidden;
        border: 2px solid rgba(255,255,255,0.6);
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        margin: 0; padding: 0;
        transition: border-color 0.3s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-img img {
        width: 100%; height: 100%; object-fit: cover; display: block;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:hover .ustyle-recs__chip--main .ustyle-recs__chip-img {
        border-color: rgba(26,24,20,0.40);
    }

    /* Caption: only category, NO item name (matches prototype lines 265-271) */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-name {
        display: none !important;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-text {
        margin: 3px 0 0; padding: 0;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__chip-cat {
        font-size: 8.5px; color: #6b6560; font-weight: 600;
        letter-spacing: 0.3px; text-transform: uppercase;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        text-align: center; line-height: 1.2;
    }

    /* Hero overlay — smaller text/positioning for narrower desktop tile.
       bottom: 32px gives the title+price pair clearance from the items
       strip that overlaps -14px upward into the hero — at the previous
       14px the price pill sat right at the strip overlap zone and
       looked cramped / partially clipped. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__hero-overlay {
        position: absolute; left: 14px; right: 14px; bottom: 32px;
        z-index: 2; color: #fff;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__hero-overlay-title {
        font-size: 15px; font-weight: 600; line-height: 1.25; color: #fff;
        text-shadow: 0 1px 8px rgba(0,0,0,0.35);
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__hero-overlay-row {
        margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__price-pill {
        display: inline-flex; align-items: center; gap: 6px;
        padding: 4px 10px; border-radius: 999px;
        background: rgba(255,255,255,0.18);
        backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255,255,255,0.20);
        color: #fff; font-size: 12px; font-weight: 600;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__price-pill--promo {
        background: rgba(220,38,38,0.70);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__price-strike {
        text-decoration: line-through; opacity: 0.55;
        font-size: 11px; font-weight: 400;
    }
    /* Desktop card omits the "X pezzi" pill (prototype only shows price) */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__pieces-pill {
        display: none !important;
    }

    /* Glass badge — tighter, smaller font on desktop. Dark base for
       legibility on light hero images (matches mobile fix). */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__badge {
        position: absolute; top: 10px; left: 10px;
        background: rgba(0,0,0,0.55);
        backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255,255,255,0.30);
        color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
        padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
        text-shadow: 0 1px 2px rgba(0,0,0,0.4);
        z-index: 3;
    }

    /* Hero gradient — same recipe as mobile, sits inside image-wrap */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__image-wrap {
        position: relative; border-radius: 20px; overflow: hidden;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__image-wrap::after {
        content: "";
        position: absolute; left: 0; right: 0; bottom: 0; height: 60%;
        background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.10) 60%, transparent 100%);
        pointer-events: none; z-index: 1;
    }

    /* Light-sweep shimmer — runs unconditionally on every desktop tile,
       staggered by position so the row has a continuous "shine" rolling
       across cards. Matches the prototype DesktopCard which runs
       shimmerEdge always-on with `index * 0.5s` stagger. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__image-wrap::before {
        content: "";
        position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
        z-index: 5; pointer-events: none;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.13), transparent);
        animation: ustyle-v4-shimmer-edge 3s ease-in-out infinite;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:nth-child(2) .ustyle-recs__image-wrap::before {
        animation-duration: 3.3s; animation-delay: 0.5s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:nth-child(3) .ustyle-recs__image-wrap::before {
        animation-duration: 3.6s; animation-delay: 1s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:nth-child(4) .ustyle-recs__image-wrap::before {
        animation-duration: 3.9s; animation-delay: 1.5s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:nth-child(5) .ustyle-recs__image-wrap::before {
        animation-duration: 4.2s; animation-delay: 2s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:nth-child(6) .ustyle-recs__image-wrap::before {
        animation-duration: 4.5s; animation-delay: 2.5s;
    }

    /* Hide legacy product-title row (info block) — title lives in hero overlay */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__info {
        display: none !important;
    }
    /* Legacy hover overlay (with category list) is replaced by the items strip */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__overlay {
        display: none !important;
    }

    /* Tile: prototype DesktopCard has NO outer chrome (just hero + strip).
       Strip the legacy card background/border/shadow so the v4 hero +
       frosted-panel strip own the visual layering. Keep flex sizing intact. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile {
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    /* Loader tile on desktop — frosted glass card matching the v4 chrome
       we strip from real tiles, with centered spinner + text. Without this
       rule, the chrome-strip above would leave the spinner at top-left.
       More specific than the .ustyle-recs__tile rule above so it wins. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.ustyle-recs__loader-tile {
        background: rgba(255,255,255,0.42) !important;
        border: 1px dashed rgba(0,0,0,0.10) !important;
        border-radius: 24px !important;
        backdrop-filter: blur(16px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
        box-shadow: 0 4px 18px rgba(0,0,0,0.05) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 14px;
        padding: 24px;
        min-height: 380px;
        flex: 0 0 280px !important;
        max-width: 280px !important;
        transform: scale(0.96);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile.ustyle-recs__loader-tile > * {
        width: auto;
        text-align: center;
    }

    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__tile:hover {
        /* Soft lift on hover — replaces the legacy shadow swap */
        transform: translateY(-3px);
        box-shadow: none !important;
    }

    /* ─── V4 nav arrows (desktop) ───
       Override the legacy nav-btn recipe with the softer prototype values
       (lighter gradient, smaller blur, simpler shadows, scale-on-press,
       chevron SVG with hover-nudge). Position arrows close to the track
       edges, slightly outdented. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn {
        top: 42% !important;
        transform: translateY(-50%) !important;
        width: 44px !important; height: 44px !important;
        border-radius: 999px !important;
        background:
            linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.4) 100%) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
        border: 1px solid rgba(255,255,255,0.55) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.9),
            inset 0 -1px 0 rgba(0,0,0,0.04),
            inset 0 0 14px rgba(255,255,255,0.15),
            0 6px 20px rgba(0,0,0,0.08) !important;
        color: #1a1814 !important;
        display: grid !important;
        place-items: center;
        padding: 0 !important;
        line-height: 1;
        z-index: 4;
        transition: all 0.25s cubic-bezier(.2,.8,.2,1) !important;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn:hover {
        background:
            linear-gradient(135deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.65) 100%) !important;
        transform: translateY(-50%) scale(1.08) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.95),
            inset 0 -1px 0 rgba(0,0,0,0.06),
            inset 0 0 18px rgba(255,255,255,0.2),
            0 10px 28px rgba(0,0,0,0.14) !important;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn:active {
        transform: translateY(-50%) scale(0.9) !important;
    }
    /* Hug the card edges instead of the section edges. The section has 5%
       horizontal padding on desktop; the cards start at that boundary. By
       positioning arrows at `calc(5% - 38px)` we shift them inward so the
       arrow's far edge aligns with — and slightly overlaps — the first/last
       card. Matches the v4 prototype's "[side]: -6 from track" intent.
       Wider screens (≥1401px) use 8% section padding, so we shift by the
       same delta there too. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--prev {
        left: calc(5% - 38px) !important;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--next {
        right: calc(5% - 38px) !important;
    }
    @media (min-width: 1401px) {
        .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--prev {
            left: calc(8% - 38px) !important;
        }
        .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--next {
            right: calc(8% - 38px) !important;
        }
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn svg {
        width: 16px; height: 16px;
        stroke: #1a1814; stroke-width: 2;
        fill: none;
        transition: transform 0.2s;
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--prev:hover svg {
        transform: translateX(-2px);
    }
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__nav-btn--next:hover svg {
        transform: translateX(2px);
    }

    /* On desktop the personalized header row + dots/swipe-hint shouldn't
       inherit the mobile-only v4 typography; reset back to legacy. */
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__dots-counter,
    .ustyle-recs-section[data-v4-mobile="1"] .ustyle-recs__swipe-hint {
        display: none !important;
    }
}

