// The code snippets in this file are derived from the Halcyon theme
// - https://github.com/dbarenholz/halcyon-obsidian?tab=readme-ov-file

@mixin hltr-wrapper($color) {
  :is(
    .hltr-#{$color},
    mark.hltr-#{$color},
    .markdown-preview-view mark.hltr-#{$color}
  ) {
    background: rgba(var(--color-#{$color}-rgb), 65%);
  }
}

body {
  @include hltr-wrapper("pink");
  @include hltr-wrapper("red");
  @include hltr-wrapper("orange");
  @include hltr-wrapper("yellow");
  @include hltr-wrapper("green");
  @include hltr-wrapper("cyan");
  @include hltr-wrapper("blue");
  @include hltr-wrapper("purple");
}

body.highlightr-lowlight
  :is(mark, span.cm-highlight, .markdown-preview-view mark) {
  --lowlight-background: var(--background-primary);
  background-image: linear-gradient(
    to right,
    0,
    var(--lowlight-background) 10%,
    rgba(var(--mono-rgb-0), 0) 10%,
    rgba(var(--mono-rgb-0), 0) 25%,
    var(--lowlight-background) 40%
  ) !important;
}

body.highlightr-floating
  mark[class*="hltr"]:last-of-type:not(mark[class*="hltr"]:only-of-type) {
  --floating-background: var(--background-primary);
  --floating-size: 20%;
  padding-bottom: 0.1em;
  background-image: linear-gradient(
    to right,
    0,
    rgba(var(--mono-rgb-0), 0) var(--floating-size),
    var(--floating-background) var(--floating-size)
  ) !important;
}

body.highlightr-rounded
  :is(mark, span.cm-highlight, .markdown-preview-view mark),
body.highlightr-realistic
  :is(mark, span.cm-highlight, .markdown-preview-view mark) {
  padding-top: 0;
  padding-bottom: 0;
}
