/* Mobile / small-screen layer. Desktop (>800px) is untouched: every rule sits inside the media query. */
@media screen and (max-width: 800px) {
  body { font-size: 14px; background-color: #BDCAA2; }

  /* Header: banner crop + stacked nav */
  .header { width: auto; height: auto !important; background: none; }
  h1 { padding: 0; height: 125px; background: url("https://www.invisiblewall.net/layout/header.jpg") -60px 0 no-repeat #5C8A03; }
  h1 a { width: 100%; height: 125px; }
  .nav { width: auto; height: auto; padding: 0; background: #5C8A03; }
  .nav ul { display: flex; flex-wrap: wrap; }
  .nav li { flex: 1 1 33.333%; display: block; }
  .nav a { float: none; width: auto; padding: 12px 4px; font-size: 15px; border-right: 0; border-bottom: 1px solid #4C8305; }
  .subnav { width: auto; height: auto; margin: 0; padding: 0; }
  .subnav ul { display: flex; flex-wrap: wrap; }
  .subnav li { display: block; }
  .subnav a { float: none; padding: 9px 12px; }
  .title { width: auto; height: auto; background-image: none !important; background: #fff !important; }
  .title span { display: block; padding: 10px 12px 0; color: #4C8305; font: bold 20px "Arial", sans-serif; }

  /* Main column */
  .main { width: auto; max-width: none; margin: 0; background: #fff; }
  .content { padding: 8px 12px 5px 12px; }
  .content img, .content iframe, .content object, .content embed, .content video { max-width: 100%; height: auto; }
  h3 { width: auto; margin-right: 0; font-size: 18px; }
  blockquote { width: auto; padding: 12px; }
  #sidebar { float: none; width: auto; margin-left: 0; }
  .block { margin-left: 0; padding-right: 0; }

  /* Floated boxes stack */
  .mainsplit, .mainsplit2, .poll, .gallery, .gallerycontainer, .commentbox, .v_gallery, .f_gallery, .rightimg { float: none; width: auto; margin: 0 0 15px 0; }
  .mainsplit div, .mainsplit2 div { height: auto; padding: 0 10px; }
  .poll div { padding: 0 10px 8px; }
  .gallerycontainer, .gallery, .v_gallery, .f_gallery { padding: 12px; }
  .v_galleryitem { float: none; width: auto; height: auto; margin: 0 0 12px 0; }
  .galleryitem { margin: 0 8px 8px 0; }
  .content > p, .content > h3 { clear: both; }

  /* Home "Latest News" banner */
  .widepic, .rtopWidepic *, .rbottomWidepic * { background: #5C8A03; }
  .widepic div { margin: 0; width: auto; padding: 12px; }
  .widepic a:link, .widepic a:visited { color: #fff; text-decoration: underline; }

  /* Legacy tables (home video thumbnails) */
  .content td { display: inline-block; width: 45% !important; vertical-align: top; }
  .content td[colspan] { display: block; width: auto !important; }

  /* Footer */
  .footer { width: auto; height: auto; background: #fff; overflow: hidden; padding-bottom: 10px; }
  #footerleft, #footerright { float: none; width: auto; padding: 8px 12px 0; text-align: left; }

  /* Stage 4 QA: stop long words/URLs and form fields forcing horizontal scroll */
  .content, .content p, .post, .post p, .post li { overflow-wrap: anywhere; word-wrap: break-word; }
  .content input[type="text"], .content input[type="email"], .content textarea { box-sizing: border-box; width: 100%; max-width: 100%; }
  /* Stage 4 QA: imported posts carry inline hr widths; contact form table must stack */
  .content hr { width: 95% !important; max-width: 100%; }
  #myform table, #myform tbody, #myform tr, #myform td { display: block; width: 100% !important; box-sizing: border-box; text-align: left; }
  #myform input:not([type="submit"]), #myform textarea { box-sizing: border-box; width: 100%; max-width: 100%; }
  #myform td[align="right"] { text-align: left; padding-top: 6px; }
}
