/* general declarations */

html, body, :where(body) :where(:not(script, table, thead, tbody, tr, th, td, summary)) {
  display: flex;
  flex-direction: column;
}

button, label {
  flex-direction: row;
  justify-content: center;
  padding: 0.3rem 0.5rem 0.3rem;
  font-size: 1.4rem;
  border-radius: 0.5rem;
  
  /* for buttons, these color styles are the default color on firefox, but not edge, setting explicitly to remove inconsistency */
  background-color: var(--button-default);
  
  &:is(:enabled, :has(input:enabled)) {
    &:hover {
      background-color: var(--button-hover);
    }
    
    &:active {
      background-color: var(--button-active);
    }
  }
}

button {
  border: none;
}

label {
  align-items: center;
  gap: 0.25rem;
  
  /* label disabled color */
  &:has(input:disabled) {
    color: var(--text-disabled);
  }
  
  & > :is(input[type = checkbox], input[type = radio]) {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0 0.2rem 0 0;
  }
}

hr {
  margin: 0.7rem 0 0.5rem;
  border: 0.1rem solid var(--outline);
  
  &.vertical {
    margin: 0;
  }
}

select, input[type = number] {
  background-color: var(--input-background);
  font-size: 1.3rem;
  border: 0.2rem solid var(--outline);
  border-radius: 0.4rem;
  padding: 0.6rem;
}

h3, h4 {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

fieldset {
  gap: 0.5rem;
  border: 0.3rem solid var(--outline);
  border-radius: 1rem;
  padding: 0.4rem 0.7rem 0.75rem;
  
  & > legend {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: bold;
  }
}

textarea {
  flex-grow: 1;
  border-radius: 0.8rem;
  border: 0.1rem solid var(--outline);
  padding: 0.3rem;
  font-size: 1.5rem;
}

.flex_row {
  flex-direction: row;
}

.wrap {
  flex-wrap: wrap;
}

.scroll {
  overflow-x: auto;
}

.centered {
  align-items: center;
  
  hr {
    align-self: stretch;
  }
}

.flat_left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}

.flat_right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.meter {
  flex-direction: row;
  flex-shrink: 0;
  height: 1.5rem;
  background: var(--meter-background);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.small_top_gap {
  margin-top: 0.4rem;
}

.med_top_gap {
  margin-top: 1rem;
}

.large_top_gap {
  margin-top: 1.5rem;
}

.caution_bg {
  background-color: var(--button-caution-default);
  
  &:is(:enabled, :has(input:enabled)) {
    &:hover {
      background-color: var(--button-caution-hover);
    }
    
    &:active {
      background-color: var(--button-caution-active);
    }
  }
}

.safe_bg {
  background-color: var(--button-safe-default);
  
  &:is(:enabled, :has(input:enabled)) {
    &:hover {
      background-color: var(--button-safe-hover);
    }
    
    &:active {
      background-color: var(--button-safe-active);
    }
  }
}

:is(.red, .red_buttons *):is(button, label) {
  /* default color */
  background-color: var(--button-red-default);
  
  /* hover and active colors */
  &:is(:enabled, :has(input:enabled)) {
    &:hover {
      background-color: var(--button-red-hover);
    }
    
    &:active {
      background-color: var(--button-red-active);
    }
  }
}

.scroll_buttons {
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}
