/* ==========================================================================
   Custom Off-Canvas Popup Menu Styles - V2 (Right-sliding)
   ========================================================================== */

/* Main Container */
.custom-off-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99990;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-off-canvas.active {
    pointer-events: auto;
    visibility: visible;
}

/* Background Overlay */
.custom-off-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.custom-off-canvas.active .custom-off-canvas-overlay {
    opacity: 1;
}

/* Sliding Frame Bars (Top and Bottom) - matching the 5vh vertical gap of the 0.9 scale */
.custom-off-canvas-top-bar,
.custom-off-canvas-bottom-bar {
    position: fixed;
    left: 0;
    width: 100%;
    height: calc(5vh + 1px);
    background-color: #fff;
    z-index: 99995;
    will-change: transform;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-off-canvas-top-bar {
    top: 0;
    transform: translateY(-100%);
}

.custom-off-canvas-bottom-bar {
    bottom: 0;
    transform: translateY(100%);
}

.custom-off-canvas.active .custom-off-canvas-top-bar,
.custom-off-canvas.active .custom-off-canvas-bottom-bar {
    transform: translateY(0);
}

/* Right-Side Off-Canvas Panel (No drop shadow as it affects corner masks) */
.custom-off-canvas-panel {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    width: 450px;
    max-width: 85%;
    height: 100%;
    background-color: #fff;
    z-index: 99996;
    transform: translate3d(100%, 0, 0);
    will-change: transform;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.custom-off-canvas.active .custom-off-canvas-panel {
    transform: translate3d(0, 0, 0);
}

/* Close Button */
.custom-off-canvas-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #1a1a1a;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.custom-off-canvas-close:hover {
    transform: rotate(90deg);
    background-color: #eee;
}

.custom-off-canvas-close svg {
    width: 18px;
    height: 18px;
}

/* Panel Content Container */
.custom-off-canvas-inner {
    flex: 1;
    overflow-y: auto;
    padding: 70px 40px 40px 40px;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.custom-off-canvas-inner::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.custom-off-canvas-inner {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Original Inverted Corner Cutout Masks (SVG Curves)
   Placed on the left side of the right-sliding panel to round the page wrapper's corners */
.custom-off-canvas-panel::before,
.custom-off-canvas-panel::after {
    content: '';
    position: absolute;
    left: -25px;
    /* Size is 25px wide matching original styles */
    right: auto;
    width: 25px;
    height: 25px;
    z-index: 99997;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    will-change: transform;
    pointer-events: none;
}

/* Top Corner Curve (Using exact original base64) */
.custom-off-canvas-panel::before {
    top: 0px;
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cGF0aCBkPSJNNTAgMCBMNTAgNTAgQTUwIDUwIDAgMCAwIDAgMCBaIiBmaWxsPSIjZmZmZmZmIi8+PC9zdmc+");
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Bottom Corner Curve (Using exact original base64, flipped vertically) */
.custom-off-canvas-panel::after {
    bottom: 0px;
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MCIgaGVpZ2h0PSI1MCIgdmlld0JveD0iMCAwIDUwIDUwIj48cGF0aCBkPSJNNTAgMCBMNTAgNTAgQTUwIDUwIDAgMCAwIDAgMCBaIiBmaWxsPSIjZmZmZmZmIi8+PC9zdmc+");
    transform: translateY(100%) rotateX(180deg);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active state: Translate masks by 5vh (matching top/bottom bar heights) */
.custom-off-canvas.active .custom-off-canvas-panel::before {
    transform: translateY(5vh);
}

.custom-off-canvas.active .custom-off-canvas-panel::after {
    transform: translateY(-5vh) rotateX(180deg);
}

/* ==========================================================================
   Page Wrapper Transformations (Z-axis Shrink and Leftward Shift)
   ========================================================================== */

#wrapper {
    will-change: transform, border-radius;
    transform-origin: right top;
    /* Forces right anchoring to prevent overrides */
    transition:
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        border-radius 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active body state */
body.custom-off-canvas-active {
    overflow: hidden !important;
    height: 100vh !important;
    background-color: #0d0d0d !important;
    /* Dark canvas revealed in the margins */
}

body.custom-off-canvas-active #wrapper {
    transform: scale(0.95) translate3d(-200px, 0, 0) !important;
    /* Forces layout transform override */
    border-radius: 0 30px 30px 0;
    /* Matches original cutout style */
    box-shadow: -20px 20px 50px rgba(0, 0, 0, 0.3);
    /* Soft shadow leftwards */
    background-color: #fff !important;
    /* Ensure solid white background on the card */
    overflow: hidden;
    pointer-events: none;
    /* Disable interaction with webpage while menu is active */
}

/* Ensure absolute elements and headers scale down correctly */
body.custom-off-canvas-active #masthead {
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-off-canvas-panel {
        width: 320px;
    }

    body.custom-off-canvas-active #wrapper {
        transform: scale(0.85) translate3d(-300px, 0, 0);
    }

    .custom-off-canvas-inner {
        padding: 60px 25px 25px 25px;
    }
}

/* ==========================================================================
   WordPress Admin Bar Compatibility
   ========================================================================== */

/* Desktop Admin Bar Offset */
.admin-bar .custom-off-canvas-panel,
.admin-bar .custom-off-canvas-top-bar,
.admin-bar .custom-off-canvas-overlay {
    top: 32px;
}

.admin-bar .custom-off-canvas-panel {
    height: calc(100% - 32px);
}

/* Mobile Admin Bar Offset */
@media (max-width: 782px) {

    .admin-bar .custom-off-canvas-panel,
    .admin-bar .custom-off-canvas-top-bar,
    .admin-bar .custom-off-canvas-overlay {
        top: 46px;
    }

    .admin-bar .custom-off-canvas-panel {
        height: calc(100% - 46px);
    }
}