/* The phone pass.
 *
 * Nothing here changes the desktop. Every rule sits inside a media query,
 * because the desktop layout was already right and the phone was not.
 *
 * Four things were actually wrong, measured at 375px before any of this was
 * written:
 *
 * 1. Data tables were being crushed, not scrolled. A three column table had
 *    about 110px per column, so "United Kingdom, the main road" wrapped over
 *    four lines and one row of the Egypt table ran nearly two screens tall.
 *    Below 700px each row now becomes a card, with the column heading printed
 *    as a small label above its value. mobile-tables.js supplies the labels.
 *
 * 2. h2 rendered larger than h1 (32px against 27.8px), so every section
 *    heading shouted louder than the page title.
 *
 * 3. The smallest labels sat at 10.5px and 11px, which is readable on a
 *    laptop at arm's length and not on a phone in a hospital corridor.
 *
 * 4. Footer and drawer links were 32px tall and tightly stacked, which is
 *    both hard to hit and visually cramped.
 */

@media (max-width: 700px) {

  /* ---------------------------------------------------- 1. DATA TABLES */

  .tw { overflow: visible; border: 0; }
  .tw table,
  .tw thead,
  .tw tbody,
  .tw tr,
  .tw th,
  .tw td { display: block; width: auto; }

  /* The heading row has done its job: its text now rides on each cell. */
  .tw thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .tw table { border-collapse: separate; border-spacing: 0; background: none; box-shadow: none; }

  .tw tbody tr {
    border: 1px solid var(--rule);
    border-radius: 14px;
    background: #fff;
    padding: 4px 16px 14px;
    margin: 0 0 12px;
    box-shadow: 0 16px 34px -30px rgba(6, 38, 70, .5);
  }
  .tw tbody tr:last-child { margin-bottom: 0; }

  /* The row heading becomes the card title. */
  .tw tbody th[scope="row"] {
    padding: 14px 0 10px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 4px;
    font-family: var(--display);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
    text-align: left;
  }

  .tw tbody td {
    padding: 11px 0 0;
    border: 0;
    font-size: 15.5px;
    line-height: 1.6;
    text-align: left;
  }

  /* The column heading, carried over by mobile-tables.js. */
  .tw tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
  }
  /* A cell whose heading repeats the card title would be noise. */
  .tw tbody td[data-label=""]::before { content: none; }

  /* ------------------------------------------------- 2. THE TYPE SCALE */

  /* h1 leads. Everything below it is smaller than it, in order. */
  .body h2, article h2 { font-size: 24px; line-height: 1.22; margin-top: 34px; }
  .body h3, article h3 { font-size: 19px; line-height: 1.3; }

  /* The smallest labels, lifted to a size a phone can actually read. */
  .eyebrow { font-size: 12px; }
  .crumbs { font-size: 12.5px; }
  .meta span { font-size: 12.5px; }
  .hero__note, .fm__k, .rw__hint, .fm__note { font-size: 12.5px; line-height: 1.55; }
  .ft__blurb { font-size: 14px; }
  .src { font-size: 11.5px; }

  /* ------------------------------------------- 3. TAP TARGETS AND RHYTHM */

  .ft a { display: inline-block; padding: 7px 0; }
  .ft ul { margin-top: 2px; }

  /* Buttons reach the full column and keep their own breathing room. */
  .btnrow .btn { width: 100%; justify-content: center; }
  .btnrow { margin: 22px 0; }

  /* Lists were hugging the left edge harder than the prose above them. */
  .body ol, .body ul, article ol, article ul { padding-left: 22px; }
  .body li, article li { margin-bottom: 10px; }

  /* ------------------------------------------------ 4. THE SVG DIAGRAMS */

  /* The nine band scale: the word labels under each bar collapse to specks
     at this width, so the numbers carry it alone. */
  .bscale__lab { display: none; }
  .bhero { padding: 14px; }
}

@media (max-width: 420px) {
  /* The last squeeze. A 320px phone still gets a readable card. */
  .tw tbody tr { padding: 2px 13px 12px; }
  .tw tbody th[scope="row"] { font-size: 18px; }
  .tw tbody td { font-size: 15px; }
}
