/* The portal on a tablet and on a phone. Loaded last, so it only changes what a narrow screen needs:
   the side menu becomes a strip across the top, side-by-side blocks stack, and a wide table scrolls inside its own
   card and never pushes the page sideways. Nothing here changes the desktop look (1100 px and wider). */

@media (max-width: 1100px) {
  /* the menu moves to the top */
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: baseline; padding: 16px 20px 0; }
  .side .logo { width: 104px; }
  .side .cap { margin: 0 0 0 12px; }
  .side .who { display: none; }                 /* the top bar already says who you are */
  .nav { margin: 12px -20px 0; padding: 0 12px; width: calc(100% + 40px); display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .nav a { flex: 0 0 auto; width: auto; white-space: nowrap; padding: 12px 12px 11px; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; }
  .nav a.on { border-left-color: transparent; border-bottom-color: var(--gold2); background: linear-gradient(0deg, rgba(233,213,166,.16), rgba(233,213,166,0)); }
  .nav i { display: none; }
  .hdr { position: static; }
  .ribbon { padding: 7px 20px; }
  .top { padding: 12px 20px; flex-wrap: wrap; row-gap: 8px; }
  .page { padding: 26px 20px 52px; }

  /* a wide table scrolls inside its card */
  /* position: relative keeps the hidden screen-reader labels in a table's heading inside the card, so they cannot widen the page */
  .card:has(table), .modal .in:has(table), .doc:has(table) { overflow-x: auto; position: relative; }
  .card > table.wrap, .card > table.t2, .card > table.t3, .card > table.t4, .card > table.tl, .card table.rates { min-width: 640px; }
  table.rates { table-layout: auto; }
}

@media (max-width: 720px) {
  h1 { font-size: 31px; line-height: 1.12; }
  .ribbon { font-size: 8px; letter-spacing: .1em; }
  .top .sp { margin-left: 0; }
  .card { padding: 18px 16px; }
  .page { padding: 22px 14px 48px; }
  .side { padding: 14px 14px 0; } .nav { margin: 10px -14px 0; width: calc(100% + 28px); padding: 0 6px; }
  .ribbon, .top { padding-left: 14px; padding-right: 14px; }

  /* everything that sat side by side now stacks */
  .g2, .g3, .g21, .dgrid, .f2, .f3, .f4, .f31, .prod, .tiles, .applyscr,
  .bz .g3, .bz .g4, .bz .g12, .bz .hero, .bz .goldsplit, .bz .f3b, .bz .rwall,
  .doc .parties, .doc .parties.three, .inv .pp, .inv .pp.four { grid-template-columns: minmax(0, 1fr); }
  .kv, .modal .doc dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .kv dd, .modal .doc dl.kv dd { margin-bottom: 8px; }
  .bz .next { grid-template-columns: 96px minmax(0, 1fr); }
  .sum { position: static; }
  .acts { flex-wrap: wrap; }
  .row { flex-wrap: wrap; }

  /* say that a wide table can be swiped (it is cut off at the edge of its card) */
  .card:has(> table.wrap)::before, .card:has(> table.t2)::before, .card:has(> table.t3)::before, .card:has(> table.t4)::before, .card:has(> table.tl)::before {
    content: 'Swipe sideways to see the whole table.'; display: block; position: sticky; left: 0; margin-bottom: 10px; font-size: 12.5px; color: var(--slate); }

  /* the stand-in sign-in and pop-ups */
  .whoscr .ph { display: none; } .whoscr .tx { padding: 34px 20px 44px; } .whoscr h1 { font-size: 36px; }
  .ov { padding: 10px; grid-template-columns: minmax(0, 1fr); } .modal { width: 100%; max-height: calc(100vh - 20px); } .modal .in { padding: 20px 18px 22px; }
  .modal .im { height: 110px; }
  .step button { width: 42px; height: 42px; } .step input { height: 42px; }
  .fin .qa, .card .qa { padding: 9px 0 7px; }
  .toast { max-width: calc(100vw - 28px); }

  /* the public apply page */
  .applymain { padding: 20px 14px 44px; } .applyside { padding: 30px 20px 26px; }

  /* buttons are easy to hit with a thumb */
  .btn, .cartb, .nav a { min-height: 44px; } .btn.sm { min-height: 40px; }
  input, select, textarea { font-size: 16px; }   /* 16 px stops a phone zooming in when a box is tapped */
}
