/* Base overrides injected by tooling to improve layout */

/* Ensure page background is white (override legacy gray) */
html, body { background-color: #ffffff; }

/* Also force legacy wrapper to white */
#wrapper { background: #ffffff; width: 100%; max-width: 960px; margin: 0 auto; }

/* Center all index page content and restore background image */
body#index-page, html#index-page {
  background-color: #ffffff;
  background-image: url('../zz_img_index/background/banner/tile.jpg');
  background-repeat: repeat;
}

/* Center main container for index */
main#main-content .container > div { margin-left: auto; margin-right: auto; max-width: 960px; text-align: center; }
main#main-content table { margin-left: auto !important; margin-right: auto !important; }

/* Center Return to Physics Forums link */
footer .return-pf { text-align: center; margin: 24px 0; }
footer .return-pf a { color: #000; text-decoration: none; font-weight: 600; }
footer .return-pf a:hover { text-decoration: underline; }

/* Global responsive enhancements */
*, *::before, *::after { box-sizing: border-box; }
img, video, iframe { max-width: 100%; height: auto; }
pre, code { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

/* Legacy two-column panels: stack on small screens */
@media (max-width: 768px) {
  .leftbar { float: none; width: auto; text-align: left; padding: 10px 12px; }
  .text, .text_even, .text_odd { float: none; width: auto; }
  .topicPage #footer { padding-left: 0; width: auto; }
  body { padding-left: 8px; padding-right: 8px; }
  /* Tables should scroll horizontally if too wide */
  .text table, .text_even table, .text_odd table { display: block; width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.simple { max-width: 100%; }
  /* Converted layout blocks collapse to single column */
  .layout .row .cell { flex: 1 1 100% !important; }
}

/* If a panel lacks .leftbar, let the content fill the full width */
.panel:has(.text):not(:has(.leftbar)) .text {
  float: none;
  width: auto;
}
.panel:has(.text_even):not(:has(.leftbar)) .text_even {
  float: none;
  width: auto;
}
.panel:has(.text_odd):not(:has(.leftbar)) .text_odd {
  float: none;
  width: auto;
}

/* Remove unintended left gutter when dropdowns are used */
.dropdown-content { left: 0; }
