# Effects

Shadows, opacity, filters, blending, and masks.

Source: https://www.zazz.sh/api/utilities/effects/

`--elevation` takes a height and draws it as a four-layer `box-shadow`: `--elevation: 4` uses the layers of `--shadow-md`, and the shadow grows and darkens as the number rises. Every layer blurs by at most its distance and pulls in by a negative spread, so with the light overhead nothing shows above the element or past its sides. A negative height draws like its absolute value, and a word draws nothing. It takes states and breakpoints (`--elevation: 1.5; --elevation--hover: 4`), shares one `box-shadow` with the `--ring*` utilities (rings first) and `--shadow` (an explicit `--shadow` wins), and replaces a primitive's resting shadow where you set it.

`--shadow` is the box-shadow form: a token (`--shadow: var(--shadow-md)`) or any box-shadow, and it never removes a primitive's focus ring. `--shadow-tint` colors every shadow in a subtree and `--shadow-angle` turns the light: `0deg` is down, `90deg` left, `180deg` up, at any breakpoint (`--shadow-angle: 180deg` on a bottom sheet, `--shadow-angle--md: 0deg` once it becomes a card). `--default-shadow-angle` on `:root` sets it for the page, and `--default-shadow-intensity`, `--default-shadow-blur`, and `--default-shadow-distance` scale every shadow's alpha, blur, and offset. `--opacity` fades the whole element; for a translucent fill, see `--bg-alpha`.

`--filter` takes any CSS filter list (`--filter: grayscale(1); --filter--hover: none` colors a logo on hover). `--backdrop-filter` filters what shows through the element, so it needs a translucent `--bg` to read as frosted glass (`--bg: var(--color-background); --bg-alpha: 0.6; --backdrop-filter: blur(12px)`). `--mix-blend` sets `mix-blend-mode` (`multiply`, `screen`, `overlay`, …) to blend the element with what is behind it. All three take state tiers, work tier-only, and exist on `::before` and `::after` as `--before-filter`, `--after-mix-blend`, and so on. A `--filter` or `--backdrop-filter` other than `none` makes the element the containing block for its `position: fixed` descendants.

`--mask-linear` and `--mask-stops` fade an element out with a linear-gradient `mask-image`, the same way `--bg-linear` and `--bg-stops` paint a background: `--mask-linear: to bottom; --mask-stops: black 70%, transparent` fades the last 30% to nothing. Opaque stops show the element and transparent stops hide it, so any color works and only its alpha counts. The mask doesn't repeat and replaces any other mask on the element. It needs both utilities, and neither one takes tiers or states.

## Reference

| Utility | Writes | Value | Tiers | Notes |
| --- | --- | --- | --- | --- |
| `--shadow` | `box-shadow` | a token (var(--shadow-md)) or any box-shadow | states | works tier-only |
| `--elevation` | `box-shadow (four layers, after the rings; an explicit --shadow wins)` | a height: a number (0 is flat; 4 uses the layers of --shadow-md) | breakpoints, states | works tier-only |
| `--shadow-tint` | `the color of the --shadow-* tokens and --elevation on this subtree` | any CSS value | — |  |
| `--shadow-angle` | `the light direction of the --shadow-* tokens and --elevation on this subtree` | angle the light casts at: 0deg down, 90deg left, 180deg up (default --default-shadow-angle) | breakpoints | works tier-only |
| `--opacity` | `opacity` | any CSS value | states | works tier-only; `--before-opacity` / `--after-opacity` |
| `--filter` | `filter` | any CSS value | states | works tier-only; `--before-filter` / `--after-filter` |
| `--backdrop-filter` | `backdrop-filter` | any CSS value | states | works tier-only; `--before-backdrop-filter` / `--after-backdrop-filter` |
| `--mix-blend` | `mix-blend-mode` | keyword | states | works tier-only; `--before-mix-blend` / `--after-mix-blend` |
| `--mask-linear` | `mask-image (linear-gradient)` | gradient prelude: direction | — |  |
| `--mask-stops` | `the mask's stops` | comma-separated stops; opaque shows, transparent hides | — |  |
