/* =========================================================
   MODULAR PROMOTION: GRID LAYOUT & CARD UI (DESIGN SYSTEM 2.0)
   ========================================================= */

/* --- 0. SECTION & HEADER --- */
.st-grid-promotion {
    padding: var(--st-section-padding-y, clamp(1rem, 2vw, 1.75rem)) 0;
}

.st-promo-header {
    border-bottom: none;
    margin-bottom: clamp(10px, 1.5vw, 16px);
}

.st-promo-header h2.st-section-title {
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    font-size: clamp(1.125rem, 1.4vw + 0.4rem, 1.375rem); /* Proposional 18px - 22px, tidak kebesaran */
    font-weight: 700;
    color: var(--st-charcoal-900, #111827);
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.st-promo-subtitle {
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    font-size: clamp(0.8125rem, 0.4vw + 0.7rem, 0.875rem); /* 13px - 14px */
    font-weight: 400;
    color: var(--st-charcoal-600, #4b5563);
    margin: var(--st-space-1, 4px) 0 0 0;
    line-height: 1.5;
    letter-spacing: 0;
}

/* --- 1. BASE CARD UI --- */
.st-card-promo {
    background: var(--st-surface-card, #FFFFFF);
    border: 1px solid var(--st-stone-200, #e7e5e4);
    border-radius: var(--st-radius-lg, 16px);
    position: relative;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    will-change: transform;
}

.st-card-promo:hover {
    box-shadow: var(--st-shadow-card, 0 4px 16px -3px rgba(0, 0, 0, 0.05), 0 2px 6px -2px rgba(0, 0, 0, 0.02));
    border-color: var(--st-stone-300, #d6d3d1);
}

.st-card-promo-link {
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
}

.st-card-promo-thumb {
    position: relative;
    border-radius: calc(var(--st-radius-lg, 16px) - 1px) calc(var(--st-radius-lg, 16px) - 1px) 0 0;
    overflow: hidden; 
    background: var(--st-surface-subtle, #FAF8F7);
    isolation: isolate; 
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0); 
    aspect-ratio: 4 / 5; /* 4:5 portrait per Section 6.1 & 7 Rule 5 */
}

.st-card-promo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Promo Badge */
.st-card-promo .product-badge-promo {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--st-brand-700, #be0038);
    color: #ffffff;
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--st-radius-full, 9999px);
    z-index: 2;
    line-height: 1.2;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Matikan tombol overlay "Detail Produk" agar tidak muncul */
.st-card-promo .product-card-overlay,
.st-card-promo .btn-product-view {
    display: none !important;
}

/* --- HOVER EFFECTS --- */
.st-card-promo.hover-zoom:hover .st-card-promo-thumb img {
    transform: scale(1.05) translateZ(0);
}

.st-card-promo.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.st-card-promo.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--st-shadow-hover, 0 10px 25px -5px rgba(0, 0, 0, 0.08));
}

/* --- 2. CARD CONTENT (Rapat & Harmonis: Jarak Judul & Harga Dekat) --- */
.st-card-promo-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    padding: 12px 10px 14px 10px !important;
    text-align: center !important;
    flex-grow: 1;
    border: none !important; /* Dilarang ada garis divider */
}

.st-card-promo-title {
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    font-size: 14px !important;
    font-weight: 700;
    margin: 0 !important;
    color: var(--st-charcoal-900, #111827) !important;
    line-height: 1.35;
    text-transform: capitalize;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.st-card-promo:hover .st-card-promo-title {
    color: var(--st-brand-700, #be0038) !important;
}

.st-card-promo-price {
    display: flex !important;
    justify-content: center !important;
    align-items: baseline !important;
    gap: 6px;
    width: 100%;
    margin-top: 2px;
}

.st-card-promo-price .actual {
    color: var(--st-brand-700, #be0038) !important;
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    font-weight: 800;
    font-size: 15px !important;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.st-card-promo-price .old {
    color: var(--st-stone-400, #9ca3af) !important;
    font-family: var(--st-font-family, 'Plus Jakarta Sans', sans-serif);
    text-decoration: line-through;
    font-size: 11.5px !important;
    line-height: 1.2;
    font-weight: 400;
}

/* --- 3. LAYOUT: CAROUSEL SNAP --- */
.st-promo-container.st-layout-carousel-snap {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 var(--st-gutter-mobile, 16px); 
    gap: 16px;
    padding: 4px 0 8px 0;
    scrollbar-width: none; 
    -ms-overflow-style: none;
}

.st-promo-container.st-layout-carousel-snap::-webkit-scrollbar {
    display: none;
}

.st-promo-container.st-layout-carousel-snap .st-card-promo {
    flex: 0 0 220px;
    min-width: 200px;
    max-width: 240px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* --- 4. CAROUSEL NAVIGATION ARROWS --- */
.st-nav-arrow {
    display: none;
}

@media (min-width: 1024px) {
    .st-grid-promotion .st-container {
        position: relative;
    }

    .st-nav-arrow {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: calc(50% + 15px); 
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        background: #ffffff;
        border: 1px solid var(--st-stone-200, #e7e5e4);
        border-radius: var(--st-radius-full, 9999px);
        color: var(--st-charcoal-700, #374151);
        cursor: pointer;
        z-index: 10;
        transition: all 0.2s ease;
        box-shadow: var(--st-shadow-card, 0 4px 12px rgba(0,0,0,0.06));
    }

    .st-nav-arrow:hover {
        background: var(--st-brand-700, #be0038);
        color: #ffffff;
        border-color: var(--st-brand-700, #be0038);
        transform: translateY(-50%) scale(1.05);
    }

    .st-nav-arrow.prev { left: -16px; }
    .st-nav-arrow.next { right: -16px; }
}

@media (max-width: 639px) {
    .st-promo-container.st-layout-carousel-snap {
        gap: 12px;
        scroll-padding: 0 var(--st-gutter-mobile, 16px);
    }

    .st-promo-container.st-layout-carousel-snap .st-card-promo {
        flex: 0 0 185px;
        min-width: 170px;
        max-width: 195px;
    }

    .st-card-promo-content {
        padding: 10px 8px 12px 8px !important;
        gap: 3px !important;
    }

    .st-card-promo-title {
        font-size: 13px !important;
    }

    .st-card-promo-price .actual {
        font-size: 14px !important;
    }
}

/* --- 5. LAYOUT: FEATURED (DESKTOP) --- */
@media (min-width: 769px) {
    .st-promo-container.st-layout-featured {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr); 
        grid-template-rows: repeat(2, 1fr);
        column-gap: 25px; 
        row-gap: 12px; 
        height: 550px; /* Batas tinggi grid desktop */
    }

    .st-promo-container.st-layout-featured .st-card-promo:first-child {
        grid-column: span 2;
        grid-row: span 2;
    }

    .st-promo-container.st-layout-featured .st-card-promo:not(:first-child) .st-card-promo-thumb {
        height: 100%;
        aspect-ratio: auto !important;
        position: relative;
        overflow: hidden;
    }

    .st-promo-container.st-layout-featured .st-card-promo:not(:first-child) .st-card-promo-thumb img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover !important;
    }
}

/* --- 6. LAYOUT: SCROLL SNAP (MOBILE) --- */
@media (max-width: 768px) {
    .st-promo-container.st-layout-featured {
        /* Kita timpa grid desktop menjadi flex agar bisa scroll samping */
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        
        /* Layouting */
        gap: 15px; 
        padding: 10px 20px 30px 20px !important;
        margin-left: -20px;
        margin-right: -20px;
        height: auto; /* Matikan batas tinggi desktop */
        
        scrollbar-width: none;
    }

    .st-promo-container.st-layout-featured::-webkit-scrollbar {
        display: none;
    }

    /* Reset aturan 'first-child' desktop agar sama rata di mobile */
    .st-promo-container.st-layout-featured .st-card-promo {
        flex: 0 0 82%; 
        scroll-snap-align: center;
        grid-column: auto !important; /* Reset grid spans */
        grid-row: auto !important;
    }

    /* Pastikan gambar di semua card mobile tetap konsisten */
    .st-promo-container.st-layout-featured .st-card-promo .st-card-promo-thumb {
        position: relative;
        height: auto;
        aspect-ratio: 1 / 1; /* Di mobile buat kotak agar seragam */
    }

    .st-promo-container.st-layout-featured .st-card-promo .st-card-promo-thumb img {
        position: relative; /* Bukan absolute agar aspect-ratio bekerja */
        width: 100%;
        height: 100%;
        object-fit: cover !important;
    }
}