/* AVA phone: 414 × 904 logical pixels, with 50px status / 20px home areas.
   Loaded last on public client pages, so all themes share the same geometry. */
:root { --phone-reserved-background: #f5eddd; }
:root[data-phone-theme="automne"] { --phone-reserved-background: #292b1b; }
:root[data-phone-theme="halloween"] { --phone-reserved-background: #0b1419; }
@media (max-width: 768px), (width: 904px) and (height: 414px) {
    :root {
        --phone-top-inset: 50px;
        --phone-bottom-inset: 20px;
        --phone-safe-height: max(0px, calc(var(--phone-viewport-height, 100dvh) - var(--phone-top-inset) - var(--phone-bottom-inset)));
        --phone-modal-center: calc(var(--phone-viewport-top, 0px) + var(--phone-top-inset) + var(--phone-safe-height) / 2);
    }
    html { height: 100%; scroll-padding-top: 50px; scroll-padding-bottom: 20px; }
    body { margin: 0; padding: 50px 0 20px; height: 100%; min-height: 100%; box-sizing: border-box; overflow: hidden; }
    body > .phone-page {
        position: fixed; top: 50px; bottom: 20px; left: 0; right: 0;
        height: auto; min-height: 0; width: 100%;
        overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
        scrollbar-width: none; scroll-padding-top: 0;
    }
    body > .phone-page::-webkit-scrollbar { display: none; }
    body > .phone-page:has(#phoneLoginModal.active, #quantityModal.active, #checkoutModal.active, .cart-sidebar.active) { overflow-y: hidden; }
    body::before, body::after {
        content: ''; display: block; position: fixed; left: 0; right: 0;
        background: var(--phone-reserved-background); z-index: 1001; pointer-events: none;
    }
    body::before { top: 0; height: 50px; }
    body::after { bottom: 0; height: 20px; }
    :root[data-phone-theme] body::before,
    :root[data-phone-theme] body::after { background: transparent; }
    .phone-page > .header {
        display: block; position: relative; top: auto; padding-top: 0;
        height: auto; min-height: 64px; visibility: visible;
    }
    .phone-page > .header .header-content {
        display: flex; align-items: center; justify-content: space-between;
        min-height: 64px; padding: 8px 14px; gap: 12px;
    }
    .phone-page > .header .logo { display: block; flex-shrink: 0; }
    .phone-page > .header .logo img { display: block; width: auto; height: 80px; }
    .phone-page > .header .header-actions { display: flex; align-items: center; margin-left: auto; }
    .phone-page > .header .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; padding: 0; flex-shrink: 0;
    }
    .phone-page > .header .nav-mobile {
        display: grid; grid-template-rows: 0fr; max-height: none;
        padding: 0; border-top-width: 0; border-bottom-width: 0;
        overflow: hidden; opacity: 0; visibility: hidden;
        transition: grid-template-rows 280ms cubic-bezier(.22,.61,.36,1), opacity 200ms ease, visibility 0s 280ms;
    }
    .phone-page > .header .nav-mobile.active {
        grid-template-rows: 1fr; opacity: 1; visibility: visible;
        max-height: none; overflow: hidden; animation: none;
        transition: grid-template-rows 280ms cubic-bezier(.22,.61,.36,1), opacity 200ms ease, visibility 0s;
    }
    .nav-mobile-clip { min-height: 0; overflow: hidden; }
    :root[data-phone-theme] .phone-page > .header .nav-mobile,
    :root[data-phone-theme] .phone-page > .header .nav-mobile.active {
        background: transparent; border: 0; box-shadow: none;
    }
    .nav-mobile-content { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
    .phone-page > .header .nav-mobile .nav-link-mobile {
        transform: translateY(-6px); transition: transform 240ms ease, background-color 140ms ease, color 140ms ease;
    }
    .phone-page > .header .nav-mobile.active .nav-link-mobile { transform: translateY(0); }
    @media (prefers-reduced-motion: reduce) {
        .phone-page > .header .nav-mobile,
        .phone-page > .header .nav-mobile.active,
        .phone-page > .header .nav-mobile .nav-link-mobile { transition: none; transform: none; }
    }
    :root[data-phone-theme] .phone-page .footer { background: transparent; }
    .phone-page > main > .hero { padding-top: 12px; }
    .cart-sidebar { top: calc(var(--phone-viewport-top, 0px) + 50px); height: var(--phone-safe-height); max-height: var(--phone-safe-height); }
    #phoneLoginModal, #quantityModal, #checkoutModal, #companySettingsModal, #companyRemoveModal {
        top: var(--phone-modal-center); max-height: calc(var(--phone-safe-height) - 24px);
    }
    dialog.recruitment-dialog { top: 50px; bottom: 20px; max-height: calc(var(--phone-safe-height) - 24px); }
    #notificationContainer { top: calc(var(--phone-viewport-top, 0px) + 62px); }
    body > :is(.autumn-atmosphere, .haunted-atmosphere) { top: 50px; bottom: 20px; }
}
