/*
 * @task_id 20261116-FE-PAGEMESSAGES-01
 * Pin .page.messages so the stack's vertical center sits at 38.2% of the
 * viewport (upper golden-section line) only while it contains a .message.
 * An empty strip stays in normal flow, so the account-page gap rules are
 * left alone.
 *
 * The account selector is repeated so margin:0 wins over
 * body.account:has(.xm-account-nav) .page.messages { margin-top: 0 }
 * and over .account .page.messages { margin-top: 1.2rem }.
 * z-index 800 sits under the modal overlay (899) and popup (900).
 *
 * min-height 102.4px is twice the old two-line box (51.2px), so one line
 * and two lines share one height. Longer copy can grow. Width is unchanged.
 * Border uses currentColor so success stays green and failure stays red;
 * Magento still owns each type's background.
 * 8px radius matches the theme account radius.
 */

body .page.messages:has(.message),
body.account:has(.xm-account-nav) .page.messages:has(.message) {
    position: fixed;
    z-index: 800;
    top: 38.2%;
    right: 0;
    bottom: auto;
    left: 0;
    width: min(420px, calc(100% - 32px));
    height: auto;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    transform: translateY(-50%);
}

body .page.messages:has(.message) .messages,
body.account:has(.xm-account-nav) .page.messages:has(.message) .messages {
    margin: 0;
}

body .page.messages:has(.message) .message {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 102.4px;
    margin: 0 0 8px;
    padding-right: 44px;
    border: 1px solid currentColor;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

body .page.messages:has(.message) .message > *:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

body .page.messages:has(.message) .message > *:first-child:before {
    top: 50%;
    margin-top: 0;
    transform: translateY(-50%);
}

body .page.messages:has(.message) .xm-page-messages__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

body .page.messages:has(.message) .messages:last-child .message:last-child {
    margin-bottom: 0;
}
