/* Cart drawer — slide-out panel + mini-cart layout
 * Uses spokar tokens (tokens.css). No bespoke vars here. */

/* ─────────────── Overlay + scroll lock ─────────────── */

.spokar-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 37, 43, 0.55);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

body.spokar-drawer-open {
    overflow: hidden;
}

/* ─────────────── Drawer shell ─────────────── */

.spokar-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    background: var(--white);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform var(--t-base) var(--ease-out-quint);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-2);
    font-family: var(--font-primary);
    color: var(--slate);
}

.spokar-drawer.active {
    transform: translateX(0);
}

.spokar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--slate);
    color: var(--white);
    border-bottom: 3px solid var(--olive);
    flex-shrink: 0;
}

.spokar-drawer-header h3 {
    margin: 0;
    /* Override the global h1–h5 slate color (base.css) which otherwise wins over
       the inherited white from .spokar-drawer-header and hides the title on the
       dark slate bar. */
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.spokar-drawer-close {
    background: transparent;
    border: 0;
    color: inherit;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--t-fast) var(--ease-out-quint);
}

.spokar-drawer-close:hover {
    color: var(--olive);
}

.spokar-drawer-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ─────────────── Mini-cart wrapper ─────────────── */

.spokar-minicart-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.spokar-cart-loading {
    padding: 32px 24px;
    text-align: center;
    color: var(--grey-600);
    font-size: var(--fs-body);
}

.spokar-minicart-scroll {
    flex: 1 1 auto;
    padding: 0 24px;
}

.spokar-minicart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.spokar-minicart-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--grey-200);
    position: relative;
    transition: background-color var(--t-base) var(--ease-out-quint);
}

.spokar-minicart-item.newly-added {
    background-color: var(--olive-soft);
}

.spokar-minicart-image {
    width: 80px;
    height: 120px;
    overflow: hidden;
}

.spokar-minicart-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.spokar-minicart-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.spokar-minicart-title {
    margin: 0;
    font-size: 0.9375rem;
    line-height: var(--leading-snug);
    font-weight: 600;
}

.spokar-minicart-title a {
    color: inherit;
    text-decoration: none;
}

.spokar-minicart-title a:hover {
    color: var(--primary);
}

.spokar-minicart-variation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 0.8125rem;
    color: var(--grey-600);
}

.spokar-minicart-variation > span {
    white-space: nowrap;
}

.spokar-minicart-attr--color {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Drawer swatches reuse the PDP pill swatch markup (circle / silhouette) but at
   a smaller size so they fit the compact mini-cart row. Overlap rules for
   multi-swatch mixes mirror the PDP defaults in sections.css. */
.spokar-minicart-attr--color .pill__swatch--circle {
    width: 1.05rem;
    height: 1.05rem;
}

.spokar-minicart-attr--color .pill__swatch--silhouette {
    width: 0.8rem;
    height: 1.6rem;
}

.spokar-minicart-attr--color .pill__lead--multi .pill__swatch--circle + .pill__swatch--circle {
    margin-left: -0.35rem;
}

.spokar-minicart-attr--color .pill__lead--multi .pill__swatch--silhouette + .pill__swatch--silhouette {
    margin-left: 0.1rem;
}

.spokar-minicart-price {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--slate);
}

.spokar-minicart-price del {
    color: var(--grey-500);
    font-weight: 400;
    margin-right: 6px;
}

.spokar-minicart-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

/* Compact stepper variant for use inside the mini-cart row */
.qty-stepper--mini {
    border-radius: var(--radius-md);
}

.qty-stepper--mini .qty-stepper__btn,
.qty-stepper--mini .qty-stepper__input {
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
    line-height: 1;
}

.spokar-remove-item {
    color: var(--grey-500);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1;
    transition: color var(--t-fast) var(--ease-out-quint);
}

.spokar-remove-item:hover {
    color: var(--burgundy);
}

/* ─────────────── Footer / CTA ─────────────── */

.spokar-minicart-footer {
    flex-shrink: 0;
    padding: 20px 24px 24px;
    border-top: 1px solid var(--grey-200);
    background: var(--white);
    position: sticky;
    bottom: 0;
}

/* First-order free-shipping perk (guests only) */
.spokar-minicart-perk {
    margin: 0 0 14px;
    padding: 10px 14px;
    background: var(--olive-soft);
    border: 1px solid var(--olive);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    line-height: 1.4;
    font-weight: 600;
    color: var(--slate);
}

/* Mirrors the PDP .btn--primary.btn--lg primitive (components.css) so the
   drawer CTA reads identically to the add-to-cart button — same blue, weight,
   size, padding and radius, no uppercase. Layout-only extras (full width with
   the cart total pushed to the right) sit on top of that shared look. Same
   approach checkout.css takes with .spokar-btn. */
.spokar-checkout-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 1.1rem 2rem;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
    transition:
        background var(--t-base) var(--ease-out-quint),
        color var(--t-base) var(--ease-out-quint),
        transform var(--t-fast) var(--ease-out-quint);
}

.spokar-checkout-button:hover {
    background: var(--primary-deep);
    color: var(--white);
}

.spokar-checkout-button:active {
    transform: scale(0.97);
}

.spokar-total-price {
    font-weight: 700;
}

.spokar-minicart-secondary-actions {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.spokar-continue-shopping-link,
.spokar-view-cart-link {
    color: var(--grey-600);
    font-size: 0.8125rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--t-fast) var(--ease-out-quint);
}

.spokar-continue-shopping-link:hover,
.spokar-view-cart-link:hover {
    color: var(--slate);
}

/* ─────────────── Info strip (delivery, manufacturer, security) ─────────────── */

.spokar-cart-info-strip {
    list-style: none;
    margin: 18px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--grey-200);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spokar-cart-info-strip__item {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--grey-600);
}

/* ─────────────── Empty cart ─────────────── */

.spokar-minicart-empty {
    padding: 64px 32px;
    text-align: center;
}

.spokar-minicart-empty p {
    margin: 0 0 20px;
    color: var(--grey-600);
    font-size: var(--fs-body);
}

/* Mirrors the .btn--olive primitive (components.css) — same olive, weight,
   size, radius and active feel as the site's buttons, no uppercase. Secondary
   action (empty cart), so it stays at the base .btn size, not .btn--lg. */
.spokar-continue-shopping {
    display: inline-flex;
    align-items: center;
    padding: 0.95rem 1.5rem;
    background: var(--olive);
    color: var(--slate);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition:
        background var(--t-base) var(--ease-out-quint),
        color var(--t-base) var(--ease-out-quint),
        transform var(--t-fast) var(--ease-out-quint);
}

.spokar-continue-shopping:hover {
    background: var(--olive-deep);
    color: var(--slate);
}

.spokar-continue-shopping:active {
    transform: scale(0.97);
}

/* ─────────────── Mobile tweaks ─────────────── */

@media (max-width: 480px) {
    .spokar-drawer {
        width: 100vw;
    }

    .spokar-minicart-item {
        grid-template-columns: 64px 1fr;
    }

    .spokar-minicart-image {
        width: 64px;
        height: 96px;
    }
}
