/* =========================================================
   Mobile app shell (includes/app-shell.php).
   Everything here applies below 820px only; desktop is untouched.
   ========================================================= */
.as-tabs, .as-install { display: none; }

@media (max-width: 820px) {
    :root { --as-tabs-h: 64px; }

    html { -webkit-tap-highlight-color: transparent; }
    body { padding-bottom: calc(var(--as-tabs-h) + env(safe-area-inset-bottom)); background: #F4F7FB; overscroll-behavior-y: none; }

    /* The tall top band belongs to the desktop site; the tab bar carries
       its shortcuts on a phone. Hiding it also gives the page back ~190px. */
    .tband { display: none !important; }

    /* Header: a slim, solid app bar. */
    .navbar { background: rgba(255,255,255,.96) !important; backdrop-filter: saturate(160%) blur(10px); box-shadow: 0 1px 0 rgba(15,23,42,.06), 0 4px 14px -10px rgba(15,23,42,.25); }

    /* Bottom tab bar */
    .as-tabs {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        height: calc(var(--as-tabs-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
        background: rgba(255,255,255,.97); backdrop-filter: saturate(160%) blur(12px);
        border-top: 1px solid #E2E8F0; box-shadow: 0 -8px 24px -18px rgba(15,23,42,.35);
    }
    .as-tab {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: var(--as-tabs-h); border: 0; background: none; padding: 0; cursor: pointer;
        color: #64748B; text-decoration: none; font: inherit; font-size: .7rem; font-weight: 600; letter-spacing: .01em;
        transition: color .15s;
    }
    .as-tab i { font-size: 1.2rem; transition: transform .15s; }
    .as-tab.is-on { color: #1B4DB3; }
    .as-tab.is-on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: #1B4DB3; }
    .as-tab:active i { transform: scale(.88); }
    .as-tab:focus-visible { outline: 2px solid #1B4DB3; outline-offset: -4px; border-radius: 10px; }
    .as-tab--book { color: #0C2F57; }
    .as-book {
        width: 54px; height: 54px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center;
        background: linear-gradient(145deg, #1B4DB3, #0EA5E9); color: #fff; border: 4px solid #F4F7FB;
        box-shadow: 0 10px 22px -8px rgba(27,77,179,.65);
    }
    .as-book i { font-size: 1.25rem; }
    .as-dot { position: absolute; top: 12px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: #EF4444; border: 2px solid #fff; }

    /* The floating Offers button is in the tab bar on a phone. */
    .of-fab-wrap { display: none !important; }

    /* Install card, above the tab bar */
    .as-install {
        display: flex; align-items: center; gap: 12px;
        position: fixed; left: 12px; right: 12px; z-index: 1001;
        bottom: calc(var(--as-tabs-h) + env(safe-area-inset-bottom) + 12px);
        padding: 12px 12px 12px 14px; border-radius: 16px; background: #0F172A; color: #fff;
        box-shadow: 0 16px 36px -14px rgba(0,0,0,.55); animation: as-up .3s cubic-bezier(.16,1,.3,1);
    }
    .as-install[hidden] { display: none; }
    .as-install img { border-radius: 12px; }
    .as-install div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
    .as-install b { font-size: .95rem; }
    .as-install span { font-size: .78rem; color: #CBD5E1; }
    .as-install-go { border: 0; border-radius: 10px; padding: 9px 14px; background: #0EA5E9; color: #fff; font-weight: 700; font: inherit; font-weight: 700; }
    .as-install-x { border: 0; background: none; color: #94A3B8; font-size: 1.4rem; line-height: 1; padding: 4px 6px; }
    @keyframes as-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

    /* App-like content: tighter rhythm, soft cards, bigger touch targets. */
    .container { padding-left: 16px; padding-right: 16px; }
    .btn, button, .bh-card, .sp-card, .hc-card { touch-action: manipulation; }
    .btn { min-height: 44px; }
    .btn:active, .bh-card:active, .sp-card:active { transform: scale(.98); }
    .footer { padding-bottom: 12px; }

    /* Footer accordions (wired in app-shell.php) */
    .as-acc > [data-acc] { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin: 0; padding: 14px 0; }
    .as-acc > [data-acc]::after { content: "+"; font-size: 1.3rem; font-weight: 400; line-height: 1; color: rgba(226,232,240,.7); transition: transform .2s; }
    .as-acc.as-open > [data-acc]::after { transform: rotate(45deg); }
    .as-acc > ul, .as-acc > .cv-v { display: none !important; }
    .as-acc.as-open > ul, .as-acc.as-open > .cv-v { display: flex !important; }
    .as-acc.as-open > ul.footer-links { display: block !important; padding-bottom: 8px; }
    .footer-grid > .as-acc { border-bottom: 1px solid rgba(255,255,255,.08); }
    .footer-grid > .as-acc h3 { font-size: 1rem; }
    .footer-grid > .as-acc h3::after { position: static; width: auto; height: auto; background: none; }
    .cv-g.as-acc { margin-top: 0; border-bottom: 1px solid rgba(255,255,255,.07); }
    .cv-g.as-acc:last-child { border-bottom: 0; }
    .cv-g.as-acc.as-open .cv-v { padding-bottom: 12px; }
    .footer-grid { gap: 0 !important; }
    .footer-brand { margin-bottom: 10px; }

    /* Sticky in-page CTAs and modals sit above the tab bar. */
    .bk-modal, .of-modal { z-index: 1300; }
}

/* Installed as an app: no browser chrome, so give the header the status-bar inset. */
@media (display-mode: standalone) and (max-width: 820px) {
    .navbar { padding-top: env(safe-area-inset-top); }
}
@media (prefers-reduced-motion: reduce) { .as-install { animation: none; } .as-tab i { transition: none; } }
@media print { .as-tabs, .as-install { display: none !important; } }
