/**
 * Cahaya Senja Kaimana
 * Floating Dark Mode
 */


/* ==========================================================
   BUTTON
   ========================================================== */

#csk-floating-dark-mode {

    position: fixed;

    top: 50%;
    right: 18px;

    transform:
        translateY(-50%);

    z-index: 45;

    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border:
        1px solid
        rgba(226, 232, 240, .95);

    border-radius: 15px;

    background:
        rgba(255, 255, 255, .94);

    color: #0F172A;

    box-shadow:
        0 12px 32px
        rgba(15, 23, 42, .13);

    backdrop-filter:
        blur(14px);

    -webkit-backdrop-filter:
        blur(14px);

    cursor: pointer;

    transition:
        background-color .25s ease,
        border-color .25s ease,
        color .25s ease,
        box-shadow .25s ease,
        transform .25s ease;

    -webkit-tap-highlight-color:
        transparent;
}


/* ==========================================================
   ICON
   ========================================================== */

#csk-floating-dark-mode
.csk-floating-darkmode-icon {

    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;

    line-height: 1;
}


#csk-floating-dark-mode
.fa-moon {

    color: #0F172A;
}


#csk-floating-dark-mode
.fa-sun {

    color: #F59E0B;
}


/* ==========================================================
   HOVER
   ========================================================== */

@media (hover: hover) {

    #csk-floating-dark-mode:hover {

        transform:
            translateY(-50%)
            translateX(-2px);

        border-color:
            rgba(245, 158, 11, .55);

        box-shadow:
            0 16px 38px
            rgba(15, 23, 42, .18);
    }

}


/* ==========================================================
   FOCUS
   ========================================================== */

#csk-floating-dark-mode:focus {

    outline: none;
}


#csk-floating-dark-mode:focus-visible {

    outline:
        3px solid
        rgba(245, 158, 11, .28);

    outline-offset: 3px;
}


/* ==========================================================
   DARK MODE
   ========================================================== */

html.dark
#csk-floating-dark-mode {

    background:
        rgba(15, 23, 42, .94);

    border-color:
        rgba(51, 65, 85, .95);

    color: #FFFFFF;

    box-shadow:
        0 12px 34px
        rgba(0, 0, 0, .28);
}


/* ==========================================================
   TOOLTIP
   ========================================================== */

.csk-floating-darkmode-tooltip {

    position: absolute;

    top: 50%;
    right: calc(100% + 10px);

    transform:
        translateY(-50%)
        translateX(4px);

    pointer-events: none;

    white-space: nowrap;

    opacity: 0;
    visibility: hidden;

    padding:
        7px 10px;

    border-radius:
        8px;

    background:
        #0F172A;

    color:
        #FFFFFF;

    font-family:
        "Inter",
        sans-serif;

    font-size:
        11px;

    font-weight:
        600;

    line-height:
        1;

    box-shadow:
        0 8px 20px
        rgba(15, 23, 42, .18);

    transition:
        opacity .2s ease,
        visibility .2s ease,
        transform .2s ease;
}


@media (hover: hover) {

    #csk-floating-dark-mode:hover
    .csk-floating-darkmode-tooltip {

        opacity: 1;
        visibility: visible;

        transform:
            translateY(-50%)
            translateX(0);
    }

}


html.dark
.csk-floating-darkmode-tooltip {

    background:
        #FFFFFF;

    color:
        #0F172A;
}


/* ==========================================================
   TABLET
   ========================================================== */

@media (
    min-width: 768px
)
and (
    max-width: 1180px
) {

    #csk-floating-dark-mode {

        right: 14px;

        width: 46px;
        height: 46px;

        border-radius:
            14px;
    }

}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 767px) {

    #csk-floating-dark-mode {

        top: auto;

        right:
            max(
                16px,
                env(safe-area-inset-right)
            );

        bottom:
            max(
                20px,
                env(safe-area-inset-bottom)
            );

        transform:
            none;

        width: 46px;
        height: 46px;

        border-radius:
            14px;
    }


    @media (hover: hover) {

        #csk-floating-dark-mode:hover {

            transform:
                translateY(-2px);
        }

    }


    .csk-floating-darkmode-tooltip {

        display: none;
    }

}


/* ==========================================================
   SMALL MOBILE
   ========================================================== */

@media (max-width: 390px) {

    #csk-floating-dark-mode {

        width: 44px;
        height: 44px;

        right:
            max(
                12px,
                env(safe-area-inset-right)
            );

        bottom:
            max(
                16px,
                env(safe-area-inset-bottom)
            );
    }

}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (
    prefers-reduced-motion:
    reduce
) {

    #csk-floating-dark-mode,
    .csk-floating-darkmode-tooltip {

        transition: none !important;
    }

}


/* ==========================================================
   PRINT
   ========================================================== */

@media print {

    #csk-floating-dark-mode {

        display: none !important;
    }

}