@use '@angular/material' as mat;
@mixin sc-links-theme($theme) {
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);
  $success: map-get($theme, success);
  $warning: map-get($theme, warning);
  $danger: map-get($theme, danger);
  $foreground: map-get($theme, foreground);
  $scForeground: map-get($theme, sc-foreground);

  //* default link style
  //*
  //* catch all links without a class and applying default link style
  //* (excluding links with classes and lesser specificity)
  // ! REMEMBER TO ADD EXCLUSIONS TO _SC-LINKS.SCSS

  a:not(.nav__link):not(.mat-button-base):not(.mat-tab-link):not([class*="link"]):not(.bread-crumb-link):not(.mat-list-item) {
    color: mat.get-color-from-palette($foreground, text);
    text-decoration-color: mat.get-color-from-palette($primary, 500);

    &:hover,
    &:active {
      color: mat.get-color-from-palette($primary, 500) !important;
    }

    &:focus {
      background-color: rgba(mat.get-color-from-palette($primary, 500), 0.08) !important;
    }
  }

  //* colored link styles

  .link {
    &-primary {
      color: mat.get-color-from-palette($primary, 500) !important;

      &:hover,
      &:active {
        color: mat.get-color-from-palette($primary, 600) !important;
        text-decoration-color: mat.get-color-from-palette($primary, 600) !important;
      }

      &:focus {
        background-color: rgba(mat.get-color-from-palette($primary, 500), 0.08) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($primary, 500) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($primary, 500), 0.08) !important;
        }
      }

      &.link-super-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;
        text-decoration-color: mat.get-color-from-palette($primary, 500) !important;

        &:hover,
        &:active {
          color: mat.get-color-from-palette($primary, 500) !important;
        }

        &:focus {
          background-color: rgba(mat.get-color-from-palette($primary, 500), 0.08) !important;
        }
      }
    }

    &-accent {
      color: mat.get-color-from-palette($accent, 500) !important;

      &:hover,
      &:active {
        color: mat.get-color-from-palette($accent, 600) !important;
        text-decoration-color: mat.get-color-from-palette($accent, 600) !important;
      }

      &:focus {
        background-color: rgba(mat.get-color-from-palette($accent, 500), 0.08) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($accent, 500) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($accent, 500), 0.08) !important;
        }
      }

      &.link-super-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;
        text-decoration-color: mat.get-color-from-palette($accent, 500) !important;

        &:hover,
        &:active {
          color: mat.get-color-from-palette($accent, 500) !important;
        }

        &:focus {
          background-color: rgba(mat.get-color-from-palette($accent, 500), 0.08) !important;
        }
      }
    }

    &-success {
      color: mat.get-color-from-palette($success, 500) !important;

      &:hover,
      &:active {
        color: mat.get-color-from-palette($success, 600) !important;
        text-decoration-color: mat.get-color-from-palette($success, 600) !important;
      }

      &:focus {
        background-color: rgba(mat.get-color-from-palette($success, 500), 0.08) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($success, 500) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($success, 500), 0.08) !important;
        }
      }

      &.link-super-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;
        text-decoration-color: mat.get-color-from-palette($success, 500) !important;

        &:hover,
        &:active {
          color: mat.get-color-from-palette($success, 500) !important;
        }

        &:focus {
          background-color: rgba(mat.get-color-from-palette($success, 500), 0.08) !important;
        }
      }
    }

    &-warning {
      color: mat.get-color-from-palette($warning, 500) !important;

      &:hover,
      &:active {
        color: mat.get-color-from-palette($warning, 600) !important;
        text-decoration-color: mat.get-color-from-palette($warning, 600) !important;
      }

      &:focus {
        background-color: rgba(mat.get-color-from-palette($warning, 500), 0.08) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($warning, 500) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($warning, 500), 0.08) !important;
        }
      }

      &.link-super-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;
        text-decoration-color: mat.get-color-from-palette($warning, 500) !important;

        &:hover,
        &:active {
          color: mat.get-color-from-palette($warning, 500) !important;
        }

        &:focus {
          background-color: rgba(mat.get-color-from-palette($warning, 500), 0.08) !important;
        }
      }
    }

    &-danger {
      color: mat.get-color-from-palette($danger, 500) !important;

      &:hover,
      &:active {
        color: mat.get-color-from-palette($danger, 600) !important;
        text-decoration-color: mat.get-color-from-palette($danger, 600) !important;
      }

      &:focus {
        background-color: rgba(mat.get-color-from-palette($danger, 500), 0.08) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($danger, 500) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($danger, 500), 0.08) !important;
        }
      }

      &.link-super-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;
        text-decoration-color: mat.get-color-from-palette($danger, 500) !important;

        &:hover,
        &:active {
          color: mat.get-color-from-palette($danger, 500) !important;
        }

        &:focus {
          background-color: rgba(mat.get-color-from-palette($danger, 500), 0.08) !important;
        }
      }
    }

    &-text {
      color: mat.get-color-from-palette($foreground, text) !important;

      &:focus {
        background-color: rgba(mat.get-color-from-palette($foreground, text), 0.04) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($foreground, text) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($foreground, text), 0.04) !important;
        }
      }
    }

    &-text-muted {
      color: mat.get-color-from-palette($foreground, secondary-text) !important;

      &:focus {
        background-color: rgba(mat.get-color-from-palette($foreground, text), 0.04) !important;
      }

      &.link-subtle {
        color: mat.get-color-from-palette($foreground, secondary-text) !important;

        &:focus {
          background-color: rgba(mat.get-color-from-palette($foreground, text), 0.04) !important;
        }
      }
    }

    &-unstyled:focus {
      background-color: rgba(mat.get-color-from-palette($foreground, text), 0.08) !important;
    }
  }
}
