/* SharpCast mobile bottom tab bar — UI/UX spec §3.2 + §9.3.
   Mobile-only (≤1023px / 63.9375em). On desktop the existing top nav is the canonical nav.
   Breakpoint expressed in em (per brand pack §11 / spec amendments §7.2) so
   browser zoom triggers the correct layout. */

@media (max-width: 63.9375em) {

  /* Below desktop, the bottom tab bar is the primary nav. The sticky site
     header (.site-header) stays visible but only renders the brand — its
     own media query in base.css hides .site-nav and .site-account. The
     redundant per-page brand+tagline+nav stack was removed in v5.7.104. */

  /* Body needs space at the bottom so content doesn't sit under the tab bar. */
  body {
    padding-bottom: 80px;
  }

  /* ── Sticky upgrade strip (above the tab bar, non-members only) ─────── */
  .mtb-upsell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px;
    height: 56px;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    background: var(--bg-elev);
    border-top: 1px solid var(--brand);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  }
  .mtb-upsell-cta {
    flex: 1;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .02em;
    text-decoration: none;
    line-height: 1.2;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .mtb-upsell-cta:hover { color: var(--brand); }
  .mtb-upsell-close {
    width: 24px;
    height: 24px;
    min-width: 44px;   /* extend tap area beyond visual size, per spec §9.3 */
    min-height: 44px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mtb-upsell-close:hover { color: var(--text); }

  /* ── Bottom tab bar ──────────────────────────────────────────────── */
  .mtb-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    z-index: 999;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    margin: 0;
    padding: 0;
    background: var(--bg-elev);
    border-top: 1px solid var(--border-strong);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
    border-bottom: 0;
  }

  .mtb-tab {
    flex: 1 1 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1;
    letter-spacing: .02em;
    border: 0;
    background: transparent;
  }
  .mtb-tab:hover { color: var(--text); }
  .mtb-tab.mtb-active { color: var(--brand); }
  .mtb-tab.mtb-active .mtb-icon { stroke: var(--brand); }

  .mtb-icon {
    display: block;
    stroke: currentColor;
  }

  .mtb-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
  }

  /* ── More sheet (collapsible <details>) ──────────────────────────── */
  .mtb-more {
    position: relative;
    list-style: none;
  }
  .mtb-more > summary {
    list-style: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
  }
  .mtb-more > summary::-webkit-details-marker { display: none; }
  .mtb-more[open] > summary { color: var(--brand); }
  .mtb-more[open] > summary .mtb-icon { stroke: var(--brand); }

  .mtb-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
    background: var(--bg-elev);
    border-top: 1px solid var(--border-strong);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
    padding: var(--space-3) 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
  }
  /* When the upsell strip is also visible, lift the sheet above it. */
  .mtb-upsell ~ .mtb-bar .mtb-sheet,
  body:has(.mtb-upsell) .mtb-sheet {
    bottom: 120px;
  }
  .mtb-sheet a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 var(--space-5);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .01em;
    border-bottom: 1px solid var(--border);
  }
  .mtb-sheet a:last-child { border-bottom: 0; }
  .mtb-sheet a:hover { background: var(--bg-elev-2); color: var(--brand); }
  .mtb-sheet a.mtb-active { color: var(--brand); }
  .mtb-sheet a.mtb-cta {
    color: var(--brand);
    font-weight: 700;
  }
  .mtb-sheet-divider {
    display: block;
    height: 1px;
    background: var(--border);
    margin: var(--space-2) 0;
  }
}

/* On desktop, the partial markup is in the DOM but never displays. */
@media (min-width: 64em) {  /* 1024px ÷ 16 */
  .mtb-bar,
  .mtb-upsell { display: none !important; }
}
