/* @since 0.5.1 */

/* Content with this class is only available to screen readers */
.bm-screenreader {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The Blue Marble windows */
.bm-window {
  position: fixed;
  background-color: rgba(21, 48, 99, 0.9);
  color: white;
  padding: 10px;
  border-radius: 8px;
  z-index: 9000;
  transition: all 0.3s ease, transform 0s;
  top: 75px;
  left: 60px;
  width: auto;
  max-height: fit-content;
  max-width: calc(100% - 135px);
  /* Font stack is as follows:
   * Highest Priority (Roboto Mono)
   * Windows fallback (Courier New)
   * macOS fallback (Monaco)
   * Linux fallback (DejaVu Sans Mono)
   * Any possible monospace font (monospace)
   * Last resort (Arial) */
  font-family: 'Roboto Mono', 'Courier New', 'Monaco', 'DejaVu Sans Mono', monospace, 'Arial';
  letter-spacing: 0.05em;
}

/* The Blue Marble windowed windows */
.bm-window.bm-windowed {
  max-width: 300px;
}

/* The drag bar */
.bm-dragbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5ch;
  /* For background circles, width & height should be odd, cx & cy should be half of width & height, and r should be less than or equal to cx & cy */
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="5"><circle cx="3" cy="3" r="1.5" fill="CornflowerBlue"/></svg>') repeat;
  cursor: grab;
  width: 100%;
  height: fit-content;
}

/* When a window is being dragged */
.bm-dragbar.bm-dragging {
  cursor: grabbing;
}

/* Disable interactions during drag for better performance */
.bm-window:has(.bm-dragbar.bm-dragging) {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Keep drag bar interactive when dragging */
.bm-dragbar.bm-dragging {
  pointer-events: auto;
}

/* The Blue Marble Favicon */
.bm-favicon {
  display: inline-block;
  height: 2.5em;
  margin-right: 1ch;
  vertical-align: middle;
}

/* Header 1 */
.bm-window h1 {
  display: inline-block;
  font-size: x-large;
  font-weight: bold;
  vertical-align: middle;
}

/* Header 1 when inside dragbar */
.bm-dragbar h1 {
  font-size: 1.2em;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow:
    3px  0px rgba(21, 48, 99, 0.5),
   -3px  0px rgba(21, 48, 99, 0.5),
    0px  3px rgba(21, 48, 99, 0.5),
    0px -3px rgba(21, 48, 99, 0.5),
    3px  3px rgba(21, 48, 99, 0.5),
   -3px  3px rgba(21, 48, 99, 0.5),
    3px -3px rgba(21, 48, 99, 0.5),
   -3px -3px rgba(21, 48, 99, 0.5);
}

/* Container for Header 1 when inside dragbar */
.bm-dragbar div:has(h1) {
  display: contents;
}

/* Header 2 */
.bm-window h2 {
  display: inline-block;
  font-size: larger;
  font-weight: 700;
  vertical-align: middle;
}

/* Header 3 */
.bm-window h3 {
  display: inline-block;
  font-size: large;
  font-weight: 700;
}

/* Container with a vertically centered header 1-6 */
.bm-container.bm-center-vertically {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* Containers for "sections" of elements */
.bm-container {
  margin: 0.5em 0;
}

/* All window buttons */
.bm-window button {
  background-color: #144eb9;
  border-radius: 1em;
  padding: 0 0.75ch;
}

/* All window buttons when hovered/focused */
.bm-window button:hover, .bm-window button:focus-visible {
  background-color: #1061e5;
}

/* All window buttons when pressed (plus disabled color) */
.bm-window button:active,
.bm-window button:disabled {
  background-color: #2e97ff;
}

/* All window buttons when disabled */
.bm-window button:disabled, .bm-window button:disabled {
  text-decoration: line-through;
  cursor: not-allowed;
}

/* Icon buttons (single character text content buttons) */
.bm-button-circle {
  border: white 1px solid;
  height: 1.5em;
  width: 1.5em;
  margin-top: 2px;
  text-align: center;
  line-height: 1em;
  padding: 0 !important; /* Overrides the padding in ".bm-window button" */
}

/* Pin button */
.bm-button-pin {
  vertical-align: middle;
}

/* Pin button image*/
.bm-button-pin svg {
  width: 50%;
  margin: 0 auto;
  fill: #111;
}

/* Transparent buttons */
.bm-window button.bm-button-trans {
  background-color: unset;
}

/* Transparent buttons on dark backgrounds when hovered */
.bm-button-trans.bm-button-hover-white:hover,
.bm-button-trans.bm-button-hover-white:focus {
  background-color: rgba(255, 255, 255, 0.17);
}

/* Transparent buttons on dark backgrounds when pressed */
.bm-button-trans.bm-button-hover-white:active {
  background-color: rgba(255, 255, 255, 0.22);
}

/* Transparent buttons on light backgrounds when hovered */
.bm-button-trans.bm-button-hover-black:hover,
.bm-button-trans.bm-button-hover-black:focus {
  background-color: rgba(0, 0, 0, 0.17);
}

/* Transparent buttons on light backgrounds when pressed */
.bm-button-trans.bm-button-hover-black:active {
  background-color: rgba(0, 0, 0, 0.22);
}

/* Tile (x, y) & Pixel (x, y) input fields */
input[type="number"].bm-input-coords {
  appearance: auto;
  -moz-appearance: textfield;
  width: 5.5ch;
  margin-left: 1ch;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0 0.5ch;
  font-size: small;
}

/* Removes scroll bar on tile & pixel input fields */
input[type="number"].bm-input-coords::-webkit-outer-spin-button,
input[type="number"].bm-input-coords::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* The template file upload button */
div:has(> .bm-input-file) > button {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Force complete invisibility of file input to prevent native browser text */
.bm-input-file,
input[type="file"] {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  z-index: -9999 !important;
  pointer-events: none !important;
}

/* Dropdown selection & dropdown (::picker) menus */
.bm-window select {
  color: white;
  background-color: #144eb9;
  border-radius: 1em;
  padding: 0 0.5ch;
}

/* Checkbox container (the label element) */
.bm-window label:has(input[type="checkbox"]) {
  display: flex;
  width: fit-content;
  gap: 1ch;
}

/* Checkbox */
.bm-window input[type="checkbox"] {
  width: 1em;
}

/* Window content container */
.bm-window-content {
  overflow: hidden;
  transition: height 300ms cubic-bezier(.4, 0, .2, 1);
}

/* Text areas */
.bm-window textarea {
  font-size: small;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0 0.5ch;
  height: 5.25em;
  width: 100%;
}

/* Anchor/Links with no children */
.bm-window a:not(:has(*)) {
  text-decoration: underline;
}

/* Small elements */
.bm-window small {
  font-size: x-small;
  color: lightgray;
}

/* List items of unordered lists */
.bm-window ul li {
  list-style: disc;
  margin-left: 5ch;
}

/* Scrollable container */
.bm-window .bm-container.bm-scrollable {
  max-height: calc(80vh - 150px);
  overflow: auto;
}

/* Flex children space between */
.bm-flex-between {
  display: flex;
  align-content: center;
  justify-content: space-between;
  align-items: center;
  gap: 0.5ch;
}

/* Flex children space center */
.bm-flex-center {
  display: flex;
  align-content: center;
  justify-content: center;
  align-items: center;
  gap: 0.5ch;
}

/* ASCII Art */
.bm-ascii {
  white-space: pre;
  letter-spacing: 0;
  line-height: 1 !important;
  font-size: 1.6em;
  font-family: monospace;
}

/* WINDOWED MODE */

/* Containers for "sections" of elements in windowed mode */
/* Does not apply to the main window */
.bm-container:not(#bm-window-main .bm-container) {
  margin: 0.25em 0;
}

/* Header 1 in windowed mode */
/* Does not apply to the main window */
.bm-windowed h1:not(#bm-window-main h1) {
  font-size: 1em;
}
