@use 'sass:math';

html {
  width: 100%;
  overflow-x: hidden;
  font-size: $base-font-size;
  font-size: math.div($base-font-size, 16px) * 100%;
  @include tablet {
    font-size: math.div($base-font-size, 16px) * 95%;
  }
  @include mobile {
    font-size: math.div($base-font-size, 16px) * 90%;
  }
  @include mobile-portrait {
    font-size: math.div($base-font-size, 16px) * 85%;
  }
  text-size-adjust: 100%;
  background-color: var(--theme-main-color-inverse, $c-white);
  &.no-overflow {
    overflow-y: hidden;
  }
}

body {
  @include body-font;
  overflow-x: hidden;
  background-color: $c-background;

  @media print {
    background-color: $c-white;
  }
}

body,
input,
select,
button,
textarea {
  @include textantialiasing;
}

// links
a:active {
  outline: none;
}

a:selected {
  border: none;
  outline: none;
}

*:focus {
  //  outline: none;
}

abbr {
  border-bottom: 1px dotted gray;
}

p sup {
  position: relative;
  top: -0.75ex;
}

p sub {
  position: relative;
  top: 0.5ex;
}

button {
  cursor: pointer;
  border-radius: 0;

  // DEV, replace with real styles
  &.codepen {
    background-image: url('/img/logo/codepen.svg');
    background-repeat: no-repeat;
    background-position: 0.5em center;
    background-size: 20px;
    padding-left: 40px;
    font-weight: bold;
    text-align: left;
    line-height: inherit;
  }
}

p img {
  background-color: var(--theme-main-color-inverse, $c-white);
  border: 1px solid var(--theme-main-color);
  max-width: 100%;

  &.no-border {
    border: none;
    background-color: transparent;
  }
}

.example-link {
  display: block;
  border: 1px solid var(--theme-color-dark);
  background-color: var(--theme-main-color-inverse, $c-white);
  border-radius: 10px;
  padding: 10px 12px 4px 12px;

  &:hover {
    border-width: 2px;
    padding: 9px 11px 3px 11px;
  }

  &-text {
    display: inline-block;
    width: 100%;
    padding-bottom: 5px;
    font-weight: bold;

    &::after {
      content: ':';
    }
  }
}

.tablist {
  margin-top: 0.5em;
  font-weight: bold;

  .control {
    display: inline-block;

    label {
      &:hover {
        cursor: pointer;
      }

      img {
        height: 29px;
        vertical-align: top;
        margin-right: -0.25em;

        &.browser {
          height: 24px;
          margin-left: -14px;
          vertical-align: bottom;
        }
      }
    }

    input {
      @include visuallyhidden;

      + label::before {
        content: '▽';
        font-size: 0.75em;
        line-height: 2em;
      }

      &:checked + label::before {
        content: '△';
        font-size: 0.75em;
      }

      &:focus + label {
        @include btn-focus-style;
      }
    }
  }

  .panel {
    table {
      margin: 0;
      border: none;
      border-radius: 10px;
    }

    pre {
      margin: 0;
      border-radius: 10px;
      background-color: var(--theme-main-color-inverse, $c-white);
      border: 1px solid var(--theme-color-dark);

      code {
        font-size: 0.9em;
        font-weight: 500;
      }
    }
  }
}
