/* ==========================================================================
   Make My Theme — cart-drawer.css
   The basket drawer (inc/basket-drawer.php, woocommerce/cart/mini-cart.php).
   Every page, like header.css, and enqueued straight after it on the same
   deps, so it still lands after core-modal.css, whose panel it reshapes.
   ========================================================================== */

/* ── Card ───────────────────────────────────────────────────────────────────── */

/* A card hung under the header's basket icon, not a full-height panel
   (maintainer decision, 2026-09-26, option A): it fits its contents up to
   half the screen, then the lines scroll while the subtotal and actions stay
   pinned. `--cart-drawer-top` is the header's bottom edge, measured by
   main.js as it opens, so the card clears the admin bar and announcement bar
   too. The 420px floor keeps two rows visible on a short screen. */
.cart-drawer {
    position: fixed;
    top: calc(var(--cart-drawer-top, 0px) + var(--sp-2));
    right: var(--sp-4);
    width: min(420px, calc(100vw - 2 * var(--sp-4)));
    max-height: min(
        max(50vh, 420px),
        calc(100vh - var(--cart-drawer-top, 0px) - var(--sp-6))
    );
    /* Paper, Rule and rung 3 come from `.core-modal-panel` (core-modal.css);
       the drawer keeps §14.1's 6px radius over the modal's 10px. */
    border-radius: var(--r-md);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(var(--sp-2) * -1));
    transition: opacity var(--dur-base) var(--ease),
                transform var(--dur-base) var(--ease),
                visibility 0s linear var(--dur-base);
}

.cart-drawer[hidden] {
    display: flex; /* keep flex, animate instead */
}

.cart-drawer.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity var(--dur-base) var(--ease),
                transform var(--dur-base) var(--ease),
                visibility 0s;
}

/* Phone: the full width under the header, a gutter either side. */
@media (width < 640px) {
    .cart-drawer {
        right: var(--sp-2);
        width: calc(100vw - 2 * var(--sp-2));
    }
}

/* The header row, title and × are the shared modal rhythm
   (`.core-modal-header` / `-title`, `.core-btn--close` — Design.md §7.10);
   the drawer only stops the header shrinking when the lines scroll. */
.cart-drawer__header {
    flex-shrink: 0;
}

/* The drawer's inner column, the fragment wrapper and the template's body all
   stretch, so the lines scroll and the subtotal + actions stay pinned at the
   foot. */
.cart-drawer__inner,
.cart-drawer__content,
.cart-drawer .widget_shopping_cart_content,
.cart-drawer__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* A refused change's sentence (issue #833), pinned above the lines so it
   never scrolls away: the site's error notice (woocommerce.css, Design.md
   §7.11) — a 2px Err edge on a 6% Err wash, Ink text, square corners. */
.cart-drawer__notice {
    flex-shrink: 0;
    margin: 0;
    padding: var(--sp-4) var(--sp-5);
    border-left: 2px solid var(--err);
    background: color-mix(in oklch, var(--err) 6%, var(--paper));
    font-size: var(--fs-14);
    line-height: var(--lh-body);
    color: var(--ink);
}

.cart-drawer__notice[hidden] {
    display: none;
}

/* ── Rows (woocommerce/cart/mini-cart.php) ──
   The basket page's row, condensed: drawing, name + one-line summary, ×;
   then the bare stepper and the price on one line under the text. Set in
   Lexend throughout, as the basket is (Design.md §4.1). */

.cart-drawer__lines {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 0 var(--sp-5); /* the header's side padding, so the edges line up */
    list-style: none;
}

.cart-drawer__line {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) var(--h-control);
    column-gap: var(--sp-4);
    padding: var(--sp-5) 0;
    border-bottom: 1px solid var(--rule);
}

.cart-drawer__drawing {
    grid-row: 1 / span 2;
    width: 72px;
    aspect-ratio: 1;
    border: 1px solid var(--rule);
    border-radius: var(--r-md);
    background: var(--paper);
    overflow: hidden;
}

.cart-drawer__drawing img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* The basket page's "drawing pending" stripes (journey.css .mmj-drawing). */
.cart-drawer__drawing .mmj-drawing__placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        var(--paper) 0 5px,
        var(--paper-soft) 5px 10px
    );
}

.cart-drawer__text {
    min-width: 0;
}

.cart-drawer__name {
    margin: 0;
    font-size: var(--fs-16);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-snug);
    letter-spacing: var(--tracking-tight);
}

.cart-drawer__meta {
    margin: 2px 0 0;
    font-size: var(--fs-13);
    line-height: var(--lh-body);
    color: var(--ink-muted);
}

/* The basket page's × (.mmj-remove): ghost until hovered, then Error. The
   44px box is pulled up so the glyph sits level with the name. */
.cart-drawer__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--h-control);
    height: var(--h-control);
    margin-top: calc(var(--sp-3) * -1);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: var(--fs-18);
    color: var(--ink-muted);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.cart-drawer__remove:hover {
    background: var(--paper-soft);
    color: var(--err);
}

.cart-drawer__foot-row {
    grid-column: 2 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-top: var(--sp-2);
}

/* The bare stepper's first glyph sits on the text column's edge. */
.cart-drawer__qty {
    margin-left: calc(-1 * var(--sp-2));
}

.cart-drawer__qty input,
.cart-drawer__qty input:focus {
    border: 0;
    background: transparent;
    font-feature-settings: normal;
    letter-spacing: var(--tracking-normal);
}

/* A text link beside the row's price, not a button: 13px and underlined, and
   centred on the row by the foot row's `align-items` rather than given a
   button's height (the checkout rail's Edit basket reads the same way). */
.cart-drawer__edit {
    font-size: var(--fs-13);
    color: var(--ink-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--dur-fast) var(--ease);
}

.cart-drawer__edit:hover {
    color: var(--ink);
}

.cart-drawer__price,
.cart-drawer__total-value {
    display: block;
    font-size: var(--fs-22);
    line-height: var(--lh-snug);
    white-space: nowrap;
}

.cart-drawer__line.is-busy .cart-drawer__foot-row {
    opacity: 0.5;
    pointer-events: none;
}

/* Inline remove confirmation — the basket page's .mmj-confirm. */
.cart-drawer__confirm {
    grid-column: 2 / -1;
    margin-top: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    background: var(--paper-soft);
}

.cart-drawer__confirm[hidden] {
    display: none;
}

.cart-drawer__confirm-text {
    margin: 0 0 var(--sp-3);
    font-size: var(--fs-14);
    line-height: var(--lh-body);
}

.cart-drawer__confirm-text strong {
    font-weight: var(--fw-semibold);
}

.cart-drawer__confirm-actions {
    display: flex;
    gap: var(--sp-2);
}

/* ── Foot: subtotal, a delivery note, two actions ── */

.cart-drawer__foot {
    flex-shrink: 0;
    padding: var(--sp-5) var(--sp-5) var(--sp-6);
    border-top: 1px solid var(--rule-strong);
}

/* Label above figure, the basket footer's total (.mmj-foot__label / __value)
   so every VAT total on the network reads alike (inconsistency #378). */
.cart-drawer__total {
    margin: 0;
}

.cart-drawer__total-label {
    display: block;
    font-size: var(--fs-11);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-muted);
}

.cart-drawer__note {
    margin: var(--sp-1) 0 var(--sp-5);
    font-size: var(--fs-13);
    color: var(--ink-muted);
}

.cart-drawer__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

/* A phone-width drawer can't fit "Continue shopping" in half its width. */
@media (width < 480px) {
    .cart-drawer__actions {
        grid-template-columns: 1fr;
    }
}

/* ── Empty: the brand device, one line, one action ── */

.cart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-5);
    padding: var(--sp-10) var(--sp-6);
    text-align: center;
}

.cart-drawer__mark {
    width: 128px;
    fill: var(--ink);
}

.cart-drawer__empty-text {
    margin: 0;
    font-size: var(--fs-16);
}
