/* Drawer layout plus item cards shared with the checkout list. */
html.cart-open,
html.cart-open body {
    overflow: hidden;
    overscroll-behavior: none;
}

#buycar.cart-drawer,
#buycar.cart-drawer * {
    box-sizing: border-box;
}

#buycar.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: block;
    width: 100%;
    height: 100%;
    visibility: hidden;
    pointer-events: none;
    background: transparent;
    color: #493429;
    line-height: 1.6;
    transition: visibility 0s .28s;
}

#buycar.cart-drawer.active {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

#buycar button { font-family: inherit; }

#buycar .cart-backdrop {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    opacity: 0;
    background: rgba(30, 16, 13, .52);
    cursor: pointer;
    transition: opacity .28s ease;
}

#buycar.active .cart-backdrop { opacity: 1; }

#buycar .cart-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: min(460px, 100%);
    height: 100%;
    overflow: hidden;
    background: #fffdf9;
    box-shadow: -12px 0 48px rgba(40, 20, 12, .12);
    transform: translateX(100%);
    transition: transform .28s ease;
}

#buycar.active .cart-panel { transform: translateX(0); }

#buycar .cart-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: max(28px, env(safe-area-inset-top)) 28px 24px;
    border-top: 3px solid #c9a84c;
    border-bottom: 1px solid #e8dfd2;
}

#buycar .cart-eyebrow {
    margin: 0 0 6px;
    color: #9a8060;
    font-size: 11px;
    letter-spacing: 2px;
}

#buycar #cart-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    color: #7f191a;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 2px;
}

#buycar .cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    border-radius: 50px;
    background: #efe6d7;
    color: #7d6040;
    font-size: 12px;
    letter-spacing: 0;
}

#buycar .cart-close-button,
:is(#buycar, .checkout-cart-list) .cart-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #e8dfd2;
    border-radius: 50%;
    background: transparent;
    color: #806f62;
    cursor: pointer;
}

#buycar .cart-close-button i { font-size: 22px; }
#buycar .cart-close-button:hover,
:is(#buycar, .checkout-cart-list) .cart-remove:hover { background: #f3e9df; color: #8b1a1a; }

#buycar .cart-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d8c8b3 transparent;
    padding: 0 28px;
}

#buycar .cart-items { display: block; padding: 0; }

:is(#buycar, .checkout-cart-list) .cart-card {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 32px;
    align-items: start;
    gap: 16px;
    padding: 24px 0;
    border-bottom: 1px solid #e8dfd2;
}

:is(#buycar, .checkout-cart-list) .cart-card:last-child { border-bottom: 0; }

:is(#buycar, .checkout-cart-list) .cart-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 100px;
    overflow: hidden;
    border: 1px solid #eee5d9;
    border-radius: 5px;
    background: #f5efe6;
}

:is(#buycar, .checkout-cart-list) .cart-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
:is(#buycar, .checkout-cart-list) .cart-item-info { min-width: 0; }
:is(#buycar, .checkout-cart-list) .cart-item-title { display: block; color: #493429; font-size: 15px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
:is(#buycar, .checkout-cart-list) .cart-item-title:hover { color: #8b1a1a; }
:is(#buycar, .checkout-cart-list) .cart-item-description { margin: 5px 0 10px; color: #998674; font-size: 12px; overflow-wrap: anywhere; }
:is(#buycar, .checkout-cart-list) .cart-item-bottom { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
:is(#buycar, .checkout-cart-list) .cart-quantity { padding: 2px 8px; border: 1px solid #e8dfd2; border-radius: 3px; color: #806f62; font-size: 11px; white-space: nowrap; }
:is(#buycar, .checkout-cart-list) .cart-item-price { color: #8b1a1a; font-size: 15px; font-weight: 600; white-space: nowrap; }
:is(#buycar, .checkout-cart-list) .cart-original-price { display: block; color: #ab9c8d; font-size: 11px; font-weight: 400; text-align: right; }
:is(#buycar, .checkout-cart-list) .cart-item-extra { margin: 5px 0 0; color: #998674; font-size: 11px; }
:is(#buycar, .checkout-cart-list) .cart-stock-warning { margin: 8px 0 0; color: #a1392b; font-size: 12px; }
:is(#buycar, .checkout-cart-list) .cart-card-unavailable .cart-image { opacity: .55; }
:is(#buycar, .checkout-cart-list) .cart-remove { width: 32px; height: 32px; border-color: transparent; font-size: 18px; }

#buycar .cart-footer {
    flex-shrink: 0;
    padding: 24px 28px max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid #e8dfd2;
    background: #f8f2e9;
}

#buycar .cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 13px; }
#buycar #buycarPrice { color: #8b1a1a; font-size: 23px; font-weight: 700; white-space: nowrap; }
#buycar .cart-note { margin: 6px 0 18px; color: #998674; font-size: 11px; }
#buycar .cart-checkout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    border: 1px solid #8b1a1a;
    border-radius: 3px;
    background: #8b1a1a;
    color: #fffaf2;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background .15s ease;
}

#buycar .cart-checkout i { font-size: 20px; }
#buycar .cart-checkout:hover { background: #701212; }
#buycar .cart-checkout:disabled { background: #d8ccbe; border-color: #d8ccbe; color: #fffdf9; cursor: default; }
#buycar .cart-continue { display: block; margin: 14px auto 0; padding: 0 10px; border: 0; background: transparent; color: #806f62; font-size: 12px; cursor: pointer; }
#buycar button:focus-visible,
#buycar a:focus-visible { outline: 2px solid #c9a84c; outline-offset: 3px; }

:is(#buycar, .checkout-cart-list) .cart-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 280px; padding: 40px 8px; text-align: center; color: #998674; font-size: 13px; }
:is(#buycar, .checkout-cart-list) .cart-state > i { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: #f5eee3; color: #b79a71; font-size: 34px; }
:is(#buycar, .checkout-cart-list) .cart-state h3 { margin: 4px 0 0; color: #493429; font-size: 18px; font-weight: 600; }
:is(#buycar, .checkout-cart-list) .cart-state p { margin: 0; font-size: 12px; }
:is(#buycar, .checkout-cart-list) .cart-retry { margin-top: 8px; padding: 8px 20px; border: 1px solid #c9a84c; border-radius: 3px; background: transparent; color: #8b1a1a; cursor: pointer; }

@media (max-width: 480px) {
    #buycar .cart-panel { width: min(420px, 100%); }
    #buycar .cart-header { padding-right: 20px; padding-left: 20px; }
    #buycar .cart-body { padding: 0 20px; }
    #buycar .cart-footer { padding-right: 20px; padding-left: 20px; }
    :is(#buycar, .checkout-cart-list) .cart-card { grid-template-columns: 72px minmax(0, 1fr) 28px; gap: 12px; padding: 20px 0; }
    :is(#buycar, .checkout-cart-list) .cart-image { width: 72px; height: 88px; }
    :is(#buycar, .checkout-cart-list) .cart-remove { width: 28px; height: 32px; }
    :is(#buycar, .checkout-cart-list) .cart-state { min-height: 240px; }
}

@media (max-height: 540px) {
    #buycar .cart-header { padding-top: 12px; padding-bottom: 12px; }
    #buycar .cart-eyebrow { display: none; }
    #buycar .cart-footer { padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    #buycar .cart-note { margin-bottom: 10px; }
    #buycar .cart-continue { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    #buycar.cart-drawer,
    #buycar .cart-panel,
    #buycar .cart-backdrop { transition: none; }
}
