/*
 * Site-wide square radio buttons.
 *
 * Loaded last (wp_enqueue_scripts, priority 100) so it out-ranks Storefront's
 * icons.css / woocommerce.css and the inline Customizer CSS, all of which are
 * printed after the child stylesheet.
 *
 * Unchecked : white square, 2px grey border (#c9c5bf)
 * Checked   : solid orange (#ff5500), no tick
 *
 * The native input itself carries the control, so every radio on the site -
 * contact form, checkout, My Account, WooCommerce blocks - looks the same.
 */

/* 1. The shared control --------------------------------------------- */

input[type="radio"]:not(.woocommerce-star-rating__input) {
    -webkit-appearance: none;
    appearance: none;
    display: inline-block;
    box-sizing: border-box;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    margin: 0 8px 0 0;
    padding: 0;
    border: 2px solid #c9c5bf;
    border-radius: 0;
    background-color: #fff;
    background-image: none;
    background-clip: padding-box;
    vertical-align: middle;
    cursor: pointer;
    transition: none !important;
    forced-color-adjust: none;
}

input[type="radio"]:not(.woocommerce-star-rating__input):checked,
input[type="radio"]:not(.woocommerce-star-rating__input):focus, 
input[type="radio"]:not(.woocommerce-star-rating__input):active {
    border-color: #ff5500 !important;
    background-color: #ff5500 !important;
}

input[type="radio"]:not(.woocommerce-star-rating__input):focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.25);
}

input[type="radio"]:not(.woocommerce-star-rating__input):disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* 2. WooCommerce checkout: payment methods --------------------------- */

/*
 * Storefront hides the native radio and paints a Font Awesome circle /
 * toggle glyph onto the label instead. Show the real radio, drop the glyph.
 */
#payment .payment_methods li.wc_payment_method > input[type="radio"],
#payment .payment_methods li.woocommerce-PaymentMethod > input[type="radio"] {
    position: static !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    margin: 0 !important;
    padding: 0 !important;
    border: 2px solid #c9c5bf !important;
    border-radius: 0 !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
    word-wrap: normal;
    vertical-align: middle;
    float: none;
}

#payment .payment_methods li.wc_payment_method > input[type="radio"]:checked,
#payment .payment_methods li.woocommerce-PaymentMethod > input[type="radio"]:checked {
    border-color: #ff5500 !important;
    background-color: #ff5500 !important;
}

#payment .payment_methods > .wc_payment_method > label::before,
#payment .payment_methods > .woocommerce-PaymentMethod > label::before {
    content: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
}

/* Radio + label on one line; the payment box drops to its own row. */
#payment .payment_methods > li.wc_payment_method,
#payment .payment_methods > li.woocommerce-PaymentMethod {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    padding: 12px 0;
    background-color: transparent !important;
}

/* Storefront's clearfix pseudo-elements would become stray flex items. */
#payment .payment_methods > li.wc_payment_method::before,
#payment .payment_methods > li.wc_payment_method::after,
#payment .payment_methods > li.woocommerce-PaymentMethod::before,
#payment .payment_methods > li.woocommerce-PaymentMethod::after {
    display: none !important;
}

#payment .payment_methods > li.wc_payment_method > label,
#payment .payment_methods > li.woocommerce-PaymentMethod > label {
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
}

#payment .payment_methods > li.wc_payment_method > .payment_box,
#payment .payment_methods > li.woocommerce-PaymentMethod > .payment_box {
    flex: 0 0 98%;
    margin-top: 18px;
    margin-left: 1%;
}

/* 3. WooCommerce checkout: delivery methods -------------------------- */

.sf-shipping-methods__item input[type="radio"] {
    margin: 0;
    flex: 0 0 auto;
}

/* Storefront adds a left margin to every input+label pair. */
.sf-shipping-methods__item input[type="radio"] + label {
    margin-left: 0;
}

