@use 'sass:map';
@use 'sass:string';
@use '../02-tokens/colors-semantic' as semantic;

@each $color, $value in semantic.$color-semantic-map {
    // Skip interactive state tokens — they are not useful as static utility classes
    @if string.index($color, '--hover') or string.index($color, '--pressed') or string.index($color, '--focused') or string.index($color, '--visited') {
        // no-op: hover/pressed/focused/visited states are pseudo-class driven
    } @else if string.index($color, 'on-surface-') {
        // on-surface tokens are consumed by their parent surface class — skip standalone generation
    } @else if string.index($color, 'border-') {
        .eds-u-c-#{$color} {
            border-color: var(--eds-c-#{$color}) !important;
        }
    } @else if string.index($color, 'surface-') {
        .eds-u-c-#{$color} {
            background-color: var(--eds-c-#{$color}) !important;

            @if map.has-key(semantic.$color-semantic-map, 'on-#{$color}') {
                color: var(--eds-c-on-#{$color}) !important;
            }
        }
    } @else if string.index($color, 'foreground') {
        .eds-u-c-#{$color} {
            color: var(--eds-c-#{$color}) !important;
        }
    } @else if string.index($color, 'alpha-backdrop') {
        .eds-u-c-#{$color} {
            background-color: var(--eds-c-#{$color}) !important;
        }
    } @else if string.index($color, 'focus') {
        .eds-u-c-#{$color} {
            outline-color: var(--eds-c-#{$color}) !important;
        }
    } @else if string.index($color, 'link') {
        .eds-u-c-#{$color} {
            color: var(--eds-c-#{$color}) !important;
        }
    } @else {
        .eds-u-c-#{$color} {
            color: var(--eds-c-#{$color}) !important;
        }
    }
}
