/* ================================
   CART POPOVER
================================ */
.cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.cart-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.cart-item__meta {
    font-size: 11px;
    color: #9a9a86;
    letter-spacing: 0.5px;
    margin-top: 3px;
    margin-bottom: 2px;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-height: 580px;
    background: var(--cream, #f4f0e7);
    z-index: 501;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 24px 64px rgba(0,0,0,.14);

    /* start state: scaled down from icon, origin top-right */
    transform-origin: top right;
    transform: scale(.7) translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition:
        transform .32s cubic-bezier(.34,1.28,.64,1),
        opacity   .22s ease,
        visibility .22s ease;
}

.cart-drawer.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Header */
.cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid rgba(0,0,0,.07);
    flex-shrink: 0;
}

.cart-drawer__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #1f1f1b;
}

.cart-drawer__close {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6a5d;
    transition: opacity .2s;
    padding: 0;
}

.cart-drawer__close:hover { opacity: .5; }

.cart-drawer__close svg {
    width: 16px;
    height: 16px;
}

/* Body */
.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 0 22px;
    min-height: 120px;
}

.cart-drawer__body::-webkit-scrollbar { width: 3px; }
.cart-drawer__body::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 2px; }

/* Empty */
.cart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    font-size: 12px;
    color: #9a9a86;
    letter-spacing: .5px;
}

/* Cart item */
.cart-item {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.cart-item__img {
    width: 72px;
    height: 90px;
    object-fit: cover;
    object-position: center top;
    background: #e5ddd0;
    display: block;
    flex-shrink: 0;
}

.cart-item__info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0;
}

.cart-item__name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #1f1f1b;
}

.cart-item__price {
    font-size: 13px;
    color: #6b6a5d;
    margin-top: 4px;
    letter-spacing: .4px;
}

/* Qty stepper */
.cart-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.cart-item__qty {
    display: flex;
    align-items: center;
    border: 1px solid rgba(0,0,0,.16);
    width: fit-content;
}

.cart-item__qty button {
    width: 26px;
    height: 24px;
    border: 0;
    background: transparent;
    font-size: 14px;
    color: #1f1f1b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
    flex-shrink: 0;
}

.cart-item__qty button:hover { background: rgba(0,0,0,.05); }

.cart-item__qty span {
    width: 28px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #1f1f1b;
    border-left: 1px solid rgba(0,0,0,.16);
    border-right: 1px solid rgba(0,0,0,.16);
    line-height: 24px;
    display: block;
    flex-shrink: 0;
}

.cart-item__remove {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #b94040;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
    transition: opacity .2s;
}

.cart-item__remove:hover { opacity: .6; }

/* Footer */
.cart-drawer__foot {
    padding: 16px 22px 22px;
    border-top: 1px solid rgba(0,0,0,.07);
    flex-shrink: 0;
}

.cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cart-total-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: #6b6a5d;
}

.cart-total-amount {
    font-size: 14px;
    font-weight: 700;
    color: #1f1f1b;
    letter-spacing: .4px;
}

.cart-checkout-btn {
    display: block;
    width: 100%;
    height: 44px;
    background: #9a9a86;
    color: #fff;
    border: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    text-align: center;
    line-height: 44px;
    cursor: pointer;
    transition: background .25s;
    text-decoration: none;
}

.cart-checkout-btn:hover { background: #777765; }

/* Mobile: full width bottom sheet */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw;
        max-height: 70vh;
        top: auto;
        bottom: 0;
        right: 0;
        transform-origin: bottom center;
        transform: scale(.95) translateY(20px);
        border-radius: 16px 16px 0 0;
    }

    .cart-overlay {
        background: rgba(0,0,0,.3);
    }

    .cart-overlay.is-open {
        background: rgba(0,0,0,.3);
    }
}