/* wheeledexcavatorexport.com - mobile layer (<=767px).
   Loaded with media="(max-width:767px)" so desktop never downloads it.
   All rules live inside the media query; mobile-only controls are switched
   off outside it so they cannot leak onto desktop. */

/* mobile-only controls: off by default (desktop must not show them) */
.m-tabbar, .f-toggle, .f-backdrop, .m-nav-foot, .m-sticky { display: none; }

@media (max-width: 767px) {
  :root {
    color-scheme: light;
    --tap: 44px;
    --tap-sm: 40px;
    --fs-input: 16px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
    --tabbar-h: 56px;
    --hairline: .5px;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---- baseline guards ---- */
  html, body { overflow-x: hidden; }
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
         padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 2px); }
  a:active, button:active, [role="button"]:active { opacity: .82; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .wrap { padding-inline: 16px; }
  img { max-width: 100%; height: auto; }

  /* single-column grids: minmax(0,1fr) so wide children cannot blow the track */
  .grid3, .grid4, .trust3, .trust4, .sizerow, .regiongrid, .docols, .coband,
  .jobcard2, .metrics, .fcols, .cta2 { grid-template-columns: minmax(0, 1fr); }
  .grid3 > *, .trust3 > *, .trust4 > *, .sizerow > *, .regiongrid > *, .jobcard2 > * { min-width: 0; }

  /* ---- header: keep the bar, make the menu a full screen drawer ---- */
  .navwrap { position: sticky; top: 0; z-index: 60; }
  .navbar { padding-inline: 16px; }
  .navpill { height: 62px; }
  .navright .langdd summary { padding: 8px 10px; min-height: var(--tap-sm); }
  .burger { width: var(--tap); height: var(--tap); }

  /* full screen drawer: fixed under the header so the burger stays reachable */
  .links {
    position: fixed;
    inset: 0;
    top: 0;
    z-index: 59;                     /* header is 60 -> burger stays above */
    display: none;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: calc(62px + var(--safe-t) + 12px) 20px calc(var(--safe-b) + 20px);
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 100vh;
    min-height: 100dvh;
  }
  body.navopen .links { display: flex; }
  /* .links lives inside .navwrap: raise the header above the tab bar and keep
     the logo/burger above the drawer (same stacking context). */
  body.navopen .navwrap { z-index: 80; }
  .navwrap .logo, .navwrap .navright, .navwrap .burger { position: relative; z-index: 61; }
  .links a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 14px 4px;
    font-size: 17px;
    font-weight: 700;
    border-bottom: var(--hairline) solid var(--line);
    border-radius: 0;
    white-space: normal;
  }
  .links a.on { background: transparent; color: var(--accent); }
  /* drawer footer: WhatsApp + quote, pinned to the bottom of the drawer */
  .m-nav-foot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 18px;
  }
  .m-nav-foot .btn { width: 100%; justify-content: center; min-height: var(--tap); }
  .links .m-nav-foot a.btn { color: #fff; border-bottom: 0; }
  .links .m-nav-foot a.btn.ghost { color: var(--ink); }
  body.navopen { overflow: hidden; }

  /* ---- bottom tab bar ---- */
  .m-tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    background: #fff;
    border-top: var(--hairline) solid var(--line);
    padding-bottom: var(--safe-b);
  }
  .m-tabbar .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: var(--tabbar-h);
    font: 700 11px/1 var(--f);
    letter-spacing: .02em;
    color: var(--muted);
    position: relative;
  }
  .m-tabbar .tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
  .m-tabbar .tab.on { color: var(--ink); }
  .m-tabbar .tab-quote { background: var(--ink); color: #fff; }
  .m-tabbar .tab-quote.on { background: var(--accent); color: #fff; }

  /* ---- catalogue filter: bottom sheet ---- */
  .f-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: var(--tap);
    margin: 10px 0 14px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font: 700 14px/1 var(--f);
    color: var(--ink);
  }
  .f-toggle .n { font-weight: 600; color: var(--muted); }
  .f-backdrop { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(22,20,18,.45); }
  .f-backdrop.show { display: block; }
  .catfilter {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    max-height: 86vh;
    max-height: 86dvh;
    overflow-y: auto;
    margin: 0;
    padding: 18px 16px calc(var(--safe-b) + 18px);
    background: #fff;
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(22,20,18,.18);
    transform: translateY(105%);
    transition: transform .25s ease;
  }
  .catfilter.open { transform: none; }
  .catfilter .inp,
  .catfilter select,
  .catfilter .btn { min-height: var(--tap); font-size: var(--fs-input); width: 100%; }
  .catfilter .inp { flex: 0 0 auto; height: var(--tap); }   /* flex:1 would stretch it to the sheet height */
  .catfilter .fbtn { width: 100%; justify-content: center; }
  .catfilter .cnt { text-align: center; }
  .catfilter .reset { text-align: center; min-height: var(--tap-sm); }

  /* ---- model page ---- */
  .mhead { display: block; }
  .mhead .gal { position: static; }
  .mhead .gal .main { border-radius: 12px; }
  .mhead .gal .main img { min-height: 0; aspect-ratio: 4/3; object-fit: contain; background: #fff; }
  .mhead .thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
    margin-top: 8px;
  }
  .mhead .thumbs img {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 64px; height: 64px;
    min-height: 0;
    padding: 4px;              /* % padding resolves against the wide flex container -> must be fixed px here */
  }
  .mhead .side { margin-top: 18px; }
  .mhead .side h1 { font-size: 26px; }
  .panel { padding: 16px; }
  /* spec table -> key/value rows with comfortable touch height */
  .panel table th, .panel table td { padding: 11px 0; font-size: 15px; }
  .panel table th { width: 46%; }
  /* FAQ accordion (rendered as <details> in the model template) */
  details.faq-item { border-top: var(--hairline) solid var(--line); }
  details.faq-item summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--tap);
    padding: 14px 0;
    font-weight: 700;
    font-size: 15px;
  }
  details.faq-item summary::-webkit-details-marker { display: none; }
  details.faq-item summary::after { content: "+"; color: var(--accent); font-size: 20px; flex: none; }
  details.faq-item[open] summary::after { content: "\2013"; }
  details.faq-item .faq-a { padding-bottom: 14px; color: var(--ink2); }

  /* sticky CTA on model pages */
  .m-sticky {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + var(--safe-b));
    z-index: 65;
    padding: 8px 12px;
    background: #fff;
    border-top: var(--hairline) solid var(--line);
  }
  .m-sticky .btn { flex: 1 1 0; min-height: var(--tap); justify-content: center; }
  .m-sticky .btn.ghost { flex: 0 0 44px; padding: 0; }
  body.has-sticky { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 62px); }

  /* keep in-page scroll targets clear of the fixed tab bar */
  a.btn, .cta a, .mcard, .bcard, .cpill, .brandchip, .pager a { scroll-margin-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
  /* ---- touch targets ---- */
  .btn { min-height: var(--tap); }
  .btn.ghost { min-height: var(--tap); }
  .brandchip, .cpill { min-height: var(--tap-sm); }
  .pager a, .pager .pg { min-height: var(--tap-sm); }
  .langmenu a { min-height: var(--tap); }
  .footcta .btn { width: 100%; justify-content: center; }
  .fnote { line-height: 1.6; }

  /* ---- content pages ---- */
  .phead h1 { font-size: 30px; }
  .prose table { display: block; overflow-x: auto; }
  .abad ul { padding-left: 18px; }
  .cta2.eq .chan { height: auto; }

  /* ---- contact / long tokens (emails, phone numbers) must not blow the track ---- */
  .cta2 > *, .chans, .chan, .infolist, .irow, .panel.form { min-width: 0; }
  .f2 { grid-template-columns: minmax(0, 1fr); }
  .form .inp, .form textarea, .form select { width: 100%; font-size: var(--fs-input); }
  /* .inp carries min-width:240px on desktop -> it would blow a 320px track (K1) */
  .inp, .field, .f2, .field .inp, textarea.inp { min-width: 0; }
  .cnt, .fstat, .panel.form a, .irow a, .chan a, .fnote { overflow-wrap: anywhere; }
  .cnt { white-space: normal; margin-left: 0; }
  .catbr summary { min-height: var(--tap); display: flex; align-items: center; }

  /* short screens (e.g. 320x640): compress the hero so the primary CTA clears the tab bar */
  @media (max-height: 700px) {
    .hero2 { min-height: auto; }
    .hero2 .inner { padding: 58px 0 calc(var(--tabbar-h) + 18px); }
    .hero2 h1 { font-size: clamp(30px, 9vw, 46px); margin-top: 14px; }
    .hero2 .lead { font-size: 15px; margin-top: 12px; }
    .hero2 .cta { margin-top: 18px; }
    .hero2 .trustline { margin-top: 18px; padding-top: 14px; gap: 16px; }
  }

  /* 320px: keep long words and buttons inside the viewport */
  @media (max-width: 360px) {
    .btn { white-space: normal; max-width: 100%; }
    .m-tabbar .tab { font-size: 11px; letter-spacing: 0; }
    .mhead .gal .thumbs img { width: 56px; height: 56px; }
  }

  /* RTL: logical properties already used; flip the drawer list border */
  [dir="rtl"] details.faq-item summary::after { transform: scaleX(-1); }
  [dir="rtl"] .m-tabbar .tab { direction: rtl; }

  /* filter sheet head + close */
  .catfilter .f-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .catfilter .f-head b { font: 800 16px/1.2 var(--f); }
  .catfilter .f-close { width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 22px; line-height: 1; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  }
}

