* {
  &,
  &:before,
  &:after {
    box-sizing: border-box;
  }
}

// Fix to prevent horizontal scrolling bug on iOS
@media @phone {
  html {
    overflow-x: hidden;
  }
}

body {
  background: var(--body-bg);
  color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Cantarell, Oxygen, Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  overflow-y: scroll;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
}

input,
button,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

a {
  .text-link();
}

hr {
  margin-top: 15px;
  margin-bottom: 15px;
  border: 0;
  border-top: 2px solid var(--control-bg);
}

p {
  margin: 0 0 10px;
}

.container {
  margin-right: auto;
  margin-left: auto;
  padding-left: 15px;
  padding-right: 15px;

  @media @tablet {
    width: @screen-tablet;
  }
  @media @desktop {
    width: @screen-desktop;
  }
  @media @desktop-hd {
    width: @screen-desktop-hd;
  }
}

.containerNarrow {
  max-width: 600px;
  margin: 0 auto;
}

.loading-container {
  position: relative;

  &::after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(128, 128, 128, 0.2);
  }

  .LoadingIndicator-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }
}

mark {
  background: var(--highlight-color);
  padding: 1px;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}
input[type="search"] {
  -webkit-appearance: none;
}

.checkbox {
  display: block;
  padding-left: 20px;
  margin-bottom: 5px;
  cursor: pointer;

  input[type=checkbox],
  input[type=radio] {
    margin-left: -20px;
    margin-top: 2px;
    float: left;
  }
}

.fade {
  opacity: 0;
  transition: opacity .15s linear;
  &.in {
    opacity: 1;
  }
}
.darkenBackground {
  background: var(--shadow-color);
}

blockquote p:last-child,
blockquote ul:last-child,
blockquote ol:last-child {
  margin-bottom: 0;
}

@media @tablet-up {
  .affix {
    position: fixed;
  }
}

.RequestErrorModal {
  pre {
    white-space: pre-wrap;
    margin: 0;
  }

  &-iframe {
    width: 100%;
    max-height: 90vh;
    border: 0;
  }
}

#flarum-loading {
  text-align: center;
  padding: 50px 0;
  font-size: 18px;
  color: var(--muted-more-color);
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.text-contrast {
  &--dark {
    --contrast-color: var(--text-on-light);
    color: var(--contrast-color);
  }
  &--light {
    --contrast-color: var(--text-on-dark);
    color: var(--contrast-color);
  }

  // This exists to prevent inheriting the contrast color from a parent element.
  // Like when a badge is inside a tag hero.
  &--unchanged {
    --contrast-color: var(--unchanged-color);
  }
}

.text-colored {
  color: var(--color);
}
