/* hero trang chủ: túi lớn tách nền trượt qua lại. Mỗi túi nằm trên nền xám nhạt (ảnh sản phẩm có nền trắng nên dùng
   mix-blend-mode: multiply để nền trắng biến mất, túi như trôi trên trang). Túi đang chọn (data-pos="0") ở giữa, túi kế bên
   hiện mờ và nhỏ ở hai phía, các túi còn lại ẩn; đổi sản phẩm thì data-pos đổi và CSS chuyển động. Chữ thương hiệu khổng lồ
   phía sau trượt xa hơn túi nên có cảm giác chiều sâu. JS (hero-bag.js) chỉ đặt data-pos, tự chuyển, phím/bấm túi bên và đổi chữ. */

.hb {
    --hb-pad: clamp(24px, 6vw, 96px);
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #efeff0;
    color: #121214;
}

.hb-inner {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    min-height: clamp(520px, 78vh, 680px);
}

/* ---------- chữ giới thiệu (đổi theo túi đang ở giữa) ---------- */
.hb-text {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 24px var(--hb-pad) 40px;
}

.hb-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #71717a;
}

.hb-title {
    margin: 0;
    font-size: clamp(2rem, 4.2vw, 3.5rem);
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1.2;
    color: #121214;
}

.hb-desc {
    max-width: 40ch;
    min-height: 3.2em;
    margin: 0 0 8px;
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
    line-height: 1.6;
    color: #52525b;
    text-wrap: pretty;
}

.hb-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #121214;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid #121214;
    transition: background-color 0.2s ease, color 0.2s ease, gap 0.2s ease;
}

.hb-btn:hover,
.hb-btn:focus-visible {
    background: transparent;
    color: #121214 !important;
    gap: 16px;
}

/* mỗi lần đổi túi, chữ trượt vào lại */
.hb-text.is-swap > * {
    animation: hb-rise 0.9s ease-out both;
}

.hb-text.is-swap > :nth-child(2) { animation-delay: 0.1s; }
.hb-text.is-swap > :nth-child(3) { animation-delay: 0.2s; }
.hb-text.is-swap > :nth-child(4) { animation-delay: 0.3s; }

/* ---------- sân khấu: túi trượt qua lại ---------- */
.hb-stage {
    position: relative;
    height: 480px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    outline-offset: -4px;
    /* hai mép mờ dần để chữ thương hiệu khổng lồ và túi ở hai bên không bị cắt cứng */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}

/* bóng đổ dưới túi đang ở giữa, co giãn ngược với nhịp trôi lên xuống */
.hb-shadow {
    position: absolute;
    left: 50%;
    bottom: 52px;
    width: min(300px, 55%);
    height: 26px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0) 70%);
    animation: hb-shadow 5.6s ease-in-out infinite;
}

.hb-item {
    --tx: 0%;
    --scale: 1;
    --rot: 0deg;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;           /* khung phủ kín sân khấu nên không nhận chuột; chỉ ảnh túi bên cạnh nhận (xem .hb-bag) */
    transform: translateX(var(--tx)) scale(var(--scale)) rotate(var(--rot));
    /* chậm và êm: 1,6 giây, vào chậm rồi ra chậm (ease-in-out), túi mờ dần theo cùng nhịp */
    transition: transform 1.6s cubic-bezier(0.45, 0, 0.2, 1), opacity 1.1s ease-in-out;
}

.hb-item[data-pos="0"] {
    opacity: 1;
}

.hb-item[data-pos="-1"] {
    --tx: -38%;
    --scale: 0.58;
    --rot: -8deg;
    opacity: 0.4;
}

.hb-item[data-pos="1"] {
    --tx: 38%;
    --scale: 0.58;
    --rot: 8deg;
    opacity: 0.4;
}

.hb-item[data-pos="far-left"] {
    --tx: -120%;
    --scale: 0.5;
    --rot: -16deg;
}

.hb-item[data-pos="far-right"],
.hb-item[data-pos="far"] {
    --tx: 120%;
    --scale: 0.5;
    --rot: 16deg;
}

/* chữ thương hiệu khổng lồ phía sau túi: trượt xa hơn túi (nhân đôi quãng dịch) nên lệch nhịp, tạo chiều sâu */
.hb-word {
    position: absolute;
    left: 50%;
    top: 46%;
    z-index: 0;
    font-family: 'Oswald', sans-serif;
    font-size: clamp(88px, 15vw, 210px);
    font-weight: 700;
    letter-spacing: 4px;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    color: rgba(18, 18, 20, 0.07);
    transform: translate(calc(-50% + var(--word-x, 0%)), -50%);
    transition: transform 2.2s cubic-bezier(0.45, 0, 0.2, 1);
}

.hb-item[data-pos="-1"] .hb-word { --word-x: -45%; }
.hb-item[data-pos="1"] .hb-word { --word-x: 45%; }
.hb-item[data-pos="far-left"] .hb-word { --word-x: -90%; }
.hb-item[data-pos="far-right"] .hb-word,
.hb-item[data-pos="far"] .hb-word { --word-x: 90%; }

.hb-bag {
    position: relative;
    z-index: 1;
    width: auto;
    max-width: 78%;
    max-height: 400px;
    object-fit: contain;
    mix-blend-mode: multiply;   /* nền trắng của ảnh hòa vào nền xám của hero */
    pointer-events: none;
    -webkit-user-drag: none;
}

/* bấm vào túi nhỏ ở hai bên để chuyển tới túi đó */
.hb-item[data-pos="-1"] .hb-bag,
.hb-item[data-pos="1"] .hb-bag {
    pointer-events: auto;
    cursor: pointer;
}

/* túi ở giữa trôi nhẹ lên xuống và nghiêng qua lại */
.hb-item[data-pos="0"] .hb-bag {
    animation: hb-float 5.6s ease-in-out infinite;
}

/* ---------- máy tính: chữ bên trái, túi bên phải ---------- */
@media (min-width: 992px) {
    .hb-inner {
        grid-template-columns: minmax(340px, 5fr) 7fr;
    }

    .hb-text {
        padding: 56px 0 56px var(--hb-pad);
    }
}

/* ---------- điện thoại và máy tính bảng: túi ở trên, chữ ở dưới ---------- */
@media (max-width: 991.98px) {
    .hb-stage {
        order: -1;
        height: 340px;
        margin-top: 16px;
    }

    .hb-bag {
        max-height: 270px;
    }

    .hb-shadow {
        bottom: 36px;
    }
}

@keyframes hb-float {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50% { transform: translateY(-14px) rotate(1.5deg); }
}

@keyframes hb-shadow {
    0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 1; }
    50% { transform: translateX(-50%) scaleX(0.86); opacity: 0.7; }
}

@keyframes hb-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* người dùng bật "giảm chuyển động": không tự chuyển (JS), không trôi, đổi túi tức thì */
@media (prefers-reduced-motion: reduce) {
    .hb-item,
    .hb-word {
        transition: none;
    }

    .hb-item[data-pos="0"] .hb-bag,
    .hb-shadow,
    .hb-text.is-swap > * {
        animation: none;
    }
}
