/* Responsive adaptation of the recovered 2013-2017 XMD "Platina" theme.
   The original stylesheet is fixed-width (912px content column); these
   narrow-screen rules keep the same layout and palette without horizontal
   page overflow. */

@media (max-width: 960px) {
  body > div > table {
    width: 100% !important;
  }

  body > div > table > tbody > tr {
    display: block;
  }

  td.lside,
  td.rside {
    display: none;
  }

  /* Header montage: keep both original images side by side, scaled down. */
  td.header {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 2px;
    padding: 4px;
  }

  td.header img {
    min-width: 0;
    max-width: 100%;
    height: auto;
  }

  /* Main menu: the original single row wraps instead of overflowing. */
  .mainmenubar {
    height: auto;
    padding: 2px 0;
  }

  .mainmenubar > table,
  .mainmenubar > table > tbody,
  .mainmenubar > table > tbody > tr {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .mainmenubar td {
    display: block;
  }

  a.mainmenuitem,
  a.mainmenuitems {
    margin: 1px 2px;
    padding: 3px 7px;
  }

  /* Content shell: stack the left column, article column and right column. */
  .contentbox {
    display: block;
    width: auto !important;
    height: auto !important;
    overflow: hidden;
  }

  .contentbox > table,
  .contentbox > table > tbody,
  .contentbox > table > tbody > tr,
  .contentbox > table > tbody > tr > td {
    display: block;
    width: auto;
    height: auto;
  }

  .contentbox > table > tbody > tr > td > table,
  .contentbox > table > tbody > tr > td > table > tbody,
  .contentbox > table > tbody > tr > td > table > tbody > tr,
  .contentbox > table > tbody > tr > td > table > tbody > tr > td {
    display: block;
    width: auto;
    height: auto;
  }

  td.lcont {
    width: auto !important;
    height: auto !important;
    margin: 0;
    padding: 6px;
    border-right-width: 0;
    border-bottom: 3px double #e0e0e0;
  }

  td.mcont {
    margin: 0;
    padding: 6px;
    overflow: hidden;
  }

  td.rcont {
    width: auto !important;
    height: auto !important;
    padding: 6px;
    border-left-width: 0;
    border-top: 1px solid #e0e0e0;
    text-align: center;
  }

  /* The theme's screen-only spacer <br> run creates a large mobile gap. */
  .printhide {
    display: none;
  }

  .lcont .box1,
  .rcont .box1,
  .rcont .box2 {
    width: auto;
    max-width: 100%;
  }

  .lcont .box1:has(table[summary="minibox"]),
  .rcont .box1:has(table[summary="minibox"]),
  .rcont .box2 {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .lcont table,
  .rcont table,
  .mcont table {
    max-width: 100%;
  }

  .mcont img,
  .lcont img,
  .rcont img {
    max-width: 100%;
    height: auto;
  }

  .image42,
  .image43 {
    max-width: 45%;
    height: auto;
  }

  .mainheadline,
  .listheadline,
  h1,
  h2,
  h3,
  h4 {
    overflow-wrap: break-word;
  }
}

@media (max-width: 560px) {
  td.header {
    padding: 2px;
  }

  .image42,
  .image43 {
    float: none;
    display: block;
    margin: 4px auto;
    max-width: 100%;
  }

  .contentbox {
    border-width: 1px;
  }

  td.mcont,
  td.lcont,
  td.rcont {
    padding: 4px;
  }

  /* The original tables mix fixed pixel widths, long URLs and underscore
     separators. Constrain them inside the mobile column without changing
     the desktop presentation. */
  body > div > table {
    table-layout: fixed;
  }

  td.contentbox {
    box-sizing: border-box;
    width: 100% !important;
  }

  td.contentbox > table,
  .contentbox > table > tbody > tr,
  .contentbox > table > tbody > tr > td {
    max-width: 100% !important;
  }

  td.mcont {
    box-sizing: border-box;
    width: auto !important;
    margin: 0 !important;
    overflow-wrap: anywhere;
    overflow-x: auto;
  }

  td.mcont,
  td.mcont * {
    box-sizing: border-box;
  }

  td.mcont table {
    width: 100% !important;
    max-width: 100% !important;
  }

  td.mcont table[width] {
    width: 100% !important;
  }

  td.mcont table[width] td[width] {
    width: auto !important;
  }

  td.mcont table[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  td.mcont td {
    overflow-wrap: anywhere;
  }
}

/* Gallery pages use three-column cards. Fixed layout keeps a surviving
   archived photo in its original column width when sibling photos are
   unavailable. */
.mcont table[cellspacing="4"] {
  width: auto !important;
}

.mcont table[cellspacing="4"] td.boxed {
  width: auto !important;
}
