/* Header and footer social icons: use the same var(--wp--custom--social-icon-size) size in both places. */
.sm-native-socials.sm-header-socials .wp-social-link a,
.sm-native-socials.sm-footer-socials .wp-social-link a {
    width: var(--wp--custom--social-icon-size) !important;
    height: var(--wp--custom--social-icon-size) !important;
}

.sm-native-socials.sm-header-socials .wp-social-link svg,
.sm-native-socials.sm-footer-socials .wp-social-link svg {
    width: var(--wp--custom--social-icon-size) !important;
    height: var(--wp--custom--social-icon-size) !important;
}

/* Support the theme's legacy image-based social links as well. */
:is(.sm-header-socials, .sm-footer-socials) .sm-social-icon,
:is(.sm-header-socials, .sm-footer-socials) .sm-social-icon img {
    width: var(--wp--custom--social-icon-size) !important;
    height: var(--wp--custom--social-icon-size) !important;
}

/* Prevent duplicate links in WordPress navigation on inner desktop pages.
   This protects the layout even when an older controller is cached. */
@media (min-width: 600px) {
    .sm-site-header .sm-navigation .wp-block-navigation__responsive-container-content > .sm-lite-nav-socials,
    .sm-site-header .sm-lite-nav-socials .sm-mobile-socials {
        display: none !important;
    }
}

/* On phones, put the same editable Gutenberg social buttons inside the menu.
   The source links remain in the desktop header and are hidden on mobile. */
@media (max-width: 599px) {
    .sm-site-header .sm-lite-nav-socials {
        width: 100%;
        box-sizing: border-box;
        padding-top: 24px;
        margin-top: auto !important;
        border-top: 1px solid rgb(255 255 255 / 24%);
    }
    .sm-site-header .sm-lite-nav-socials .sm-native-socials.sm-mobile-socials {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center;
        justify-content: center;
        gap: 16px !important;
        margin: 0 auto !important;
        padding: 0;
        list-style: none;
    }
    .sm-site-header .sm-lite-nav-socials .wp-social-link a {
        min-width: 44px;
        min-height: 44px;
        display: grid;
        place-items: center;
        border-radius: 50%;
    }
    .sm-site-header .sm-lite-nav-popover:popover-open .sm-lite-nav-socials .wp-social-link a::before {
        background-color: #fff !important;
    }
    /* WordPress's fallback menu on inner pages: keep links readable
       and place contact buttons after the navigation items. */
    html body .sm-site-header .sm-navigation .wp-block-navigation__responsive-container.is-menu-open {
        background: #00111b !important; /* Interior header stays dark in the dark theme. */
        color: #fff !important;
    }
    html body .sm-site-header .sm-navigation .wp-block-navigation__responsive-container.is-menu-open :is(
        .wp-block-navigation__container,
        .wp-block-navigation-item__content,
        .wp-block-navigation__responsive-container-close
    ) {
        color: #fff !important;
    }
    .sm-site-header .sm-navigation .wp-block-navigation__responsive-container-content > .wp-block-navigation__container {
        order: 0 !important;
    }
    .sm-site-header .sm-navigation .wp-block-navigation__responsive-container-content > .sm-lite-nav-socials {
        order: 1 !important;
        margin-top: 24px !important;
    }
}
