/* 仅消费端移动导航使用；桌面沿用现有导航和语言组件。 */
.mobile-navigation-search,
.mobile-search-shell { display: none; }
.mobile-search-shell[hidden] { display: none; }

@media (max-width: 1100px) {
    body.mobile-menu-open:not(.is-admin-shell) {
        position: fixed;
        top: var(--mobile-menu-scroll-y, 0px);
        left: 0;
        right: 0;
        overflow: hidden;
    }

    /* 页头层级为 300；导航展开时让聊天浮层位于整个导航下方。 */
    body.mobile-menu-open:not(.is-admin-shell) .site-chat {
        z-index: 299;
    }

    .junco-template-theme:not(.has-admin-shell) .lumo-header {
        --mobile-header-height: 44.2px;
        padding: 8px 12px 0;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-header__top.theme-header-grid {
        --mobile-header-cell-width: 60px;
        display: grid;
        grid-template-columns: var(--mobile-header-cell-width) minmax(0, 1fr) calc(var(--mobile-header-cell-width) * 2);
        align-items: stretch;
        min-height: var(--mobile-header-height);
        padding: 0;
        gap: 0;
        border-radius: 12px;
        box-shadow: none;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-mobile-menu.theme-mobile-menu {
        grid-column: 1;
        min-width: 0;
        width: var(--mobile-header-cell-width);
    }
    .junco-template-theme:not(.has-admin-shell) .theme-mobile-menu__toggle {
        width: var(--mobile-header-cell-width);
        height: var(--mobile-header-height);
        border: 0;
        border-right: 1px solid #ededed;
        border-radius: 12px 0 0 12px;
        background: transparent;
        box-shadow: none;
        transform: none;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-header__logo.theme-logo {
        grid-column: 2;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 0 14px;
        justify-content: center;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-header__logo .site-logo-img {
        width: 65%;
        max-width: 123.5px;
        height: auto;
        max-height: 23.4px;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-header__icons.auth-area {
        /* 覆盖 base.css 在 640px 以下遗留的 .auth-area { width: 100% }。 */
        grid-column: 3;
        width: auto;
        min-width: 0;
        gap: 0;
        max-width: none;
        justify-content: flex-end;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-header-search,
    .junco-template-theme:not(.has-admin-shell) .lumo-user-menu {
        display: none;
    }
    .junco-template-theme:not(.has-admin-shell) .mobile-navigation-search,
    .junco-template-theme:not(.has-admin-shell) .lumo-icon-link.cart-link {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 var(--mobile-header-cell-width);
        width: var(--mobile-header-cell-width);
        min-width: 0;
        box-sizing: border-box;
        height: var(--mobile-header-height);
        border: 0;
        border-left: 1px solid #ededed;
        border-radius: 0;
        background: transparent;
        color: #111;
        padding: 0;
        cursor: pointer;
    }
    .junco-template-theme:not(.has-admin-shell) .cart-badge {
        top: 3px;
        right: 6px;
        background: #df382f;
        color: white;
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-mobile-panel.theme-mobile-panel {
        inset: 0;
        width: 100vw;
        height: 100dvh;
        max-height: none;
        display: block;
        padding: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        z-index: 410;
        transform: translateX(-16px);
    }
    .junco-template-theme:not(.has-admin-shell) .lumo-mobile-menu[open] .lumo-mobile-panel {
        transform: none;
    }
    .mobile-navigation { height: 100%; display: flex; flex-direction: column; color: #111; }
    .mobile-navigation [hidden],
    .mobile-navigation [data-mobile-page][hidden],
    .mobile-navigation [data-mobile-category-feature][hidden] { display: none; }
    .mobile-navigation button { color: inherit; font: inherit; cursor: pointer; }
    .mobile-navigation__header { display: flex; flex: 0 0 68px; border-bottom: 1px solid #ededed; }
    .mobile-navigation__header .mobile-navigation__brand { flex: 1; display: flex; align-items: center; padding: 0 20px; }
    .mobile-navigation__brand img { width: min(190px, 100%); height: auto; max-height: 36px; object-fit: contain; }
    .mobile-navigation__header button { width: 68px; background: white; border: 0; border-left: 1px solid #ededed; display: grid; place-items: center; }
    .mobile-navigation__pages { flex: 1; min-height: 0; display: flex; }
    .mobile-navigation [data-mobile-page] { width: 100%; min-width: 0; box-sizing: border-box; padding: 18px 20px 26px; overflow-y: auto; overscroll-behavior: contain; }
    .mobile-navigation .mobile-navigation__home { display: flex; flex-direction: column; }
    .mobile-navigation__links { display: flex; flex-direction: column; }
    .mobile-navigation__links button,
    .mobile-navigation__links a {
        display: flex; align-items: center; justify-content: space-between;
        width: 100%; min-height: 54px; padding: 8px 0; border: 0; background: transparent;
        font-size: 21px; font-weight: 700; text-align: left; text-decoration: none;
    }
    .mobile-navigation__footer { margin-top: auto; padding-top: 36px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
    .mobile-navigation__footer .mobile-navigation__account { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; box-sizing: border-box; min-height: 56px; border-radius: 999px; background: #111; color: white; padding: 0 16px; font-size: 16px; font-weight: 700; text-decoration: none; }
    .mobile-navigation__footer .mobile-navigation__account a { color: white; padding: 10px 2px; }
    .mobile-navigation__footer > a { padding: 4px 12px; }
    .mobile-navigation__footer form button { background: transparent; border: 0; min-height: 44px; }
    .mobile-navigation__footer .mobile-navigation__orders { display: flex; align-items: center; gap: 22px; min-height: 70px; padding: 12px 16px; box-sizing: border-box; border-radius: 12px; background: #f5f5f5; color: #111; text-decoration: none; }
    .mobile-navigation__orders > span { flex: 1; min-width: 0; }
    .mobile-navigation__orders strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.4; }
    .mobile-navigation__orders small { display: block; margin-top: 2px; color: #666; font-size: 13px; line-height: 1.4; }
    .mobile-navigation__orders > svg { flex-shrink: 0; }
    .mobile-navigation__footer .mobile-navigation__logout { margin: 0; width: 100%; }
    .mobile-navigation__footer .mobile-navigation__logout button { display: flex; align-items: center; gap: 22px; width: 100%; min-height: 56px; padding: 12px 16px; text-align: left; font-size: 16px; font-weight: 700; }
    .mobile-navigation [data-mobile-language-slot] { align-self: center; min-height: 44px; }
    .mobile-navigation .shadcn-dropdown-trigger { min-height: 44px; padding: 0 10px; gap: 8px; border: 0; background: white; box-shadow: none; font-size: 15px; }
    /* 现有组件在移动端用 important 隐藏名称；菜单首页需要恢复可读的语言名称。 */
    .mobile-navigation .shadcn-dropdown-trigger__label { display: inline !important; }
    .mobile-navigation .shadcn-dropdown-menu { top: auto; bottom: calc(100% + 8px); left: 50%; right: auto; transform: translateX(-50%); transform-origin: bottom center; max-height: min(360px, 55dvh); }
    .mobile-navigation .shadcn-dropdown-menu__list { max-height: min(280px, 42dvh); }
    .mobile-navigation__back { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; margin-bottom: 14px; border: 0; background: white; color: #555; }
    .mobile-navigation__group { width: 100%; min-width: 0; margin-bottom: 12px; }
    /* 分类标题不能继承旧展开按钮的 42px 圆形和打开时的绿色样式。 */
    .mobile-navigation .mobile-navigation__group > summary {
        position: relative; z-index: auto; width: 100%; height: auto; min-height: 48px;
        box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 16px;
        margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
        box-shadow: none; transform: none; transition: none; color: #111;
        font-size: 21px; font-weight: 700; white-space: nowrap; list-style: none; cursor: pointer;
    }
    .mobile-navigation .mobile-navigation__group-link {
        display: block; flex: 1; min-width: 0; min-height: 48px; line-height: 48px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        padding: 0; color: inherit; font: inherit; text-decoration: none;
    }
    .mobile-navigation__group > summary > .icon-sm { flex: 0 0 auto; margin-left: auto; }
    .mobile-navigation__group summary::-webkit-details-marker { display: none; }
    .mobile-navigation__group[open] summary .icon-sm { transform: rotate(180deg); }
    .mobile-navigation__group:not([open]) > .mobile-navigation__items { display: none; }
    .mobile-navigation__items { display: flex; flex-direction: column; gap: 12px; padding: 10px 0 20px; }
    .mobile-navigation__items a { display: flex; align-items: center; gap: 14px; padding: 0; min-height: 56px; font-size: 17px; font-weight: 500; }
    .mobile-navigation__items > a { width: 100%; box-sizing: border-box; }
    .mobile-navigation__items > a > span:last-child { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
    .mobile-navigation__thumb { display: grid; place-items: center; width: 56px; height: 56px; flex: 0 0 56px; overflow: hidden; background: #f0f1f2; border-radius: 12px; }
    .mobile-navigation__thumb img { width: 100%; height: 100%; object-fit: contain; }
    .mobile-navigation .mobile-navigation__feature {
        position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
        width: 100%; box-sizing: border-box; gap: 14px; min-height: 264px; margin-top: 24px; padding: 22px; overflow: hidden;
        border-radius: 20px; background: linear-gradient(135deg, #315a55, #8eb7aa); color: white;
    }
    .mobile-navigation__feature::before {
        content: ""; position: absolute; inset: 0; z-index: 1;
        background: linear-gradient(90deg, rgba(18, 24, 32, 0.75), rgba(18, 24, 32, 0.08));
        pointer-events: none;
    }
    .mobile-navigation .mobile-navigation__feature > img {
        position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; max-width: none;
        margin: 0; padding: 0; border: 0; border-radius: 0; object-fit: cover;
    }
    .mobile-navigation__feature > span,
    .mobile-navigation__feature strong,
    .mobile-navigation__feature em { position: relative; z-index: 2; }
    .mobile-navigation .mobile-navigation__feature > span,
    .mobile-navigation .mobile-navigation__feature > strong {
        display: block; margin: 0; padding: 0; border: 0; border-radius: 0;
        background: transparent; box-shadow: none; color: white;
    }
    .mobile-navigation .mobile-navigation__feature > span { font-size: 13px; font-weight: 700; text-transform: uppercase; }
    .mobile-navigation .mobile-navigation__feature > strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; max-width: min(190px, 100%); font-size: 25px; line-height: 1.2; }
    .mobile-navigation__feature em {
        display: flex; gap: 12px; align-items: center; width: fit-content; padding: 6px 8px 6px 18px;
        margin-top: 12px; color: #111; background: white; font-style: normal; border-radius: 999px; min-height: 44px;
    }
    .mobile-navigation__feature em .icon { width: 32px; height: 32px; padding: 8px; box-sizing: border-box; border-radius: 50%; color: white; background: #111; }
    .mobile-navigation :is(a, button, summary):focus-visible,
    .mobile-navigation-search:focus-visible { outline: 2px solid #111; outline-offset: -3px; }
}

@media (max-width: 1100px) {
    body.mobile-search-open {
        position: fixed; top: var(--mobile-search-scroll-y, 0px); left: 0; right: 0; overflow: hidden;
    }
    .cart-drawer-shell .cart-drawer {
        inset: 0;
        width: 100vw;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        transform: translate3d(100%, 0, 0);
    }
    .mobile-search-shell { display: block; position: fixed; inset: 0; z-index: 500; }
    .mobile-search-scrim {
        position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
        background: rgba(23, 31, 29, 0.2); opacity: 0; transition: opacity 0.32s ease;
    }
    .mobile-search-dialog {
        position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; box-sizing: border-box;
        overflow: hidden; background: white; color: #111; border: 0;
        border-radius: 0; box-shadow: none;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mobile-search-shell.is-open .mobile-search-dialog { transform: translateX(0); }
    .mobile-search-shell.is-open .mobile-search-scrim { opacity: 1; }
    .mobile-search-shell.is-closing { pointer-events: none; }
    .mobile-search-dialog [hidden] { display: none; }
    .mobile-search-dialog button { font: inherit; cursor: pointer; }
    .mobile-search-dialog :is(a, button, input):focus-visible { outline: 2px solid #111; outline-offset: -2px; }
    .mobile-search-page { display: flex; flex-direction: column; height: 100%; width: 100%; margin: 0; }
    .mobile-search-page__header { display: flex; flex: 0 0 68px; width: 100%; border-bottom: 1px solid #ededed; }
    .mobile-search-page .theme-mobile-search__field {
        flex: 1; min-width: 0; min-height: 68px; padding: 0 16px; gap: 12px;
        background: white; border: 0; border-radius: 0;
    }
    .mobile-search-page input[name="q"] { min-width: 0; width: 100%; font-size: 16px; }
    .mobile-search-page .header-search-clear {
        width: 44px; min-width: 44px; height: 44px; padding: 0;
        border: 0; border-radius: 0; background: transparent; color: #111;
    }
    .mobile-search-page .theme-mobile-search__submit { display: none; }
    .mobile-search-page .theme-mobile-search__icon .icon { width: 22px; height: 22px; }
    .mobile-search-page__close {
        flex: 0 0 64px; display: grid; place-items: center; width: 64px; min-height: 68px;
        border: 0; border-left: 1px solid #ededed; background: white; padding: 0;
    }
    .mobile-search-page .header-search-panel {
        flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0;
        border: 0; border-radius: 0; box-shadow: none; animation: none;
    }
    .mobile-search-page .header-search-panel__scroll { height: 100%; max-height: none; padding: 28px 18px; }
    .mobile-search-page .header-search-panel__results { gap: 30px; }
    .mobile-search-page .header-search-section { gap: 16px; }
    .mobile-search-page .header-search-section h2 { font-size: 18px; }
    .mobile-search-page .header-search-chip { min-height: 40px; padding: 8px 14px; font-size: 15px; font-weight: 600; }
    .mobile-search-page .header-search-featured-grid {
        grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: clamp(150px, 40vw, 220px);
        gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
        padding-bottom: 8px; scrollbar-width: thin;
    }
    .mobile-search-page .header-search-featured-grid .header-search-product { scroll-snap-align: start; }
    .mobile-search-page .header-search-product__media { border-radius: 22px; background: #f0f1f2; }
    .mobile-search-page .header-search-product__details { padding-top: 9px; gap: 5px; }
    .mobile-search-page .header-search-product__title { font-size: 15px; }
    .mobile-search-page .header-search-price { font-size: 16px; flex-wrap: nowrap; white-space: nowrap; }
    .mobile-search-page .header-search-price__original { font-size: 13px; }
    .mobile-search-page .header-search-colors { gap: 8px; min-height: 28px; }
    .mobile-search-page .header-search-color { width: 21px; height: 21px; }
    .mobile-search-page .header-search-price.is-sale .header-search-price__current { color: #df382f; }
    .mobile-search-page .header-search-product__cart {
        left: auto; right: 10px; bottom: 10px; width: 32px; opacity: 1; pointer-events: auto; transform: none;
    }
    .mobile-search-page .header-search-cart {
        width: 32px; height: 32px; min-height: 32px; padding: 0; gap: 0; justify-content: center; border-radius: 50%; background: white; color: #111;
    }
    .mobile-search-page .header-search-cart__label { display: none; }
    .mobile-search-page .header-search-cart__icon { background: transparent; color: #111; flex: 0 0 32px; width: 32px; height: 32px; }
    .mobile-search-page .header-search-cart__icon .icon { width: 16px; height: 16px; }
    .mobile-search-page .header-search-preview { display: none; }
    .mobile-search-page .header-search-product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
    .junco-template-theme:not(.has-admin-shell) .lumo-header__top.theme-header-grid { --mobile-header-cell-width: 48px; }
    .junco-template-theme:not(.has-admin-shell) .lumo-header__logo.theme-logo { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .junco-template-theme:not(.has-admin-shell) .lumo-mobile-panel.theme-mobile-panel,
    .mobile-search-dialog, .mobile-search-scrim { transition: none; }
}
