/*
 * Remove the block theme's empty vertical space around custom page layouts.
 *
 * The explicit body class is added by PHP and is the compatibility path for
 * browsers where :has() is unavailable or disabled. The :has() rules remain as
 * a safe fallback for pages that already carry the shared header in content.
 */
body.ybseo-custom-layout-page .wp-site-blocks,
body.ybseo-custom-layout-page .wp-site-blocks > .wp-block-group,
body.ybseo-custom-layout-page .wp-site-blocks > .wp-block-group > .wp-block-group,
body.ybseo-custom-layout-page .wp-block-post-content {
    margin-block: 0 !important;
    padding-block: 0 !important;
}

body.ybseo-custom-layout-page #bsu-site-header {
    margin-top: 0 !important;
}

body:has(#bsu-site-header) .wp-site-blocks {
    margin-block: 0 !important;
    padding-block: 0 !important;
}

body:has(#bsu-site-header) .wp-site-blocks > .wp-block-group:has(#bsu-site-header),
body:has(#bsu-site-header) .wp-site-blocks > .wp-block-group:has(#bsu-site-header) > .wp-block-group:has(#bsu-site-header) {
    margin-block: 0 !important;
    padding-block: 0 !important;
}

/* Keep the brand and navigation together instead of stretching them apart. */
#bsu-site-header .bsu-inner {
    min-height: 64px !important;
    justify-content: flex-start !important;
    column-gap: clamp(24px, 3vw, 40px) !important;
    row-gap: 0 !important;
}

#bsu-site-header .bsu-brand-text {
    max-width: 240px !important;
}

/* Restore the blue Y artwork already used as the site's favicon. */
#bsu-site-header .bsu-mark {
    display: block !important;
    box-sizing: border-box !important;
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: url("/favicon.svg") center / contain no-repeat transparent !important;
}

#bsu-site-header .bsu-mark i {
    display: none !important;
}

#bsu-site-header .bsu-nav {
    flex: 0 1 auto !important;
    justify-content: flex-start !important;
    gap: 0 11px !important;
}

/* Two explicit installation routes in every package card. */
.yc-package .yc-download-btn,
.yc-package .ybseo-online-btn {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
}

.yc-package .ybseo-online-btn {
    display: flex;
    margin-top: 8px;
    border: 2px solid #173e36;
    color: #173e36;
    background: #fff;
}

.yc-package .ybseo-online-btn:hover,
.yc-package .ybseo-online-btn:focus-visible {
    color: #fff;
    background: #173e36;
}

@media (max-width: 1000px) {
    #bsu-site-header .bsu-inner {
        min-height: 0 !important;
        padding-block: 8px !important;
        flex-wrap: wrap !important;
        column-gap: 12px !important;
        row-gap: 6px !important;
    }

    #bsu-site-header .bsu-nav {
        width: 100%;
        min-width: 0;
        flex: 1 0 100% !important;
        flex-wrap: nowrap !important;
        gap: 0 16px !important;
        padding-block: 2px 0 !important;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    #bsu-site-header .bsu-nav a {
        flex: 0 0 auto;
        min-height: 40px;
    }
}

@media (max-width: 380px) {
    #bsu-site-header .bsu-mark {
        width: 32px !important;
        height: 32px !important;
        flex-basis: 32px !important;
    }

    #bsu-site-header .bsu-brand-text {
        max-width: 220px !important;
        font-size: 13px !important;
    }
}
