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

$params: (
   "container-size": true,
   "container-max-width": 1000px,

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

   "content-margin": 40px 0,
);

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

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

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

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

   .article-content {
      margin: map.get($params, "content-margin");
   }

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

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

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