/* This Source Code Form is subject to the terms of the Creative Commons
 * Attribution-NonCommercial-ShareAlike International License, v. 4.0.
 * If a copy of the CC BY-NC-SA 4.0 was not distributed with this
 * file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/
 * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. */

/* fundamental content styles, e.g. plaintext pages. */

@namespace html url("http://www.w3.org/1999/xhtml");
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

html|tt,
html|code,
html|kbd,
html|samp,
html|xmp,
html|pre,
html|plaintext,
html|listing,
html|textarea,
html|input:is([type="date"], [type="time"], [type="datetime-local"]) {
  font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed, monospace;
  font-weight: 300;
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background-color: var(--global-selection-bgcolor) !important;
    color: var(--global-selection-color) !important;
  }

  /* pdf viewer: selection, findbar highlights */
  .pdfViewer .textLayer .highlight {
    background-color: var(--pdf-selection-bgcolor) !important;
  }

  .pdfViewer .textLayer .highlight.selected {
    background-color: var(--pdf-highlight-bgcolor) !important;
  }

  .pdfViewer .textLayer ::selection {
    background-color: var(--pdf-selection-bgcolor) !important;
    color: revert !important;
  }

  /* optional dark mode for PDFs. to use, open the inspector
  and change class="pdfViewer" to class="pdfViewer invert" */
  .pdfViewer.invert {
    filter: invert(1) brightness(1.15) contrast(0.85);
  }

  /* consistent PDF viewer dialog theme */
  #dialogContainer dialog.dialog {
    --dialog-bg-color: var(--in-content-bg-dark) !important;
    --dialog-border-color: var(--uc-content-border-color) !important;
    --text-primary-color: var(--uc-content-page-color) !important;
    --focus-ring-color: var(--global-focus-outline-color) !important;
    --textarea-bg-color: var(--uc-content-box-background-odd) !important;
    --textarea-border-color: var(--uc-content-box-border-color) !important;
    --radio-bg-color: var(--uc-content-button-background) !important;
    --radio-checked-bg-color: var(--uc-parent-primary-button-text-color) !important;
    --radio-checked-border-color: var(--uc-parent-primary-button-background-hover) !important;
    --button-secondary-bg-color: var(--uc-content-button-background-solid) !important;
    --button-primary-bg-color: var(--uc-parent-primary-button-background-hover) !important;
    --button-primary-fg-color: var(--uc-parent-primary-button-text-color) !important;

    .mainContainer {
      button {
        &:hover {
          cursor: default;
        }
      }
    }
  }
}

:read-only:focus:not(:focus-visible),
:not(textarea, [contenteditable]:read-write, input[type="text"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"], input[type="week"]):focus:not(:focus-visible) {
  outline: unset;
  outline-offset: unset;
}

@-moz-document plain-text-document() {
  :root {
    font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed, monospace;
    font-weight: 300;
  }

  xmp,
  pre,
  plaintext {
    font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed, monospace;
    font-weight: 300;
  }
}

@-moz-document plain-text-document(), media-document(all) {
  @media (prefers-color-scheme: dark) {
    :root {
      color: var(--plaintext-color) !important;
      background-color: var(--in-content-bg-dark) !important;
    }

    body:not([style*="background"], [class], [id]) {
      background-color: transparent !important;
    }

    ::selection {
      color: var(--content-selection-color) !important;
      background-color: var(--content-selection-bgcolor) !important;
    }
  }
}

.controlsContainer {
  --control-focus-outline: 2px solid var(--purple-30) !important;
}

#texttracks {
  font-family: SF Pro Text, SF Arabic, Segoe UI, sans-serif !important;
}
