/* Inline field messages (js/field-errors.js): a callout under the field with a notch pointing up at it. */

:root {
    --sl-fe-ring: rgb(225 29 72 / 0.18);
}

.sl-fe {
    --sl-fe-fg: var(--sl-color-danger);
    --sl-fe-icon: #e11d48;
    --sl-fe-bg: #fff1f2;
    --sl-fe-bg-end: #ffe4e6;
    --sl-fe-border: #fecdd3;
    --sl-fe-glow: rgb(225 29 72 / 0.18);
    --sl-fe-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm-1.1 4.4h2.2v6.2H8.9V5.4Zm0 7.9h2.2v2.2H8.9v-2.2Z'/%3E%3C/svg%3E");

    position: relative;
    display: flex;
    align-items: flex-start;
    align-self: flex-start;
    justify-self: start;
    gap: 4px 8px;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin: 10px 0 2px;
    padding: 7px 12px;
    border: 1px solid var(--sl-fe-border);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--sl-fe-bg), var(--sl-fe-bg-end));
    box-shadow: 0 6px 16px -10px var(--sl-fe-glow);
    color: var(--sl-fe-fg);
    font-family: inherit;
    font-size: var(--sl-text-xs);
    font-weight: var(--sl-weight-bold);
    line-height: var(--sl-leading-ui);
    text-align: start;
    overflow-wrap: anywhere;
    animation: sl-fe-in 0.18s ease-out;
}

.sl-fe[hidden] {
    display: none;
}

.sl-fe::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background: var(--sl-fe-icon);
    -webkit-mask: var(--sl-fe-mask) center / contain no-repeat;
    mask: var(--sl-fe-mask) center / contain no-repeat;
}

.sl-fe::after {
    content: "";
    position: absolute;
    top: -6px;
    inset-inline-start: 16px;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--sl-fe-border);
    border-left: 1px solid var(--sl-fe-border);
    border-top-left-radius: 3px;
    background: var(--sl-fe-bg);
    transform: rotate(45deg);
}

.sl-fe[data-fe-type="success"] {
    --sl-fe-fg: var(--sl-color-success);
    --sl-fe-icon: #059669;
    --sl-fe-bg: #ecfdf5;
    --sl-fe-bg-end: #d1fae5;
    --sl-fe-border: #a7f3d0;
    --sl-fe-glow: rgb(5 150 105 / 0.16);
    --sl-fe-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm-1.3 12.7 6.1-6.1-1.5-1.5-4.6 4.6-2.3-2.3-1.5 1.5 3.8 3.8Z'/%3E%3C/svg%3E");
}

.sl-fe[data-fe-type="info"],
.sl-fe[data-fe-type="pending"] {
    --sl-fe-fg: var(--sl-color-text-muted);
    --sl-fe-icon: #64748b;
    --sl-fe-bg: #f8fafc;
    --sl-fe-bg-end: #f1f5f9;
    --sl-fe-border: #e2e8f0;
    --sl-fe-glow: transparent;
    --sl-fe-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm-1.1 7.6h2.2v6.2H8.9V8.6Zm0-3.9h2.2v2.2H8.9V4.7Z'/%3E%3C/svg%3E");

    font-weight: var(--sl-weight-medium);
}

/* Pending messages bring their own spinner. */
.sl-fe[data-fe-type="pending"]::before {
    display: none;
}

.sl-fe .fa-spinner {
    margin-top: 3px;
}

/* The invalid state always wins over hover/focus styling of the surrounding form. */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"],
.sl-fe-anchor-invalid {
    border-color: var(--sl-color-danger) !important;
}

input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
.sl-fe-anchor-invalid:focus-within {
    outline: none;
    box-shadow: 0 0 0 3px var(--sl-fe-ring) !important;
}

/* An input inside a bordered wrapper: only the wrapper draws the ring. */
.sl-fe-anchor-invalid input[aria-invalid="true"]:focus {
    box-shadow: none !important;
}

.sl-fe-shake {
    animation: sl-fe-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes sl-fe-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes sl-fe-shake {
    20%,
    60% { transform: translateX(-4px); }
    40%,
    80% { transform: translateX(4px); }
}

/* Wizard hints are centred full-width lines by default; the callout hugs its text. */
.st-welcome-inner .st-field-hint.sl-fe:not([hidden]) {
    display: flex;
    width: fit-content;
    min-height: 0;
    margin-top: 10px;
    justify-content: flex-start;
}

/* Room for the "use this link instead" suggestion button. */
.st-welcome-inner #w-username-hint.sl-fe {
    flex-wrap: wrap;
    margin-top: 10px;
}

.st-slug-status.sl-fe {
    margin-bottom: var(--sl-space-4);
}

@media (prefers-reduced-motion: reduce) {
    .sl-fe,
    .sl-fe-shake {
        animation: none;
    }
}
