|
17 | 17 | @use 'sass:string'; |
18 | 18 | @use 'config' as *; |
19 | 19 |
|
20 | | -// Helper: build a shadow layer with spread value and light-dark() color |
21 | | -@function _shadow-layer-spread($blur, $spread, $light-color, $light-alpha, $dark-color, $dark-alpha) { |
| 20 | +// Helper: build a shadow layer with light-dark() color |
| 21 | +@function _shadow-layer($blur, $spread, $light-color, $light-alpha, $dark-color, $dark-alpha) { |
22 | 22 | @return string.unquote( |
23 | 23 | '0 0 #{$blur} #{$spread} light-dark(oklch(#{$light-color} / #{$light-alpha}), oklch(#{$dark-color} / #{$dark-alpha}))' |
24 | 24 | ); |
25 | 25 | } |
26 | 26 |
|
27 | 27 | // Build a 7-layer progressive content shadow. |
28 | | -// Each layer uses light-dark() so opacity adapts to the color scheme. |
29 | | -// Modeled after PicoCSS/veneer card shadow with stronger presence. |
| 28 | +// Ported from Open Props --shadow-4: negative spread (-2px) on blur layers |
| 29 | +// so visible footprints overlap gradually instead of stacking as concentric |
| 30 | +// rings. light-dark() on each layer's color swaps shadow (dark oklch) for |
| 31 | +// glow (light oklch) automatically. |
30 | 32 | @function _content-shadow($light-color, $dark-color) { |
31 | 33 | @return |
32 | | - _shadow-layer-spread(0.15rem, 0, $light-color, 0.02, $dark-color, 0.015), |
33 | | - _shadow-layer-spread(0.3rem, 0, $light-color, 0.03, $dark-color, 0.02), |
34 | | - _shadow-layer-spread(0.75rem, 0, $light-color, 0.04, $dark-color, 0.025), |
35 | | - _shadow-layer-spread(1.35rem, 0, $light-color, 0.04, $dark-color, 0.03), |
36 | | - _shadow-layer-spread(2.5rem, 0, $light-color, 0.05, $dark-color, 0.035), |
37 | | - _shadow-layer-spread(6rem, 0, $light-color, 0.06, $dark-color, 0.04), |
38 | | - _shadow-layer-spread(0rem, 0.0625rem, $light-color, 0.015, $dark-color, 0.01); |
| 34 | + _shadow-layer(5px, 0, $light-color, 0.03, $dark-color, 0.015), |
| 35 | + _shadow-layer(1px, -2px, $light-color, 0.04, $dark-color, 0.02), |
| 36 | + _shadow-layer(2px, -2px, $light-color, 0.04, $dark-color, 0.025), |
| 37 | + _shadow-layer(5px, -2px, $light-color, 0.05, $dark-color, 0.03), |
| 38 | + _shadow-layer(9px, -2px, $light-color, 0.06, $dark-color, 0.035), |
| 39 | + _shadow-layer(16px, -2px, $light-color, 0.07, $dark-color, 0.04), |
| 40 | + _shadow-layer(0px, 0.0625rem, $light-color, 0.015, $dark-color, 0.01); |
39 | 41 | } |
40 | 42 |
|
41 | 43 | @layer nimble.base { |
42 | 44 |
|
43 | 45 | :root { |
44 | 46 | // Soft elevation shadow on the padded content column. |
45 | 47 | // Uses surface hue for tonal consistency; adapts to light/dark mode. |
| 48 | + // Each layer uses light-dark() on the color: dark oklch for shadow, |
| 49 | + // light oklch for glow. Switches automatically with color-scheme. |
46 | 50 | // Override with --nc-content-shadow: none to disable. |
47 | 51 | #{$prefix}content-shadow: #{_content-shadow( |
48 | 52 | $content-shadow-color-light, $content-shadow-color-dark |
|
0 commit comments