/* Mobile layout for The Sawdust Bag. Pages use inline styles, so overrides need !important. */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  body *:not(.leaflet-container *) { max-width: 100%; }
  img:not(.leaflet-container img) { height: auto; }
  .leaflet-container { min-height: 360px; }
  img[style*="object-fit"]:not(.leaflet-container img) { width: 100% !important; }

  /* Header: logo on top, menu as one swipeable row */
  header > div { flex-wrap: wrap !important; row-gap: 10px !important; padding: 0 16px !important; }
  header nav { flex-wrap: nowrap !important; justify-content: flex-start !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: 100%; font-size: 14px !important; column-gap: 4px !important; margin: 0 -16px; padding: 0 16px 2px; max-width: none; width: calc(100% + 32px); }
  header nav::-webkit-scrollbar { display: none; }
  header nav a { flex-shrink: 0; padding: 12px 10px; }
  header nav a[style*="border-radius"] { padding: 10px 18px !important; margin-left: 6px; }

  /* Section gutters */
  header ~ section, header ~ footer, header ~ section > div, header ~ footer > div { padding-left: 20px !important; padding-right: 20px !important; }
  section section { padding: 0 !important; }
  section > div > div[style*="padding:80px"], section > div > div[style*="padding: 80px"] { padding-left: 0 !important; padding-right: 0 !important; }
  header ~ section[style*="padding"] { padding-top: 56px !important; padding-bottom: 56px !important; }

  [style*="padding:80px"], [style*="padding: 80px"] { padding-top: 48px !important; padding-bottom: 32px !important; }

  /* Side-by-side columns stack */
  [style*="display:flex"]:has(> [style*="flex:1"] ~ [style*="flex:1"]),
  [style*="display: flex"]:has(> [style*="flex: 1"] ~ [style*="flex: 1"]),
  [style*="display:flex"]:has(> [style*="flex: 1"] ~ [style*="flex: 1"]),
  [style*="display: flex"]:has(> [style*="flex:1"] ~ [style*="flex:1"]) { flex-direction: column !important; min-height: 0 !important; }
  [style*="display:flex"]:not([style*="flex-direction"]), [style*="display: flex"]:not([style*="flex-direction"]) { flex-wrap: wrap; }
  [style*="flex:1"], [style*="flex: 1"] { min-width: 0 !important; min-height: 0 !important; width: auto !important; height: auto !important; }
  [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  [style*="grid-column"] { grid-column: auto !important; }

  /* Type */
  h1 { font-size: clamp(40px, 13vw, 60px) !important; }
  h2 { font-size: clamp(30px, 9vw, 40px) !important; line-height: 1.05 !important; }
  h3 { font-size: min(26px, 7vw); }
  p[style*="width"] { width: auto !important; }
  p[style*="font-size:28px"], p[style*="font-size: 28px"] { font-size: 22px !important; }

  a[href^="tel"], a[href^="mailto"] { white-space: nowrap; }

  /* Tables scroll sideways instead of overflowing */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  td, th { padding: 10px 12px !important; white-space: nowrap; }

  /* Comfortable tap targets and no iOS zoom on form focus */
  input, select, textarea { font-size: 16px !important; }
  a[style*="padding"][style*="border-radius"], button:not(:empty) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }

  /* Home hero: photo and badge move under the text */
  section img[style*="636px"] { position: relative !important; order: 5; width: 100% !important; height: auto !important; aspect-ratio: 4 / 5; object-position: center 58% !important; inset: auto !important; }
  section div[style*="left: 636px"] { z-index: 2; left: 0 !important; top: auto !important; bottom: 16px !important; }
}

/* EN / FR language switcher: beside the logo on phones, menu row underneath */
@media (max-width: 760px) {
  header .lang-switch { order: 1; margin-left: auto; }
  header nav { order: 2; }
  header .lang-switch a { min-height: 34px !important; padding: 0 12px !important; display: inline-flex !important; align-items: center; }
}
