/* ============================================================
   Mobile navigation drawer + mobile-hardening layer
   Loaded on every page. Purely additive — desktop (>800px) is
   untouched; all rules are gated to small screens or are safe
   global hardening (overflow guard, tap targets, text-size-adjust).
   ============================================================ */

/* ---- Global hardening (safe at all sizes) ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
*, a, button { -webkit-tap-highlight-color: rgba(0,94,170,0.18); }
/* Never allow a stray wide element to cause horizontal scroll on phones */
@media (max-width: 800px) {
  html, body { max-width: 100%; overflow-x: hidden; }
}

/* ---- Hamburger toggle button (hidden on desktop) ---- */
.mnav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-0, #0b0d12);   /* dark by default → visible on light navs (catalogue, about, contact, etc.); homepage flips it white over its dark hero */
  margin-left: 6px;
  border-radius: 10px;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.nav.is-attached .mnav-toggle { color: var(--ink-0, #0b0d12); }  /* dark once nav sits on white */
.mnav-toggle .mnav-bars { position: relative; width: 22px; height: 16px; display: block; }
.mnav-toggle .mnav-bars span {
  position: absolute; left: 0; height: 2px; width: 100%;
  background: currentColor; border-radius: 2px;
  transition: transform .28s ease, opacity .2s ease, top .28s ease;
}
.mnav-toggle .mnav-bars span:nth-child(1) { top: 0; }
.mnav-toggle .mnav-bars span:nth-child(2) { top: 7px; }
.mnav-toggle .mnav-bars span:nth-child(3) { top: 14px; }
/* Animated X when open */
body.mnav-open .mnav-toggle .mnav-bars span:nth-child(1) { top: 7px; transform: rotate(45deg); }
body.mnav-open .mnav-toggle .mnav-bars span:nth-child(2) { opacity: 0; }
body.mnav-open .mnav-toggle .mnav-bars span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

/* ---- Backdrop + drawer ---- */
.mnav-backdrop {
  position: fixed; inset: 0; z-index: 998;
  background: rgba(8,11,18,0.55);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
}
body.mnav-open .mnav-backdrop { opacity: 1; visibility: visible; }

.mnav-drawer {
  position: fixed; top: 0; right: 0; z-index: 999;
  height: 100dvh; width: min(86vw, 340px);
  background: #0e1320;
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -18px 0 48px -16px rgba(0,0,0,0.6);
  transform: translateX(100%);
  transition: transform .34s cubic-bezier(.22,.8,.26,1);
  display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
body.mnav-open .mnav-drawer { transform: translateX(0); }

.mnav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.mnav-drawer-head .mnav-brand {
  font-family: 'Cabinet Grotesk','Switzer',sans-serif; font-weight: 800;
  font-size: 15px; color: #fff; letter-spacing: .01em;
}
.mnav-drawer-head .mnav-brand small {
  display: block; font-family: 'Geist Mono', monospace; font-size: 9.5px;
  letter-spacing: .18em; color: rgba(255,255,255,.5); text-transform: uppercase;
}
.mnav-close {
  width: 40px; height: 40px; border: 0; background: rgba(255,255,255,.06);
  color: #fff; border-radius: 10px; font-size: 20px; cursor: pointer;
  display: grid; place-items: center;
}

.mnav-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mnav-links a {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px;                 /* generous touch target */
  padding: 6px 8px;
  color: #e9edf4; text-decoration: none;
  font-family: 'Cabinet Grotesk','Switzer',sans-serif; font-weight: 600; font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: color .2s, padding-left .2s;
}
.mnav-links a:active { color: #ffb800; padding-left: 12px; }
.mnav-links a.is-current { color: #ffb800; }

.mnav-actions { margin-top: auto; padding-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.mnav-actions a {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; border-radius: 12px; text-decoration: none;
  font-family: 'Cabinet Grotesk',sans-serif; font-weight: 700; font-size: 15px;
}
.mnav-actions svg { width: 18px; height: 18px; }
.mnav-cta-wa { background: #25D366; color: #fff; }
.mnav-cta-wa svg { fill: currentColor; }
.mnav-cta-call { background: #ffb800; color: #0a0d12; }
.mnav-cta-quote { background: #fff; color: #0a0d12; border: 1px solid rgba(0,0,0,.08); }

/* ---- Show the toggle, hide the inline links, on phones/tablets ---- */
@media (max-width: 800px) {
  .mnav-toggle { display: inline-flex; }
}
@media (min-width: 801px) {
  /* desktop: drawer + backdrop never render */
  .mnav-drawer, .mnav-backdrop, .mnav-toggle { display: none !important; }
}

/* ---- Touch-target hardening + legibility for on-site buyers (gloves off, sun) ---- */
@media (max-width: 800px) {
  .nav-cta { min-height: 44px; display: inline-flex; align-items: center; }
  /* >=44px hit areas on the small controls people actually tap */
  .si-clear, .cat-prod-fav, .product-card-fav, .wl-card-remove { min-width: 44px; min-height: 44px; }
  .btn-primary, .btn-ghost, .msr-wa, .wl-inquire-all, .scp-card-link, .cat-tab { min-height: 44px; }
  .cat-tab { display: inline-flex; align-items: center; }
  /* nudge the smallest labels a notch up for legibility in bright light */
  .scp-pcard-spec, .msr-s, .cat-prod-card p, .tm-sub { font-size: 12px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .mnav-drawer, .mnav-backdrop, .mnav-toggle .mnav-bars span { transition: none !important; }
}
