/*
 * RI Floating Header 1.2.0
 * One native Merchant header, one shared visual system.
 */

/* ---------------------------------------------------------
   Shared design tokens and outer header shell
   --------------------------------------------------------- */

#site-header.ri-floating-header {
    --ri-header-height: 68px;
    --ri-header-top: 18px;
    --ri-header-surface: rgba(245, 242, 236, .90);
    --ri-header-border: rgba(23, 23, 21, .13);
    --ri-header-shadow: 0 8px 28px rgba(23, 23, 21, .13);
    --ri-ui-brown: #976344;
    --ri-ui-brown-hover: #82533a;

    position: sticky !important;
    top: calc(env(safe-area-inset-top, 0px) + var(--ri-header-top)) !important;
    z-index: 990 !important;

    width: calc(100% - 48px) !important;
    max-width: 1440px !important;
    height: var(--ri-header-height);

    margin: 18px auto !important;
    padding: 0 18px !important;
    box-sizing: border-box;

    border: 1px solid var(--ri-header-border) !important;
    border-radius: 17px;

    background: var(--ri-header-surface) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);

    box-shadow: var(--ri-header-shadow) !important;
    color: #171715;
    overflow: visible !important;
}

/*
 * The outer #site-header is the single visible shell.
 * Inner Merchant wrappers stay transparent so they cannot create
 * a second white rectangle or hide the shared border and shadow.
 */

#site-header.ri-floating-header .header-main,
#site-header.ri-floating-header .merchant-header-container,
#site-header.ri-floating-header .header-contents {
    background: transparent !important;
}

#site-header.ri-floating-header .header-contents {
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

/* ---------------------------------------------------------
   Desktop header
   --------------------------------------------------------- */

@media (min-width: 1200px) {

    #site-header.ri-floating-header .header-main {
        display: block !important;
    }

    #site-header.ri-floating-header .header-mobile {
        display: none !important;
    }

    #site-header.ri-floating-header .merchant-header-container {
        display: flex !important;
        align-items: center;
        justify-content: space-between;

        width: 100%;
        max-width: none;
        height: 66px;
        min-height: 0;

        margin: 0 !important;
        padding: 0 !important;
        gap: 18px;
        box-sizing: border-box;
    }

    #site-header.ri-floating-header .header-left-items,
    #site-header.ri-floating-header .header-right-items {
        flex: 0 0 auto !important;
        width: auto !important;
    }

    #site-header.ri-floating-header .header-left-items {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
    }

    #site-header.ri-floating-header .header-center-items {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0;
        justify-content: center;
    }

    #site-header.ri-floating-header .header-left-items .site-branding,
    #site-header.ri-floating-header .header-left-items .logo {
        position: static !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #site-header.ri-floating-header #primary-menu > ul {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: clamp(12px, 1.3vw, 22px);
    }

    #site-header.ri-floating-header #primary-menu > ul > li {
        margin: 0 !important;
        padding: 0 !important;
    }

    #site-header.ri-floating-header #primary-menu > ul > li > a {
        font-size: 14px;
        white-space: nowrap;
    }

    #site-header.ri-floating-header .merchant-header-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ---------------------------------------------------------
   Shared logo and typography
   --------------------------------------------------------- */

#site-header.ri-floating-header .site-branding {
    margin: 0;
    padding: 0;
}

#site-header.ri-floating-header .site-branding .logo {
    display: block;
    width: 40px;
    line-height: 0;
}

#site-header.ri-floating-header .logo-image {
    width: 40px !important;
    max-width: 40px !important;
    height: auto !important;
    max-height: 54px;
    object-fit: contain;
}

#site-header.ri-floating-header .site-title,
#site-header.ri-floating-header .site-description {
    display: none !important;
}

/* ---------------------------------------------------------
   Shared CTA: outline at rest, filled only on interaction
   --------------------------------------------------------- */

#site-header.ri-floating-header .header_custom_text_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    min-height: 44px;
    padding: 0 19px;

    border: 1px solid var(--ri-ui-brown, #976344) !important;
    border-radius: 999px !important;

    background: transparent !important;
    color: var(--ri-ui-brown, #976344) !important;

    text-decoration: none;
    white-space: nowrap;
    box-shadow: none !important;

    transition:
        background-color .22s ease,
        border-color .22s ease,
        color .22s ease;
}

#site-header.ri-floating-header .header_custom_text_button:hover,
#site-header.ri-floating-header .header_custom_text_button:active {
    background: var(--ri-ui-brown-hover, #82533a) !important;
    border-color: var(--ri-ui-brown-hover, #82533a) !important;
    color: #fff !important;
}

#site-header.ri-floating-header .header_custom_text_button:focus-visible {
    outline: 2px solid var(--ri-ui-brown, #976344);
    outline-offset: 3px;
}

#site-header.ri-floating-header .header_custom_text_button small {
    color: inherit !important;
}

/* ---------------------------------------------------------
   Services submenu
   --------------------------------------------------------- */

#site-header.ri-floating-header .dropdown-submenu {
    padding: 12px !important;
    border: 1px solid rgba(23, 23, 21, .12);
    border-radius: 15px;
    background: #f6f3ed !important;
    box-shadow: 0 16px 48px rgba(23, 23, 21, .16);
}

/* ---------------------------------------------------------
   Tablet and mobile header
   --------------------------------------------------------- */

@media (max-width: 1199px) {

    #site-header.ri-floating-header {
        --ri-header-height: 58px;
        --ri-header-top: 10px;

        width: calc(100% - 28px) !important;
        margin: 10px auto !important;
        padding: 0 12px !important;
        border-radius: 15px;
    }

    #site-header.ri-floating-header .header-main {
        display: none !important;
    }

    #site-header.ri-floating-header .header-mobile {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
        align-items: center !important;
        gap: 4px !important;

        position: relative !important;
        height: 56px !important;
        min-height: 56px !important;
        padding: 0 !important;
    }

    #site-header.ri-floating-header .header-mobile .site-branding {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;

        position: static !important;
        transform: none !important;
        order: 0 !important;
        z-index: 2 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #site-header.ri-floating-header .header-mobile .site-branding .logo,
    #site-header.ri-floating-header .header-mobile .logo-image {
        width: 30px !important;
        max-width: 30px !important;
        max-height: 40px !important;
        height: auto !important;
    }

    #site-header.ri-floating-header .mobile-header-icons {
        display: flex !important;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        align-items: center;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #site-header.ri-floating-header .header-mobile > .mobile-menu {
        display: flex;
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        align-items: center;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        z-index: 1 !important;
    }

    #site-header.ri-floating-header .header-mobile .header_custom_text_button {
        width: 96px !important;
        min-width: 96px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 3px !important;
        border-radius: 12px !important;
        box-sizing: border-box !important;
        font-size: 10px !important;
        position: relative !important;
        z-index: 1 !important;
    }

    #site-header.ri-floating-header .header-mobile .ri-mobile-cta-label {
        display: block !important;
        color: inherit !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        line-height: 1.1 !important;
        letter-spacing: -.02em !important;
        text-align: center !important;
    }

    #site-header.ri-floating-header .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px !important;

        width: 96px !important;
        min-width: 96px !important;
        height: 42px !important;
        min-height: 42px !important;

        padding: 0 8px !important;
        border: 1px solid rgba(23, 23, 21, .10) !important;
        border-radius: 12px !important;
        box-sizing: border-box !important;

        background: #e9e4de !important;
        color: #65594f !important;
        box-shadow: none !important;
    }

    #site-header.ri-floating-header .mobile-menu-toggle::before {
        content: "Меню" !important;
        color: #65594f !important;
        font-family: inherit !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        line-height: 1;
        letter-spacing: -.02em !important;
        text-transform: none !important;
    }

    #site-header.ri-floating-header .mobile-menu-toggle svg {
        width: 19px !important;
        height: 16px !important;
        color: #65594f !important;
        fill: currentColor !important;
    }

    #site-header.ri-floating-header .mobile-menu-toggle:hover,
    #site-header.ri-floating-header .mobile-menu-toggle:active {
        background: #ded7ce !important;
        border-color: rgba(23, 23, 21, .16) !important;
        color: #65594f !important;
    }
}

/* Narrow phones */
@media (max-width: 374px) {
    #site-header.ri-floating-header {
        width: calc(100% - 20px) !important;
    }
}

/* ---------------------------------------------------------
   Homepage: same header, positioned over the hero.
   Only positioning changes; shell, border, shadow and controls
   remain exactly the shared component styles above.
   --------------------------------------------------------- */

/*
 * Merchant adds decorative pseudo layers to the header wrapper.
 * On the overlay homepage they are suppressed so no extra white
 * rectangle is visible outside the single styled header shell.
 */
body.home.page-id-8781 #site-header.ri-floating-header::before,
body.home.page-id-8781 #site-header.ri-floating-header::after {
    display: none !important;
    content: none !important;
}

body.home.page-id-8781 #site-header.ri-floating-header {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 18px) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 48px) !important;
    max-width: 1440px !important;
    margin: 0 !important;
    z-index: 1000 !important;
}

body.home.page-id-8781 #page,
body.home.page-id-8781 #content,
body.home.page-id-8781 .site-content,
body.home.page-id-8781 #primary,
body.home.page-id-8781 .content-area {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.home.page-id-8781 #ri-story-01 {
    margin-top: 0 !important;
    padding-top: 0 !important;
    min-height: 100svh;
}

@media (max-width: 1199px) {
    body.home.page-id-8781 #site-header.ri-floating-header {
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        width: calc(100% - 28px) !important;
    }
}

/* ---------------------------------------------------------
   WordPress admin bar offsets
   --------------------------------------------------------- */

body.admin-bar #site-header.ri-floating-header {
    top: calc(var(--ri-header-top) + 32px) !important;
}

body.admin-bar.home.page-id-8781 #site-header.ri-floating-header {
    top: calc(18px + 32px) !important;
}

@media (max-width: 782px) {
    body.admin-bar #site-header.ri-floating-header {
        top: calc(var(--ri-header-top) + 46px) !important;
    }

    body.admin-bar.home.page-id-8781 #site-header.ri-floating-header {
        top: calc(10px + 46px) !important;
    }
}

/* ---------------------------------------------------------
   Accessibility and reduced motion
   --------------------------------------------------------- */

#site-header.ri-floating-header a:focus-visible {
    outline: 2px solid #8f8276;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    #site-header.ri-floating-header * {
        transition: none !important;
    }
}
