/**
 * Yitu Storefront —— 商品流模块。
 *
 * 卡片本身复用 Electro 的 .products .product 样式，这里只管容器、标签栏、
 * 骨架屏与状态区。列数是模块默认节奏（移动 2 / 平板 4 / 桌面 6），
 * 具体页面要不同节奏时用更高特异性的选择器覆盖（如子主题的购物车 CSS）。
 */

.ysf-feed {
    margin: 16px 0 32px;
}

.ysf-feed-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    padding: 0 4px;
}

/* ---------- 标签栏 ---------- */

.ysf-feed-tabs-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 14px;
}

.ysf-feed-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.ysf-feed-tabs {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0 4px;
    white-space: nowrap;
}

.ysf-feed-tab {
    flex: 0 0 auto;
    padding: 7px 16px;
    border-radius: 18px;
    background: #f2f2f2;
    color: #444;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background .2s, color .2s;
}

.ysf-feed-tab:hover {
    background: #e6e6e6;
}

.ysf-feed-tab:focus-visible {
    outline: 2px solid #cc0000;
    outline-offset: 2px;
}

.ysf-feed-tab.is-active {
    background: #cc0000;
    color: #fff;
    font-weight: 600;
}

/* ---------- 商品网格 ---------- */

.ysf-feed-grid.products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0 4px;
}

.ysf-feed-grid.products::before,
.ysf-feed-grid.products::after {
    display: none;
}

/* Electro 的循环卡片默认带浮动与百分比宽度，进网格前要先解开。 */
.ysf-feed-grid.products li.product {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
}

@media (min-width: 769px) and (max-width: 1199px) {
    .ysf-feed-grid.products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .ysf-feed-grid.products {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* ---------- 全宽变体 .ysf-feed--full ---------- */

/*
 * `[storefront_feed full_width="yes"]` 用的列数节奏，比模块默认（2 / 4 / 6）
 * 密一档，卡片全程稳定在 ~190-240px：容器铺满 1920 屏后再用 6 列，
 * 每列会撑到 320px 以上，图片糊、信息密度也垮。断点与 Última Llegada
 * 页的栅格对齐，两处观感一致。
 *
 * 只管网格列数——把外层容器撑开是消费页面自己的事（主题的 .container
 * 限宽插件管不着）。特异性 0,0,3,0 高于上面的默认规则。
 *
 * 前身是一段带 .woocommerce-cart 前缀的购物车专属覆盖（2 / 3 / 5），
 * 2026-09-06 随本变体删除：插件按「页面是谁」写死样式本就是耦合，
 * 改成按能力划分，哪个页面要全宽就传参数。
 */

.ysf-feed--full .ysf-feed-grid.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 576px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (min-width: 1600px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

@media (min-width: 1920px) {
    .ysf-feed--full .ysf-feed-grid.products {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

/* 推荐区紧跟在页面自己的头部区块后面，模块的上外边距会显得空。 */
.recommended-products .ysf-feed {
    margin-top: 0;
}

/* ---------- 骨架屏 ---------- */

.ysf-feed-skeleton-item {
    list-style: none;
}

.ysf-feed-skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: ysf-feed-shimmer 1.2s ease-in-out infinite;
    aspect-ratio: 3 / 4;
}

@keyframes ysf-feed-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* ---------- 状态区 ---------- */

.ysf-feed-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #888;
    font-size: 13px;
}

.ysf-feed-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #eee;
    border-top-color: #cc0000;
    border-radius: 50%;
    animation: ysf-feed-spin .8s linear infinite;
    display: inline-block;
}

@keyframes ysf-feed-spin {
    to { transform: rotate(360deg); }
}

.ysf-feed-retry {
    border: 1px solid #cc0000;
    color: #cc0000;
    background: #fff;
    border-radius: 16px;
    padding: 6px 18px;
    font-size: 13px;
    cursor: pointer;
}

.ysf-feed-retry:hover {
    background: #cc0000;
    color: #fff;
}

.ysf-feed-trigger {
    height: 1px;
}

/* 用户开了「减少动态效果」时停掉所有循环动画。 */
@media (prefers-reduced-motion: reduce) {
    .ysf-feed-skeleton,
    .ysf-feed-spinner {
        animation: none;
    }
}
