/* ============================================================
   form.css — the Bricks Form's error and success messages
   ============================================================
   Bricks prints two kinds of message: the error under a field
   (.form-group-error-message) and the result after sending
   (.message.success / .message.error). Both run on Bricks' own colour
   variables, which measure 2.9:1 and 2.3:1. This file swaps them for
   the house feedback tokens: the tint as background, the prose in
   --text-on-light, and the feedback colour as a bar on the leading edge
   (DESIGN-SYSTEM.md §2.7 "colour the signal, not the prose"; chosen
   by Katrine on a trial page 2026-09-13). The boxes look the same in
   light and dark: a light tint, black text, a fixed bar (2026-09-30).
   The fields themselves are styled in Theme Style › Form. The
   screen-reader wiring (aria-invalid, focus to the message) lives in
   assets/js/form-feedback.js.
   Conventions: _shared/bricks-builder/css-conventions.md

   Last updated: 2026-10-07 (auto-stamped by the pre-commit hook)
   ============================================================ */

/* Bricks' four message variables → the house tokens. The tints do not
   change in dark mode, so the boxes stay light.
   Bricks also uses them for its file-upload and captcha error boxes. */
.brxe-form {
    --bricks-text-danger:  var(--text-on-light);
    --bricks-bg-danger:    var(--surface-error);
    --bricks-text-success: var(--text-on-light);
    --bricks-bg-success:   var(--surface-success);
}

/* The text is always black (--text-on-light, it does not flip in dark
   mode); the feedback colour is the bar on the leading edge. Twice the
   strong border, so the bar still reads next to a field's own 2 px
   focus border. The end away from the bar is rounded like the info
   box (--radius-3); the bar side stays straight. */
.brxe-form .form-group-error-message,
.brxe-form .message.error {
    color: var(--text-on-light);
    border-inline-start: calc(2 * var(--border-width-strong)) solid var(--border-error);
    border-start-end-radius: var(--radius-3);
    border-end-end-radius: var(--radius-3);
}

/* A field error hangs free below its field, like a small message of its
   own, so its rounded corners do not clash with the field's. Margin, not
   a gap on the group: a gap would also loosen the label above the field. */
.brxe-form .form-group-error-message {
    margin-block-start: var(--space-2xs);
}

.brxe-form .message.success {
    color: var(--text-on-light);
    border-inline-start: calc(2 * var(--border-width-strong)) solid var(--border-success);
    border-start-end-radius: var(--radius-3);
    border-end-end-radius: var(--radius-3);
}
