@layer components {
    :where(html[data-ds]) .dialog {
        width: min(100% - var(--ds-space-8), calc(var(--ds-space-32) * 4));
        max-height: calc(100dvh - var(--ds-space-16));
        margin: auto;
        padding: 0;
        border: var(--ds-border-width-1) solid var(--ds-color-border);
        border-radius: var(--ds-radius-lg);
        background-color: var(--ds-color-background);
        color: var(--ds-color-text);
    }

    :where(html[data-ds]) .dialog[open] {
        display: flex;
        flex-direction: column;
        animation: ds-dialog-in var(--ds-duration-medium) var(--ds-easing-out);
    }

    :where(html[data-ds]) .dialog::backdrop {
        background-color: color-mix(in srgb, var(--ds-color-background) 80%, transparent);
    }

    :where(html[data-ds]) .dialog-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: var(--ds-space-4);
        padding: var(--ds-space-5) var(--ds-space-6) 0;
    }

    :where(html[data-ds]) .dialog-title {
        margin: 0;
        font-size: var(--ds-text-h3-size);
        line-height: var(--ds-text-h3-line-height);
        overflow-wrap: break-word;
    }

    :where(html[data-ds]) .dialog-body {
        display: flex;
        flex-direction: column;
        gap: var(--ds-space-4);
        padding: var(--ds-space-4) var(--ds-space-6);
        overflow-y: auto;
    }

    :where(html[data-ds]) .dialog-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--ds-space-2);
        padding: var(--ds-space-4) var(--ds-space-6) var(--ds-space-5);
        border-block-start: var(--ds-border-width-1) solid var(--ds-color-border);
    }

    @keyframes ds-dialog-in {
        from {
            opacity: 0;
            translate: 0 var(--ds-space-2);
        }
    }
}
