@use '../abstract/variables' as v;
@use '../abstract/mixins' as m;
@use '../abstract/theme' as t;
@use 'config' as c;

@include c.host('card') {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: v.card('padding');
border-radius: v.card('border-radius');
background-color: t.color('surface-container-low');
color: t.color('on-surface');
@include m.typography('body-medium');

&[variant='filled'] {
background-color: t.color('surface-container-highest');
}

&[variant='outlined'] {
border: 1px solid t.color('outline-variant');
background-color: t.color('surface');
}

&[headline]::before {
content: attr(headline);
order: -2;
@include m.typography('title-large');
}

&[subhead]::after {
content: attr(subhead);
order: -1;
color: t.color('on-surface-variant');
}

&[headline]:not([subhead])::before,
&[subhead]::after {
margin-bottom: v.card('padding');
}

> [slot='headline'] {
order: -2;
@include m.typography('title-large');
}

> [slot='subhead'] {
order: -1;
color: t.color('on-surface-variant');
}

&:not(:has(> [slot='actions'] ~ [slot='actions'])) {
> [slot='actions'] {
align-self: flex-end;
margin-block: 24px -8px;
margin-inline: -8px;
}
&[actions-align='start'] > [slot='actions'],
&[actions-align='space-between'] > [slot='actions'] { align-self: flex-start; }
&[actions-align='center'] > [slot='actions'] { align-self: center; }
}
}
