/* Ghana Used Car Export — mobile (WAP) layer. Only loaded <=767px via media="(max-width:767px)".
   Desktop is untouched: nothing in this file applies above 767px. */
@media (max-width: 767px) {
  :root {
    color-scheme: light;
    --tabbar-h: 60px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --tap: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  html, body { overflow-x: hidden; }
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  }
  body.nav-open { overflow: hidden; }
  a:active, button:active, [role="button"]:active { opacity: .82; }
  .btn, .more, .lk, .dest-lnk, .mcard-go { min-height: var(--tap); }
  input, select, textarea { font-size: 16px; }

  /* ---------- full-screen drawer nav ---------- */
  nav.main {
    position: fixed; inset: 0; z-index: 200; left: 0; right: 0; top: 0; margin: 0; max-width: none;
    display: none; flex-direction: column; align-items: stretch; gap: 0; flex-wrap: nowrap;
    background: var(--paper); border: 0; border-radius: 0; box-shadow: none;
    padding: calc(var(--safe-t) + 4px) 0 calc(var(--safe-b) + 20px);
    overflow-y: auto; overscroll-behavior: contain;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  nav.main.open { display: flex; }
  nav.main a { padding: 15px 22px; font-size: 17px; font-weight: 600; color: var(--ink); border-radius: 0; border-bottom: 1px solid var(--hair); white-space: normal; }
  nav.main a.active { background: rgba(10, 53, 55, .05); color: var(--gulf); }
  .m-nav-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px 10px; background: var(--paper); border-bottom: 1px solid var(--hair); }
  .m-nav-head b { font-family: var(--serif); font-weight: 600; font-size: 18px; }
  .m-nav-x { width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ink); cursor: pointer; flex: none; }
  .tools .btn.wa { display: none; }

  /* ---------- bottom tab bar ---------- */
  .mtab { padding-bottom: var(--safe-b); background: rgba(6, 35, 37, .98); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .mtab .tab { min-height: var(--tabbar-h); justify-content: center; gap: 2px; }

  /* ---------- tables -> key/value cards ---------- */
  .spec-table, .spec-table tbody, .spec-table tr, .spec-table th, .spec-table td { display: block; width: auto; }
  .spec-table tr { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
  .spec-table th { color: var(--muted); font-weight: 500; }
  .spec-table td { text-align: end; }

  /* ---------- filter bottom sheet (/stock) ---------- */
  .f-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--tap); margin: 8px 0 16px; border: 1px solid var(--hair); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; color: var(--gulf); cursor: pointer; }
  .f-backdrop { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(6, 35, 37, .5); }
  .f-backdrop.show { display: block; }
  form.filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; max-height: 85dvh; overflow-y: auto; margin: 0;
    border-radius: 18px 18px 0 0; padding: 22px 18px calc(var(--safe-b) + 22px); background: #fff;
    transform: translateY(100%); transition: transform .25s ease; box-shadow: 0 -12px 40px rgba(6, 35, 37, .25); }
  form.filters.open { transform: none; }
  .f-close { display: block; position: absolute; inset-inline-end: 10px; top: 10px; width: 44px; height: 44px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink); cursor: pointer; }

  /* ---------- sticky vehicle bar ---------- */
  .pd-sticky { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; z-index: 70;
    bottom: calc(var(--tabbar-h) + var(--safe-b)); background: #fff; border-top: 1px solid var(--hair); padding: 10px 14px; }
  .pd-sticky .pd-price { flex: none; line-height: 1.05; }
  .pd-sticky .pd-price small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--muted); }
  .pd-sticky .pd-price b { font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--gulf); }
  .pd-sticky .btn { flex: 1; }
  body.pd-page { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 72px); }

  /* ---------- horizontal chips ---------- */
  .brands { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .brands::-webkit-scrollbar { display: none; }
  .brands > a { flex: 0 0 auto; }
}

/* ---- overflow hardening (playbook pitfall 5/6) ---- */
@media (max-width: 767px) {
  .grid3, .gridlist, .grid4, .mgrid, .dest-grid, .veh, .browse2, .gs-grid, .stats, .realgrid, .ans-feat, .ans-cards, .faq-list { grid-template-columns: minmax(0, 1fr) !important; }
  .wrap, .shell, .core, .card, .in, .veh > *, .hbtns, .head .l { min-width: 0; }
  .head { flex-wrap: wrap; gap: 12px; }
  .head .l { min-width: 0; }
  h1, h2, h3, h4, p, li, a, td, th, .lede, .prose, .mcard h4, .card h4 { overflow-wrap: anywhere; }
  img { max-width: 100%; height: auto; }
  .card .top { flex-wrap: wrap; gap: 8px; }
  .card .top .tagset { flex-wrap: wrap; min-width: 0; }
  .eyebrow { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
  .mtab { display: grid; grid-template-columns: repeat(5, 1fr); }
  .mtab .tab { min-width: 0; padding: 6px 3px; overflow: hidden; }
  .mtab .tab span { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filters select, .f-bar select { width: 100%; }
}

/* ---- overflow hardening v2 (forced) ---- */
@media (max-width: 767px) {
  html, body { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .wrap { max-width: 100vw; padding-inline: 18px; }
  nav.mtab { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  nav.mtab .tab { min-width: 0 !important; }
  .grid3, .gridlist, .grid4, .mgrid, .dest-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .card, .core, .shell, .in { min-width: 0 !important; }
  .card .top { flex-wrap: wrap !important; row-gap: 8px; }
  .card .top .ref { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .card .top .tagset { flex-wrap: wrap !important; min-width: 0; }
  .head, .head .l, .head .more, .hbtns { min-width: 0; }
  .head { flex-wrap: wrap !important; }
  .stats, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
