/* WalkOnAWire — site-wide responsive safeguards.
   Injected into generated dist pages after scripts/build.mjs.
   Narrow-screen overrides only; existing lesson themes are preserved.
   Do not replace assets/site.css with this file. */

/* Avoid a rigid grid child forcing its *parent page* wider.
   Wide diagrams keep their own horizontal scroll container. */
.grid > *, .main > *, .hero > *, .two > *, .post > *, .pbuild > *,
.labgrid > *, .selrow > *, .cmpbox > *, .fgrid > *, .ev > *,
.mgrid > *, .stats > *, .section-heading > *, .top-nav > *,
.stage-layout > *, .rack-side, .buffer-side, .visual {min-width:0;}
img, video, canvas {max-width:100%;height:auto;}
pre, code, .term, .code, .cfg {overflow-wrap:anywhere;}
/* Keep existing intentional diagram scrolling and do not crop SVG content. */
.topowrap,.tablewrap,.table-scroll,.diagram-scroll,.pipe {max-width:100%;}

@media (max-width: 900px) {
  .site-header .top-nav {gap:10px;flex-wrap:wrap;padding-block:10px;}
  .site-header .navlinks {display:flex;flex-wrap:wrap;gap:8px 14px;}
  .section-heading {align-items:flex-start;}
}
@media (max-width: 600px) {
  /* Preserve every header destination; don't hide Live labs below 400px. */
  .site-header .top-nav {align-items:flex-start;}
  .site-header .navlinks {width:100%;justify-content:flex-start;}
  .site-header .navlinks a {display:inline-flex;padding:5px 0;white-space:normal;}
  .site-header .navlinks a:nth-child(2) {display:inline-flex;}
  .site-header .logo {max-width:100%;min-width:0;}
  .site-header .wa-horizontal-logo {max-width:100%;}
  .lab-item {min-width:0;flex-wrap:wrap;}
  .lab-text {min-width:min(100%,180px);overflow-wrap:anywhere;}
  .go {margin-left:auto;}
  .path-card,.path-info,.panel {min-width:0;}
  .buttons,.actions,.controls,.toolrow,.links {flex-wrap:wrap;}
  .buttons > *, .actions > *, .controls > * {max-width:100%;}
  .detail,.card,.sim {max-width:100%;}
  /* Native wide tables remain usable without shifting the entire page. */
  table.fields,table.maptable,table.vtable,table.frame,table.maptable {
    display:block;max-width:100%;overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
}
@media (max-width: 400px) {
  .site-header .navlinks {font-size:13px;}
  .site-header .navlinks a:nth-child(2) {display:inline-flex;}
  .lab-item {padding:12px;}
  .btn {white-space:normal;overflow-wrap:anywhere;}
}
@media (prefers-reduced-motion: reduce) {
  html {scroll-behavior:auto;}
}
