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

$params: (
   "gap": 70px,
   "padding": 30px 40px,
   "margin": global.$spacer-lg 0 global.$spacer-lg 0,
   "text-align-sm": center,
   "border-top": global.$border-width solid global.$border-color,
   "border-bottom": global.$border-width solid global.$border-color,
   "justify-content": center,

   "title-font-size": global.$font-size-h4,
   "title-font-weight": global.$font-weight-base,
   "title-color": global.$text-dark,
   "title-margin": 0,

   "links-gap": 20px,
   "links-font-size": 20px,
   "links-color": global.$brand-primary,
   "links-margin-sm": 10px 0 0 0,
   "links-margin": 0,
   "links-display": flex,

   "display-sm": flex,
);

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

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

.#{component("Articles:ShareButtons", "class")} {
   display: map.get($params, "display-sm");
   justify-content: map.get($params, "justify-content");
   gap: map.get($params, "gap");
   padding: map.get($params, "padding");
   border-top: map.get($params, "border-top");
   border-bottom: map.get($params, "border-bottom");
   margin: map.get($params, "margin");

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

   .links {
      display: map.get($params, "links-display");
      gap: map.get($params, "links-gap");
      justify-content: center;
      align-items: center;
      margin: map.get($params, "links-margin-sm");

      svg {
         font-size: map.get($params, "links-font-size");
         color: map.get($params, "links-color");
      }
   }
}

@container (inline-size > 600px) {
   .#{component("Articles:ShareButtons", "class")} {
     display: flex;

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