window {
  &.csd {
    box-shadow: 0 1px 3px 3px transparent,
                0 2px 8px 2px RGB(0 0 0 / 13%),
                0 3px 20px 10px RGB(0 0 0 / 9%),
                0 6px 32px 16px RGB(0 0 0 / 4%),
                0 0 0 1px RGB(0 0 0 / #{if($contrast == 'high', 80%, .5%)});
    margin: 0px;
    border-radius: var(--window-radius);

    outline: 1px solid $window_outline_color;
    outline-offset: -1px;

    &:backdrop {
      // the transparent shadow here is to enforce that the shadow extents don't
      // change when we go to backdrop, to prevent jumping windows.
      // The biggest shadow should be in the same order then in the active state
      // or the jumping will happen during the transition.
      box-shadow: 0 1px 3px 3px RGB(0 0 0 / 9%),
                  0 2px 14px 5px RGB(0 0 0 / 5%),
                  0 4px 28px 12px RGB(0 0 0 / 3%),
                  0 6px 32px 16px transparent,
                  0 0 0 1px RGB(0 0 0 / #{if($contrast == 'high', 80%, 2%)});
      transition: box-shadow $backdrop_transition;
    }

    &.dialog.message,
    &.messagedialog {
      box-shadow: 0 2px 8px 2px RGB(0 0 0 / 7%),
                  0 3px 20px 10px RGB(0 0 0 / 5%),
                  0 6px 32px 16px RGB(0 0 0 / 2%),
                  0 0 0 1px RGB(0 0 0 / #{if($contrast == 'high', 80%, 5%)});
    }

    &.tiled,
    &.tiled-top,
    &.tiled-left,
    &.tiled-right,
    &.tiled-bottom {
      --window-radius: 0px;
      outline: none;

      box-shadow: 0 0 0 1px $border_color,
                  0 0 0 20px transparent; //transparent control workaround -- #3670

      &:backdrop {
        box-shadow: 0 0 0 1px $border_color,
                    0 0 0 20px transparent;
      }
    }

    &.maximized,
    &.fullscreen {
      --window-radius: 0px;
      outline: none;
      box-shadow: none;
      transition: none;
    }

    &.ssd-frame {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }
  }

  &.solid-csd {
    margin: 0;
    padding: 5px;
    --window-radius: 0px;
    box-shadow: inset 0 0 0 5px $border_color,
                inset 0 0 0 4px var(--headerbar-bg-color),
                inset 0 0 0 1px $border_color;

    &:backdrop {
      box-shadow: inset 0 0 0 5px $border_color,
                  inset 0 0 0 4px var(--headerbar-backdrop-color),
                  inset 0 0 0 1px $border_color;
    }
  }

  // server-side decorations as used by mutter
  &.ssd {
    // just doing borders, wm draws actual shadows
    box-shadow: 0 0 0 1px RGB(0 0 0 / #{if($contrast == 'high', 80%, 5%)});
  }
}
