@media (max-width: 1180px) {
    .ct-header-inner {
        grid-template-columns: auto 1fr auto auto;
        gap: 12px;
    }

    .ct-menu-toggle {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        justify-self: end !important;
        margin-left: auto !important;
        position: relative !important;
        z-index: 10002 !important;
        width: 42px !important;
        height: 42px !important;
        padding: 8px !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        cursor: pointer !important;
    }
    .ct-menu-toggle span {
        display: block !important;
        width: 24px !important;
        height: 2px !important;
        min-height: 2px !important;
        margin: 3px 0 !important;
        padding: 0 !important;
        background: #201751 !important;
        border: 0 !important;
        border-radius: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Drawer móvil/tablet: limpio, compacto y cargado a la derecha */
    .ct-primary-nav {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: min(86vw, 380px);
        height: auto;
        max-height: 100dvh;
        padding: 0 24px 30px;
        background: #fff;
        border: 0;
        box-shadow: -18px 0 48px rgba(20, 16, 51, .14);
        transform: translateX(105%);
        opacity: 1;
        pointer-events: none;
        transition: transform .30s cubic-bezier(.22,.61,.36,1);
        z-index: 10001;
        overflow-y: auto;
        overscroll-behavior: contain;
        font-family: var(--ct-font);
    }

    .admin-bar .ct-primary-nav {
        top: 32px;
        height: auto;
        max-height: calc(100dvh - 32px);
    }

    .ct-primary-nav.is-open {
        transform: translateX(0);
        pointer-events: auto;
    }

    .ct-site-header .ct-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 16, 51, .56);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .24s ease, visibility .24s ease;
        z-index: 10000;
    }
    .ct-site-header .ct-nav-overlay.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .ct-site-header .ct-mobile-nav-head {
        min-height: 76px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid rgba(32,23,81,.10);
        margin-bottom: 6px;
    }
    .ct-mobile-nav-title {
        color: #201751;
        font-size: 12px;
        line-height: 1;
        font-weight: 400;
        font-synthesis: none;
        letter-spacing: .16em;
        text-transform: uppercase;
        font-family: var(--ct-font);
    }
    .ct-menu-close {
        width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
        background: transparent;
        color: #201751;
        font-family: Arial, sans-serif;
        font-size: 32px;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
    }

    .ct-desktop-menu-wrap { display: none !important; }
    .ct-mobile-menu {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .ct-mobile-menu li {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid rgba(32,23,81,.09);
    }
    .ct-mobile-menu a {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 50px;
        padding: 0 2px;
        color: #241d49;
        text-decoration: none;
        text-transform: none;
        font-family: var(--ct-font);
        font-size: 15px;
        font-weight: 400;
        letter-spacing: .012em;
    }
    .ct-mobile-menu a::after {
        content: '→';
        margin-left: auto;
        color: rgba(32,23,81,.34);
        font-size: 16px;
        font-weight: 400;
        transform: translateY(-1px);
    }
    .ct-mobile-menu a:hover,
    .ct-mobile-menu a:focus {
        color: #201751;
        background: rgba(32,23,81,.025);
    }

    .ct-site-header .ct-mobile-quote {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        width: calc(100% - 16px);
        min-height: 48px;
        margin: 20px 8px 0;
        padding: 0 18px;
        border-radius: 0;
        background: #201751;
        color: #fff;
        text-decoration: none;
        font-family: var(--ct-font);
        font-size: 14px;
        font-weight: 700;
        letter-spacing: .01em;
    }

    body.ct-menu-open { overflow: hidden; }

    /* Cuando el drawer está abierto, solo se ve la X del panel. */
    body.ct-menu-open .ct-menu-toggle {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Join.chat / WhatsApp flotante queda detrás del overlay mientras el menú está abierto. */
    body.ct-menu-open .joinchat,
    body.ct-menu-open #joinchat,
    body.ct-menu-open .joinchat__button,
    body.ct-menu-open .whatsapp,
    body.ct-menu-open .whatsapp-button,
    body.ct-menu-open .floating-whatsapp,
    body.ct-menu-open .wa__btn_popup,
    body.ct-menu-open .wa__popup_chat_box {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

@media (max-width: 820px) {
    :root { --ct-left-pad: 22px; }
    .ct-header-inner {
        min-height: 74px;
        grid-template-columns: minmax(0,1fr) auto !important;
    }
    .ct-brand { grid-column: 1 !important; min-width: 0; }
    .ct-brand .custom-logo { max-height: 52px; }
    .ct-header-actions { display: none; }
    .ct-menu-toggle { grid-column: 2 !important; }
    .admin-bar .ct-primary-nav {
        top: 46px;
        height: auto;
        max-height: calc(100dvh - 46px);
    }
    .ct-footer-top { grid-template-columns: 1fr; gap: 30px; }
    .ct-footer-menu { columns: 1; }
}

@media (max-width: 520px) {
    .ct-header-inner { padding-left: 16px; padding-right: 16px; }
    .ct-brand { min-width: 0; }
    .ct-brand .custom-logo { max-width: 150px; max-height: 46px; }
    .ct-menu-toggle { width: 38px !important; height: 38px !important; padding: 6px !important; }
    .ct-primary-nav {
        width: min(86vw, 350px);
        padding-left: 20px;
        padding-right: 20px;
    }
    .ct-site-header .ct-mobile-nav-head { min-height: 66px; }
    .ct-mobile-menu a { min-height: 48px; font-size: 14px; }
    .ct-site-header .ct-mobile-quote {
        width: calc(100% - 12px);
        margin-left: 6px;
        margin-right: 6px;
        min-height: 47px;
    }
    .ct-content-shell { padding-left: 18px; padding-right: 18px; }
}

/* =========================================================
   v1.4.0 - Device/orientation hardening
   Keeps the same design while normalizing header/menu behavior
   across desktop, laptop, tablet and phone in portrait/landscape.
   ========================================================= */

/* Desktop / large landscape */
@media (min-width: 1181px) {
    .ct-header-inner {
        min-height: 86px;
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
    .ct-primary-nav { min-width: 0; }
    .ct-desktop-menu-wrap { display: block !important; }
    .ct-mobile-menu,
    .ct-mobile-nav-head,
    .ct-mobile-quote,
    .ct-menu-toggle,
    .ct-nav-overlay { display: none !important; }
}

/* Tablet landscape / compact laptop */
@media (min-width: 821px) and (max-width: 1180px) {
    .ct-header-inner {
        min-height: 78px;
        grid-template-columns: auto minmax(0,1fr) auto;
    }
    .ct-brand .custom-logo { max-height: 54px; }
    .ct-header-actions { display: flex; }
    .ct-menu-toggle { grid-column: 3; }
}

/* Tablet portrait and phones */
@media (max-width: 820px) {
    .ct-site-header,
    .ct-primary-nav,
    .ct-mobile-menu,
    .ct-mobile-menu a,
    .ct-mobile-nav-title,
    .ct-mobile-quote,
    .ct-site-title {
        font-family: var(--ct-font) !important;
    }

    .ct-header-inner {
        width: 100%;
        min-height: 72px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .ct-primary-nav {
        padding-bottom: calc(26px + env(safe-area-inset-bottom));
    }
}

/* Phone portrait */
@media (max-width: 600px) and (orientation: portrait) {
    .ct-header-inner { min-height: 68px; }
    .ct-primary-nav { width: min(86vw, 350px); }
    .ct-mobile-menu a { min-height: 47px; }
    .ct-site-header .ct-mobile-quote { min-height: 46px; }
}

/* Phone landscape */
@media (max-width: 932px) and (orientation: landscape) {
    .ct-header-inner { min-height: 62px; }
    .ct-brand .custom-logo { max-height: 42px; }
    .ct-primary-nav {
        width: min(58vw, 390px);
        max-height: 100dvh;
    }
    .ct-site-header .ct-mobile-nav-head { min-height: 58px; }
    .ct-mobile-menu a { min-height: 42px; font-size: 13px; }
    .ct-site-header .ct-mobile-quote { min-height: 42px; margin-top: 14px; }
}

/* Very small phones */
@media (max-width: 390px) {
    .ct-header-inner { padding-left: 12px; padding-right: 12px; }
    .ct-brand .custom-logo { max-width: 138px; max-height: 42px; }
    .ct-primary-nav { width: 88vw; padding-left: 18px; padding-right: 18px; }
    .ct-mobile-menu a { font-size: 13.5px; }
}
