/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/multi-row_tabs.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

:root {
  --uc-multirow-tabbar-rows: 3;
  --uc-multirow-tab-dynamic-width: 1; /* Change to 0 for fixed-width tabs using the above width. */
}

// Scrollbar can't be clicked but the rows can be scrolled with mouse wheel
// Uncomment the next line if you want to be able to use the scrollbar with mouse clicks
// #tabbrowser-arrowscrollbox{ -moz-window-dragging: no-drag }

//  Uncommenting the above makes you unable to drag the window from empty space in the tab strip but normal draggable spaces will continue to work

#tabbrowser-tabs {
  min-height: unset !important;
  padding-inline-start: 0px !important;
}

@include moz-document(url "chrome://browser/content/browser.xhtml") {
  #scrollbutton-up ~ spacer,
  #scrollbutton-up,
  #scrollbutton-down {
    display: var(--scrollbutton-display-model, initial);
  }

  scrollbox[part][orient="horizontal"] {
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    max-height: calc((var(--tab-min-height) + 2 * var(--tab-block-margin, 0px)) * var(--uc-multirow-tabbar-rows));
    // scrollbar-color: currentColor transparent;
    // scrollbar-width: thin;
    // scroll-snap-type: y mandatory;

    // .tabbrowser-tab {
    //   scroll-snap-align: start;
    // }
  }
}

.scrollbox-clip[orient="horizontal"],
#pinned-tabs-container,
#tabbrowser-arrowscrollbox {
  overflow: -moz-hidden-unscrollable;
  display: block;
  --scrollbutton-display-model: none;
}

#tabbrowser-tabs .tabbrowser-tab[pinned] {
  position: static !important;
  margin-inline-start: 0px !important;
}

.tabbrowser-tab[fadein]:not([pinned]) {
  flex-grow: var(--uc-multirow-tab-dynamic-width);
}

.tabbrowser-tab > stack {
  width: 100%;
  height: 100%;
}

/* remove bottom margin so it doesn't throw off row height computation */
#tabs-newtab-button {
  margin-bottom: 0 !important;
}
#tabbrowser-tabs[hasadjacentnewtabbutton][overflow="true"] > #tabbrowser-arrowscrollbox > #tabbrowser-arrowscrollbox-periphery > #tabs-newtab-button {
  @include Box(true);
}

#alltabs-button,
:root:not([customizing]) #TabsToolbar #new-tab-button,
#tabbrowser-arrowscrollbox > spacer,
.tabbrowser-tab::after {
  display: none !important;
}
