/* ═══════════════════════════════════════════════════════════════════════
   LONG-FORM, ON A PHONE

   The Rules of the Game briefings and the longer Voice of Volge pieces are
   built as fixed-canvas documents: a .book 1080px wide holding .pg pages
   locked to 1080 x 1350, in the manner of a printed briefing rather than a
   web page. On a 390px screen that forces the whole document to scroll
   sideways, and scaling it to fit would put the body text at roughly 4px.

   So below 860px the canvas is released: pages take the width they are
   given and the height their content needs, every multi-column grid folds
   to one column, the generous print margins come in, and tables scroll
   inside their own box rather than pushing the page wide.

   Loaded after each page's own <style>, so these rules win without any
   edit to the original design. Above 860px nothing here applies and the
   document renders exactly as drawn.
   ════════════════════════════════════════════════════════════════════════ */

/* Nothing should ever push the document sideways, at any width. */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }

@media (max-width: 860px) {

  /* ── the canvas ──────────────────────────────────────────────────── */
  .book {
    width: 100% !important; max-width: 100% !important;
    padding: 10px 0 !important; gap: 12px !important;
  }
  .pg {
    width: 100% !important; max-width: 100% !important;
    height: auto !important; min-height: 0 !important;
    overflow: visible !important;
    padding: 30px 20px !important;
  }

  /* Cover art is absolutely positioned at the canvas size. Put it back in
     flow so the page can size to it instead of clipping it. */
  .cvx-visual {
    position: relative !important;
    left: auto !important; right: auto !important; top: auto !important;
    width: 100% !important; height: auto !important;
  }
  .cvx-visual img { width: 100% !important; height: auto !important; }
  .cvx-visual svg { width: 100% !important; height: auto !important; }
  .cvx-type {
    position: static !important;
    left: auto !important; right: auto !important; height: auto !important;
    padding: 26px 20px !important;
  }

  /* ── every multi-column grid folds ───────────────────────────────── */
  .five, .callrow, .bbb, .mxgrid, .itrow, .chips,
  .pills.grid2, .imprint-grid, .tl-row, .grid2, .grid3, .grid4 {
    grid-template-columns: 1fr !important;
  }
  /* items that spanned several of those columns no longer can */
  .fv, .fv.g, [class*="span"] { grid-column: auto !important; }

  /* These documents also declare grids inline, which no class selector can
     reach. Below 860px a single column is right for all of them, so the
     attribute selector catches whatever the markup declares. */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  [style*="grid-column"]           { grid-column: auto !important; }
  /* inline multi-column text would be unreadable at this width too */
  [style*="column-count"]          { column-count: 1 !important; }

  /* ── print margins come in ───────────────────────────────────────── */
  .opener      { margin: 0 0 22px !important; padding: 24px 20px !important; }
  .quotepanel  { padding: 28px 22px !important; }
  .call        { padding: 20px 18px !important; }
  .bb          { padding: 24px 18px !important; }
  .scn .bb     { padding: 26px 18px !important; }
  .mth .it     { padding: 22px 18px !important; }
  .it          { padding: 20px 16px !important; }
  .mx-cell     { padding: 18px 16px !important; }
  .pills.grid2 .pill { padding: 18px 16px !important; }
  .layer       { padding: 16px 16px !important; }
  .tl-row      { padding: 20px 0 !important; gap: 10px !important; }
  .tail10 .tl-row { padding: 20px 0 !important; }
  .wtd .act    { padding: 18px 2px !important; }
  .ex-head, .roomy .ex-head { padding: 14px 16px !important; }
  .ex-body, .roomy .ex-body { padding: 10px 16px 18px !important; }

  /* ── tables scroll inside themselves ─────────────────────────────── */
  table {
    display: block; width: 100%; max-width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  thead th, tbody td,
  .roomy thead th, .roomy tbody td { padding: 10px 10px !important; }

  /* ── stacked flex rows ───────────────────────────────────────────── */
  .ex-head { flex-wrap: wrap; gap: 6px; }
  .toc a   { padding: 14px 2px !important; }

  /* Inline flex rows set to space-between have no wrap, so on a narrow
     screen their two ends slide over each other instead of stacking. */
  [style*="space-between"] { flex-wrap: wrap !important; row-gap: 4px; }

  /* Wide tracking is a print affectation. At 330px a running head set at
     .32em is wider than the screen on its own. */
  [style*="letter-spacing:.32em"], [style*="letter-spacing: .32em"],
  [style*="letter-spacing:.28em"], [style*="letter-spacing: .28em"],
  [style*="letter-spacing:.2em"],  [style*="letter-spacing: .2em"] {
    letter-spacing: .1em !important;
  }
}

/* The leadership page sets a 420px fixed width on a card, which overflows a
   390px screen on its own. */
@media (max-width: 520px) {
  [style*="width:420px"], [style*="width: 420px"] { width: 100% !important; }
}
