/*
 * Shared fixes for the legal pages (TEE-1414, LIVE-01), linked from each page's
 * <head> after its own <style> so these rules win ties. The pages are generated
 * from packages/web/legal/*.md through legal/template.html, which carries the link;
 * `packages/app/src/config/__tests__/legalPages.a11y.test.ts` fails without it.
 */

/*
 * Reflow (SC 1.4.10). The export fixes the body at 468pt wide with 72pt padding
 * on every side: 816px plus the 8px default body margin each way, so anything
 * narrower than 832px (a phone, or a desktop at 400% zoom) scrolled sideways.
 * Desktop is left exactly as exported; only narrower screens change.
 */
@media (max-width: 832px) {
  body.doc-content {
    margin: 0 auto;
    padding: 32px 24px;
    /* Breaks only a string too long for the line, such as a URL. */
    overflow-wrap: break-word;
  }

  /*
   * The few tables set fixed point widths per cell; let them share the width.
   * Inside a narrow cell, words hyphenate where English allows (the pages set
   * lang="en"), and break anywhere only as a last resort, so the page never
   * scrolls sideways. One of them is also a layout table holding a whole
   * section, so it can't be given a scroll region of its own.
   */
  .doc-content table {
    width: 100%;
  }

  .doc-content td,
  .doc-content th {
    width: auto;
    hyphens: auto;
    overflow-wrap: anywhere;
  }

  /* The export indents list items 36pt; in a cell a third of the width is too much. */
  .doc-content td li {
    margin-left: 18pt;
  }
}

@media (max-width: 480px) {
  body.doc-content {
    padding: 24px 16px;
  }
}
