/* Klinike — Mini Cart */

.kmd-mini-cart {
    --kmd-ink: #000;
    --kmd-muted: #8c8c8c;
    --kmd-line: #d9d9d9;
    --kmd-beige: #efe6e0;
    --kmd-image-bg: #f4f3f1;
    --kmd-control-bg: #d3d3d3;
    --kmd-control-ink: #808080;
    --kmd-serif: var(--font-libre, "Libre Caslon Text", serif);
    --kmd-mono: var(--font-mono, "Roboto Mono", monospace);
    --kmd-gutter: 16px;

    display: flex;
    flex-direction: column;
    min-height: 100%;
    color: var(--kmd-ink);
    font-family: var(--kmd-mono);
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
}

/* Let the content fill the drawer so the summary sits at the bottom. */
.widget_shopping_cart_content:has(> .kmd-mini-cart) {
    height: 100%;
}

.kmd-mini-cart *,
.kmd-mini-cart *::before,
.kmd-mini-cart *::after {
    box-sizing: border-box;
}

.kmd-mini-cart a {
    color: inherit;
    text-decoration: none;
}

.kmd-mini-cart button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.kmd-mini-cart.is-busy .kmd-mini-cart__items {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.15s;
}

/* Header */

.kmd-mini-cart__header {
    padding: 18px var(--kmd-gutter);
    border-bottom: 1px solid var(--kmd-line);
}

.kmd-mini-cart__title {
    margin: 0;
    font-family: var(--kmd-serif);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
}

.kmd-mini-cart__notice {
    margin: 12px var(--kmd-gutter) 0;
    padding: 10px 12px;
    background: var(--kmd-beige);
    font-size: 12px;
}

.kmd-mini-cart__notice[hidden] {
    display: none;
}

/* Lines */

/* Outranks `.woocommerce ul.cart_list { padding: 0 }` on shop and product pages. */
.kmd-mini-cart ul.kmd-mini-cart__items.cart_list {
    margin: 0;
    padding: 12px var(--kmd-gutter);
    list-style: none;
}

/* Extra specificity: WooCommerce (.woocommerce ul.cart_list li …), the theme and Elementor
   all style mini-cart lines, and losing the grid here collapses the image. */
.kmd-mini-cart .kmd-mini-cart__items .kmd-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) auto;
    grid-template-areas:
        "image name  price"
        "image qty   remove";
    column-gap: 14px;
    row-gap: 10px;
    padding: 10px 0;
    margin: 0;
    list-style: none;
}

/* Spans from the top of the name to the bottom of the quantity control.
   The image is taken out of flow so it never sets the row height itself;
   the explicit size keeps the box visible even if the grid is overridden. */
/* WooCommerce's clearfix pseudo-elements would become extra grid rows. */
.kmd-mini-cart .kmd-mini-cart__items .kmd-item::before,
.kmd-mini-cart .kmd-mini-cart__items .kmd-item::after {
    content: none;
    display: none;
}

.kmd-item__image {
    grid-area: image;
    position: relative;
    align-self: stretch;
    width: 80px;
    min-height: 86px;
    background: var(--kmd-image-bg);
}

/* The theme's link rule (`position: relative; width: fit-content`, behind a long
   :not() chain that outranks any normal selector) would shrink the link around
   the absolutely positioned image to 0 × 0, hence !important. */
.kmd-mini-cart .kmd-item .kmd-item__image > a {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.kmd-mini-cart .kmd-item .kmd-item__image img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: contain;
    /* White product backgrounds blend into the plate, as on the product cards. */
    mix-blend-mode: multiply;
}

/* Same type as the product cards (.kew-product-grid titles). */
.kmd-item__name {
    grid-area: name;
    font-weight: 400;
    padding-right: 16px;
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

/* `.woocommerce ul.cart_list li a` makes it bold on shop and product pages. */
.kmd-mini-cart .kmd-item .kmd-item__name a {
    font-weight: inherit;
}

/* The theme's hover underline is an absolutely positioned ::after, so it only
   reaches the last line of a wrapped name. */
.kmd-mini-cart .kmd-item__name a::after {
    display: none !important;
}

.kmd-item__meta {
    margin-top: 4px;
    color: var(--kmd-muted);
    font-size: 11px;
}

.kmd-item__meta dl,
.kmd-item__meta dd,
.kmd-item__meta p {
    margin: 0;
}

.kmd-item__meta dt,
.kmd-item__meta dd {
    display: inline;
}

.kmd-item__price {
    grid-area: price;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.kmd-item__price-regular {
    color: var(--kmd-muted);
    font-size: 12px;
}

.kmd-item__qty {
    grid-area: qty;
    align-self: end;
}

.kmd-item__remove {
    grid-area: remove;
    align-self: end;
    justify-self: end;
}

/* Quantity control */

.kmd-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.kmd-mini-cart .kmd-qty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--kmd-control-bg);
    color: var(--kmd-control-ink);
    line-height: 1;
    transition: background-color 0.15s;
}

.kmd-mini-cart .kmd-qty__btn:hover:not(:disabled),
.kmd-mini-cart .kmd-qty__btn:focus-visible {
    background: #bfbfbf;
    color: var(--kmd-ink);
}

.kmd-qty__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.kmd-qty__value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 26px;
    padding: 0 4px;
    border: 1px solid var(--kmd-ink);
    font-size: 13px;
}

.kmd-qty__value--static {
    border-color: var(--kmd-line);
    color: var(--kmd-muted);
}

.kmd-mini-cart .kmd-remove {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
}

.kmd-remove:hover,
.kmd-remove:focus-visible {
    opacity: 0.6;
}

/* Summary: pushed to the bottom of the drawer. */

.kmd-mini-cart__summary {
    margin-top: auto;
    padding: 24px var(--kmd-gutter) 0;
}

.kmd-points {
    margin-bottom: 40px;
    padding: 20px 18px;
    background: var(--kmd-beige);
    font-family: var(--kmd-serif);
    font-size: 17px;
    line-height: 1.45;
}

.kmd-points p {
    margin: 0;
}

.kmd-points__amount {
    margin-top: 10px !important;
    font-style: italic;
}

.kmd-mini-cart .kmd-totals {
    margin: 0;
}

.kmd-totals__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--kmd-line);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.kmd-totals__row dt {
    color: var(--kmd-muted);
    font-weight: 400;
}

.kmd-totals__row dd {
    margin: 0;
    white-space: nowrap;
}

.kmd-totals__row--total {
    padding-top: 10px;
}

.kmd-totals__row--total dt {
    color: var(--kmd-ink);
}

/* Footer */

.kmd-mini-cart__footer {
    padding: 12px var(--kmd-gutter) 16px;
    border-top: 1px solid var(--kmd-line);
}

/* !important: the theme's link rule sets `width: fit-content` behind a long :not() chain. */
.kmd-mini-cart__button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--kmd-ink);
    color: #fff !important;
    font-family: var(--kmd-mono);
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: opacity 0.15s;
}

.kmd-mini-cart__button:hover,
.kmd-mini-cart__button:focus-visible {
    opacity: 0.85;
}

.kmd-mini-cart__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-top: 14px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.kmd-pay {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kmd-pay__label {
    margin-right: 6px;
    color: var(--kmd-muted);
}

/* Outranks `.elementor img { height: auto; max-width: 100% }`. */
.kmd-mini-cart .kmd-pay img.kmd-pay__logo {
    display: block;
    height: 20px;
    width: auto;
    max-width: none;
}

.kmd-pay__logo--text {
    height: auto;
    font-family: system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

/* Empty state */

.kmd-mini-cart__empty {
    padding: 24px var(--kmd-gutter);
}

.kmd-mini-cart__empty p {
    margin: 0 0 16px;
    font-family: var(--kmd-serif);
    font-size: 16px;
}

/* Elementor Pro Menu Cart drawer */

/* Elementor's widget CSS loads after ours and sets the drawer padding, so this has to win outright. */
.elementor-menu-cart__container .elementor-menu-cart__main {
    padding: 0 !important;
}

/* Elementor keeps `transform: scale(1)` on the open container, which makes it the
   containing block for the fixed drawer; the container is 100vw wide, so the drawer
   slid under the scrollbar and its right edge was cut off. The closed state's
   scale(0) is left alone, it hides the overlay. */
.elementor-menu-cart--shown .elementor-menu-cart__container {
    transform: none;
}

/* Close button on the same row as the "Varukorg" heading, vertically centred on it:
   header top padding + half the title line height - half the button. */
.elementor-menu-cart__main .elementor-menu-cart__close-button {
    position: absolute;
    top: calc(18px + 13.2px - var(--cart-close-icon-size, 25px) / 2);
    right: 10px;
    z-index: 1;
    margin: 0;
}

/* Thin black cross, same line weight as the cart's other icons. */
.elementor-menu-cart__main .elementor-menu-cart__close-button::before,
.elementor-menu-cart__main .elementor-menu-cart__close-button::after {
    height: 1.5px;
    margin-top: -0.75px;
    border-radius: 0;
    background: #000;
}

/* The mega-menu hamburger overlaps the open drawer; hide it only while the cart is shown. */
body:has(.elementor-menu-cart--shown) .kmm-toggle {
    display: none !important;
}

/* Header cart toggle subtotal (see kmd_filter_cart_subtotal). */

.kmd-original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9em;
    margin-right: 4px;
}

.kmd-discounted-price {
    font-weight: 700;
}
