/* Public WordPress controls. The .trap-btn variants share their palette with the cards app. */
:root {
    --trb-blue: #154cc1;
    --trb-green: #b8f669;
    --trb-ink: #1a1916;
    --trb-purple: #5e2ab4;
    --trb-lilac: #f2e9ff;
    --trb-mist: #e5ecff;
    --trb-navy: #123b92;
}

/* Legacy posts, WPBakery and the payment form set competing inline colours and
   theme !important rules. Keep the overrides together and limited to actions. */
@layer trotoara-buttons {
    :where(
        .trap-btn, a.btn, button.btn, a.button, a.vc_btn3, button.vc_btn3,
        a.wpb_button, button.wpb_button, .wp-block-button__link,
        .btn-red > a, .btn-white > a, a.scrollToSubscribe,
        a.tr-apply, a.tl-action, a.paper-link, a.tr-follow-action,
        a.trap-dance__signup, .trap-studio-actions > a, .trap-member-actions > a,
        a.trap-film-next, a.give-primary, .menu-apply-button > a,
        input[type="submit"], input[type="button"], input[type="reset"],
        .epay-submit-button, .monthly-panel button, .trap-monthly-form button,
        .foot .fieldrow button, #SubscribeForm button[type="submit"],
        form.comment-form button[type="submit"], .wp-pagenavi > a, .wp-pagenavi > .current,
        #cookie-notice .cn-set-cookie
    ) {
        box-sizing: border-box !important;
        vertical-align: middle !important;
        align-items: center !important;
        justify-content: center !important;
        gap: .5em !important;
        min-height: var(--trb-height, 44px) !important;
        max-width: 100% !important;
        padding: var(--trb-pad, 10px 17px) !important;
        appearance: none !important;
        background: var(--trb-fill, var(--trb-blue)) !important;
        color: var(--trb-text, white) !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        text-decoration: none !important;
        -webkit-text-fill-color: currentColor !important;
        font: 700 var(--trb-size, 17px)/1.2 TrapCond, Cond, "Open Sans Condensed", "Arial Narrow", Arial, sans-serif !important;
        letter-spacing: normal !important;
        text-align: center !important;
        text-transform: var(--trb-case, uppercase) !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        transform: none !important;
        translate: none !important;
        scale: none !important;
        rotate: none !important;
        transition: none !important;

        &:is(a, button, span):not([hidden]) {
            /* Keep display overridable by visibility rules and JS step controls. */
            display: inline-flex;
        }
        &:is(:hover, :focus-visible, :active) {
            background: var(--trb-over, var(--trb-green)) !important;
            color: var(--trb-over-text, var(--trb-ink)) !important;
        }
        &:focus-visible {
            outline: 3px solid var(--trb-ring, var(--trb-navy)) !important;
            outline-offset: 2px !important;
        }
        &:is(:disabled, [aria-disabled="true"], .disabled, [aria-busy="true"]) {
            background: #e7e6e2 !important;
            color: #514f49 !important;
            opacity: 1 !important;
            cursor: not-allowed !important;
        }
        & :where(span:not(.screen-reader-text), i, svg) {
            color: inherit !important;
            text-decoration: none !important;
        }
    }
    /* Rows of links on campaign and donation landing pages use a contrasting secondary action. */
    :where(.trap-btn--green, .menu-apply-button > a, .don-foot, .give-primary,
           .trap-member-actions > a:first-child) {
        --trb-fill: var(--trb-green);
        --trb-text: var(--trb-ink);
        --trb-over: var(--trb-ink);
        --trb-over-text: white;
    }
    :where(.trap-btn--ink, .ink-btn, .btn-red > a, .tr-follow-action) {
        --trb-fill: var(--trb-ink);
        --trb-text: white;
    }
    :where(.trap-btn--purple, .trap-film-next, .trap-dance__signup, .epay-subscribe-btn) {
        --trb-fill: var(--trb-purple);
        --trb-text: white;
        --trb-over: var(--trb-lilac);
        --trb-over-text: #351664;
    }
    :where(.trap-btn--light, .trap-btn--outline, .btn-white > a, .tr-apply-secondary,
           .trap-studio-actions > a + a, .trap-member-actions > a:nth-child(3),
           .trap-monthly-form .secondary, .trap-monthly-form .edit-choice, input[type="reset"],
           .wp-pagenavi > a, .vc_btn3[href*="drive.google.com"]) {
        --trb-fill: var(--trb-mist);
        --trb-text: var(--trb-navy);
        --trb-over: var(--trb-blue);
        --trb-over-text: white;
    }
    :where(.paper-link, .wp-pagenavi > .current) {
        --trb-fill: var(--trb-ink);
        --trb-text: white;
    }
    :where(.paper-link, .trap-member-actions > a, .wp-pagenavi > a, .wp-pagenavi > .current) {
        --trb-pad: 8px 12px;
        --trb-size: 15px;
    }
    :where(.trap-film-next, .vc_btn3[href*="drive.google.com"], #cn-accept-cookie) {
        --trb-case: none;
    }
    .vc_btn3[href*="drive.google.com"] {
        text-align: start !important;
    }
    /* WPBakery's 3D preset also moves the whole anchor with top on hover. */
    .vc_btn3, .wpb_button, a.button4 { inset: auto !important; }
    .vc_btn3:is(.vc_btn3-icon-left, .vc_btn3-icon-right):not([hidden]) {
        display: inline-flex !important;
    }
    .vc_btn3 > .vc_btn3-icon {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        margin: 0 !important;
        flex: none;
        align-self: baseline;
        font-size: 1em !important;
        line-height: 1 !important;
    }
    a.button4::before, a.button4::after {
        content: none !important;
    }
    .wpb_text_column:has(.trotoara-drive-video .trap-film-nav):has(+ .gap + .vc_btn3-container) {
        margin-bottom: 0 !important;
    }
    .wpb_text_column:has(.trotoara-drive-video .trap-film-nav) + .gap:has(+ .vc_btn3-container) {
        height: 12px !important;
        line-height: 12px !important;
    }
    .trotoara-drive-video:has(.trap-film-nav), .trotoara-drive-video .trap-film-nav {
        margin-bottom: 0 !important;
    }
    .trap-film-nav {
        margin-top: 12px !important;
    }

    /* Preserve icon shape, hidden menus and the positioning of viewer controls. */
    :where(.arrows button, .reel-controls button, .view-controls button, .view-close,
           #partnerDialog .x, .social_sharing .social_icon a.social_item,
           .post-title .navi a[rel], .slide-options button, .location-tabs button, .tr-search button,
           .tr-mast .tr-toggle) {
        color: white !important;
        background-color: var(--trb-ink) !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        transition: none !important;

        &:is([aria-pressed="true"], [aria-selected="true"], .on, .active) {
            color: var(--trb-ink) !important;
            background-color: var(--trb-green) !important;
            font-weight: 700 !important;
        }
        &:is(:hover, :focus-visible) {
            color: white !important;
            background-color: var(--trb-purple) !important;
        }
        &:focus-visible {
            outline: 2px solid currentColor !important;
            outline-offset: -3px !important;
        }
        &:is(:disabled, [aria-disabled="true"]) {
            color: #514f49 !important;
            background-color: #e7e6e2 !important;
        }
    }
    /* The old theme builds share icons from a rotated box and two triangles. */
    .social_sharing .social_icon {
        display: inline-flex !important;
        flex-wrap: wrap;
        gap: 4px;
        overflow: visible !important;
    }
    .social_sharing .social_icon a.social_item {
        display: grid !important;
        place-items: center;
        box-sizing: border-box !important;
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
    }
    .social_sharing .social_icon a.social_item::before,
    .social_sharing .social_icon a.social_item::after { content: none !important; }
    .social_sharing .social_icon a.social_item i {
        position: static !important;
        width: auto !important;
        height: auto !important;
        transform: none !important;
        color: inherit !important;
        font-size: 16px !important;
    }
    .post-title .navi a[rel]::after { color: inherit !important; }
    /* Links styled as text in the footer keep their position among the other links. */
    .foot .plink {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        &:is(:hover, :focus-visible) { color: var(--trb-green) !important; }
        &:focus-visible { outline: 2px solid currentColor !important; }
    }
    .slide-options button, .location-tabs button {
        min-height: 40px !important;
    }
    :where(.arrows button, .reel-controls button) {
        min-width: 36px !important;
        min-height: 36px !important;
    }
    .menu-apply-button > a {
        --trb-pad: 9px 18px;
        --trb-ring: white;
        text-align: center !important;
        line-height: 1.2 !important;
    }
    .tr-mast .menu-apply-button > a:not([hidden]) {
        display: inline-flex !important;
    }
    .tr-mast .menu-apply-button { align-self: center; }
    @media (max-width: 700px) {
        .menu-apply-button > a { --trb-pad: 9px 14px; }
    }
    @media (forced-colors: active) {
        :where(.trap-btn, .vc_btn3, a.button, a.btn, button, input[type="submit"],
               input[type="button"], .trap-film-next, .menu-apply-button > a, .wp-pagenavi > a) {
            outline: 1px solid ButtonText !important;
            outline-offset: -1px !important;
            &:focus-visible { outline: 3px solid Highlight !important; }
        }
    }
}
