/* Layout for the top bar and small screens. Loaded after w3.css and w3schools.css. */

/* ---------- top bar (all screens) ---------- */

.topnav {
  display: flex;
  align-items: stretch;
  overflow: visible;          /* the phone drop-down hangs below the bar */
  z-index: 10;
  top: 0;
}
.topnav a, .topnav form { float: none; }
.topnav form.search {
  display: flex;
  align-items: center;
  padding: 0 16px;
}
.topnav form.search input { float: none; }
.topnav form.search input[type=search] { height: 24px; }

.menu { display: flex; flex: 1; }
.menu-right { display: flex; flex-direction: row-reverse; margin-left: auto; }

.menu-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 0;
  color: #f2f2f2;
  font-size: 24px;
  line-height: 1;
  padding: 0 16px;
  cursor: pointer;
}
.menu-toggle:hover, .topnav.open .menu-toggle { background-color: #555; }

/* keep table rows as compact as they were (pages used to render in quirks mode) */
.w3-table td, .w3-table th { line-height: 1.2; }

/* sortable column headers look clickable */
table.sortable th { cursor: pointer; }

/* home page: bulleted text on the left, picture on the right, tops aligned */
.home-body { display: flex; align-items: flex-start; gap: 48px; margin-top: 32px; padding: 0 24px; }
.home-text { flex: 3; }
.home-img { flex: 2; }
.home-img img { width: 100%; height: auto; display: block; }
.home-section { font-weight: bold; margin: 0 0 4px; }
.home-text ul { margin: 0 0 20px; padding-left: 24px; }
.home-text li { margin: 2px 0; }
.home-updated { margin-top: 28px; color: #555; }

/* images never wider than the screen */
img.a3, img.a4, img.chart { max-width: 100%; height: auto; }

/* wide maths scrolls inside its own box */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }

/* ---------- phones and narrow windows ---------- */

@media (max-width: 900px) {
  .menu-toggle { display: block; }

  .topnav form.search { flex: 1; min-width: 0; padding: 0 8px; }
  .topnav form.search input[type=search] { width: 100%; min-width: 0; font-size: 16px; height: 30px; }
  .topnav form.search input[type=submit] { height: 30px; }

  .menu {
    display: none;
    position: absolute;
    top: 44px;
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: #333;
    box-shadow: 0 6px 12px rgba(0, 0, 0, .3);
  }
  .topnav.open .menu { display: flex; }
  .menu-right { flex-direction: column; margin-left: 0; border-top: 1px solid #555; }
  .menu a { text-align: left; padding: 12px 20px; }

  /* quote box: less of the screen */
  .wise { font-size: 13px; padding: 0 8px; }
  .wise p { margin: 8px 0; }

  /* filter bars: wrap cleanly, controls big enough to tap, 16px stops iOS zooming in */
  form.bar { line-height: 2.8; margin: 4px 8px; }
  form.bar input, form.bar select { font-size: 16px; line-height: normal; height: 32px; padding: 2px 4px; vertical-align: middle; }

  /* wide tables scroll sideways inside their own box instead of widening the page */
  table.w3-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table.w3-table td, table.w3-table th { padding: 6px 8px; }
  /* player column (set by site.js) stays put while the numbers scroll */
  table.w3-table .pin { position: sticky; left: 0; z-index: 1; background-color: #fff; }
  table.w3-table tr:nth-child(even) .pin { background-color: #f1f1f1; }
  table.w3-table .pin { box-shadow: 2px 0 3px -2px rgba(0, 0, 0, .35); }

  /* multi-column chart grids become one column */
  .column2, .column3 { width: 100%; float: none; padding: 5px 0; }

  /* charts and figures use the full width */
  img.chart, .a4 img, .a3 img { width: 100% !important; height: auto; }

  /* home page: no picture on phones */
  .home-img { display: none; }
  .home-body { padding: 0 16px; }

  h1 { font-size: 28px; }
}
