/* ==========================================================================
   Mobile Custom Header - Sliding Panel Menu
   ========================================================================== */

/* Only show on mobile (breakpoint controlled via JS) */
.mch-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.4s, opacity 0.4s ease;
    overflow: hidden;
}

.mch-overlay.mch-overlay--open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.4s ease;
}

/* Background image layer */
.mch-overlay__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.mch-overlay__bg--default {
    background: linear-gradient(135deg, #3d1f4e 0%, #2a1435 100%);
}

.mch-overlay__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
}

/* Content container — starts below the header */
.mch-overlay__content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    /* --mch-header-h is set by JS from the actual header height */
    padding: calc(var(--mch-header-h, 120px) + 16px) 20px 30px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Panels container */
.mch-panels {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    /* Extra bottom padding so the panel never fills the full height */
    padding-bottom: 20px;
    overflow: hidden;
}

/* Individual panel */
.mch-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    /* Use calc to leave space at bottom for visible border-radius */
    bottom: 20px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.mch-panel--active {
    transform: translateX(0);
}

.mch-panel--exit-left {
    transform: translateX(-30%);
}

/* Scrollable area inside panel */
.mch-panel__scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 24px 20px;
}

/* Back button */
.mch-back-button {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 8px 0;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    font-family: inherit;
    transition: opacity 0.2s;
}

.mch-back-button:hover {
    opacity: 0.7;
}

.mch-back-button svg {
    flex-shrink: 0;
}

/* Panel title */
.mch-panel__title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding: 0;
    line-height: 1.3;
}

/* Menu list */
.mch-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mch-menu-item {
    border-bottom: 1px solid #f0f0f0;
}

.mch-menu-item:last-child {
    border-bottom: none;
}

/* Menu link / button */
.mch-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 8px;
    background: none;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
    box-sizing: border-box;
}

.mch-menu-link:hover,
.mch-menu-link:focus-visible {
    background-color: #f8f8f8;
    outline: none;
}

.mch-menu-link span {
    flex: 1;
    text-align: left;
}

/* Arrow icon */
.mch-arrow {
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
}

.mch-menu-link:hover .mch-arrow {
    opacity: 0.7;
    transform: translateX(3px);
}

/* CTA Button */
.mch-cta-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    margin-top: 16px;
    background-color: #3d1f4e;
    color: #fff;
    border: 2px solid #3d1f4e;
    border-radius: 12px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-sizing: border-box;
}

.mch-cta-button:hover {
    background-color: #2a1435;
    color: #fff;
}

.mch-cta-button:active {
    transform: scale(0.98);
}

.mch-cta-button svg {
    flex-shrink: 0;
}

/* Keurmerk logos */
.mch-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 0 8px;
    margin-top: auto;
}

.mch-logos img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: none;
}

/* ==========================================================================
   Circular Hamburger Button [mch_hamburger] shortcode
   ========================================================================== */

.mch-hamburger {
    --mch-ham-size: 48px;
    --mch-ham-color: #ffffff;
    --mch-ham-bg: transparent;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mch-ham-size);
    height: var(--mch-ham-size);
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: var(--mch-ham-bg);
    cursor: pointer;
    position: relative;
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, transform 0.2s;
}

.mch-hamburger:hover {
    transform: scale(1.08);
}

.mch-hamburger:active {
    transform: scale(0.95);
}

/* The box that contains the three lines */
.mch-hamburger__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(var(--mch-ham-size) * 0.1);
    width: calc(var(--mch-ham-size) * 0.5);
    height: calc(var(--mch-ham-size) * 0.5);
    position: relative;
}

/* Individual lines */
.mch-hamburger__line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--mch-ham-color);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                width 0.3s ease;
    transform-origin: center;
}

/* Stagger line widths for a modern look */
.mch-hamburger__line:nth-child(1) {
    width: 100%;
}

.mch-hamburger__line:nth-child(2) {
    width: 75%;
    align-self: flex-end;
}

.mch-hamburger__line:nth-child(3) {
    width: 100%;
}

/* ---- Active state: morph into X ---- */
.mch-hamburger.mch-hamburger--active .mch-hamburger__box {
    gap: 0;
}

.mch-hamburger.mch-hamburger--active .mch-hamburger__line {
    position: absolute;
    width: 100%;
}

.mch-hamburger.mch-hamburger--active .mch-hamburger__line:nth-child(1) {
    transform: rotate(45deg);
}

.mch-hamburger.mch-hamburger--active .mch-hamburger__line:nth-child(2) {
    opacity: 0;
    width: 0;
}

.mch-hamburger.mch-hamburger--active .mch-hamburger__line:nth-child(3) {
    transform: rotate(-45deg);
}

/* When overlay is open, keep the hamburger visible on top */
.mch-overlay--open ~ .mch-hamburger,
body.mch-menu-active .mch-hamburger {
    z-index: 1000000;
}

/* Legacy trigger (unused now) */
.mch-hamburger-trigger {
    display: none;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes mch-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mch-overlay--open .mch-panel--active .mch-menu-item {
    animation: mch-fade-in 0.3s ease forwards;
    opacity: 0;
}

.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(1) { animation-delay: 0.05s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(2) { animation-delay: 0.08s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(3) { animation-delay: 0.11s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(4) { animation-delay: 0.14s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(5) { animation-delay: 0.17s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(6) { animation-delay: 0.20s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(7) { animation-delay: 0.23s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(8) { animation-delay: 0.26s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(9) { animation-delay: 0.29s; }
.mch-overlay--open .mch-panel--active .mch-menu-item:nth-child(10) { animation-delay: 0.32s; }

/* CTA fade in */
.mch-overlay--open .mch-panel--active .mch-cta-button {
    animation: mch-fade-in 0.3s ease forwards;
    animation-delay: 0.25s;
    opacity: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Adjust padding for smaller screens */
@media (max-width: 375px) {
    .mch-overlay__content {
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 20px;
    }

    .mch-panel__scroll {
        padding: 20px 16px;
    }

    .mch-menu-link {
        padding: 14px 6px;
        font-size: 15px;
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 500px) {
    .mch-overlay__content {
        padding-top: calc(var(--mch-header-h, 80px) + 8px);
    }
}

/* ==========================================================================
   Header stays on top of overlay
   ========================================================================== */

/*
 * The Elementor header (top bar + logo bar) must remain visible above
 * the overlay.  We lift it above the overlay z-index and let the overlay
 * content start below the header via a CSS custom property.
 *
 * --mch-header-height is set by JS at runtime for pixel-perfect alignment,
 * but we provide a sensible CSS fallback.
 */

body.mch-menu-active .elementor-location-header {
    z-index: 1000001 !important;
}

/* Also lift any fixed/sticky inner container Elementor uses */
body.mch-menu-active .elementor-location-header > .e-con {
    z-index: 1000001 !important;
}

/* ==========================================================================
   Hide Elementor default mobile menu when our overlay is active
   ========================================================================== */

body.mch-menu-active .elementor-menu-toggle + nav.elementor-nav-menu--dropdown,
body.mch-menu-active .elementor-nav-menu--dropdown-tablet,
body.mch-menu-active .elementor-nav-menu--dropdown-mobile,
body.mch-menu-active .elementor-nav-menu--dropdown {
    display: none !important;
}

/* Ensure our overlay is below the header but above page content */
.mch-overlay {
    z-index: 999999 !important;
}

/* ==========================================================================
   Desktop: hide the overlay entirely
   ========================================================================== */
/* This is handled via JS breakpoint check, but as a safety net: */
@media (min-width: 1025px) {
    .mch-overlay {
        display: none !important;
    }
}
