@use "sass:map";
@use "@twig/scss/_global" as global;
@use "@twig/scss/variables/_variables-components" as components;

$params: (
   "container-size": true,
   "background-color": global.$body-bg,
   "border-bottom": 1px solid global.$border-color,
   "border-top": 1px solid global.$border-color,
   "box-shadow": global.$box-shadow,
   "padding": 0,
   "margin": 0 0 40px,
   "align-items": center,
   "height": 74px,
   "breakpoint": global.$lg,
);

@if global-variable-exists(c-product-stickyline, components) {
   $keys: map.keys(components.$c-product-stickyline);
   @each $name in $keys {
      @if not map.get($params, $name) {
         @warn "Neexistující proměnná '#{$name}' v komponentě '$#{component("Product:StickyLine", "class")}'.";
      }
   }

   $params: map.merge($params, components.$c-product-stickyline);
}

.#{component("Product:StickyLine", "class")} {
   position: sticky;
   top: 0;
   z-index: 100;
   background-color: map.get($params, "background-color");
   border-bottom: map.get($params, "border-bottom");
   border-top: map.get($params, "border-top");
   box-shadow: map.get($params, "box-shadow");
   padding: map.get($params, "padding");
   margin: map.get($params, "margin");

   > .container {
      display: flex;
      align-items: map.get($params, "align-items");
      height: map.get($params, "height");

      @if not (map.get($params, "container-size")) {
         max-width: global.$unset-max;
      }
   }

   @media screen and (max-width: map.get($params, "breakpoint") - 1) {
      display: none;
   }
}
