/* ==========================================================================
   Header mini-cart — button + drawer (inc/minicart.php, assets/js/minicart.js)
   Loaded only while the mini-cart is on. Depends on tokens from redesign.css.
   ========================================================================== */

/* ── Header button ──────────────────────────────────────────────────────── */
/* Sits in .kxp-hdr__actions (pages.css), which does the placing. */
.kxp-mc-btn {
    position: relative;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border: 0; background: none; color: var(--kxp-black);
    cursor: pointer;
}
.kxp-mc-btn:hover svg { color: var(--kxp-accent); }
.kxp-mc-btn svg { transition: color 0.3s var(--kxp-ease); }
.kxp-mc-btn .kxp-mc-count {
    position: absolute; top: 4px; right: 1px;
    min-width: 17px; height: 17px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: var(--kxp-accent); color: var(--kxp-white);
    font: 700 10px/1 var(--kxp-font-body);
}
.kxp-mc-count[hidden] { display: none !important; }
@media (max-width: 400px) {
    .kxp-mc-btn { width: 40px; }
}

/* ── Drawer ─────────────────────────────────────────────────────────────── */
html.kxp-mc-lock { overflow: hidden; }

.kxp-mc { position: fixed; inset: 0; z-index: 300; }
.kxp-mc[hidden] { display: none; }
.kxp-mc__scrim {
    position: absolute; inset: 0;
    background: rgba(10, 10, 10, 0.45);
    opacity: 0; transition: opacity 0.35s var(--kxp-ease);
}
.kxp-mc__panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(420px, 100%);
    display: flex; flex-direction: column;
    background: var(--kxp-white);
    transform: translateX(100%);
    transition: transform 0.4s var(--kxp-ease);
    outline: none;
}
.kxp-mc.is-open .kxp-mc__scrim { opacity: 1; }
.kxp-mc.is-open .kxp-mc__panel { transform: none; }
@media (prefers-reduced-motion: reduce) {
    .kxp-mc__scrim, .kxp-mc__panel { transition: none; }
}

.kxp-mc__head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--kxp-grey-100);
}
.kxp-mc__title {
    display: flex; align-items: center; gap: 0.55rem;
    font-size: var(--kxp-step-0); letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.2;
}
.kxp-mc__title .kxp-mc-count {
    min-width: 22px; height: 22px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--kxp-black); color: var(--kxp-white);
    font: 700 11px/1 var(--kxp-font-body); letter-spacing: 0;
}
.kxp-mc__close {
    width: 40px; height: 40px; margin-right: -10px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border: 0; background: none; color: var(--kxp-black); cursor: pointer;
}
.kxp-mc__close:hover { color: var(--kxp-accent); }

.kxp-mc__body { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity 0.2s; }
.kxp-mc.is-busy .kxp-mc__body { opacity: 0.55; pointer-events: none; }

.kxp-mc__list { flex: 1; overflow-y: auto; margin: 0; padding: 0 1.5rem; list-style: none; overscroll-behavior: contain; }
.kxp-mc__item {
    display: grid; grid-template-columns: 72px 1fr auto; gap: 0.9rem;
    padding: 1.1rem 0; border-bottom: 1px solid var(--kxp-grey-100);
    transition: opacity 0.2s;
}
.kxp-mc__item.is-removing { opacity: 0.35; }
.kxp-mc__thumb { display: block; width: 72px; height: 72px; background: var(--kxp-grey-50); }
.kxp-mc__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.kxp-mc__info { min-width: 0; }
.kxp-mc__name { margin: 0 0 0.2rem; font-weight: 600; font-size: var(--kxp-step--1); line-height: 1.35; }
.kxp-mc__name a:hover { color: var(--kxp-accent); }
/* wc_get_formatted_cart_item_data(): a <dl> of attribute / value pairs. */
.kxp-mc__info dl.variation { display: flex; flex-wrap: wrap; gap: 0 0.35rem; margin: 0 0 0.2rem; font-size: 0.78rem; color: var(--kxp-grey-500); }
.kxp-mc__info dl.variation dt, .kxp-mc__info dl.variation dd { margin: 0; }
.kxp-mc__info dl.variation dd p { margin: 0; display: inline; }
.kxp-mc__unit, .kxp-mc__qty-fixed { margin: 0; font-size: 0.78rem; color: var(--kxp-grey-500); }
.kxp-mc__qty-fixed { margin-top: 0.5rem; }

/* −/+ stepper: same square language as the cart page's, scaled to the drawer. */
.kxp-mc__stepper {
    display: inline-flex; align-items: stretch; margin-top: 0.55rem;
    border: 1px solid var(--kxp-grey-300); background: var(--kxp-white);
}
.kxp-mc__step {
    width: 32px; height: 32px; padding: 0;
    border: 0; background: none; color: var(--kxp-black);
    font: 500 1rem/1 var(--kxp-font-body); cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.kxp-mc__step:hover:not(:disabled) { background: var(--kxp-grey-50); color: var(--kxp-accent); }
.kxp-mc__step:disabled { color: var(--kxp-grey-300); cursor: default; }
.kxp-mc__step:focus-visible { outline: 2px solid var(--kxp-black); outline-offset: -2px; }
.kxp-mc__n {
    min-width: 30px; display: inline-flex; align-items: center; justify-content: center;
    border-inline: 1px solid var(--kxp-grey-100);
    font-weight: 600; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.kxp-mc__item.is-updating .kxp-mc__line { opacity: 0.4; }

.kxp-mc__error {
    margin: 0; padding: 0.7rem 1.5rem;
    background: #fdecec; color: var(--kxp-accent-dk);
    font-size: 0.8rem; line-height: 1.4;
}
.kxp-mc__error[hidden] { display: none; }
.kxp-mc__end { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 0.5rem; }
.kxp-mc__line { font-weight: 600; font-size: var(--kxp-step--1); white-space: nowrap; }
/* "(ex. VAT)" once, on the subtotal — not on every line too. */
.kxp-mc__line .tax_label { display: none; }
.kxp-mc__remove { font-size: 0.75rem; color: var(--kxp-grey-500); text-decoration: underline; text-underline-offset: 3px; }
.kxp-mc__remove:hover { color: var(--kxp-accent); }

.kxp-mc__foot { padding: 1.25rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom)); background: var(--kxp-grey-50); }
.kxp-mc__subtotal { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 0.25rem; }
.kxp-mc__subtotal span { font-family: var(--kxp-font-display); font-size: var(--kxp-step--1); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.kxp-mc__subtotal strong { font-size: var(--kxp-step-1); }
.kxp-mc__subtotal small { font-size: 0.72rem; font-weight: 400; color: var(--kxp-grey-500); }
.kxp-mc__note { margin: 0 0 1rem; font-size: 0.78rem; color: var(--kxp-grey-500); }
.kxp-mc__checkout { width: 100%; justify-content: center; }
.kxp-mc__link {
    display: inline-block; margin-top: 0.9rem;
    font-size: var(--kxp-step--1); font-weight: 600;
    text-decoration: underline; text-underline-offset: 4px;
}
.kxp-mc__foot .kxp-mc__link { display: block; text-align: center; }
.kxp-mc__link:hover { color: var(--kxp-accent); }

.kxp-mc__empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.5rem; text-align: center; }
.kxp-mc__empty p { margin: 0; color: var(--kxp-grey-700); }

/* Free-delivery bar (kxp_free_delivery_meter) — same look as in checkout.css,
   which is not loaded outside the cart and checkout. */
.kxp-mc .kxp-fd { margin: 0 0 1rem; padding: 0.85rem 1rem; background: var(--kxp-white); }
.kxp-mc .kxp-fd__text { margin: 0 0 0.6rem; font-size: 0.8rem; color: var(--kxp-grey-700); }
.kxp-mc .kxp-fd__text strong { color: var(--kxp-black); }
.kxp-mc .kxp-fd.is-free .kxp-fd__text { color: var(--kxp-black); font-weight: 600; }
.kxp-mc .kxp-fd.is-free .kxp-fd__text::before { content: "✓"; margin-right: 0.45rem; color: var(--kxp-accent); }
.kxp-mc .kxp-fd__track { height: 4px; background: var(--kxp-grey-100); overflow: hidden; }
.kxp-mc .kxp-fd__track span { display: block; height: 100%; background: var(--kxp-accent); }

@media (max-width: 440px) {
    .kxp-mc__head, .kxp-mc__foot, .kxp-mc__error { padding-inline: 1.1rem; }
    .kxp-mc__list { padding-inline: 1.1rem; }
    .kxp-mc__item { grid-template-columns: 60px 1fr auto; gap: 0.75rem; }
    .kxp-mc__thumb { width: 60px; height: 60px; }
}

/* Short screens (iPhone SE and landscape phones): the footer kept ~275px and
   left room for about one line, so tighten its spacing to give the list more. */
@media (max-height: 700px) {
    .kxp-mc__head { padding-block: 0.8rem; }
    .kxp-mc__item { padding-block: 0.8rem; }
    .kxp-mc__foot { padding-top: 0.9rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .kxp-mc .kxp-fd { margin-bottom: 0.7rem; padding: 0.6rem 0.85rem; }
    .kxp-mc .kxp-fd__text { margin-bottom: 0.45rem; }
    .kxp-mc__note { margin-bottom: 0.7rem; }
    .kxp-mc__checkout { padding-block: 0.85em; }
    .kxp-mc__foot .kxp-mc__link { margin-top: 0.6rem; }
}
