/* Deckard on a phone. Loaded last, after the layout (application.css) and the look (theme.css),
   so what is here only has to say what changes when the screen is narrow.

   The rules of the pass:
   - The page itself never scrolls sideways. A table that is wider than the screen scrolls inside
     its own panel instead.
   - Anything you tap is at least 36px tall.
   - Nothing is hidden that carries information; only decoration and repeats go. */
@media (max-width: 760px) {
  /* Top bar: the name and sign-out on one line, the sections on a strip that scrolls sideways
     underneath (nav_controller.js brings the current one into view). */
  .topbar { height: auto; flex-wrap: wrap; padding: 0 12px; gap: 0 12px; }
  .topbar-left { display: contents; }
  .brand { order: 1; padding: 12px 0; }
  .topbar-right { order: 2; margin-left: auto; }
  .account-name { max-width: 46vw; }
  .account-menu .menu-body { width: max-content; min-width: 200px; max-width: calc(100vw - 24px); }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; margin: 0 -12px; padding: 0 6px; gap: 0; scrollbar-width: none; align-items: center;
         border-top: 1px solid rgba(255, 255, 255, .1); }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { flex: none; padding: 12px 9px 10px; }

  .container { padding: 14px 12px 32px; }
  .page-head { margin-bottom: 12px; gap: 10px; }
  h1 { font-size: 18px; overflow-wrap: anywhere; }

  /* Panels: tighter, and a wide table scrolls inside its panel. */
  .card:not(.waterfall) { padding: 12px; overflow-x: auto; }
  .table th { white-space: nowrap; }
  .table td.name-col, .table td.op-col, .table td.issue-col { max-width: 250px; }
  .error-sub { max-width: 250px; }
  .list li { flex-wrap: wrap; }
  .facts { gap: 12px 18px; }
  .kv th { width: 40%; overflow-wrap: anywhere; }
  .token { overflow-wrap: anywhere; }
  .callout { padding: 10px 12px; }
  .callout ul { padding-left: 18px; }
  .menu-body, .help .menu-body { min-width: 0; width: max-content; max-width: calc(100vw - 24px); }

  /* Numbers two to a row. */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 10px 12px; }
  .tile-value { font-size: 20px; }
  .grid-3, .charts { gap: 10px; }

  /* Things to tap. Inputs, selects and buttons are one height here too, and tall enough for a thumb. */
  :root { --control: 44px; --control-sm: 36px; }
  .btn { padding: 0 13px; }
  .btn-sm { padding: 8px 11px; }
  .tab { padding: 10px 11px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  .tabs-minor { gap: 6px; }
  .tabs-minor .tab { padding: 8px 11px; }
  .filters .inline { flex-wrap: wrap; }
  /* A filter form: the search box takes a line, the selects and the number share the next ones
     evenly, and the button takes the last. Nothing is left ragged at the right. */
  .filters input[type=search] { flex: 1 1 100%; width: auto; }
  .filters select, .filters input.num { flex: 1 1 138px; width: auto; min-width: 0; max-width: 100%; }
  form.filters > .btn { flex: 1 1 100%; justify-content: center; }
  .range-window { margin-left: 0; flex: 1 1 100%; white-space: normal; }
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number], select { font-size: 16px; }
  input.rename-input { min-width: 230px; }
  .filters .filter-menu { flex: 1 1 138px; min-width: 0; }
  .filters .filter-menu summary { display: flex; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bulk-actions .btn-sm { flex: 1 1 auto; justify-content: center; }
  .digest-toggle { padding: 6px 0; }
  .chart-table summary, .frames details > summary { padding: 8px 0; }

  /* A wide chart keeps a readable size and scrolls sideways; shrunk to the screen its labels
     would be a few pixels tall. */
  .chart { padding: 10px 10px 6px; }
  .chart-wide .chart-plot { overflow-x: auto; }
  .chart-wide .chart-plot svg { min-width: 640px; }

  /* Trace summary: the bar repeats the percentage beside it. */
  .digest .summary-cell, .digest th:last-child { display: none; }
  .table tr.digest-detail > td { padding: 10px 8px 12px 12px; }
  /* An opened row is as wide as its table, which can be wider than the screen. The statement in
     it stays the width of the screen and in view, so it is read without scrolling sideways. */
  .digest-detail pre.code { position: sticky; left: 0; max-width: calc(100vw - 68px); }

  /* Timeline: name and duration on one line, the bar under them at full width; shallower steps. */
  .span-row > summary { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 10px; }
  .span-row > summary .bar-svg { grid-column: 1 / -1; }
  .span-detail { padding: 10px; }
  .depth-1 { padding-left: 6px; } .depth-2 { padding-left: 12px; } .depth-3 { padding-left: 18px; } .depth-4 { padding-left: 24px; }
  .depth-5 { padding-left: 30px; } .depth-6 { padding-left: 36px; } .depth-7 { padding-left: 42px; } .depth-8 { padding-left: 48px; }
  .depth-9 { padding-left: 54px; } .depth-10 { padding-left: 60px; } .depth-11 { padding-left: 66px; } .depth-12 { padding-left: 72px; }

  /* Sign-in and the loading line. */
  .auth-body { padding: 16px; }
  .auth-card { padding: 28px 20px 24px; }
  .brand.big { font-size: 40px; }
  .neon-alt { letter-spacing: .4em; }
  .loading { bottom: 14px; padding: 14px 16px 12px; }
  .loading blockquote { font-size: 14px; }
}
