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

$params: (
   "items-per-row": 5,
   "gap": 10px,
   "border": 1px solid global.$border-color,
   "padding": 40px 60px,
   "border-radius": global.$border-radius-lg,
);

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

   $params: map.merge($params, components.$c-producers-blocks);
}

.#{component("Producers:Blocks", "class")} {
   display: flex;
   flex-wrap: wrap;
   gap: map.get($params, "gap");
   container-type: inline-size;

   > a {
      @include global.item-size(map.get($params, "items-per-row"), map.get($params, "gap"));

      display: flex;
      align-items: center;
      justify-content: center;
      border: map.get($params, "border");
      padding: map.get($params, "padding");
      border-radius: map.get($params, "border-radius");
   }

   @container (inline-size < 1250px) {
      > a {
         @include global.item-size(4, map.get($params, "gap"));
      }
   }

   @container (inline-size < 900px) {
      > a {
         @include global.item-size(3, map.get($params, "gap"));
      }
   }

   @container (inline-size < 600px) {
      > a {
         @include global.item-size(2, map.get($params, "gap"));
      }
   }
}
