/* Shared page-header shell. Page templates own slot content; this file owns the contract. */

/* Shared customer-facing interaction reset. Keep keyboard focus visible while
 * removing browser-specific tap and mouse-focus chrome from frontend links. */
[data-ms-page-header] a {
    -webkit-tap-highlight-color: transparent;
}

[data-ms-page-header] a:hover,
[data-ms-page-header] a:active,
.minestone-desktop-global-nav a:hover,
.minestone-desktop-global-nav a:active {
    color: inherit;
}

[data-ms-page-header] a:focus:not(:focus-visible) {
    outline: none;
}

[data-ms-page-header] a:focus-visible {
    outline: 2px solid rgba(21, 35, 61, 0.38);
    outline-offset: 3px;
}

[data-ms-page-header],
[data-ms-page-header] * {
    box-sizing: border-box;
}

.ms-page-header {
    --ms-page-header-height: var(--ms-frontend-header-height-mobile, 56px);
    --ms-page-header-z-index: 40;
    --ms-page-header-background: #ffffff;
    --ms-page-header-border: #e8e8e8;
    --ms-page-header-text: #111111;
    --ms-page-header-muted: #6b6b6b;
    --ms-page-header-button-size: 44px;
    --ms-page-header-inline-inset: 16px;
    --ms-page-header-radius: 999px;
    position: relative;
    z-index: var(--ms-page-header-z-index);
    width: 100%;
    color: var(--ms-page-header-text);
    background: var(--ms-page-header-background);
    padding-top: env(safe-area-inset-top, 0px);
}

.ms-page-header--position-fixed {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
}

.ms-page-header--position-sticky {
    position: sticky;
    top: 0;
}

.ms-page-header--workbench {
    position: relative;
    z-index: 30;
}

.ms-page-header--workbench .ms-page-header__row {
    width: 100%;
    margin: 0;
    padding: 0;
}

.ms-page-header__row {
    width: min(100% - 2 * var(--ms-page-header-inline-inset), 1200px);
    min-height: var(--ms-page-header-height, var(--ms-frontend-header-height-mobile, 56px));
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
    align-items: center;
    gap: 16px;
}

.ms-page-header__leading,
.ms-page-header__center,
.ms-page-header__trailing {
    min-width: 0;
    display: flex;
    align-items: center;
}

.ms-page-header__leading {
    justify-content: flex-start;
}

.ms-page-header__center {
    justify-content: center;
    text-align: center;
}

.ms-page-header__trailing {
    justify-content: flex-end;
}

.ms-page-header__button {
    width: var(--ms-page-header-button-size);
    height: var(--ms-page-header-button-size);
    min-width: var(--ms-page-header-button-size);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    color: var(--ms-page-header-text);
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.ms-page-header__button:hover {
    border-color: transparent;
    background: transparent;
    color: var(--ms-page-header-text);
    box-shadow: none;
}

.ms-page-header__button:active {
    transform: scale(0.97);
}

.ms-page-header__button:focus-visible {
    outline: 3px solid rgba(17, 17, 17, 0.2);
    outline-offset: 3px;
}

.ms-page-header__icon {
    display: block;
    flex: 0 0 auto;
}

.ms-page-header__subbar {
    grid-column: 1 / -1;
    width: 100%;
}

.ms-page-header--library {
    --ms-page-header-background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--ms-page-header-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.ms-page-header--library .ms-page-header__row {
    min-height: var(--ms-frontend-header-height-mobile-large, 64px);
}

.ms-page-header--library .ms-page-header__center {
    display: grid;
    gap: 2px;
}

.ms-page-header .page-eyebrow {
    margin: 0;
    color: var(--ms-page-header-muted);
    font-size: var(--ms-font-size-caption, 0.75rem);
    line-height: 1.2;
}

.ms-page-header .page-title,
.ms-page-header .models-header-title,
.ms-page-header .order-detail-header-title,
.ms-page-header__title {
    margin: 0;
    color: var(--ms-page-header-text);
    font-family: inherit;
    font-size: var(--ms-font-size-page-title-mobile, 1.375rem);
    font-weight: var(--ms-weight-heading);
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
    letter-spacing: var(--ms-letter-spacing-ui);
}

.ms-page-header .page-description,
.ms-page-header__subtitle {
    margin: 0;
    color: var(--ms-page-header-muted);
    font-size: var(--ms-font-size-subtitle-mobile, 0.75rem);
    line-height: 1.3;
}

.ms-page-header--auth,
.ms-page-header--compact,
.ms-page-header--transaction {
    border-bottom: 1px solid var(--ms-page-header-border);
}

/* PC global shell. Page templates opt in to this shared nav while the
 * existing page header and bottom nav remain the mobile presentation. */
.minestone-desktop-global-nav {
    display: none;
}

@media (min-width: 901px) {
    .minestone-desktop-global-nav {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 60;
        min-height: 78px;
        border-bottom: 1px solid #e8eaee;
        background: #fff;
    }

    .minestone-desktop-global-nav__inner {
        width: min(1840px, calc(100% - 2 * clamp(16px, 7.22vw, 104px)));
        min-height: 78px;
        padding-block: .5rem;
        row-gap: .5rem;
        margin: 0 auto;
        display: flex;
        align-items: center;
        column-gap: 64px;
        flex-wrap: wrap;
        min-width: 0;
    }

    .minestone-desktop-global-nav a {
        color: inherit;
        text-decoration: none;
    }

    .minestone-desktop-global-nav__brand {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        max-width: 100%;
        flex: 0 1 300px;
        color: #111;
        font-size: 1.5rem;
        font-weight: 800;
        letter-spacing: .16em;
    }

    .minestone-desktop-global-nav__brand-logo {
        display: block;
        width: 272px;
        max-width: 100%;
        height: auto;
        max-height: 48px;
        object-fit: contain;
        object-position: left center;
    }

    .minestone-desktop-global-nav__brand-mark {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 2px solid #111;
        border-radius: 50%;
        font-size: 1.125rem;
        letter-spacing: 0;
    }

    .minestone-desktop-global-nav__links {
        display: flex;
        align-items: stretch;
        flex: 1 1 15rem;
        flex-wrap: wrap;
        min-width: 0;
        gap: 1rem 64px;
        min-height: 0;
    }

    .minestone-desktop-global-nav__link {
        position: relative;
        display: inline-flex;
        align-items: center;
        color: #737982;
        font-size: 1.125rem;
        font-weight: var(--ms-weight-label);
        white-space: normal;
        overflow-wrap: anywhere;
        min-height: 2.75rem;
        min-width: 0;
    }

    .minestone-desktop-global-nav__link.is-active {
        color: #111;
    }

    .minestone-desktop-global-nav__link.is-active::after {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        height: 3px;
        border-radius: 3px 3px 0 0;
        background: #111;
        content: "";
    }

    .minestone-desktop-global-nav__actions {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-left: auto;
        flex-wrap: wrap;
        min-width: 0;
        max-width: 100%;
    }

    .minestone-desktop-global-nav__icon-button {
        position: relative;
        width: 50px;
        height: 50px;
        min-width: 2.75rem;
        min-height: 2.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #e8eaee;
        border-radius: 50%;
        background: #fff;
        color: #111;
    }

    .minestone-desktop-global-nav__icon-button:hover,
    .minestone-desktop-global-nav__icon-button:focus-visible {
        border-color: #cfd3d8;
        color: #111;
    }

    .minestone-desktop-global-nav__badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 22px;
        height: 22px;
        display: grid;
        place-items: center;
        padding: 0 5px;
        border-radius: 50%;
        background: #111;
        color: #fff;
        font-size: 0.6875rem;
        line-height: 1;
    }

    .minestone-desktop-global-nav__user-chip {
        min-width: 0;
        max-width: min(24.375rem, 100%);
        min-height: 3.125rem;
        height: auto;
        display: inline-flex;
        align-items: center;
        gap: 12px;
        padding: 4px 14px 4px 5px;
        border: 1px solid #e8eaee;
        border-radius: 999px;
        background: #fff;
        color: #111;
        font-size: 1rem;
        font-weight: var(--ms-weight-label);
        white-space: nowrap;
    }

    .minestone-desktop-global-nav__user-trigger {
        appearance: none;
        -webkit-appearance: none;
        cursor: pointer;
        font-family: inherit;
        line-height: 1;
        text-align: left;
        box-shadow: none;
    }

    .minestone-desktop-global-nav__user-trigger:hover,
    .minestone-desktop-global-nav__user-trigger:focus-visible {
        border-color: #cfd3d8;
        color: #111;
    }

    .minestone-desktop-global-nav__avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
        display: grid;
        place-items: center;
        border-radius: 50%;
        background: #dce9ed;
        color: #3e5961;
        font-size: 1.25rem;
        font-weight: var(--ms-weight-label);
    }

    .minestone-desktop-global-nav__avatar-image {
        object-fit: cover;
    }

    .minestone-desktop-global-nav__user-email {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #111;
    }

    .minestone-desktop-global-nav__user-expand {
        margin-left: auto;
        flex: 0 0 auto;
        color: #8a8f98;
    }

    .minestone-desktop-global-nav__user-menu {
        position: relative;
    }

    .minestone-desktop-global-nav__user-dropdown {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: min(11.875rem, calc(100vw - 2rem));
        padding: 8px;
        border: 1px solid #e8eaee;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 14px 32px rgba(17, 17, 17, 0.12);
    }

    .minestone-desktop-global-nav__user-dropdown[hidden] {
        display: none;
    }

    .minestone-desktop-global-nav__user-menu-item {
        width: 100%;
        min-height: 2.75rem;
        display: flex;
        align-items: center;
        padding: 0 12px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #222;
        font: inherit;
        font-size: 0.875rem;
        font-weight: var(--ms-weight-label);
        text-decoration: none;
        cursor: pointer;
    }

    .minestone-desktop-global-nav__user-menu-item:hover,
    .minestone-desktop-global-nav__user-menu-item:focus-visible {
        background: #f5f6f7;
        color: #111;
    }

    .minestone-desktop-global-nav__user-menu-logout {
        color: #b42318;
    }

    .minestone-desktop-global-nav__actions {
        gap: 16px;
    }


}

@media (min-width: 901px) and (max-width: 1500px) {
    .minestone-desktop-global-nav__inner {
        column-gap: 32px;
    }

    .minestone-desktop-global-nav__brand {
        flex-basis: 220px;
        font-size: 1.25rem;
    }

    .minestone-desktop-global-nav__brand-logo {
        width: 210px;
        max-height: 42px;
    }

    .minestone-desktop-global-nav__brand-mark {
        width: 36px;
        height: 36px;
        font-size: 0.9375rem;
    }

    .minestone-desktop-global-nav__links {
        column-gap: 36px;
    }

    .minestone-desktop-global-nav__link {
        font-size: 1rem;
    }

    .minestone-desktop-global-nav__user-chip {
        min-width: 0;
        max-width: min(20rem, 100%);
        font-size: 0.875rem;
    }
}

@media (min-width: 640px) {
    .ms-page-header {
        --ms-page-header-height: var(--ms-frontend-header-height-desktop, 64px);
    }

    .ms-page-header--library .ms-page-header__row {
        min-height: var(--ms-frontend-header-height-desktop, 64px);
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 24px;
    }

    .ms-page-header--library .ms-page-header__center {
        justify-content: flex-start;
        text-align: left;
    }

    .ms-page-header .page-title,
    .ms-page-header .models-header-title,
    .ms-page-header .order-detail-header-title,
    .ms-page-header__title {
        font-size: var(--ms-font-size-page-title-desktop, 1.625rem);
    }

    .ms-page-header .page-description,
    .ms-page-header__subtitle {
        font-size: var(--ms-font-size-subtitle-desktop, 0.8125rem);
    }
}

/* Account/auth pages use the full-width desktop chrome shown in their PC
 * designs. Keep the shared shell's compact content width for other pages. */
@media (min-width: 901px) {
    .address-page-header,
    .login-page-header,
    .register-page-header {
        --ms-page-header-height: 78px;
    }

    .address-page-header .ms-page-header__row,
    .login-page-header .ms-page-header__row,
    .register-page-header .ms-page-header__row {
        width: 100%;
        max-width: none;
        min-height: 78px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .profile-edit-page-header,
    .account-settings-page-header {
        --ms-page-header-height: 78px;
    }

    .profile-edit-page-header .ms-page-header__row,
    .account-settings-page-header .ms-page-header__row {
        width: 100%;
        max-width: none;
        min-height: 78px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .password-page-header {
        --ms-page-header-height: 78px;
    }

    .password-page-header .ms-page-header__row {
        width: 100%;
        max-width: none;
        min-height: 78px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .profile-edit-page > .profile-edit-page-header,
    .account-settings-page > .account-settings-page-header {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }

    .password-page > .password-page-header {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }
}

@media (width < 640px) {
    .ms-page-header__row {
        width: 100%;
        padding-right: 16px;
        padding-left: 16px;
        gap: 12px;
    }

    .ms-page-header--library .ms-page-header__row {
        min-height: var(--ms-frontend-header-height-mobile-large, 64px);
    }

    .ms-page-header--library .ms-page-header__button {
        --ms-page-header-button-size: 42px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .ms-page-header__button {
        transition: none;
    }
}

/* Back controls share geometry on compact pages and custom workbenches alike.
 * Layout slots may vary; the control itself has one owner and no page offsets. */
[data-ms-page-header] .ms-page-header__back {
    width: var(--ms-page-back-size, 44px);
    min-width: var(--ms-page-back-size, 44px);
    height: var(--ms-page-back-size, 44px);
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ms-page-header-text, #111);
    text-decoration: none;
}
[data-ms-page-header] .ms-page-header__back .ms-page-header__icon {
    width: var(--ms-page-back-icon-size, 24px);
    height: var(--ms-page-back-icon-size, 24px);
}
