/* IGCSE360 site-wide layout hardening (ICT Practical Simulators intentionally excluded).
   Applies only to HTML pages which opt in to this stylesheet. */
@media screen {
  /* On flex-column page shells, direct content children must be allowed to shrink.
     The default min-width:auto caused whole-page scrolling on narrow devices. */
  body > main,
  body > .container,
  body > .content,
  body > .wrapper,
  body > .accounting-page,
  body > .business-chapter {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  main, section, article, .container, .ab-page, .econ-page, .accounting-page,
  .business-chapter, .toc-page { min-width: 0; }
  img, video, iframe { max-width: 100%; }
  .table-wrap, .table-responsive, .responsive-table { max-width:100%; overflow-x:auto; }
  .site-footer-global { width: 100%; max-width:100%; min-width:0; box-sizing:border-box; }
}
/* Keep wide ledger and subject tables readable with local horizontal scrolling. */
.sitewide-table-scroll{
  display:block;
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  margin:14px 0;
  border-radius:8px;
}
.sitewide-table-scroll > table { max-width:none; }
.sitewide-table-scroll:focus-visible {outline:2px solid #2563eb;outline-offset:2px;}
/* Avoid long header text creating extra page width on narrow phones. */
@media(max-width:480px){
  header h1,.site-header h1,.alevel-top h1 {max-width:100%;overflow-wrap:anywhere;word-break:normal;}
}
/* Grid children must be shrinkable before their internal scroll areas engage. */
.card-grid > *, .ppc-grid > *, .diagram-card.figure-card {min-width:0;max-width:100%;box-sizing:border-box;}
@media (min-width:651px) and (max-width:850px) {
 .alevel-economics-site .ppc-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
}
/* Smaller Accounting card grids: minmax(270px,1fr) exceeded a 320px viewport. */
@media(max-width:480px){
 .accounting-page .two-column,
 .accounting-page .three-column{
   grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));
 }
}
@media(max-width:480px){
 .accounting-page .partner-ledger{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));}
}

/* 2026-10-21: keep the expanded mobile main menu inside the viewport.
   Several older chapter stylesheets override width but not box sizing. */
@media (max-width:800px) {
  .global-site-nav.nav-open > .site-nav-list,
  .global-site-nav.nav-open .site-nav-list {
    box-sizing: border-box !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}
/* Keep site-wide Search readily accessible when a subject submenu expands. */
@media (max-width:800px) {
  .global-site-nav .site-nav-list > li.search-nav-item { order: -1 !important; }
}
