/* public/assets/test/css/partials/home-items-v2.css */
/* Home Items V2
   - PC: 5 columns, design-like spacing (20) + cleaner cards
   - Mobile: 3 columns, show 9 only + big "All Games" pill (keep your current font/weight)
*/

/* =========================
   Home unified container
   ========================= */
:root{
    /* 统一首页内容宽度：介于 banner(更宽) 与 items(更窄) 的“中间值” */
    --home-maxw: 1300px;
    --home-gutter: 100px;     /* 总留白=100 => 每侧约50 */
    --home-gutter-m: 26px;    /* 总留白=26  => 每侧约13 */

    /* Items tokens */
    --iv2-text:#111827;
    --iv2-muted:rgba(17,24,39,.55);

    /* 更“干净”的卡片质感：轻阴影 + 轻描边 */
    --iv2-radius: 20px;
    --iv2-shadow: 0 14px 34px rgba(15,23,42,.10);
    --iv2-shadow-hover: 0 18px 48px rgba(15,23,42,.14);
    --iv2-stroke: rgba(15,23,42,.06);

    /* PC card ratio: 264 x 340 */
    --iv2-ar-w: 264;
    --iv2-ar-h: 340;
}

/* 统一所有模块 inner 容器宽度（只命中首页这些块，不影响别页） */
#home_banner_v3.hmb3 .hmb3-inner,
#home_items.iv2 .iv2-inner,
#home_recent .home-recent-inner,
#why_flashmunk .wf-inner{
    width: min(var(--home-maxw), calc(100% - var(--home-gutter)));
    margin-inline: auto;
}

@media (max-width: 860px){
    #home_banner_v3.hmb3 .hmb3-inner,
    #home_items.iv2 .iv2-inner,
    #home_recent .home-recent-inner,
    #why_flashmunk .wf-inner{
        width: calc(100% - var(--home-gutter-m));
    }
}

/* banner 右下角 controls 桌面端跟容器对齐（避免写死 56px） */
#home_banner_v3.hmb3 .hmb3-controls{
    right: calc(
        (100% - min(var(--home-maxw), calc(100% - var(--home-gutter)))) / 2 + 6px
    );
}
@media (max-width: 860px){
    #home_banner_v3.hmb3 .hmb3-controls{ right: 14px; }
}

/* =========================
   Items section
   ========================= */
#home_items.iv2{
    padding: 0px 0 34px;
}

#home_items.iv2 .iv2-block + .iv2-block{
    margin-top: 38px;
}

/* ===== Head (match your design) ===== */
#home_items.iv2 .iv2-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 16px;
    margin-bottom: 18px;
}

#home_items.iv2 .iv2-title{
    display:flex;
    align-items:center;
    gap: 10px;

    color: var(--iv2-text);
    font-weight: 900;
    font-size: 28px;          /* PC 标题更“像设计图” */
    letter-spacing: -0.3px;
    line-height: 1.15;
}

#home_items.iv2 .iv2-emoji{
    font-size: 20px;
    transform: translateY(1px);
}

/* ✅ All Games（右上角）——保持你现在的字号/粗体，不改 */
#home_items.iv2 .iv2-more{
    display:inline-flex;
    align-items:center;
    gap: 8px;

    text-decoration:none;
    color: rgba(17,24,39,.55);
    font-weight: 700;     /* 保留 */
    font-size: 14px;      /* 保留 */
    padding: 6px 0;
}
#home_items.iv2 .iv2-more:hover{
    color: rgba(17,24,39,.92);
}
#home_items.iv2 .iv2-arrow{
    font-size: 16px;
    transform: translateY(-1px);
}

/* ===== Grid (design spacing = 20) ===== */
#home_items.iv2 .iv2-grid{
    display:grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;               /* ✅你图里的核心节奏：20 */
}

/* ===== Card ===== */
#home_items.iv2 .iv2-card{
    text-decoration:none;
    color: inherit;
    display:block;
    -webkit-tap-highlight-color: transparent;
}

#home_items.iv2 .iv2-cover{
    position: relative;
    width: 100%;
    aspect-ratio: calc(var(--iv2-ar-w) / var(--iv2-ar-h));
    border-radius: var(--iv2-radius);
    overflow: hidden;

    background: #e5e7eb;
    box-shadow: var(--iv2-shadow);

    /* ✅更像设计稿：轻描边 + 更顺滑 hover */
    outline: 1px solid var(--iv2-stroke);
    outline-offset: -1px;

    transform: translateY(0);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        filter 180ms ease;
}

#home_items.iv2 .iv2-card:hover .iv2-cover{
    transform: translateY(-3px);
    box-shadow: var(--iv2-shadow-hover);
    filter: saturate(1.02);
}

#home_items.iv2 .iv2-card:focus-visible .iv2-cover{
    outline: 2px solid rgba(37,99,235,.45);
    outline-offset: 2px;
}

#home_items.iv2 .iv2-cover img{
    width:100%;
    height:100%;
    object-fit: cover;
    display:block;
}

/* placeholder */
#home_items.iv2 .iv2-ph{
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    background: linear-gradient(135deg, rgba(15,23,42,.16), rgba(15,23,42,.06));
    color: rgba(17,24,39,.75);
    font-size: 34px;
    font-weight: 900;
}

/* discount badge (top-right) — 更像设计稿的小贴片 */
#home_items.iv2 .iv2-off{
    position:absolute;
    top: 12px;
    right: 12px;
    z-index: 5;

    height: 22px;
    line-height: 22px;
    padding: 0 10px;
    border-radius: 999px;

    background: #FFCB2E;
    color: #111;
    font-weight: 900;
    font-size: 12px;

    box-shadow: 0 10px 18px rgba(0,0,0,.10);
}

/* bottom overlay (更干净，不要太黑) */
#home_items.iv2 .iv2-bottom{
    position:absolute;
    left:0; right:0; bottom:0;
    padding: 14px 14px 12px;

    background: linear-gradient(
        180deg,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,.38) 58%,
        rgba(0,0,0,.60) 100%
    );
}

#home_items.iv2 .iv2-name{
    color:#fff;
    font-weight: 900;
    font-size: 16px;
    line-height: 1.15;
    white-space: nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}

#home_items.iv2 .iv2-meta{
    margin-top: 10px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;

    color: rgba(255,255,255,.72);
    font-weight: 700;
    font-size: 12px;
}

#home_items.iv2 .iv2-rate{
    display:inline-flex;
    align-items:center;
    gap: 6px;
}

#home_items.iv2 .iv2-star{
    color:#FFCB2E;
    transform: translateY(-0.5px);
}
#home_items.iv2 .iv2-score{
    color:#FFCB2E;
    font-weight: 900;
}

/* foot button: PC hidden */
#home_items.iv2 .iv2-foot{ display:none; }

/* =========================
   Responsive (PC -> tablet)
   ========================= */
@media (max-width: 1280px){
    /* 屏幕小一点：保持 5 列但收一点 gap */
    #home_items.iv2 .iv2-grid{ gap: 18px; }
}
@media (max-width: 1120px){
    #home_items.iv2 .iv2-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 920px){
    #home_items.iv2 .iv2-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =========================
   Mobile: keep your current behavior
   - 3 columns
   - show 9 only
   - All Games pill keep your current font/weight
   ========================= */
@media (max-width: 860px){

    #home_items.iv2{
        padding: 16px 0 30px;
    }

    #home_items.iv2 .iv2-title{
        font-size: 22px;
    }
    #home_items.iv2 .iv2-emoji{
        font-size: 16px;
    }

    #home_items.iv2 .iv2-grid{
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px 10px;
    }

    /* mobile card ratio close to fig (≈ 3/4) */
    #home_items.iv2 .iv2-cover{
        aspect-ratio: 3 / 4;
        border-radius: 14px;
        box-shadow: 0 10px 18px rgba(15,23,42,.10);
    }

    #home_items.iv2 .iv2-off{
        top: 8px; right: 8px;
        height: 22px;
        line-height: 22px;
        padding: 0 9px;
        font-size: 12px;
        border-radius: 999px;
    }

    #home_items.iv2 .iv2-bottom{
        padding: 10px 10px 9px;
    }
    #home_items.iv2 .iv2-name{
        font-size: 13px;
    }
    #home_items.iv2 .iv2-meta{
        margin-top: 6px;
        font-size: 11px;
    }

    /* ✅ 只显示 9 个：第 10 个开始隐藏 */
    #home_items.iv2 .iv2-grid > .iv2-card:nth-child(n+10){
        display: none !important;
    }

    /* bottom big button */
    #home_items.iv2 .iv2-foot{
        display:block;
        margin-top: 18px;
    }

    /* ✅ All Games（底部按钮）——保留你现在的字体/粗体 */
    #home_items.iv2 .iv2-morebtn{
        width: 100%;
        height: 42px;
        border-radius: 999px;
        background: rgba(255,255,255,.95);
        border: 1px solid rgba(15,23,42,.10);

        display:flex;
        align-items:center;
        justify-content:center;
        gap: 10px;

        text-decoration:none;
        color: #111827;

        font-weight: 600;   /* 保留 */
        font-size: 14px;    /* 保留 */

        box-shadow: 0 12px 26px rgba(15,23,42,.08);
        -webkit-tap-highlight-color: transparent;
    }

    #home_items.iv2 .iv2-morebtn .iv2-arrow{
        font-size: 20px;
        transform: translateY(-1px);
        opacity: .75;
    }

    #home_items.iv2 .iv2-morebtn:active{
        transform: translateY(1px);
        box-shadow: 0 8px 18px rgba(15,23,42,.06);
    }
}




/* =========================================
   Mobile only: 顶部保持不动，只让底部渐变到白
   追加到文件最后
   ========================================= */
@media (max-width: 860px){

    #home_items.iv2{
        position: relative;
        overflow: hidden;
        isolation: isolate;

        /* 不改顶部现有衔接，只增加底部可见空间 */
        padding-bottom: 56px;
        background: transparent !important;
    }

    /* 内容层抬高，避免被底部渐变层影响 */
    #home_items.iv2 .iv2-inner{
        position: relative;
        z-index: 2;
    }

    /* 只在底部铺一层：透明 -> 白 */
    #home_items.iv2::after{
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 150px;
        z-index: 1;
        pointer-events: none;

        background: linear-gradient(
            180deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0) 42%,
            rgba(255, 255, 255, .22) 62%,
            rgba(255, 255, 255, .52) 78%,
            rgba(255, 255, 255, .82) 90%,
            rgba(255, 255, 255, 1) 100%
        );
    }

    /* 底部按钮和渐变区更自然 */
    #home_items.iv2 .iv2-foot{
        margin-bottom: 8px;
    }
}