////
/// Screens.
///
/// @group  Tools
/// @author Sky Shabatura <theme@sky.camp>
/// @link   https://taproot-theme.com
////

// public screens
$screen--mobile-max: '767px';
$screen--tablet-min: '768px';
$screen--tablet-max: '1024px';
$screen--desktop-min: '1025px';

// editor screens
$screen--editor-mobile-max: '360px';
$screen--editor-tablet-min: '361px';
$screen--editor-desktop-min: '781px';

// The screen mixin
@mixin screen($screen) {
    $query: '';

    @if ($screen == 'mobile') {
        $query: '( max-width: #{$screen--mobile-max} )';
    }

    @if ($screen == 'tablet') {
        $query: '( min-width: #{$screen--tablet-min} ) and ( max-width: #{$screen--tablet-max} )';
    }

    @if ($screen == 'tablet-and-under') {
        $query: '( max-width: #{$screen--tablet-max} )';
    }

    @if ($screen == 'tablet-and-up') {
        $query: '( min-width: #{$screen--tablet-min} )';
    }

    @if ($screen == 'desktop') {
        $query: '( min-width: #{$screen--desktop-min} )';
    }

    @if ($screen == 'editor-mobile') {
        $query: '( max-width: #{$screen--editor-mobile-max} )';
    }

    @if ($screen == 'editor-tablet') {
        $query: '( min-width: #{$screen--editor-tablet-min} )';
    }

    @if ($screen == 'editor-desktop') {
        $query: '( min-width: #{$screen--editor-desktop-min} )';
    }

    @if ($query != '') {
        @media #{$query} {
            @content;
        }
    } @else {
        @content;
    }
}
