/*
    R50 (WP-407, 5 Aug call + a Figma API measurement the same day): THE CONSOLE'S CORNERS.

    Measured off the queue frame rather than chosen: buttons 2px, input fields 2px, tags 2px, and cards and
    the table container SQUARE. Batch 2 standardised the console on 5px and 6px, which was a real
    standardisation in the wrong direction - it made everything agree with the shape the prototype does not
    draw. This file is the correction, and it is where the two numbers live from now on.

    WHY A FILE RATHER THAN AN EDIT PER COMPONENT. Two reasons, and batch 2's own notes record both:

      1. A scoped component stylesheet CANNOT REACH a portaled surface. Ant's drawers, modals, dropdowns and
         notifications render at the app root, outside every page-owned element, so the fields inside the
         raise drawer and the ceremony modals were the one set batch 2 explicitly gave up on ("fields inside
         portaled drawers and modals are out of reach from a component scope"). They are exactly where an
         agent does most of their typing.
      2. Scattered literals are how a radius drifts. The tokens are declared once, here, and every
         component's own stylesheet reads them - so the next ruling on this is one edit rather than
         twenty-five.

    INERT UNLESS MARKED, the pattern ace-theme.css and console-roboto.css already use: nothing in THIS FILE
    applies without `.dev-preview-marker`, so no customer-facing page takes the portaled rules. The
    `:has()` gate also out-specifies Ant's own single-class rules, so no !important is needed anywhere below.

    (That marker came from DevPreviewLayout when this was written. Since A10 promoted the console to a real
    /ace/ route, the console and its sign-in page draw the span themselves, for the reason console-roboto.css
    records at length.)

    STATED PRECISELY, because the gate does not reach as far as it looks: the component stylesheets that read
    these tokens carry the same numbers as var() FALLBACKS, so those components draw 2px and square with or
    without the marker. That is deliberate - they are console-only components, and a fallback that restored
    the corrected 5px would be worse than one that agrees with the token.
*/

/*
    Declared at the BODY, not on `.ace-app`, and that placement is load-bearing: custom properties inherit
    down the DOM, and a portaled drawer is not a descendant of the page's own root element. On the body they
    reach both trees.
*/
body:has(.dev-preview-marker) {
    /* Buttons, input fields and tags. One number for all three - the frame gives all three the same. */
    --ace-radius-control: 2px;

    /* Cards and the table container. Square, so stated as a plain 0 rather than as "no radius". */
    --ace-radius-card: 0;
}

/*
    The portaled surfaces' own controls. Everything in-page reads the tokens from its component stylesheet;
    these selectors exist for the trees no component stylesheet can see.

    Deliberately NOT a blanket `[class*="ant-"]`: Ant's dropdown panels, tooltips, popovers and message
    boxes are none of the five things the ruling names, and flattening them would be inventing a rule the
    designer did not give. Only buttons, fields and tags are listed.
*/
body:has(.dev-preview-marker) .ant-drawer .ant-btn,
body:has(.dev-preview-marker) .ant-modal .ant-btn,
body:has(.dev-preview-marker) .ant-notification .ant-btn {
    border-radius: var(--ace-radius-control, 2px);
}

body:has(.dev-preview-marker) .ant-drawer .ant-input,
body:has(.dev-preview-marker) .ant-drawer .ant-input-affix-wrapper,
body:has(.dev-preview-marker) .ant-drawer .ant-input-number,
body:has(.dev-preview-marker) .ant-drawer .ant-picker,
body:has(.dev-preview-marker) .ant-drawer textarea.ant-input,
body:has(.dev-preview-marker) .ant-modal .ant-input,
body:has(.dev-preview-marker) .ant-modal .ant-input-affix-wrapper,
body:has(.dev-preview-marker) .ant-modal .ant-input-number,
body:has(.dev-preview-marker) .ant-modal .ant-picker,
body:has(.dev-preview-marker) .ant-modal textarea.ant-input {
    border-radius: var(--ace-radius-control, 2px);
}

/*
    Ant's Select puts its border on an inner element, so it needs its own selector - with the
    `:not(.ant-select-customize-input)` qualifier the in-page rules also carry, for the specificity reason
    their notes record: Ant's own rule scores three classes and a plainer one loses the tie.
*/
body:has(.dev-preview-marker) .ant-drawer .ant-select:not(.ant-select-customize-input) .ant-select-selector,
body:has(.dev-preview-marker) .ant-modal .ant-select:not(.ant-select-customize-input) .ant-select-selector {
    border-radius: var(--ace-radius-control, 2px);
}

body:has(.dev-preview-marker) .ant-drawer .ant-tag,
body:has(.dev-preview-marker) .ant-modal .ant-tag {
    border-radius: var(--ace-radius-control, 2px);
}
