/* torn-edge.css: a scrap of torn paper behind any element with data-torn-edge.
   Its ragged outlines are drawn by js/effects/torn-edge.js: --torn-edge for the paper,
   --torn-edge-rim for the rim of torn paper around it.
   Both are layers behind the content, so the text and the focus outline are never cut.
   Colours: --torn-edge-color (white unless set) and --torn-edge-rim-color (none unless set). */

[data-torn-edge] {
  position: relative;
  isolation: isolate;
  background: none;
}

[data-torn-edge]::before,
[data-torn-edge]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
}

/* The rim, under the paper. */
[data-torn-edge]::before {
  background: var(--torn-edge-rim-color, transparent);
  clip-path: var(--torn-edge-rim, none);
}

[data-torn-edge]::after {
  background: var(--torn-edge-color, var(--color-paper));
  clip-path: var(--torn-edge, none);
}
