@charset "UTF-8";

// @description
// * ipad-mini mixin.
// * The ipad-mini mixin is designed to simplify the creation of media
// * queries targeting ipad-mini device with 768px × 1024px.
// * It allows you to specify the orientation type (portrait or landscape)
// * and includes common device-specific media query conditions.

// @access public

// @version 1.4.0

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/@media

// @namespace ipad

// @module ipad/ipad-mini

// @dependencies:
// * - meta.type-of (SASS function).
// * - list.index (SASS function).
// * - LibFunc1.is-in-list (function).
// * - LibFunc2.merge (function).
// * - Error.throw (function).

// @param {String} $orientation-type
// * The type of the orientation for the mixin of the device type.
// * It can be (landscape, land, l, portrait, port, p, all, "").

// @example
// * .example {
// *   @include ipad-mini(land) {
// *     content: "example";
// *   }
// * }

// @output
// * @media only screen and (min-device-width: 768px)
// * and (max-device-width: 1024px)
// * and (-webkit-min-device-pixel-ratio: 1)
// * and (orientation: landscape) {
// *  .example {
// *    content: "example";
// *  }
// * }

// @note
// * This mixin you can use for iPad 1, 2, mini and air.

// stylelint-disable media-feature-name-no-vendor-prefix
// stylelint-disable scss/operator-no-newline-after
// stylelint-disable media-query-no-invalid

@use "sass:meta";
@use "sass:list";
@use "../../../../../functions/global/is-in-list" as LibFunc1;
@use "../../../../../functions/list/merge" as LibFunc2;
@use "../../../../../development-utils/toggle-error-message" as Error;

@mixin ipad-mini($orientation-type: portrait) {
    @if meta.type-of($orientation-type) != string {
        content: Error.throw("The parameter of ipad-mini mixin must be in a string type.");
    }

    $landscape-values: (landscape, land, l) !default;
    $portrait-values: (portrait, port, p, "") !default;
    $all-orientations-types: LibFunc2.merge($landscape-values, $portrait-values) !default;
    $min-device-width: 768px !default;
    $max-device-width: 1024px !default;
    $min-device-pixel-ratio: 1 !default;

    @if $orientation-type == all {
        @media screen and (min-device-width: $min-device-width)
            and (max-device-width: $max-device-width)
            and (-webkit-device-pixel-ratio: $min-device-pixel-ratio) {
            @content;
        }
    } @else {
        @if LibFunc1.is-in-list($all-orientations-types, $orientation-type) {
            @if list.index($landscape-values, $orientation-type) {
                @media only screen and (min-device-width: $min-device-width)
                    and (max-device-width: $max-device-width)
                    and (-webkit-min-device-pixel-ratio: $min-device-pixel-ratio)
                    and (orientation: landscape) {
                    @content;
                }
            } @else if list.index($portrait-values, $orientation-type) {
                @media only screen and (min-device-width: $min-device-width)
                    and (max-device-width: $max-device-width)
                    and (-webkit-min-device-pixel-ratio: $min-device-pixel-ratio)
                    and (orientation: portrait) {
                    @content;
                }
            }
        } @else {
            content: Error.throw("The parameter of ipad-mini mixin must be one of: (#{$all-orientations-types}).");
        }
    }
}
