/* Apply the storefront link treatment, including visited and hover states. */
body a:any-link:not(:where(#wpadminbar *, #wp-toolbar *)) {
    text-decoration-line: none !important;
}

/* Keep the colours assigned by the theme's existing components and their controls. */
body a:any-link:not(:where(
    #wpadminbar *, #wp-toolbar *, .fh *, .fh-skip,
    .button, .fqs-button, .wp-block-button__link, .wp-element-button, .wc-block-components-button,
    .jgc-product-link, .jgc-circle-link, .jgc-pagination *,
    .farruniq-checkout #main-content *, .farruniq-cart-page #main-content *
)) {
    color: #394d41 !important;
}

body a:any-link:hover:not(:where(
    #wpadminbar *, #wp-toolbar *, .fh *, .fh-skip,
    .button, .fqs-button, .wp-block-button__link, .wp-element-button, .wc-block-components-button,
    .jgc-product-link, .jgc-circle-link, .jgc-pagination *,
    .farruniq-checkout #main-content *, .farruniq-cart-page #main-content *
)) {
    color: #203b2e !important;
}

body :where(a:any-link):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

body.farruniq-cart-page #main-content :is(
    .wc-block-cart__submit-button,
    .wc-proceed-to-checkout .checkout-button,
    .return-to-shop .button,
    .wc-block-cart__empty-cart__title ~ .wp-block-buttons .wp-block-button__link
) {
    background: #394d41;
    border-color: #394d41;
}

body.farruniq-cart-page #main-content :is(
    .wc-block-cart__submit-button,
    .wc-proceed-to-checkout .checkout-button,
    .return-to-shop .button,
    .wc-block-cart__empty-cart__title ~ .wp-block-buttons .wp-block-button__link
):hover {
    background: #2d4035;
    border-color: #2d4035;
}

/* Clip page-level overflow on the Cart while leaving the circle viewport scrollable. */
body.farruniq-cart-page {
    overflow-x: hidden;
    overflow-x: clip;
}

:root:has(> body.farruniq-cart-page) {
    overflow-x: hidden;
    overflow-x: clip;
}

body.farruniq-cart-page #main-content {
    box-sizing: border-box;
    min-inline-size: 0;
    max-inline-size: 100%;
}

@media (min-width: 801px) {
    body.farruniq-cart-page #main-content {
        inline-size: 100%;
        padding-inline: 0;
    }

    body.farruniq-cart-page #main-content > article {
        box-sizing: border-box;
        inline-size: 100%;
        max-inline-size: var(--farruniq-cart-header-width, 1400px);
        margin-inline: auto;
        padding-inline: var(--farruniq-cart-header-padding, 24px);
    }
}

@media (max-width: 749px) {
    body.farruniq-cart-page #main-content :is(
        article, .page-content, .wp-block-woocommerce-cart, .wc-block-cart,
        .wc-block-cart__main, .wc-block-cart__sidebar, .wc-block-cart-items,
        .wc-block-cart-items__row, .wc-block-cart-item__product,
        .wc-block-cart-item__total, .wc-block-cart-item__quantity,
        .woocommerce-cart-form, .cart-collaterals
    ) {
        box-sizing: border-box;
        min-inline-size: 0;
        max-inline-size: 100%;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items,
    body.farruniq-cart-page #main-content .wc-block-cart-items > tbody {
        display: block;
        inline-size: 100%;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items > thead {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row {
        display: grid;
        grid-template-columns: clamp(48px, 22%, 84px) minmax(0, 1fr);
        grid-template-areas:
            "image product"
            "total total";
        align-items: start;
        gap: var(--farruniq-cart-space-total-top, 8px) var(--farruniq-cart-space-image-gap, 12px);
        inline-size: 100%;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row > :is(
        .wc-block-cart-item__image, .wc-block-cart-item__product, .wc-block-cart-item__total
    ) {
        position: static;
        float: none;
        inline-size: auto;
        min-inline-size: 0;
        max-inline-size: 100%;
        margin: 0;
        padding-inline: 0;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row > .wc-block-cart-item__image {
        grid-area: image;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row > .wc-block-cart-item__product {
        grid-area: product;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row > .wc-block-cart-item__total {
        grid-area: total;
        text-align: center;
        padding-block: 0;
        justify-self: stretch;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__product .wc-block-components-product-metadata__description {
        display: none;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__total .wc-block-cart-item__total-price-and-sale-badge-wrapper {
        display: flex;
        flex-flow: row wrap;
        align-items: center;
        justify-content: center;
        gap: var(--farruniq-cart-space-badge-gap-block, 6px) var(--farruniq-cart-space-badge-gap-inline, 10px);
        inline-size: 100%;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__product .wc-block-components-product-name {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.farruniq-cart-page #main-content :is(
        .wc-block-cart-item__product, .wc-block-cart-item__total,
        .wc-block-cart-item__total .wc-block-components-sale-badge,
        .wc-block-components-totals-item__value, .woocommerce-cart-form .product-name
    ) {
        overflow-wrap: anywhere;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__total .wc-block-components-sale-badge {
        box-sizing: border-box;
        max-inline-size: 100%;
        white-space: normal;
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__quantity {
        flex-wrap: wrap;
    }

    body.farruniq-cart-page #main-content .wc-block-components-quantity-selector {
        max-inline-size: 100%;
    }
}

body.farruniq-cart-page #main-content :is(
    .wc-block-cart__submit-button .wc-block-components-button__text,
    .wc-block-cart__submit-button:not(:has(.wc-block-components-button__text)),
    .wc-proceed-to-checkout .checkout-button
) {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: center;
    gap: var(--farruniq-cart-space-button-icon-gap, .45em);
    min-inline-size: 0;
}

body.farruniq-cart-page #main-content :is(
    .wc-block-cart__submit-button .wc-block-components-button__text,
    .wc-block-cart__submit-button:not(:has(.wc-block-components-button__text)),
    .wc-proceed-to-checkout .checkout-button
)::before {
    content: var(--farruniq-cart-checkout-icon-content, none);
    position: static;
    order: var(--farruniq-cart-checkout-icon-order, -1);
    flex: 0 0 1.05em;
    block-size: 1.05em;
    background: currentColor;
    -webkit-mask: var(--farruniq-cart-checkout-icon-mask) center / contain no-repeat;
    mask: var(--farruniq-cart-checkout-icon-mask) center / contain no-repeat;
    pointer-events: none;
}

/* Typography and spacing for the Cart content. The circle slider has its own controls. */
body.farruniq-cart-page #main-content :is(
    article > h1, .entry-title, .wp-block-post-title, .wp-block-woocommerce-cart,
    .woocommerce-cart-form, .cart_totals, .wc-block-components-product-name,
    .wc-block-components-totals-item__label, .wc-block-components-totals-item__value,
    .wc-block-cart__submit-button, .wc-block-components-button__text,
    .farruniq-cart-delivery-note
) {
    line-height: var(--farruniq-cart-space-line-height, 150%);
    letter-spacing: var(--farruniq-cart-space-letter-spacing, 0px);
    word-spacing: var(--farruniq-cart-space-word-spacing, 0px);
}

body.farruniq-cart-page #main-content :is(article > h1, .entry-title, .wp-block-post-title) {
    margin-block-end: var(--farruniq-cart-space-title-bottom, 24px);
}

body.farruniq-cart-page #main-content .wc-block-cart-item__product .wc-block-components-product-name {
    display: block;
    margin-block-end: var(--farruniq-cart-space-title-price, 4px);
}

body.farruniq-cart-page #main-content :is(.wc-block-cart-item__prices, .woocommerce-cart-form .product-price) del {
    margin-inline-end: var(--farruniq-cart-space-unit-price-gap, 4px);
}

body.farruniq-cart-page #main-content .wc-block-cart-item__quantity {
    margin-block-start: var(--farruniq-cart-space-quantity-top, 8px);
    gap: var(--farruniq-cart-space-quantity-gap, 16px);
}

body.farruniq-cart-page #main-content .wc-block-cart-item__quantity .wc-block-cart-item__remove-link {
    margin-inline: 0;
}

body.farruniq-cart-page #main-content :is(
    .wc-block-cart__sidebar .wc-block-components-totals-wrapper,
    .wc-block-cart__sidebar .wc-block-components-totals-footer-item,
    .cart_totals tr > :is(th, td)
) {
    padding-block: var(--farruniq-cart-space-summary-padding, 12px);
}

body.farruniq-cart-page #main-content .wc-block-cart__sidebar .wc-block-components-totals-item {
    column-gap: var(--farruniq-cart-space-summary-gap, 12px);
}

body.farruniq-cart-page #main-content .cart_totals tr > th {
    padding-inline-end: var(--farruniq-cart-space-summary-gap, 12px);
}

body.farruniq-cart-page #main-content .farruniq-cart-delivery-note {
    display: inline-block;
    margin-block-start: var(--farruniq-cart-space-delivery-gap, 4px);
}

body.farruniq-cart-page #main-content :is(.wc-block-cart__submit, .wc-proceed-to-checkout) {
    margin-block-start: var(--farruniq-cart-space-button-top, 16px);
}

@media (min-width: 750px) {
    body.farruniq-cart-page #main-content :is(.wc-block-cart-items__row, .woocommerce-cart-form__cart-item) > td {
        padding-block: var(--farruniq-cart-space-item-padding, 16px);
    }

    body.farruniq-cart-page #main-content :is(.wc-block-cart-item__image, .woocommerce-cart-form .product-thumbnail) {
        padding-inline-end: var(--farruniq-cart-space-image-gap, 20px);
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__total-price-and-sale-badge-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        margin-block-start: var(--farruniq-cart-space-total-top, 0px);
        row-gap: var(--farruniq-cart-space-badge-gap-block, 6px);
    }

    body.farruniq-cart-page #main-content .wc-block-cart-item__total .wc-block-components-sale-badge {
        margin-inline-end: var(--farruniq-cart-space-badge-gap-inline, 0px);
    }
}

@media (max-width: 749px) {
    body.farruniq-cart-page #main-content .wc-block-cart-items__row {
        padding-block: var(--farruniq-cart-space-item-padding, 16px);
    }

    body.farruniq-cart-page #main-content .wc-block-cart-items__row > :is(.wc-block-cart-item__image, .wc-block-cart-item__product) {
        padding-block: 0;
    }
}
