@use "../../../dev" as *;
@use "../../../variables" as *;
// ============================================================================
// Media | Video
// ============================================================================

// Note: Tag-level styles for video have been moved to src/scss/tags/_media.scss

/// Wrapper for video elements.
///
/// Ensures the video occupies the full height and width of its container.
@mixin video_wrapper {
    height: 100%;
    overflow: hidden;
    position: absolute;
    width: 100%;

    // position: relative;
    // padding-bottom: 56.25%;
    // /* 16:9 */
    // padding-top: q(25);
    // height: 0;

    // background-color: var(--color_text_primary);
    // height: auto;
    // left: 50%;
    // min-height: 100%;
    // min-width: 100%;
    // position: absolute;
    // top: 50%;
    // -ms-transform: translate(-50%, -50%);
    // -webkit-transform: translate(-50%, -50%);
    // transform: translate(-50%, -50%);
    // -moz-transform: translate(-50%, -50%);
    // -o-transform: translate(-50%, -50%);
    // width: auto;
    // z-index: -3;

    iframe {
        // height: 100%;
        // left: 0;
        // position: absolute;
        // top: -q(4) !important;
        // width: 100%;

        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/// Background overlay for videos.
///
/// This overlay is semi-transparent and covers the entire video area, useful for adding effects or messages.
@mixin video-background {
    position: absolute;
    height: 100%;
    width: 100%;
    z-index: 1;
    top: 0;
    background: rgba(67, 67, 67, 0.5);
}

@mixin htms-video {
}

@mixin video-wrapper-iframe {
}

// Advanced SCSS with Mixins for Responsive Aspect Ratios
// ----------------------------------------------------------------------------
// For a more advanced and flexible approach, especially for maintaining
// specific aspect ratios (like 16:9), you can use SCSS mixins.

/// Mixin for maintaining aspect ratio for elements.
///
/// This mixin is especially useful for video containers to ensure that they maintain a specific aspect ratio.
///
/// @param {Number} $width - The width part of the aspect ratio.
/// @param {Number} $height - The height part of the aspect ratio.
@mixin video-aspect-ratio($width, $height) {
    position: relative;
    &:before {
        display: block;
        content: "";
        width: 100%;
        padding-top: calc($height / $width) * 100%;
    }
    > .video-content {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/// Container for videos, ensuring a 16:9 aspect ratio.
///
/// Applies the aspect-ratio mixin for consistent sizing across different devices.
@mixin video-container {
    @include video-aspect-ratio(16, 9); // 16:9 aspect ratio

    video {
        position: absolute;
        width: 100%;
        height: 100%;
        border: none; // Remove border for this approach
    }
}

// Styling Video Overlays and Custom Controls
// ----------------------------------------------------------------------------
// If you're implementing custom controls or overlays (like play buttons or
// progress bars), SCSS can help you manage their styles cohesively.

/// Styling for video overlays, typically used for play buttons or video captions.
///
/// This overlay is semi-transparent and centered within the video container.
/// It becomes visible on hover or when the video is paused.
@mixin video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5); // Semi-transparent overlay
    color: var(--color_surface_primary);
    font-size: q(32);
    cursor: pointer;

    // Hide by default and show on video hover or pause
    opacity: 0;
    transition: opacity 0.3s ease;
    video:hover + &,
    video:pause + & {
        opacity: 1;
    }
}

/// Custom controls for video playback.
///
/// These controls are positioned at the bottom of the video and styled with a semi-transparent background.
@mixin custom-controls {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: q(10);
    background: rgba(0, 0, 0, 0.7); // Semi-transparent background for controls
    color: var(--color_surface_primary);
    display: flex;
    justify-content: space-between;

    .play-button,
    .volume-control,
    .full-screen-button {
        cursor: pointer;
    }
}

// Responsive Video Embeds
// ----------------------------------------------------------------------------
// For embedded videos (like from YouTube or Vimeo), ensuring responsiveness
// while maintaining aspect ratio is crucial.

/// Ensures embedded videos maintain responsiveness and aspect ratio.
///
/// Particularly useful for video embeds from platforms like YouTube or Vimeo.
@mixin embed-responsive {
    @include video-aspect-ratio(
        16,
        9
    ); // 16:9 aspect ratio for embedded videos

    iframe,
    object,
    embed {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}
