/* 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/. */

html {
  /* Offset anchors/fragments so they don't appear under the sticky header */
  scroll-padding-top: 200px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

th {
  font-weight: 500; /* semi-bold */
}

details {
  /* Ensure the focus outline doesn't go under adajcent items like the sticky header. */
  margin-top: 1px;
  margin-bottom: 1px;
}

button {
  border-radius: 2px;
}

button[type="submit"] {
  background: #0060df;
  border: none;
  color: white;
  height: 24px;
}

button[type="submit"]::-moz-focus-inner {
  border: none;
}

button[type="submit"]:focus {
  box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, 0.3)
}

button[type="submit"]:hover {
  background-color: #003eaa;
}

button[type="submit"]:hover:active {
  background-color: #002275
}

a {
  text-decoration: none;
}

a:link {
  color: #0060df;
}

/* Include :link with :hover so we don't underline with no @href */
a:link:hover,
a:active {
  text-decoration: underline;
}

a:visited {
  color: #00215b;
}

body {
  background-color: #f9f9fa;
  color: #0c0c0d;
  margin: 0;
}

#chooser,
#results,
#intro {
  padding: 8px;
}

#results {
  padding-top: 0;
}

#chooser {
  background-color: inherit;
  font-size: 0.85em;
  position: sticky;
  top: -2.1em;
  z-index: 1;
}

#chooser tbody input {
  text-overflow: ellipsis;
  overflow: hidden;
}

#swapRevCell {
  padding: 0;
  /* Hard-code to prevent jumping of the Revision heading from the table growing. */
  width: 26px;
}

#swapRevCell > button {
  background: none;
  border: none;
  color: rgba(12, 12, 13, 0.8);
  line-height: 0;
  padding: 0;
}

#swapRevCell > button::-moz-focus-inner {
  border: none;
}

#swapRevCell > button:focus {
  border:none !important;
  box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, 0.3);
  outline: none;
}

#swapRevCell > button:hover {
  background-color: rgba(12, 12, 13, 0.1)
}

#swapRevCell > button:hover:active {
  background-color: rgba(12, 12, 13, 0.2);
}

#oldCommit, #newCommit {
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.1em;
  min-height: calc(2 * 1.1em);
  display: -webkit-inline-box;
  -webkit-box-orient: vertical;
}

#progressCell {
  position: relative;
}

progress {
  /* Align the progress bar with the text that replaces it. */
  height: 1.5em;
  /* Prevent flicker of the width from differing text and <progress> sizes. */
  position: absolute;
  width: 100%;
}

progress + span {
  font-size: 0.8em;
  opacity: 0.9;
}

progress:not([hidden]) + span {
  visibility: hidden;
}

/* Hide headings of empty columns before submission */
:root:not(.commitPopulated) #dateHeading,
:root:not(.commitPopulated) #commitHeading,
:root:not(.commitPopulated) #pushlog,
:root:not(.resultsLoaded) #filtersCell,
/* Hide the checkboxes when not comparing. */
:root:not(.comparison) #filtersCell > fieldset {
  visibility: hidden;
}

fieldset, legend {
  all: unset;
}

legend {
  display: inline;
  /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=653870 */
  float: left;
}

#results table {
  border-collapse: collapse;
  margin: 0 8px;
  width: calc(100% - 16px);
}

summary {
  background-color: #f9f9fa;
  cursor: pointer;
  position: sticky;
  top: 5.7em;
}

summary > h2 {
  display: inline-block;
  font-size: 1.25em;
  font-weight: 500;
  margin-bottom: 0.5em;
  margin-top: 1.2em;
}

summary > span {
  margin-left: 1em;
  margin-right: 1em;
}

summary .different {
  color: #ff0039;
}

/* Only if the whole platform is similar */
summary .similar:first-child:last-child {
  color: #058b00;
}

#oldDate, #oldCommit,
#newDate, #newCommit,
#pushlog,
#filtersCell,
#results td {
  padding: 1px 5px;
}

#results tbody > tr:hover {
  background: #DDD;
}

tr:target {
  background: #00feff80;
  /* Force the permalink fragment row to be visible since we don't add all filters to the URL */
  display: table-row !important;
}

/* Highlight the row where the lightbox left off */
#results tbody > tr:focus-within {
  background: #fceec4;
}

/* Combination name column links */
#results tbody > tr > td:first-child > a {
  color: transparent;
  padding-inline: 0.5em;
  text-decoration: none;
}

#results tbody > tr > td:first-child > a:focus,
#results tbody > tr > td:first-child:hover > a {
  color: inherit;
}

tr.similar > .diffCell {
  background: #058b00;
  color: white;
  text-align: right;
}

tr.error > .diffCell {
  background: #d70022;
  color: white;
}

tr.missing_after > .diffCell,
tr.missing_before > .diffCell {
  background: #ffe900;
}

tr.different > .diffCell {
  background: #b5007f;
  color: white;
  text-align: right;
}

.diffCell a:link {
  color: inherit;
}

tr.different > .diffCell a:visited {
  color: #e3e3e3;
}

/* Must be below the equivalent tr.different since they are both applied */
tr.known_inconsistency > .diffCell {
  background: lightblue;
  color: #0c0c0d;
  text-align: right;
  white-space: nowrap;
}

tr.known_inconsistency > .diffCell a:visited {
  color: inherit;
}

.knownInconsistencyIcon {
  vertical-align: super;
  width: 0.7em;
}

.textMismatch,
#results.hideMissing tr.missing_after,
#results.hideMissing tr.missing_before,
#results.hideKnownInconsistencies.hideSimilar tr.known_inconsistency.similar,
#results.hideKnownInconsistencies tr.known_inconsistency:not(.similar),
tr:not(.known_inconsistency) > .diffCell .knownInconsistencyIcon,
:root:not(.comparison) .diffCell,
:root:not(.comparison) .newColumn,
#results:not(:empty) ~ #intro,
#results.hideSimilar tr.similar:not(.known_inconsistency) {
  display: none;
}

/* Lightbox styles */

/* The next three rulesets workaround a flicker in the .gslide-description max-width calculation */
.glightbox-container .ginner-container {
  display: grid !important;
  grid-template: "slide" "desc";
  grid-template-columns: minmax(min-content, auto);
}

.gslide:not(.zoomed) .ginner-container {
  grid-template-rows: minmax(0, 1fr) min-content;
  max-height: 100vh;
}

.gslide.zoomed .ginner-container {
  grid-template-rows: auto auto;
}

.glightbox-clean .gslide-media, .glightbox-modern .gslide-media {
  grid-area: slide;
}

.glightbox-clean .gslide-description, .glightbox-modern .gslide-description {
  grid-area: desc;
  /* Don't break cropper when resizing the window. This shouldn't be necessary with the grid anyways. */
  max-width: none !important;
}

.gslide:not(.zoomed) .gslide-image img.zoomable {
  max-height: 100% !important;
}

/* It's too annoying when it flickers, especially when traversing vertically
   where there isn't preloading yet. */
.gloader {
  display: none !important;
}

.glightbox-container .gslide {
 -webkit-user-select: auto;
 -moz-user-select: auto;
 -ms-user-select: auto;
 user-select: auto;
}

.gslide-title {
  word-break: break-word;
}

.gslide-desc {
  align-items: end;
  display: flex;
}

.gslide-desc > :first-child {
  margin-inline-start: auto;
}

.fullScreenButton,
.cropButtonLabel {
  /* Align icons vertically despite text node differences: */
  line-height: 0;
}

.cropButton + svg,
.fullScreenButton {
  -moz-appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 10px;
}

:root:fullscreen .fullScreenButton,
.fullScreenButton:hover,
.cropButton + svg:hover,
.cropButton:checked + svg {
  color: #0a84ff;
}
