/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*** Common-styled progressmeter ***/

/*
 * Styling "html:progress" is limited by the fact that a number of properties
 * are intentionally locked at the UA stylesheet level. We have to use a border
 * instead of an outline because the latter would be drawn over the progress
 * bar and we cannot change its z-index. This means we have to use a negative
 * margin, except when the value is zero, and adjust the width calculation for
 * the indeterminate state.
 */

.downloadProgress {
  appearance: none;
  display: -moz-box;
  margin: 4px 0 0;
  margin-inline-end: 12px;
  border: 1px solid ButtonShadow;
  height: 6px;
  background-color: ButtonFace;
}

.downloadProgress::-moz-progress-bar {
  appearance: none;
  background-color: Highlight;
}

.downloadProgress[paused]::-moz-progress-bar {
  background-color: GrayText;
}

.downloadProgress:not([value="0"])::-moz-progress-bar {
  margin: -1px;
  height: 8px;
}

.downloadProgress:indeterminate::-moz-progress-bar {
  width: calc(100% + 2px);
  /* Make a white reflecting animation.
     Create a gradient with 2 identical pattern, and enlarge the size to 200%.
     This allows us to animate background-position with percentage. */
  background-image: linear-gradient(90deg, transparent 0%,
                                           rgba(255,255,255,0.5) 25%,
                                           transparent 50%,
                                           rgba(255,255,255,0.5) 75%,
                                           transparent 100%);
  background-blend-mode: lighten;
  background-size: 200% 100%;
  animation: downloadProgressSlideX 1.5s linear infinite;
}

@keyframes downloadProgressSlideX {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -100% 0;
  }
}
