@mixin verticalFadePseudoElements($size) {
  position: relative;

  &:before {
    content: '';
    position: absolute;
    z-index: 1;
    height: spacing($size);

    inset: 0 10px auto 0; // Right inset needed to not overlay the scrollbar
    background: linear-gradient(
      180deg,
      colorAlpha(var(--corvaui-background), 1) 0%,
      colorAlpha(var(--corvaui-background), 0) 100%
    );
  }

  &:after {
    content: '';
    position: absolute;
    z-index: 1;
    height: spacing($size);

    inset: auto 10px 0 0; // Right inset needed to not overlay the scrollbar
    background: linear-gradient(
      0deg,
      colorAlpha(var(--corvaui-background), 1) 0%,
      colorAlpha(var(--corvaui-background), 0) 100%
    );
  }
}

@mixin transparencyCheckerboard($checkerboardSize) {
  // Not theme colours
  background: #fff repeating-conic-gradient(#ccc 0% 25%, transparent 0% 50%) 50%;
  background-size: $checkerboardSize $checkerboardSize;
}

// Design system focus state: crisp primary ring + 4px halo (palette/primary/p12)
// https://www.figma.com/design/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=138328-22115
@mixin focusVisibleOutline($borderRadius: null) {
  // Transparent outline stays visible in Windows High Contrast Mode where box-shadow is not rendered
  outline: 2px solid transparent;
  box-shadow:
    0 0 0 1px $palette_primary_main,
    0 0 0 5px colorAlpha($palette_primary_main, 0.12);

  // The ring follows the element's own border-radius; pass one for square elements
  @if $borderRadius {
    border-radius: $borderRadius;
  }
}

@mixin transparencyTransparentIndicator($borderWidth: 1px) {
  position: relative;

  &:before {
    content: '';
    position: absolute;
    width: 90%;
    border-radius: 2px;
    border: $borderWidth solid #ff0000; // Not a theme colour
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }
}
