/*
 * CannaHaven Brand Fix
 * Reversible: deactivate/delete the cannahaven-brand-fix plugin.
 * Scope: CannaHaven.net only, via body.cannahaven-brand-fix.
 */

/* ISSUE 5: Hide RapHaven marks and replace wrong background-image references. */
body.cannahaven-brand-fix img[src*="raphaven"],
body.cannahaven-brand-fix img[src*="rap-haven"],
body.cannahaven-brand-fix img[src*="rh-logo"],
body.cannahaven-brand-fix .rh-corner-logo,
body.cannahaven-brand-fix .rap-logo-corner,
body.cannahaven-brand-fix .rap-logo,
body.cannahaven-brand-fix .raphaven-logo {
    display: none !important;
}

body.cannahaven-brand-fix [style*="raphaven"] {
    background-image: var(--cannahaven-logo) !important;
}

body.cannahaven-brand-fix .site-logo,
body.cannahaven-brand-fix .custom-logo-link,
body.cannahaven-brand-fix .header-logo,
body.cannahaven-brand-fix .mobile-logo,
body.cannahaven-brand-fix .elementor-widget-theme-site-logo {
    background-image: var(--cannahaven-logo) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
}

body.cannahaven-brand-fix .ch-masthead__brand img,
body.cannahaven-brand-fix .ch-masthead__lockup img {
    object-fit: contain !important;
}

body.cannahaven-brand-fix .custom-logo,
body.cannahaven-brand-fix .site-logo img,
body.cannahaven-brand-fix .header-logo img,
body.cannahaven-brand-fix .mobile-logo img,
body.cannahaven-brand-fix .elementor-widget-theme-site-logo img {
    max-width: min(230px, 64vw) !important;
    height: auto !important;
    object-fit: contain !important;
}

/* ISSUE 5: Remove the earlier standalone header if a cached copy is still present. */
body.cannahaven-brand-fix .cannahaven-fix-header {
    display: none !important;
}

/* ISSUE 5: Make the approved CannaHaven masthead artwork functional. */
body.cannahaven-brand-fix .ch-masthead {
    position: relative !important;
    min-height: clamp(132px, 16vw, 230px) !important;
    overflow: hidden !important;
    background: #ffffff !important;
}

/* ISSUE 5: Remove old flat header art so social/logo/mascot content does not double up. */
body.cannahaven-brand-fix .ch-masthead__art,
body.cannahaven-brand-fix .ch-masthead__mascots {
    display: none !important;
    visibility: hidden !important;
}

body.cannahaven-brand-fix .ch-masthead__social {
    position: absolute !important;
    left: clamp(18px, 2.5vw, 42px) !important;
    top: 50% !important;
    z-index: 20 !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 0 !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center;
    gap: clamp(8px, 1.15vw, 14px);
    flex-wrap: wrap;
}

body.cannahaven-brand-fix .ch-masthead__social a[aria-label] {
    display: inline-grid !important;
    width: clamp(34px, 3.2vw, 46px) !important;
    height: clamp(34px, 3.2vw, 46px) !important;
    min-width: clamp(34px, 3.2vw, 46px) !important;
    min-height: clamp(34px, 3.2vw, 46px) !important;
    place-items: center !important;
    color: #11391f !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(17, 57, 31, 0.9) !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

body.cannahaven-brand-fix .ch-masthead__social a[aria-label]:hover,
body.cannahaven-brand-fix .ch-masthead__social a[aria-label]:focus-visible {
    color: #ffffff !important;
    background: #11391f !important;
    outline: 2px solid rgba(47, 143, 70, 0.35) !important;
    outline-offset: 2px !important;
}

body.cannahaven-brand-fix .ch-masthead__social .cannahaven-header-email {
    display: none !important;
}

body.cannahaven-brand-fix .ch-masthead__brand,
body.cannahaven-brand-fix .ch-masthead__tools {
    position: absolute !important;
    z-index: 21 !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 0 !important;
    pointer-events: auto !important;
}

body.cannahaven-brand-fix .ch-masthead__brand {
    inset: 0 !important;
    display: block !important;
    z-index: 18 !important;
}

body.cannahaven-brand-fix .ch-masthead__brand .ch-masthead__lockup {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    width: min(520px, 44vw) !important;
    max-width: 44vw !important;
    height: min(170px, 76%) !important;
    transform: translate(-50%, -50%) !important;
}

body.cannahaven-brand-fix .ch-masthead__brand img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    pointer-events: none !important;
}

body.cannahaven-brand-fix .ch-masthead__tools {
    right: clamp(20px, 2.4vw, 42px) !important;
    top: 50% !important;
    display: grid !important;
    grid-template-columns: clamp(42px, 4vw, 58px) minmax(170px, 16vw) !important;
    align-items: center !important;
    gap: clamp(10px, 1vw, 16px) !important;
    transform: translateY(-50%) !important;
}

body.cannahaven-brand-fix .ch-masthead__search,
body.cannahaven-brand-fix .ch-masthead__newsletter {
    pointer-events: auto !important;
}

body.cannahaven-brand-fix .ch-main-nav a,
body.cannahaven-brand-fix .ch-topic-pills a,
body.cannahaven-brand-fix .ch-breaking__items a,
body.cannahaven-brand-fix .ch-home-feed__image {
    pointer-events: auto !important;
}

@media (max-width: 760px) {
    body.cannahaven-brand-fix .ch-masthead {
        min-height: 112px !important;
    }

    body.cannahaven-brand-fix .ch-masthead__social {
        left: 16px !important;
        top: 50% !important;
        max-width: 31vw !important;
        gap: 6px !important;
    }

    body.cannahaven-brand-fix .ch-masthead__social a[aria-label] {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        font-size: 0.9rem !important;
        border-color: rgba(17, 57, 31, 0.75) !important;
    }

    body.cannahaven-brand-fix .ch-masthead__social .cannahaven-header-email {
        display: none !important;
    }

    body.cannahaven-brand-fix .ch-masthead__brand .ch-masthead__lockup {
        top: 50% !important;
        width: 38vw !important;
        max-width: 38vw !important;
        height: 72% !important;
    }

    body.cannahaven-brand-fix .ch-masthead__tools {
        right: 10px !important;
        top: 50% !important;
        grid-template-columns: 28px 28px !important;
        gap: 6px !important;
    }

    body.cannahaven-brand-fix .ch-masthead__search {
        width: 28px !important;
        height: 28px !important;
        font-size: 1rem !important;
    }

    body.cannahaven-brand-fix .ch-masthead__newsletter {
        display: inline-grid !important;
        place-items: center !important;
        width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
        font-size: 0 !important;
        border-color: rgba(17, 57, 31, 0.75) !important;
    }

    body.cannahaven-brand-fix .ch-masthead__newsletter svg {
        font-size: 1rem !important;
    }
}

body.cannahaven-brand-fix .ch-masthead__newsletter {
    display: inline-grid !important;
    place-items: center !important;
    width: clamp(42px, 4vw, 58px) !important;
    min-width: clamp(42px, 4vw, 58px) !important;
    min-height: clamp(42px, 4vw, 58px) !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(17, 57, 31, 0.9) !important;
}

body.cannahaven-brand-fix .ch-masthead__newsletter span {
    display: none !important;
}

body.cannahaven-brand-fix .ch-masthead__newsletter svg {
    font-size: clamp(1.15rem, 1.6vw, 1.7rem) !important;
}

@media (max-width: 760px) {
    body.cannahaven-brand-fix .ch-masthead__newsletter {
        width: 28px !important;
        min-width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
    }

    body.cannahaven-brand-fix .ch-masthead__newsletter svg {
        font-size: 1rem !important;
    }
}
