@use 'styles/settings' as s;
@use 'styles/mixins' as mx;
@use 'styles/functions' as fn;

:root {
    &::before {
        display: none;
        content: 'light';
    }

    @each $key, $value in s.$light-colors {
        --#{$key}: #{$value};
    }

    @each $key, $value in s.$light-colors {
        --#{$key}-rgb: #{red($value), green($value), blue($value)};
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        &::before {
            display: none;
            content: 'dark';
        }

        @each $key, $value in s.$dark-colors {
            --#{$key}: #{$value};
        }

        @each $key, $value in s.$dark-colors {
            --#{$key}-rgb: #{red($value), green($value), blue($value)};
        }
    }
}

:root.light-theme {
    &::before {
        display: none;
        content: 'light';
    }

    @each $key, $value in s.$light-colors {
        --#{$key}: #{$value};
    }

    @each $key, $value in s.$light-colors {
        --#{$key}-rgb: #{red($value), green($value), blue($value)};
    }
}

:root.dark-theme {
    &::before {
        display: none;
        content: 'dark';
    }

    @each $key, $value in s.$dark-colors {
        --#{$key}: #{$value};
    }

    @each $key, $value in s.$dark-colors {
        --#{$key}-rgb: #{red($value), green($value), blue($value)};
    }
}

* {
    transition: s.$transition;
    font-family: s.$body-font;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    color: s.$text;
    position: relative;
    background: s.$background;
}

button {
    background: none;
    border: none;
    outline: none;
}

a, button {
    font-size: 1em;
    font-weight: s.$weight-semi-bold;
    color: s.$primary;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        color: rgba(s.$primary, 0.5);
    }
}

.content-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 30px;
}

h1, h2, h3,
h4, h5, h6 {
    font-weight: s.$weight-bold;
    line-height: 1.2;
}

h1 {
    font-size: fn.toRem(36);
    margin-bottom: fn.toRem(20);
    font-weight: s.$weight-xbold;

    &.underlined {
        position: relative;
        display: inline-block;
        z-index: 1;

        &:before {
            content: ' ';
            position: absolute;
            right: -7px;
            bottom: 0;
            width: 90px;
            background: rgba(s.$secondary, 0.5);
            height: 20px;
            z-index: -1;

            @include mx.breakpoint(large) {
                height: 24px;
                width: 120px;
                bottom: 5px;
            }
        }
    }

    @include mx.breakpoint(large) {
        font-size: fn.toRem(48);
        margin-bottom: fn.toRem(24);
    }
}

h2 {
    font-size: fn.toRem(24);
    margin-bottom: fn.toRem(16);

    @include mx.breakpoint(large) {
        font-size: fn.toRem(36);
        margin-bottom: fn.toRem(24);
    }

    &.left {
        text-align: left;
        max-width: none;
    }
}

h3 {
    font-size: fn.toRem(18);
    margin-bottom: fn.toRem(12);
    font-weight: s.$weight-bold;

    @include mx.breakpoint(large) {
        font-size: fn.toRem(24);
        margin-bottom: fn.toRem(16);
    }
}

h4 {
    font-size: fn.toRem(16);
    margin-bottom: fn.toRem(10);

    @include mx.breakpoint(large) {
        font-size: fn.toRem(20);
        margin-bottom: fn.toRem(16);
    }
}

@each $key,
$color in s.$themeDarkMap {
    .bg-dark-#{$key} {
        background-color: $color;
    }

    .text-dark-#{$key} {
        color: $color
    }
}

@each $key,
$color in s.$themeLightMap {
    .bg-light-#{$key} {
        background-color: $color;
    }

    .text-light-#{$key} {
        color: $color
    }
}

@each $key,
$color in s.$themeLightMap {
    .bg-gradient-#{$key} {
        background: linear-gradient(to bottom, $color 0%, fn.getFrom(s.$themeDarkMap, $key) 100%);
    }

    .bg-gradient-horizontal-#{$key} {
        background: linear-gradient(to left, $color 0%, fn.getFrom(s.$themeDarkMap, $key) 100%);
    }

    .theme-#{$key} {
        --primary: #{$color};
        --primary-dark: #{fn.getFrom(s.$themeDarkMap, $key)};
    }
}

.back-btn {
    position: absolute;
    top: 0;
    left: 0;
    padding: 35px 30px 20px 30px;
    font-size: 30px;
    height: 84px;
    cursor: pointer;
    color: s.$text;
    user-select: none;
}