/* ==========================================================
   SCOTLAND GROWS MAGAZINE
   FULL-WIDTH WOOCOMMERCE CHECKOUT FIX FOR APOSTROPHE 2
   ========================================================== */

/* Hide the Apostrophe 2 sidebar on the checkout page only */
body.woocommerce-checkout #secondary,
body.woocommerce-checkout .widget-area,
body.woocommerce-checkout .sidebar,
body.woocommerce-checkout aside[role="complementary"] {
    display: none !important;
}

/* Allow the main checkout area to use the full available width */
body.woocommerce-checkout #primary,
body.woocommerce-checkout .content-area,
body.woocommerce-checkout .site-main,
body.woocommerce-checkout .entry-content {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Give the checkout a sensible maximum width on desktop */
body.woocommerce-checkout .site-content,
body.woocommerce-checkout .content-wrapper,
body.woocommerce-checkout .entry-content {
    max-width: 1200px !important;
}

/* Improve the WooCommerce Checkout Block proportions */
@media (min-width: 900px) {

    body.woocommerce-checkout .wc-block-checkout {
        display: grid !important;
        grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.85fr) !important;
        gap: 40px !important;
        width: 100% !important;
        max-width: none !important;
    }

    body.woocommerce-checkout .wc-block-checkout__main {
        min-width: 0 !important;
        width: 100% !important;
    }

    body.woocommerce-checkout .wc-block-checkout__sidebar {
        min-width: 380px !important;
        width: 100% !important;
    }

    /* Keep each product row readable */
    body.woocommerce-checkout
    .wc-block-components-order-summary-item {
        display: grid !important;
        grid-template-columns: 64px minmax(0, 1fr) auto !important;
        column-gap: 14px !important;
        align-items: start !important;
    }

    body.woocommerce-checkout
    .wc-block-components-order-summary-item__description {
        min-width: 0 !important;
        width: auto !important;
    }

    /* Prevent the product name running vertically */
    body.woocommerce-checkout
    .wc-block-components-product-name {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        font-weight: 600 !important;
        line-height: 1.35 !important;
        margin-bottom: 6px !important;
    }

    /* Keep subscription information readable */
    body.woocommerce-checkout
    .wc-block-components-product-metadata,
    body.woocommerce-checkout
    .wc-block-components-product-details,
    body.woocommerce-checkout
    .wc-block-components-order-summary-item__description p {
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        font-size: 13px !important;
        line-height: 1.45 !important;
    }

    /* Stop the price crushing the product title */
    body.woocommerce-checkout
    .wc-block-components-order-summary-item__total-price {
        min-width: 72px !important;
        white-space: nowrap !important;
        text-align: right !important;
        font-weight: 600 !important;
    }
}

/* Tablet and mobile */
@media (max-width: 899px) {

    body.woocommerce-checkout .wc-block-checkout {
        display: block !important;
        width: 100% !important;
    }

    body.woocommerce-checkout .wc-block-checkout__sidebar {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.woocommerce-checkout
    .wc-block-components-product-name {
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        line-height: 1.35 !important;
    }
}
/* ==========================================================
   BALANCED CHECKOUT COLUMNS
   ========================================================== */

@media (min-width: 900px) {

    /* Let the checkout use more of the available page width */
    body.woocommerce-checkout .entry-content,
    body.woocommerce-checkout .site-content,
    body.woocommerce-checkout .content-area {
        max-width: 1320px !important;
        width: calc(100% - 60px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Create two more evenly balanced columns */
    body.woocommerce-checkout .wc-block-checkout {
        display: grid !important;
        grid-template-columns: minmax(520px, 1.15fr) minmax(420px, 0.85fr) !important;
        gap: 56px !important;
        width: 100% !important;
        max-width: 1320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        align-items: start !important;
    }

    /* Main customer details column */
    body.woocommerce-checkout .wc-block-checkout__main {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    /* Order summary column */
    body.woocommerce-checkout .wc-block-checkout__sidebar {
        width: 100% !important;
        max-width: none !important;
        min-width: 420px !important;
    }

    /* Make form sections fill the left column */
    body.woocommerce-checkout .wc-block-checkout__main .wc-block-components-checkout-step,
    body.woocommerce-checkout .wc-block-checkout__main .wc-block-components-text-input,
    body.woocommerce-checkout .wc-block-checkout__main .wc-block-components-address-form,
    body.woocommerce-checkout .wc-block-checkout__main input,
    body.woocommerce-checkout .wc-block-checkout__main select {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    /* Make express checkout use the full form-column width */
    body.woocommerce-checkout .wc-block-components-express-payment {
        width: 100% !important;
        max-width: none !important;
    }

    body.woocommerce-checkout .wc-block-components-express-payment__content {
        width: 100% !important;
    }
}
/* Reduce excess space above the checkout */
body.woocommerce-checkout .entry-header,
body.woocommerce-checkout .page-header {
    margin-bottom: 30px !important;
}

body.woocommerce-checkout .entry-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.woocommerce-checkout .wc-block-checkout {
    margin-top: 0 !important;
}

/* Slightly tighten the overall checkout position */
@media (min-width: 900px) {
    body.woocommerce-checkout .site-main {
        padding-top: 20px !important;
    }
}