/*
---
name: overlay()
category:
  - core/mixin
---
Overlay helper

### scss
```scss
//
// @param  hex  $hex
// @param  int  $opacity
//

@use "node_modules/sass-basis/src/css/core";

.c-foo {
  @include core.overlay(#fff, .5);
}
```
*/

@mixin overlay($hex, $opacity: 1) {
  position: relative;

  &::before {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    content: '';

    @if (1 == $opacity) {
      background-color: $hex;
    } @else {
      background-color: rgba($hex, $opacity);
    }
  }
}
