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

$params: (
   "breakpoint-sm": global.$sm,

   "list-gap": global.$gap-width,

   "title-margin": 0 0 global.$headings-margin-bottom,
   "title-text-align": start,
   "title-color": global.$text-dark,
   "title-font-size": global.$font-size-h3,
   "title-font-weight": global.$headings-font-weight,
);

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

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

.#{component("Product:Articles", "class")} {
   .product-articles-list {
      display: flex;
      flex-wrap: wrap;
      gap: map.get($params, "list-gap");
      container-type: inline-size;
   }

   .title-default {
      margin: map.get($params, "title-margin");
      color: map.get($params, "title-color");
      font-size: map.get($params, "title-font-size");
      font-weight: map.get($params, "title-font-weight");
      text-align: map.get($params, "title-text-align");
   }

   @container (inline-size < #{map.get($params, "breakpoint-sm")}) {
      .product-articles-list {
         display: block;
      }
   }
}
