/* ============================================
   Smart Header & Footer Scroll v2.3
   Full-width fix + vis header & footer ved første last
   ============================================ */

/* ============================================
   1. GLOBAL FULL-WIDTH RESET
   ============================================ */

html.shf-enabled,
body.shf-enabled,
.shf-enabled #page,
.shf-enabled #wrapper,
.shf-enabled #content,
.shf-enabled #primary,
.shf-enabled .site,
.shf-enabled .site-content,
.shf-enabled .site-inner,
.shf-enabled .container,
.shf-enabled .wrapper,
.shf-enabled .page-wrapper,
.shf-enabled .elementor,
.shf-enabled .elementor-page {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

body.shf-enabled {
    overflow-x: hidden !important;
}

/* ============================================
   2. ELEMENTOR HEADER (ID 904) – FULL VIEWPORT
   ============================================ */

.shf-enabled .elementor-904,
.shf-enabled [data-elementor-type="header"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    z-index: 9999 !important;
    background: #000000 !important;
    box-sizing: border-box !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform;
    overflow: visible;
}

.shf-enabled .elementor-904 > .elementor-container,
.shf-enabled .elementor-904 > .elementor-section,
.shf-enabled .elementor-904 > .elementor-section > .elementor-container,
.shf-enabled .elementor-904 > .e-con,
.shf-enabled .elementor-904 > .e-con > .e-con-inner,
.shf-enabled [data-elementor-type="header"] > .elementor-container,
.shf-enabled [data-elementor-type="header"] > .elementor-section,
.shf-enabled [data-elementor-type="header"] > .elementor-section > .elementor-container,
.shf-enabled [data-elementor-type="header"] > .e-con,
.shf-enabled [data-elementor-type="header"] > .e-con > .e-con-inner {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    --content-width: 100% !important;
}

/* Gi plass til fixed header */
.shf-enabled #page,
.shf-enabled #content,
.shf-enabled .site-content {
    padding-top: 87px;
}

@media (max-width: 991px) {
    .shf-enabled #page,
    .shf-enabled #content,
    .shf-enabled .site-content {
        padding-top: 75px;
    }
}

@media (max-width: 767px) {
    .shf-enabled #page,
    .shf-enabled #content,
    .shf-enabled .site-content {
        padding-top: 70px;
    }
}

/* ============================================
   3. FOOTER – FULL VIEWPORT
   ============================================ */

.shf-enabled .site-footer,
.shf-enabled footer.site-footer,
.shf-enabled #colophon,
.shf-enabled .footer,
.shf-enabled [data-elementor-type="footer"] {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    z-index: 9998 !important;
    box-sizing: border-box !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform;
}

.shf-enabled .site-footer > .elementor-container,
.shf-enabled .site-footer > .e-con,
.shf-enabled .site-footer > .e-con > .e-con-inner,
.shf-enabled [data-elementor-type="footer"] > .elementor-container,
.shf-enabled [data-elementor-type="footer"] > .elementor-section,
.shf-enabled [data-elementor-type="footer"] > .elementor-section > .elementor-container,
.shf-enabled [data-elementor-type="footer"] > .e-con,
.shf-enabled [data-elementor-type="footer"] > .e-con > .e-con-inner {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    --content-width: 100% !important;
}

/* ============================================
   4. VIS BÅDE HEADER OG FOOTER VED FØRSTE LAST
   (body.shf-show-footer)
   ============================================ */

.shf-enabled.shf-at-top.shf-show-footer .elementor-904,
.shf-enabled.shf-at-top.shf-show-footer [data-elementor-type="header"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.shf-enabled.shf-at-top.shf-show-footer .site-footer,
.shf-enabled.shf-at-top.shf-show-footer footer.site-footer,
.shf-enabled.shf-at-top.shf-show-footer #colophon,
.shf-enabled.shf-at-top.shf-show-footer .footer,
.shf-enabled.shf-at-top.shf-show-footer [data-elementor-type="footer"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ============================================
   5. SCROLLER NEDOVER – header skjules, footer vises
   ============================================ */

.shf-enabled.shf-scrolling-down .elementor-904,
.shf-enabled.shf-scrolling-down [data-elementor-type="header"] {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.shf-enabled.shf-scrolling-down .site-footer,
.shf-enabled.shf-scrolling-down footer.site-footer,
.shf-enabled.shf-scrolling-down #colophon,
.shf-enabled.shf-scrolling-down .footer,
.shf-enabled.shf-scrolling-down [data-elementor-type="footer"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ============================================
   6. SCROLLER OPPOVER – header vises, footer skjules
   ============================================ */

.shf-enabled.shf-scrolling-up .elementor-904,
.shf-enabled.shf-scrolling-up [data-elementor-type="header"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.shf-enabled.shf-scrolling-up .site-footer,
.shf-enabled.shf-scrolling-up footer.site-footer,
.shf-enabled.shf-scrolling-up #colophon,
.shf-enabled.shf-scrolling-up .footer,
.shf-enabled.shf-scrolling-up [data-elementor-type="footer"] {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================
   7. ALLER ØVERST – header synlig, footer skjult
   (men .shf-show-footer overstyrer for første last – se punkt 4)
   ============================================ */

.shf-enabled.shf-at-top .elementor-904,
.shf-enabled.shf-at-top [data-elementor-type="header"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.shf-enabled.shf-at-top .site-footer,
.shf-enabled.shf-at-top footer.site-footer,
.shf-enabled.shf-at-top #colophon,
.shf-enabled.shf-at-top .footer,
.shf-enabled.shf-at-top [data-elementor-type="footer"] {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================
   8. ALLER NEDERST – footer synlig
   ============================================ */

.shf-enabled.shf-at-bottom .site-footer,
.shf-enabled.shf-at-bottom footer.site-footer,
.shf-enabled.shf-at-bottom #colophon,
.shf-enabled.shf-at-bottom .footer,
.shf-enabled.shf-at-bottom [data-elementor-type="footer"] {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ============================================
   9. ADMIN BAR JUSTERING
   ============================================ */

.admin-bar.shf-enabled .elementor-904,
.admin-bar.shf-enabled [data-elementor-type="header"] {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar.shf-enabled .elementor-904,
    .admin-bar.shf-enabled [data-elementor-type="header"] {
        top: 46px !important;
    }
}

/* ============================================
   10. REDUSERT BEVEGELSE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .shf-enabled .elementor-904,
    .shf-enabled [data-elementor-type="header"],
    .shf-enabled .site-footer,
    .shf-enabled [data-elementor-type="footer"] {
        transition: none !important;
    }
}