@use "../global";

:root {
    --font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;

    --line-height-0: 1;
    --line-height-xs: 1.25;
    --line-height-s: 1.375;
    --line-height: 1.5;
    --line-height-m: 1.625;
    --line-height-l: 2;

    --font-size-base: 1.8rem;
    --font-size-ratio: 1.25;
    --font-size-subtitle-ratio: 1.14;

    --title-font-family: var(--font-family);
    --title-font-weight: 700;
    --title-line-height: var(--line-height-xs);
    --title-margin: var(--size) 0;

    --size-1: calc(var(--size-2) * calc(1.2 * var(--font-size-ratio)));     /* h1 */
    --size-2: calc(var(--size-3) * var(--font-size-ratio));     /* h2 */
    --size-3: calc(var(--size-4) * var(--font-size-ratio));     /* h3 */
    --size-4: calc(var(--size-5) * var(--font-size-ratio));     /* h4 */
    --size-5: var(--font-size-base);                            /* text */
    --size-6: calc(var(--font-size-base) / var(--font-size-subtitle-ratio));    /* small */
    --size-7: calc(var(--font-size-base) / var(--font-size-ratio));     /* superscript */
}
    @media (max-width: 62rem) {
        :root {
            --size: 0.6rem;
        }
    }
    @media (max-width: 47.9em){
        :root {
            --size-4: 1.75rem;      /* h4 */
        }
    }

/* #region Sizes */
h1, h2, h3, h4 {
    font-family: var(--title-font-family);
    font-weight: var(--title-font-weight);
    line-height: var(--title-line-height);
    color: var(--color-primary);
    margin: var(--title-margin);
    display: block;
}
@for $i from 1 through 7 {
    %title#{$i} {
        font-size: var(--size-#{$i}); --font-size: var(--size-#{$i});
    }
    @if $i == 6 {
        .size-#{$i}, small {
            @extend %title#{$i};
        }
    } @else if $i == 7 {
        .size-#{$i}, sub, sup {
            @extend %title#{$i};
        }
    } @else {
        h#{$i}, .size-#{$i} {
            @extend %title#{$i};
        }
    }
    .size-#{$i}-var { --font-size: var(--size-#{$i}); }
}
@mixin variant ($name: null) {
    $prefix: null;
    @if $name != null {
        $prefix: #{$name}\:
    }
    @for $i from 1 through 7 {
        .#{$prefix}size-#{$i} { font-size: var(--size-#{$i}); --font-size: var(--size-#{$i}); }
        .#{$prefix}size-0 { font-size: 0; --font-size: 0; }
    }
}

@include variant;
@each $bpname, $bpsize in global.$breakpoints {
    @media #{$bpsize} {
        @include variant($bpname);
    }
}
.size-0 { font-size: 0; }
.text-title-font { font-family: var(--title-font-family); }
/* #endregion */
/* #region Special elements */
a {
    color: var(--color-secondary);
    text-decoration: none;
    outline: 0;
    transition: all .3s var(--anim-linkeasing);
    cursor: pointer;
}
    a:not(.button):hover { color: var(--color-primary); }

icon {
    font-size: var(--font-size, var(--size-5));
    overflow: hidden;
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    display: block;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
    color: inherit;

    width: calc(var(--font-size) * 1.4);
    height: calc(var(--font-size) * 1.4);
    line-height: calc(var(--font-size) * 1.4);
    text-align: center;
}

    .material-design-icon {
        display: inline-flex;
        align-self: center;
        position: relative;
    }

    .material-design-icon>.material-design-icon__svg {
        fill: currentColor;
    }
/* #endregion */