/* 91 · Edge: the structural blend module (the user, Round 17: "make blending modules … recompile the structures").
   One module gives every structure (button, chip, plate, panel, item, card) the same edge, built in four layers
   from two inputs:
     --edge-tint   the object's own colour (defaults to currentColor);
     --edge-ground the colour of what it sits on (defaults to the page ground, --rw-bg).
   Layers, outside in:
     1 falloff  a soft shadow tinted by the ground, never black, so the object sinks into the page instead of floating;
     2 border   1px, the tint mixed into the ground (a true edge, never a stripped one);
     3 rim      a 1px inner light on the top edge, the illusory lift;
     4 glow     an inner glow of the tint at the border that fades toward the centre.
   Depth is one number, --edge-depth (0 flat … 1 raised, default .5); hover raises it by .25. Load it last among the
   styles (after 90-motion.css), and it owns border-color and box-shadow on these structures. A structure opts out with
   data-edge="none"; anything else opts in with the class rw-edge. Replaces 92-blend.css (unlinked by minion 3). */

:root{--edge-ground-default:var(--rw-bg,#f6eef1)}
:root[data-rw-theme="dark"]{--edge-ground-default:var(--rw-bg,#140b10)}

.rw-edge,.rw-btn,.rw-chip,.rw-plate,.rw-panel,.rw-item,.rw-card{
  --edge-t:var(--edge-tint,currentColor);
  --edge-g:var(--edge-ground,var(--edge-ground-default));
  --edge-d:var(--edge-depth,.5);
  --edge-border:color-mix(in oklab,var(--edge-t) 34%,var(--edge-g));
  --edge-rim:color-mix(in oklab,#fff calc(var(--edge-d) * 55%),transparent);
  --edge-glow:color-mix(in oklab,var(--edge-t) calc(var(--edge-d) * 22%),transparent);
  --edge-fall:color-mix(in oklab,var(--edge-t) 18%,color-mix(in oklab,var(--edge-g) 60%,#000));
  border-color:var(--edge-border);
  box-shadow:
    inset 0 1px 0 var(--edge-rim),
    inset 0 0 0 1px color-mix(in oklab,var(--edge-t) 8%,transparent),
    inset 0 0 calc(4px + var(--edge-d) * 10px) var(--edge-glow),
    0 calc(1px + var(--edge-d) * 6px) calc(4px + var(--edge-d) * 18px) calc(var(--edge-d) * -6px) color-mix(in oklab,var(--edge-fall) calc(25% + var(--edge-d) * 30%),transparent);
  transition:box-shadow .2s ease,border-color .2s ease}

/* the hover lift: one reaction, depth up by a quarter */
.rw-edge:hover,.rw-btn:hover,.rw-chip:hover,.rw-card:hover,.rw-item:hover{--edge-depth:calc(var(--edge-d-rest,.5) + .25)}

/* the quiet ones: no ground, so no falloff or glow, only the true border */
.rw-btn--ghost,.rw-btn--link,.rw-btn--close,.rw-btn--share{--edge-d-rest:0;--edge-depth:0}
.rw-btn--link,.rw-btn--close{border-color:transparent;box-shadow:none}

/* plates and panels sit deeper and wider; a card wears its accent as the tint */
.rw-plate,.rw-panel{--edge-d-rest:.65;--edge-depth:.65}
.rw-card{--edge-tint:var(--c-accent,currentColor)}
.rw-chip{--edge-tint:var(--k2,var(--rw-chip-ink,currentColor));--edge-d-rest:.3;--edge-depth:.3}

/* the opt-out */
[data-edge="none"]{box-shadow:none !important}

@media (prefers-reduced-motion:reduce){.rw-edge,.rw-btn,.rw-chip,.rw-plate,.rw-panel,.rw-item,.rw-card{transition:none}}
@media print{.rw-edge,.rw-btn,.rw-chip,.rw-plate,.rw-panel,.rw-item,.rw-card{box-shadow:none}}
