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

$params: (
   "breakpoint-lg": 1100px,

   "padding": 20px global.$gap-width,
   "border-top-wrapper": none,
   "border-top": global.$border-width solid global.$border-color-dark,
   "background-color": transparent,
   "color": global.$text-muted,
   "font-size": global.$font-size-base,

   "container-size": true,
   "container-max-width": 1230px,
   "container-align": unset,
   "container-gap": unset,
   "container-line-height": inherit,

   "container-justify-content-lg": space-between,

   "copyright-padding": 0 global.$spacer,

   "ul-margin": 0 0 global.$spacer 0,
   "ul-margin-lg": 0 0 0 auto,
   "ul-text-align": center,
   "ul-text-align-resp": center,
   "ul-width": auto,
   "ul-width-resp": 100%,
   "ul-order-resp": -1,
   "ul-line-height": inherit,

   "li-padding": 0 global.$spacer 0 global.$spacer,
   "li-padding-lg": 0 global.$spacer 0 global.$spacer,
   "li-color": global.$text-muted,
);

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

   $params: map.merge($params, components.$c-footer-copyrightmenu);
}

.#{component("Footer:CopyrightMenu", "class")} {
   container-type: inline-size;
   width: 100%;
   background-color: map.get($params, "background-color");
   color: map.get($params, "color");
   border-top: map.get($params, "border-top-wrapper");
   font-size: map.get($params, "font-size");

   > .container {
      position: relative;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: map.get($params, "container-align");
      gap: map.get($params, "container-gap");
      padding: map.get($params, "padding");
      border-top: map.get($params, "border-top");
      line-height: map.get($params, "container-line-height");

      @if (map.get($params, "container-size") != "true") {
         max-width: global.$unset-max;
      } @else if (map.get($params, "container-max-width" ) != "false") {
         max-width: map.get($params, "container-max-width");
      }

      > div {
         padding: map.get($params, "copyright-padding");
      }
   }

   p {
      margin-bottom: 0;
   }

   a {
      @include global.underline-hover;
   }

   ul {
      text-align: map.get($params, "ul-text-align-resp");
      order: map.get($params, "ul-order-resp");
      width: map.get($params, "ul-width-resp");
      margin: map.get($params, "ul-margin");
      line-height: map.get($params, "ul-line-height");
   }

   li {
      padding: map.get($params, "li-padding");
      color: map.get($params, "li-color");
   }

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

      @include global.container-query-selector("ul") {
         order: 0;
         text-align: map.get($params, "ul-text-align");
         width: map.get($params, "ul-width");
         margin: map.get($params, "ul-margin-lg");
      }

      @include global.container-query-selector("li") {
         padding: map.get($params, "li-padding-lg");
      }
   }
}
