/*
 * OneTrust consent UI: equal Accept / Reject buttons, every brand (tyson-core.onetrust-buttons).
 *
 * Fixes the OneTrust Compliance Assistant finding "Mismatched or unequal sizes of accept/reject
 * buttons" once for all brand sites instead of editing each brand's OneTrust banner template.
 *
 * - Banner (#onetrust-banner-sdk): side-by-side button groups become an equal-column grid, so
 *   "Accept All Cookies" and "Reject Non-Essential Cookies" always get the same width and height;
 *   full-width (stacked) layouts keep the brand's stacking with both at 100% width. Both share
 *   padding, font size/weight, line height and border width. "Customize Cookies" keeps its own
 *   (secondary) colours but sits in the same grid, so it can never squeeze Reject.
 * - Preference center (#onetrust-pc-sdk): "Allow All" and "Reject All" get the same box and type.
 * - Colours: onetrust-buttons.js copies Accept's computed fill/text/border colours to its Reject
 *   button (as custom properties) and sets data-tc-ot-eq, so both use the brand's Accept style.
 *
 * OneTrust injects its own CSS (and each brand's template CSS, some of it !important) after this
 * file, so the selectors repeat ids for specificity and sizing uses !important.
 * Rollback: remove the tyson-core.onetrust-buttons call from consent-loader.html.
 */

/* ---------- Banner ---------- */

/*
 * Side-by-side layouts: an equal-column grid. auto-fit drops to fewer (still equal) columns, down
 * to one stacked column, when the banner is too narrow for three.
 */
#onetrust-consent-sdk #onetrust-banner-sdk:not(.ot-buttons-fw) #onetrust-button-group#onetrust-button-group {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14em), 1fr)) !important;
    grid-auto-rows: 1fr !important;
    gap: 10px 12px !important;
    align-items: stretch !important;
    justify-items: stretch !important;
}

#onetrust-consent-sdk #onetrust-banner-sdk:not(.ot-buttons-fw) #onetrust-button-group#onetrust-button-group > button {
    float: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
}

/* Same visual order: Accept, Reject, Customize (left to right, or top to bottom). */
#onetrust-consent-sdk #onetrust-banner-sdk:not(.ot-buttons-fw) #onetrust-button-group#onetrust-button-group #onetrust-accept-btn-handler { order: 1 !important; }
#onetrust-consent-sdk #onetrust-banner-sdk:not(.ot-buttons-fw) #onetrust-button-group#onetrust-button-group #onetrust-reject-all-handler { order: 2 !important; }
#onetrust-consent-sdk #onetrust-banner-sdk:not(.ot-buttons-fw) #onetrust-button-group#onetrust-button-group #onetrust-pc-btn-handler { order: 3 !important; }

/*
 * Full-width layouts (OneTrust adds .ot-buttons-fw, e.g. on phones and stacked banners): the brand
 * template already stacks the buttons; keep its order, spacing and min-width (some templates set a
 * min-width wider than the group), and force Accept and Reject to the same full width.
 */
#onetrust-consent-sdk #onetrust-banner-sdk.ot-buttons-fw #onetrust-button-group#onetrust-button-group #onetrust-accept-btn-handler,
#onetrust-consent-sdk #onetrust-banner-sdk.ot-buttons-fw #onetrust-button-group#onetrust-button-group #onetrust-reject-all-handler {
    float: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    height: auto !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
}

/* Both layouts: identical type, padding and border. */
#onetrust-consent-sdk #onetrust-banner-sdk #onetrust-button-group#onetrust-button-group #onetrust-accept-btn-handler,
#onetrust-consent-sdk #onetrust-banner-sdk #onetrust-button-group#onetrust-button-group #onetrust-reject-all-handler {
    padding: 12px 16px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    border-width: 2px !important;
    border-style: solid !important;
    text-align: center !important;
    opacity: 1 !important;
}

#onetrust-consent-sdk[data-tc-ot-eq] #onetrust-banner-sdk #onetrust-button-group#onetrust-button-group #onetrust-reject-all-handler {
    background-color: var(--tc-ot-bnr-bg) !important;
    color: var(--tc-ot-bnr-fg) !important;
    border-color: var(--tc-ot-bnr-bd) !important;
    border-radius: var(--tc-ot-bnr-radius) !important;
    font-family: var(--tc-ot-bnr-font) !important;
    text-transform: var(--tc-ot-bnr-tt) !important;
    text-decoration: none !important;
}

/* ---------- Preference center ---------- */

#onetrust-consent-sdk #onetrust-pc-sdk #accept-recommended-btn-handler#accept-recommended-btn-handler,
#onetrust-consent-sdk #onetrust-pc-sdk#onetrust-pc-sdk button.ot-pc-refuse-all-handler {
    box-sizing: border-box !important;
    /* Same fixed width in both places (they sit in containers of different widths). */
    width: min(320px, calc(100vw - 96px)) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    border-width: 1px !important;
    border-style: solid !important;
    text-align: center !important;
    white-space: normal !important;
    opacity: 1 !important;
}

#onetrust-consent-sdk[data-tc-ot-eq] #onetrust-pc-sdk#onetrust-pc-sdk button.ot-pc-refuse-all-handler {
    background-color: var(--tc-ot-pc-bg) !important;
    color: var(--tc-ot-pc-fg) !important;
    border-color: var(--tc-ot-pc-bd) !important;
    border-radius: var(--tc-ot-pc-radius) !important;
    font-family: var(--tc-ot-pc-font) !important;
    text-transform: var(--tc-ot-pc-tt) !important;
}

/* Narrow phones: "Reject ..." may wrap to two lines, so reserve two lines on both. */
@media only screen and (max-width: 400px) {
    #onetrust-consent-sdk #onetrust-pc-sdk #accept-recommended-btn-handler#accept-recommended-btn-handler,
    #onetrust-consent-sdk #onetrust-pc-sdk#onetrust-pc-sdk button.ot-pc-refuse-all-handler {
        min-height: 62px !important;
    }
}

/* Phones: OneTrust stacks the footer buttons; centre Reject instead of pinning it to one side. */
@media only screen and (max-width: 600px) {
    #onetrust-consent-sdk #onetrust-pc-sdk#onetrust-pc-sdk button.ot-pc-refuse-all-handler {
        align-self: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}
