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

$params: (
   "breakpoint": global.$lg,
   "left-side-width": percentage(math.div(3, 12)),
   "right-side-width": percentage(math.div(9, 12)),
   "gap": 60px,
   "margin": 0 0 global.$spacer 0,
   "padding-bottom": 0,
   "title-text-align": left,
);

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

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

.#{component("Articles:View", "class")} {
   margin: map.get($params, "margin");
   container-type: inline-size;
   gap: map.get($params, "gap");

   h1 {
      text-align: map.get($params, "title-text-align");
   }

   @container (inline-size > #{map.get($params, "breakpoint")}) {
      @include global.container-query-selector(".articles-content") {
         display: flex;
         justify-content: space-between;
      }

      @include global.container-query-selector(".articles-right-side") {
         width: calc(map.get($params, "left-side-width") - map.get($params, "gap"));
      }

      @include global.container-query-selector(".articles-left-side") {
         width: map.get($params, "right-side-width");
      }
   }
}
