/* ==========================================================================
   Her Peptides — slide-out cart sidebar

   Loaded site-wide when WooCommerce is active (inc/enqueue.php). Self-contained:
   it only relies on the design tokens in style.css, never on shop.css. Mirrors
   the .nav-drawer / .nav-scrim motion from navigation.css, anchored to the right.
   ========================================================================== */

.mc-scrim {
    position: fixed;
    z-index: 1075;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    background: rgba(58, 30, 44, .45);
    transition: opacity .3s ease, visibility .3s;
}

.mc-scrim.is-on {
    visibility: visible;
    opacity: 1;
}

.mini-cart {
    position: fixed;
    z-index: 1085;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    visibility: hidden;
    width: min(94vw, 420px);
    flex-direction: column;
    background: #fff;
    box-shadow: -24px 0 60px -24px rgba(150, 70, 105, .4);
    transform: translateX(100%);
    transition: transform .34s cubic-bezier(.4, 0, .2, 1), visibility .34s;
}

.mini-cart.is-open {
    visibility: visible;
    transform: none;
}

/* ---------------------------------- head ---------------------------------- */

.mc-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.mc-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 500;
}

.mc-title i {
    color: var(--pink);
    font-size: 20px;
}

.mc-close {
    display: grid;
    flex: none;
    width: 36px;
    height: 36px;
    place-content: center;
    border: 0;
    border-radius: 50%;
    color: #4a4245;
    background: var(--pink-tint);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.mc-close:hover {
    color: #fff;
    background: var(--pink);
}

/* --------------------------------- body --------------------------------- */

.mc-scroll {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
}

.mc-scroll .widget_shopping_cart_content {
    display: flex;
    width: 100%;
    min-height: 100%;
    flex-direction: column;
}

.mc-list {
    flex: 1 1 auto;
    margin: 0;
    padding: 0 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.mc-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity .2s ease;
}

.mc-item.is-busy {
    opacity: .45;
    pointer-events: none;
}

.mc-item-media img {
    width: auto;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--pink-tint);
}

.mc-item-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mc-item-name a,
.mc-item-name {
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    text-decoration: none;
}

.mc-item-name a:hover {
    color: var(--pink-dark);
}

.mc-item-price {
    color: var(--muted);
    font-size: 11.5px;
}

.mc-item-price .amount {
    color: var(--ink);
    font-weight: 500;
}

.mc-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

/* stepper — a compact copy of the shop's .qty-control */
.mini-cart .qty-control {
    display: inline-flex;
    align-items: center;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
}

.mini-cart .qty-btn {
    display: grid;
    width: 28px;
    height: 28px;
    place-content: center;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--pink);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.mini-cart .qty-btn:hover:not(:disabled) {
    background: var(--pink-tint);
}

.mini-cart .qty-btn:disabled {
    color: #cdbfc5;
    cursor: default;
}

.mini-cart .qty-control input.qty {
    width: 30px;
    height: 28px;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.mini-cart .qty-control input.qty::-webkit-outer-spin-button,
.mini-cart .qty-control input.qty::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.mini-cart .qty-control input.qty:focus {
    outline: 0;
}

.mc-qty-fixed {
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.mc-item-subtotal {
    margin-left: auto;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.mc-remove {
    display: grid;
    flex: none;
    width: 26px;
    height: 26px;
    place-content: center;
    border-radius: 50%;
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    transition: color .18s ease, background .18s ease;
}

.mc-remove:hover {
    color: var(--pink-dark);
    background: var(--pink-tint);
}

.mc-remove.loading {
    opacity: .4;
    pointer-events: none;
}

.mc-item-error {
    color: #b3261e;
    font-size: 11.5px;
    line-height: 1.4;
}

/* --------------------------------- foot --------------------------------- */

.mc-foot {
    flex: none;
    border-top: 1px solid var(--border);
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    background: #fff;
}

/* free-shipping meter, compacted for the sidebar */
.mc-foot .cart-meter {
    margin: 0 0 14px;
}

.mc-foot .cart-meter p {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.mc-foot .cart-meter i {
    color: var(--pink);
    font-size: 15px;
}

.mc-foot .cart-meter-track {
    display: block;
    height: 6px;
    border-radius: 6px;
    background: var(--pink-tint);
    overflow: hidden;
}

.mc-foot .cart-meter-fill {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--pink), var(--pink-dark));
    transition: width .4s ease;
}

.mc-totals {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

.mc-total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: #4a4245;
    font-size: 13px;
}

.mc-total-row .amount {
    color: inherit;
}

.mc-discount {
    color: var(--pink-dark);
    font-weight: 500;
}

.mc-grand-total {
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.mc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 30px;
    padding: 12px 16px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.mc-btn--ghost {
    border: 1px solid var(--border);
    color: #4a4245;
    background: #fff;
}

.mc-btn--ghost:hover {
    border-color: rgba(224, 92, 150, .45);
    color: var(--pink-dark);
    background: var(--pink-tint);
}

.mc-btn--pink {
    color: #fff;
    background: var(--pink);
}

.mc-btn--pink:hover {
    background: var(--pink-dark);
}

/* -------------------------------- empty -------------------------------- */

.mc-empty {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
}

.mc-empty i {
    color: var(--pink-soft);
    font-size: 44px;
}

.mc-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

.mc-empty .mc-btn {
    margin-top: 4px;
}

/* -------------------------- WooCommerce overrides -------------------------- */

/* woocommerce.css styles `ul.cart_list` / `ul.product_list_widget`, and the
   drawer keeps those classes on purpose so Woo's own scripts and third-party
   integrations still recognise it. Those rules carry a `.woocommerce` ancestor,
   so they only bite on a WooCommerce-classed page — shop, product, cart,
   checkout, account — which is why the drawer looks right on the front page and
   wrong everywhere else. Each rule below re-states an intent from earlier in
   this file one level deeper, to out-specify `.woocommerce ul.cart_list …`.
   Same trap as the checkout fields in commerce.css. */

/* `padding: 0` there was flattening the list's side gutter. */
.mini-cart .mc-scroll ul.mc-list {
    margin: 0;
    padding: 0 20px;
}

/* The important one. Woo adds a float clearfix as `::before` / `::after` with
   `display: table`; in a grid container those are two extra grid items, so they
   take the first row and shunt the media and body cells one cell each — the
   thumbnail lands in the wide column and the text is crushed into the 64px one.
   Nothing floats in here, so there is nothing to clear. */
.mini-cart .mc-list li.mc-item::before,
.mini-cart .mc-list li.mc-item::after {
    display: none;
}

.mini-cart .mc-list li.mc-item {
    margin: 0;
    padding: 16px 0;
}

/* Woo pins widget thumbnails to 32px and floats them right. */
.mini-cart .mc-item .mc-item-media img {
    width: auto;
    height: 80px;
    float: none;
    margin-left: 0;
}

.mini-cart .mc-item .mc-item-name a {
    display: inline;
    font-weight: 500;
}

/* `.woocommerce a.remove` makes this a 1.5em block; the drawer wants the same
   26px round icon button as the rest of the theme. Woo's hover colour is
   `!important`, so the pink has to be too. */
.mini-cart .mc-item a.mc-remove {
    display: grid;
    width: 26px;
    height: 26px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
}

.mini-cart .mc-item a.mc-remove:hover {
    color: var(--pink-dark) !important;
    background: var(--pink-tint);
}

/* Variation data on a variable-product line: Woo floats the dt/dd pairs and
   hangs them off a grey rule, which is far too heavy for a 260px column. */
.mini-cart .mc-item .variation {
    margin: 0;
    border-left: 0;
    padding-left: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.mini-cart .mc-item .variation dt,
.mini-cart .mc-item .variation dd {
    display: inline;
    float: none;
    margin: 0;
    padding: 0;
    font-weight: 400;
}

.mini-cart .mc-item .variation dt {
    margin-right: 4px;
}

.mini-cart .mc-item .variation dd {
    margin-right: 8px;
}

.mini-cart .mc-item .variation dd p {
    display: inline;
    margin: 0;
}

/* ------------------------------ responsive ------------------------------ */

/* The panel itself is fluid already — min(94vw, 420px). What needs adjusting
   below tablet is the line item: a 64px media column plus an 80px thumbnail
   eats a third of a phone-width drawer, leaving the product name wrapping a
   word at a time. */

@media (max-width: 767.98px) {
    .mc-item {
        grid-template-columns: 56px 1fr;
        gap: 12px;
    }

    .mini-cart .mc-item .mc-item-media img {
        height: 70px;
    }
}

@media (max-width: 575.98px) {
    .mc-head {
        padding: 14px 16px;
    }

    .mc-title,
    .mc-title i {
        font-size: 18px;
    }

    .mc-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .mini-cart .mc-scroll ul.mc-list {
        padding: 0 16px;
    }

    .mc-item {
        grid-template-columns: 48px 1fr;
        gap: 12px;
    }

    .mini-cart .mc-list li.mc-item {
        padding: 14px 0;
    }

    .mini-cart .mc-item .mc-item-media img {
        height: 60px;
    }

    .mc-item-name a,
    .mc-item-name {
        font-size: 13px;
    }

    /* Stepper, subtotal and remove stop fitting on one line next to the media
       column on the narrowest phones. Wrapping drops the trash button to a
       second row rather than pushing it out past the panel edge; above ~360px
       nothing wraps and the row is unchanged. */
    .mc-item-controls {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .mc-foot {
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }

    .mc-btn {
        padding: 11px 12px;
        font-size: 12.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mini-cart,
    .mc-scrim,
    .mc-foot .cart-meter-fill {
        transition-duration: .01ms;
    }
}
