////
/// @group Typography
////

@include default-box-sixing;

/// The default focus style used for elements like anchors and buttons
/// @output the default focus styles ie background colour and outline
/// @since 0.1.0
@mixin default-focus-style {
  outline: 3px solid $colour-focus;
}

html {
  font-size: rem($nice-root-font-size-min);

  @include mq($from: $nice-root-font-size-min-breakpoint) {
    // sass-lint:disable-block no-duplicate-properties

    // Fallback halfway between max and min for older browsers that don't support calc
    font-size: rem($nice-root-font-size-min + ($nice-root-font-size-max - $nice-root-font-size-min) / 2);
    // Follows "fluid typography" rules: https://www.google.co.uk/search?q=fluid%20typography%20vw
    // ie scales font-size linearly between 2 breakpoints.
    // Also uses rems so that they're relative to browser font size.
    // In form: MIN_FONT_SIZE + (MAX_FONT_SIZE - MIN_FONT_SIZE) * (100vw - MIN_SCREEN_SIZE) / (MAX_SCREEN_SIZE - MIN_SCREEN_SIZE)
    font-size: calc(#{rem($nice-root-font-size-min)} + #{strip-unit(rem($nice-root-font-size-max) - rem($nice-root-font-size-min))} * ((100vw - #{rem($nice-root-font-size-min-breakpoint)}) / #{strip-unit(rem($nice-root-font-size-max-breakpoint) - rem($nice-root-font-size-min-breakpoint))}));
  }

  @include mq($from: $nice-root-font-size-max-breakpoint) {
    font-size: rem($nice-root-font-size-max);
  }
}

body {
  background: $colour-body;
  color: $colour-text;
  font-family: font-family(sans);
  font-style: normal;
  line-height: rem($nice-base-line-height);
  overflow-x: hidden;
  text-rendering: optimizelegibility;
}

p,
.p {
  @include font($scale: 0);
  font-feature-settings: 'kern', 'onum', 'liga';
  font-weight: normal;

  &.lead {
    @include font($scale: 1);

    // TODO: Drop cap needs some work
    &--drop-cap {
      &:first-letter {
        float: left;
        font-size: 200%;
        font-weight: 300;
        padding: em(0 2px 0 0);
      }
    }
  }
}

code {
  background: $colour-panel-default;
  border: 1px solid $colour-border;
  border-radius: 2px;
  color: $colour-text;
  display: inline-block;
  font-family: font-family(mono);
  margin: em(0 0 2);
  padding: em(0 4);

  pre & {
    background: transparent;
    border: 0;
    margin: 0;
  }
}

/// Mark
mark,
.mark {
  background-color: #fff999;
  padding: em(4);
}

/// Small
small,
.small {
  font-size: 85%;
}
