/* LifeByLogic phone fit v1 (October 8, 2026).
   Linked last in the head of unsealed public pages that scrolled sideways on a
   phone. Its rules apply at phone and tablet widths only, apart from the first
   three, which fix a page wider than the screen at every width. Served
   immutable: a change needs a new file name. */

/* Code-like text scrolls inside its own box. */
pre { max-width: 100%; overflow-x: auto; }

/* A table of six or more columns scrolls inside its column. The empty caption,
   as wide as the box, keeps the rows at the box's full width. */
table:has(tr > :nth-child(6)) { display: block; max-width: 100%; overflow-x: auto !important; container-type: inline-size; }
table:has(tr > :nth-child(6))::before { content: ""; display: table-caption; width: 100cqw; }

@media (max-width: 1180px) {
  /* The sign-in page's footer is a flex item sized to its content. */
  body > footer { min-width: 0; max-width: 100%; }
}

@media (max-width: 960px) {
  /* Every table scrolls inside its own box; one that fits keeps its full width.
     !important because some pages hide a table's overflow to round its corners. */
  table { display: block; max-width: 100%; overflow-x: auto !important; container-type: inline-size; }
  table::before { content: ""; display: table-caption; width: 100cqw; }
  .article-utility-table-wrap { max-width: 100%; overflow-x: auto; }
  .owner-utility, .layout > * { min-width: 0; }
  /* The lab hubs' tool details wrap inside their card, which hides overflow. */
  .tool-meta-row { flex-wrap: wrap; row-gap: 12px; }
}

@media (max-width: 640px) {
  /* Words longer than the line break only where they would overflow; links,
     headings and citations, which hold URLs and long names, break anywhere. */
  p, li, dd, dt, blockquote, figcaption, td, th { overflow-wrap: break-word; }
  a { overflow-wrap: anywhere; }
  td a, th a { overflow-wrap: inherit; }
  a > * { overflow-wrap: normal; }
  h1, h2, h3, .cite-text { overflow-wrap: anywhere; }
  .lbl-global-nav a, .lbl-footer-after a { overflow-wrap: normal; }

  /* Share buttons keep their names (aria-label); the hover tips, which ran past
     the screen's edge, go. */
  .share-tooltip { display: none; }

  /* Card grids and rows that held a fixed width. */
  body .tools-grid, body .lbl-journeys .lj-grid { grid-template-columns: minmax(0, 1fr); }
  .breadcrumb { flex-wrap: wrap; }
  body .lbl-start-here .lsh-hub-tag { white-space: normal; }
  .tp-fact { flex-wrap: wrap; row-gap: 4px; }
  .tp-fact .v { flex: 1 1 7em; min-width: 0; }
}

@media (max-width: 480px) {
  /* The ADHD method page's nested panels leave the text a wider column. */
  .substance-panel { padding: 24px 20px; }
  .substance-panel .callout { padding: 16px; }
}
