/**
 * CMSMasters Custom Cursor
 * States controlled via BODY classes
 */

/* ==========================================================================
   CSS Custom Properties & Adaptive Colors
   ========================================================================== */

:root {
    --cmsmasters-cursor-color:#222;
    /* DISABLED: Adaptive color vars — adaptive mode commented out
    --cmsmasters-cursor-color-light:#fff;
    --cmsmasters-cursor-color-dark:#222;
    */
    --cmsmasters-cursor-dot-size:8px;
    --cmsmasters-cursor-dot-hover-size:40px;
    --cmsmasters-cursor-ring-offset:32px
}

/* DISABLED: Adaptive color mode — cursor color no longer changes by background
body.cmsmasters-cursor-on-dark {
    --cmsmasters-cursor-color:var(--cmsmasters-cursor-color-light)!important
}

body.cmsmasters-cursor-on-light {
    --cmsmasters-cursor-color:var(--cmsmasters-cursor-color-dark)!important
}
*/

/* ==========================================================================
   Core Cursor Elements (container, base, cursor:none)
   ========================================================================== */

#cmsmasters-cursor-container {
    --cmsmasters-cursor-z-default: 999999;
    --cmsmasters-cursor-z-blend: 999999;
    z-index: var(--cmsmasters-cursor-z-default)
}

.cmsmasters-cursor {
    position:fixed;
    top:0;
    left:0;
    pointer-events:none;
    will-change:transform,opacity;
    opacity:0;
    transition:opacity .3s ease;
    transform:translate3d(-200px,-200px,0)
}

.cmsmasters-cursor-enabled .cmsmasters-cursor {
    opacity:1
}

.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual),
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) * {
    cursor:none!important
}

/* Widget-only mode: cursor elements visible */
.cmsmasters-cursor-widget-only .cmsmasters-cursor {
    opacity:1
}

/* Widget-only mode: hide native cursor only inside show zones (not in dual) */
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) [data-cursor-show],
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) [data-cursor-show] * {
    cursor:none!important
}

/* ==========================================================================
   Plugin & UI Overrides (auto-hide, datepicker, select2, admin bar, touch)
   ========================================================================== */

body:not(.cmsmasters-cursor-dual) [data-cursor=hide],
body:not(.cmsmasters-cursor-dual) [data-cursor=hide] *,
body:not(.cmsmasters-cursor-dual) [data-cursor=none],
body:not(.cmsmasters-cursor-dual) [data-cursor=none] * {
    cursor:auto!important
}

body:not(.cmsmasters-cursor-dual) [data-cursor=hide] a,
body:not(.cmsmasters-cursor-dual) [data-cursor=hide] button,
body:not(.cmsmasters-cursor-dual) [data-cursor=hide] [role="button"],
body:not(.cmsmasters-cursor-dual) [data-cursor=hide] input[type="submit"],
body:not(.cmsmasters-cursor-dual) [data-cursor=none] a,
body:not(.cmsmasters-cursor-dual) [data-cursor=none] button,
body:not(.cmsmasters-cursor-dual) [data-cursor=none] [role="button"],
body:not(.cmsmasters-cursor-dual) [data-cursor=none] input[type="submit"] {
    cursor:pointer!important
}

.air-datepicker,
.daterangepicker,
.flatpickr-calendar,
.ui-datepicker,
.select2-dropdown,
.chosen-drop,
.choices__list--dropdown,
.nice-select-dropdown,
.nice-select .list,
.ts-dropdown,
.ss-content,
.selectize-dropdown,
.ui-selectmenu-menu,
.k-animation-container,
.k-list-container {
    cursor:default!important
}

.air-datepicker-cell,
.air-datepicker-nav--action,
.daterangepicker .btn,
.daterangepicker select,
.daterangepicker td,
.daterangepicker th,
.flatpickr-calendar .flatpickr-day,
.flatpickr-calendar .flatpickr-monthDropdown-months,
.flatpickr-calendar .flatpickr-next-month,
.flatpickr-calendar .flatpickr-prev-month,
.flatpickr-calendar .numInputWrapper,
.ui-datepicker a,
.ui-datepicker button,
.ui-datepicker td {
    cursor:pointer!important
}

/* Admin bar: restore visible cursor in both full and widget-only modes.
   (dual mode excluded from cursor:none via :not(), so original WP styles apply) */
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar,
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar *,
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar,
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar * {
    cursor:auto!important
}

/* Admin bar: restore pointer on clickable elements (cursor:auto overrides UA pointer) */
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar a,
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar button,
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar [role="button"],
.cmsmasters-cursor-enabled:not(.cmsmasters-cursor-dual) #wpadminbar input[type="submit"],
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar a,
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar button,
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar [role="button"],
.cmsmasters-cursor-widget-only:not(.cmsmasters-cursor-dual) #wpadminbar input[type="submit"] {
    cursor:pointer!important
}

@media (hover:none) and (pointer:coarse) {
    #cmsmasters-cursor-container,.cmsmasters-cursor {
        display:none!important
    }
}

/* ==========================================================================
   Dot & Ring
   ========================================================================== */

.cmsmasters-cursor-dot {
    width:var(--cmsmasters-cursor-dot-size);
    height:var(--cmsmasters-cursor-dot-size);
    background:var(--cmsmasters-cursor-color);
    border-radius:50%;
    margin-left:calc(var(--cmsmasters-cursor-dot-size)/ -2);
    margin-top:calc(var(--cmsmasters-cursor-dot-size)/ -2);
    transition:background-color .15s ease-out,width .2s cubic-bezier(.25, 1, .5, 1),height .2s cubic-bezier(.25, 1, .5, 1),margin .2s cubic-bezier(.25, 1, .5, 1)
}

.cmsmasters-cursor-ring {
    --_ring:calc(var(--cmsmasters-cursor-dot-size) + var(--cmsmasters-cursor-ring-offset));
    width:var(--_ring);
    height:var(--_ring);
    border:2px solid var(--cmsmasters-cursor-color);
    border-radius:50%;
    margin-left:calc(var(--_ring) / -2);
    margin-top:calc(var(--_ring) / -2);
    box-sizing:border-box;
    transition:width .2s cubic-bezier(.25, 1, .5, 1),height .2s cubic-bezier(.25, 1, .5, 1),margin .2s cubic-bezier(.25, 1, .5, 1),opacity .2s ease,background-color .2s ease,border-color .15s ease-out
}

/* ==========================================================================
   Blend Modes
   ========================================================================== */

body.cmsmasters-cursor-blend-medium #cmsmasters-cursor-container,
body.cmsmasters-cursor-blend-soft #cmsmasters-cursor-container,
body.cmsmasters-cursor-blend-strong #cmsmasters-cursor-container {
    z-index: var(--cmsmasters-cursor-z-blend)
}

body.cmsmasters-cursor-blend-soft #cmsmasters-cursor-container {
    mix-blend-mode:exclusion
}

body.cmsmasters-cursor-blend-medium #cmsmasters-cursor-container {
    mix-blend-mode:difference
}

body.cmsmasters-cursor-blend-strong #cmsmasters-cursor-container {
    mix-blend-mode:difference;
    filter:contrast(1.5)
}

/* ==========================================================================
   Cursor States (hover, down, text, hidden)
   ========================================================================== */

body.cmsmasters-cursor-hover .cmsmasters-cursor-ring {
    --_ring-hover:calc(var(--cmsmasters-cursor-dot-hover-size) + 20px);
    width:var(--_ring-hover);
    height:var(--_ring-hover);
    margin-left:calc(var(--_ring-hover) / -2);
    margin-top:calc(var(--_ring-hover) / -2);
    opacity:.5;
    background-color:color-mix(in srgb,var(--cmsmasters-cursor-color) 10%,transparent)
}

body.cmsmasters-cursor-down .cmsmasters-cursor-ring {
    --_ring-down:calc(var(--cmsmasters-cursor-dot-size) + var(--cmsmasters-cursor-ring-offset) * 0.7);
    width:var(--_ring-down);
    height:var(--_ring-down);
    margin-left:calc(var(--_ring-down) / -2);
    margin-top:calc(var(--_ring-down) / -2);
    background-color:color-mix(in srgb,var(--cmsmasters-cursor-color) 90%,transparent)
}

body.cmsmasters-cursor-down .cmsmasters-cursor-dot {
    opacity:.5
}

body.cmsmasters-cursor-text .cmsmasters-cursor-ring {
    width:4px;
    height:24px;
    border-radius:2px;
    margin-left:-2px;
    margin-top:-12px;
    background-color:var(--cmsmasters-cursor-color);
    border:none;
    opacity:1
}

body.cmsmasters-cursor-text .cmsmasters-cursor-dot {
    opacity:0
}

body.cmsmasters-cursor-hidden .cmsmasters-cursor {
    opacity:0!important
}

/* System cursor fallback when custom cursor hides (form zones, video/iframe) */
body.cmsmasters-cursor-hidden:not(.cmsmasters-cursor-dual),
body.cmsmasters-cursor-hidden:not(.cmsmasters-cursor-dual) * {
    cursor:default!important
}

/* ==========================================================================
   Size Variants & Themes
   ========================================================================== */

body.cmsmasters-cursor-size-sm .cmsmasters-cursor-ring {
    width:20px;
    height:20px;
    margin-left:-10px;
    margin-top:-10px
}

body.cmsmasters-cursor-size-lg .cmsmasters-cursor-ring {
    width:80px;
    height:80px;
    margin-left:-40px;
    margin-top:-40px
}

body.cmsmasters-cursor-theme-dot .cmsmasters-cursor-ring {
    display:none!important
}

body.cmsmasters-cursor-theme-dot.cmsmasters-cursor-hover .cmsmasters-cursor-dot {
    width:var(--cmsmasters-cursor-dot-hover-size);
    height:var(--cmsmasters-cursor-dot-hover-size);
    margin-left:calc(var(--cmsmasters-cursor-dot-hover-size)/ -2);
    margin-top:calc(var(--cmsmasters-cursor-dot-hover-size)/ -2)
}

/* ==========================================================================
   Special Cursor: Image
   ========================================================================== */

.cmsmasters-cursor-image {
    position:fixed;
    top:0;
    left:0;
    pointer-events:none;
    will-change:transform,width;
    transition:width .2s cubic-bezier(.25, 1, .5, 1),margin .2s cubic-bezier(.25, 1, .5, 1);
    transform:translate3d(-200px,-200px,0);
    height:auto;
    object-fit:contain
}

/* Hide system cursor on special cursor zones (skip in dual mode — system cursor stays visible) */
body:not(.cmsmasters-cursor-dual) [data-cursor-image],
body:not(.cmsmasters-cursor-dual) [data-cursor-image] * {
    cursor:none!important
}

body.cmsmasters-cursor-blend-medium .cmsmasters-cursor-image,
body.cmsmasters-cursor-blend-soft .cmsmasters-cursor-image,
body.cmsmasters-cursor-blend-strong .cmsmasters-cursor-image {
    filter:none
}

.cmsmasters-cursor-image.cmsmasters-cursor-image-buzz,
.cmsmasters-cursor-image.cmsmasters-cursor-image-pulse,
.cmsmasters-cursor-image.cmsmasters-cursor-image-shake,
.cmsmasters-cursor-image.cmsmasters-cursor-image-wobble {
    transition:none
}

/* ==========================================================================
   Special Cursor: Text
   ========================================================================== */

.cmsmasters-cursor-text-el.cmsmasters-cursor-text-buzz,
.cmsmasters-cursor-text-el.cmsmasters-cursor-text-pulse,
.cmsmasters-cursor-text-el.cmsmasters-cursor-text-shake,
.cmsmasters-cursor-text-el.cmsmasters-cursor-text-wobble {
    transition:none
}

.cmsmasters-cursor-text-el {
    position:fixed;
    top:0;
    left:0;
    pointer-events:none;
    will-change:transform;
    transition:transform .1s ease-out;
    transform:translate3d(-200px,-200px,0);
    white-space:nowrap;
    display:inline-block;
    box-sizing:border-box
}

body:not(.cmsmasters-cursor-dual) [data-cursor-text],
body:not(.cmsmasters-cursor-dual) [data-cursor-text] * {
    cursor:none!important
}

body.cmsmasters-cursor-blend-medium .cmsmasters-cursor-text-el,
body.cmsmasters-cursor-blend-soft .cmsmasters-cursor-text-el,
body.cmsmasters-cursor-blend-strong .cmsmasters-cursor-text-el {
    filter:none
}

/* ==========================================================================
   Special Cursor: Icon
   ========================================================================== */

.cmsmasters-cursor-icon-el {
    position:fixed;
    top:0;
    left:0;
    pointer-events:none;
    will-change:transform;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-sizing:border-box;
    transition:width .2s cubic-bezier(.25, 1, .5, 1),height .2s cubic-bezier(.25, 1, .5, 1),padding .2s cubic-bezier(.25, 1, .5, 1),font-size .2s cubic-bezier(.25, 1, .5, 1);
    transform:translate3d(-200px,-200px,0)
}

.cmsmasters-cursor-icon-el i,
.cmsmasters-cursor-icon-el img,
.cmsmasters-cursor-icon-el svg {
    display:block;
    width:1em;
    height:1em
}

.cmsmasters-cursor-icon-el svg {
    fill:currentColor
}

body:not(.cmsmasters-cursor-dual) [data-cursor-icon],
body:not(.cmsmasters-cursor-dual) [data-cursor-icon] * {
    cursor:none!important
}

.cmsmasters-cursor-icon-el.cmsmasters-cursor-icon-buzz,
.cmsmasters-cursor-icon-el.cmsmasters-cursor-icon-pulse,
.cmsmasters-cursor-icon-el.cmsmasters-cursor-icon-shake,
.cmsmasters-cursor-icon-el.cmsmasters-cursor-icon-wobble {
    transition:none
}

body.cmsmasters-cursor-blend-medium .cmsmasters-cursor-icon-el,
body.cmsmasters-cursor-blend-soft .cmsmasters-cursor-icon-el,
body.cmsmasters-cursor-blend-strong .cmsmasters-cursor-icon-el {
    filter:none
}

/* ==========================================================================
   Cursor Inner Wrapper
   ========================================================================== */

.cmsmasters-cursor-inner {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    will-change:transform
}

.cmsmasters-cursor-image .cmsmasters-cursor-inner {
    width:100%;
    height:100%
}

.cmsmasters-cursor-text-el .cmsmasters-cursor-inner {
    white-space:nowrap
}

.cmsmasters-cursor-icon-el .cmsmasters-cursor-inner {
    line-height:1
}

/* ==========================================================================
   Popup & Overlay Z-index
   ========================================================================== */

.air-datepicker #cmsmasters-cursor-container,
.daterangepicker #cmsmasters-cursor-container,
.elementor-popup-modal #cmsmasters-cursor-container,
.flatpickr-calendar #cmsmasters-cursor-container,
.ui-datepicker #cmsmasters-cursor-container {
    z-index: var(--cmsmasters-cursor-z-default)
}

/* ==========================================================================
   Browser Compatibility Fallbacks
   ========================================================================== */

/**
 * CSS-002: Fallback for browsers without color-mix() support
 * Safari <16.4, Firefox <113, Chrome <111 (~5% users)
 * Uses rgba() with correct opacity values matching color-mix percentages
 */
@supports not (background-color: color-mix(in srgb, red 50%, blue)) {
    /* Default: dark cursor (#222) on light background */
    body.cmsmasters-cursor-hover .cmsmasters-cursor-ring {
        background-color: rgba(34, 34, 34, 0.1)
    }

    body.cmsmasters-cursor-down .cmsmasters-cursor-ring {
        background-color: rgba(34, 34, 34, 0.9)
    }

    /* DISABLED: Adaptive fallback — adaptive mode commented out
    body.cmsmasters-cursor-on-dark.cmsmasters-cursor-hover .cmsmasters-cursor-ring {
        background-color: rgba(255, 255, 255, 0.1)
    }

    body.cmsmasters-cursor-on-dark.cmsmasters-cursor-down .cmsmasters-cursor-ring {
        background-color: rgba(255, 255, 255, 0.9)
    }
    */
}
