@use 'sass:map';
@use '../core/theming/theming';
@use '../core/theming/palette';

@mixin color($config-or-theme) {
  $config: theming.get-color-config($config-or-theme);
  $background: map.get($config, background);
  $foreground: map.get($config, foreground);
  $is-dark-theme: map.get($config, is-dark);

  .mtx-text3d {
    .mtx-text3d-layer {
      text-shadow: 0 0 1px rgba(black, .54);

      &:not(:first-child) {
        text-shadow: 0 0 20px rgba(black, .12);
        color: theming.get-color-from-palette(palette.$gray-palette, 100);
      }

      &:first-child {
        color: theming.get-color-from-palette(palette.$gray-palette, 900);
      }
    }
  }
}

@mixin typography($config-or-theme) {}

@mixin _density($config-or-theme) {}

@mixin theme($theme-or-color-config) {
  $theme: theming.private-legacy-get-theme($theme-or-color-config);
  @include theming.private-check-duplicate-theme-styles($theme, 'mtx-text3d') {
    $color: theming.get-color-config($theme);
    $density: theming.get-density-config($theme);
    $typography: theming.get-typography-config($theme);

    @if $color != null {
      @include color($color);
    }
    @if $density != null {
      @include _density($density);
    }
    @if $typography != null {
      @include typography($typography);
    }
  }
}
