/* 
  Quick mobile fixes for legacy KompoZer / LibreOffice / Word-exported pages
  Add this line in the <head> of old .html files:
  <link rel="stylesheet" href="responsive-fixes.css">
  
  Or paste the content inside a <style> tag.
*/

:root {
  --legacy-max-width: 1000px;
}

body {
  font-size: 16px !important; /* Prevent tiny text on mobile */
  line-height: 1.5;
}

/* Make all images fluid */
img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}

/* Legacy tables: become full-width and allow content to breathe */
table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse;
}

/* On very small screens, stack table cells vertically when possible */
@media (max-width: 640px) {
  table tr {
    display: block;
    margin-bottom: 1rem;
  }
  
  table td,
  table th {
    display: block;
    width: 100% !important;
    padding: 8px !important;
    box-sizing: border-box;
  }
  
  /* Slightly larger tap targets */
  a {
    padding: 4px 0;
    display: inline-block;
    min-height: 28px;
  }
}

/* ============================================
   STRONG FIXES FOR THE BIG FAMILY PAGE TABLE
   (bosomworth family.html - 1583px wide table)
   ============================================ */
@media (max-width: 768px) {
  /* Target the main family page table specifically */
  table[width="1583"],
  table[style*="width:1583"] {
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
  }

  /* Force all three columns to become full-width blocks */
  table[width="1583"] td[width="246"],
  table[width="1583"] td[width="524"],
  table[width="1583"] td[width="796"],
  table[style*="1583"] td[width="246"],
  table[style*="1583"] td[width="524"],
  table[style*="1583"] td[width="796"] {
    display: block !important;
    width: 100% !important;
    float: none !important;
    padding: 10px 8px !important;
    border: 1px solid #ddd !important;
    margin-bottom: 8px !important;
    background: white !important;
  }

  /* Make images inside the family page scale nicely */
  table[width="1583"] img,
  table[style*="1583"] img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Improve text size on the family page for phones */
  table[width="1583"] font[size="+3"],
  table[style*="1583"] font[size="+3"] {
    font-size: 22px !important;
  }

  table[width="1583"] font[size="+2"],
  table[style*="1583"] font[size="+2"] {
    font-size: 18px !important;
  }
}

/* Readable headings */
h1, h2, h3, font[size] {
  line-height: 1.25 !important;
}

/* Prevent horizontal scroll on old fixed layouts */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Make the very old fixed 1000px+ containers usable */
[style*="width: 1007"],
[style*="width:1583"],
[style*="width: 1324"],
table[width="1583"],
table[width="1007"] {
  width: 100% !important;
  max-width: 100% !important;
}

/* Slightly nicer links for touch */
a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* When the old page has a massive table as the entire layout, give it breathing room */
body > table:first-of-type {
  margin: 0 auto;
  padding: 12px;
}

/* Print / very large desktop still looks decent */
@media (min-width: 1100px) {
  body > table {
    max-width: 980px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}