/* legacy-fixes.css: fixes for old pages, in three sections.
 *
 * Linked (data-ir-showroom) after the page's other stylesheets, only on the pages named in the
 * comments below. scripts/apply-chrome.py adds the link; docs/showroom-build/fix-2-report.md and
 * fix-3-report.md have the measurements.
 *
 * Section 1 (fix card 2): phone-width overflow. Every rule sits inside the 767px media query, so
 * desktop cannot change. Nothing here is set on html or body, and nothing is hidden or clipped: a
 * wide table scrolls inside its own box, a long word wraps, a box that was too wide is constrained.
 *
 * Section 2 (fix card 3), "all widths: openings", after section 1: empty space above the
 * first content block on two placeholder pages. Every selector starts with body[data-ir-page="<path>"],
 * so a rule can match one page only.
 *
 * Section 3 (fix card 4), "all widths: title column", at the very end: the article column of three review pages whose
 * article sits in a <div class="container">. Every selector starts with body[data-ir-page="<path>"]. In section 1 the
 * badge and hero rules for the two ratings-badge pages are also from fix card 4; the page-header rule
 * (.hero:has(> .meta-row)) is from fix card 5, found with scripts/check-clipping.py.
 */
@media (max-width: 767px) {

  /* Pages: /about/ (title), /safety/sauna-blanket-recalls/ (same hero class; its title already fits).
     The one-word site name in the h1 is 395px wide at the old 14vw size, in a 342px column.
     A smaller size keeps the word whole; overflow-wrap is the fallback on very narrow screens.
     !important because editorial.css sets the h1 font shorthand with !important. */
  .page-hero h1 {
    font-size: clamp(34px, 11vw, 46px) !important;
    overflow-wrap: anywhere;
  }

  /* Pages: /learn/ (category cards at the bottom).
     An inline style sets three equal columns, too narrow for the card text on a phone.
     Two columns fit; minmax(0, 1fr) lets a column shrink below its content. !important
     because the old value is in a style attribute. */
  div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Pages: /learn/what-is-red-light-therapy/ (both evidence tables).
     The table scrolls sideways inside its own box so every column can be read. */
  table.evidence-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Pages: /red-light-therapy-wands/currentbody-acne-pen-review/ (wavelength table).
     Same cause as the evidence table: it scrolls inside its own box. */
  table.wl-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Pages: /sauna-blankets/infra-ritual-review/ (head-to-head table).
     Same cause: the first column has min-width 140px and the table is 469px wide. */
  table.comp-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Pages: /red-light-therapy-wands/boncharge-face-wand-review/ (head-to-head table),
     /pemf-mats/best/ (comparison table). 359px and 363px wide in a 320px column at 360. */
  table.compare-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Pages: /safety/sauna-blanket-recalls/ (model-code table).
     The table clipped itself (overflow: hidden) at 347px in a 312px column at 360;
     it now scrolls inside its own box. */
  table.model-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  /* Pages: /red-light-therapy-masks/currentbody-led-mask-series-2-review/,
     /red-light-therapy-masks/deluxeskin-mask-review/,
     /red-light-therapy-masks/dr-dennis-gross-spectralite-review/,
     /red-light-therapy-masks/ihome-red-light-mask-review/,
     /sauna-blankets/currentbody-sauna-blanket-review/,
     /sauna-blankets/settewell-review/ (old two-column score card).
     The card is a grid of "circle | score rows". The rows need 218px (a 170px label that cannot
     shrink, the bar, a 28px value) beside a 110px circle. The two cells now stack, so the rows
     get the full card width. */
  .score-card {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Pages: /red-light-therapy-masks/currentbody-led-mask-series-2-review/,
     /red-light-therapy-masks/dr-dennis-gross-spectralite-review/ (page hero, the row the star-rating badge is in).
     main.css makes the page hero a flex row that never wraps (.hero { display: flex; overflow: hidden }): the
     tag, the h1, the meta row and the badge sit side by side in it. The badge was a 60px strip that started at
     x=326 in a 320px hero, so its end was cut off by the hero's overflow. The row may now wrap. Only the hero
     that holds a .review-badge is changed. */
  .hero:has(> .review-badge) {
    flex-wrap: wrap;
  }

  /* Pages: /red-light-therapy-masks/currentbody-led-mask-series-2-review/,
     /red-light-therapy-masks/dr-dennis-gross-spectralite-review/ (star-rating badge under the title).
     The badge takes a full line of its own in the hero row, so "4.2 stars + 379 reviews on Amazon" sits on one
     or two lines inside the hero. It may still wrap inside its own box (card 2). */
  .review-badge {
    flex-basis: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }

  /* Pages: /sauna-blankets/settewell-review/ (the byline and the price were cut off), and, with the same
     page header, /red-light-therapy-masks/deluxeskin-mask-review/, /red-light-therapy-masks/ihome-red-light-mask-review/,
     /sauna-blankets/currentbody-sauna-blanket-review/ (title squeezed to about 180px in the same way).
     Same cause as the badge rule above: .hero is a flex row that never wraps, so on a phone the label, the
     title and the byline/price row (.meta-row, one column 90-100px wide) sit side by side. On SetteWell the row
     ran from x=251 to x=353 in a hero that ends at x=340 and has overflow hidden, so its end was cut off, and
     the title was squeezed between the label and that row. The hero may now wrap: the label, the title and the
     meta row each get a line, and the title gets the full width. No text, no overflow and no markup changes. */
  .hero:has(> .meta-row) {
    flex-wrap: wrap;
  }

  /* Pages: /sauna-blankets/settewell-review/, /red-light-therapy-masks/deluxeskin-mask-review/,
     /red-light-therapy-masks/ihome-red-light-mask-review/, /sauna-blankets/currentbody-sauna-blanket-review/
     (and the two badge pages above, which already wrap). The label's own line is its natural width; the
     title and the meta row take a full line each (flex-basis 100%), and min-width: 0 lets a long word wrap
     inside them. */
  .hero:has(> .meta-row) > h1,
  .hero:has(> .meta-row) > .meta-row {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Pages: /red-light-therapy-panels/best/ (sources list).
     Some source links are long URLs with no break points and ran 372px wide. They wrap. */
  #sources-checked a {
    overflow-wrap: anywhere;
  }

}

/* ====================================================================================================
   all widths: openings (fix card 3, tester defect D3)
   These rules apply at every width, so they sit outside the phone media query above. Each selector is
   scoped to one page through the data-ir-page attribute that scripts/apply-chrome.py sets on <body> of
   these pages only. Only top margin or padding may be set here, 40px at most.
   ==================================================================================================== */

/* Pages: /deals/
   The "coming soon" placeholder box has margin: 120px auto in the page's own style block, so the
   heading starts 120px below the header at every width. The top margin is now 32px; the 120px
   below the box stays. */
body[data-ir-page="/deals/"] .coming-soon {
  margin-top: 32px;
}

/* Pages: /sauna-blankets/
   The same placeholder box and the same 120px top margin as /deals/. */
body[data-ir-page="/sauna-blankets/"] .coming-soon {
  margin-top: 32px;
}

/* ====================================================================================================
   all widths: title column (fix card 4, buy button on a desktop)
   Rules here apply at every width, outside the phone media query, and each selector starts with
   body[data-ir-page="<path>"], which scripts/apply-chrome.py sets (COLUMN_PAGES) on these three pages only.
   ==================================================================================================== */

/* Pages: /red-light-therapy-masks/inia-glow-review/, /red-light-therapy-panels/mito-red-mitopro-review/,
   /sauna-blankets/higherdose-v4-review/
   Why the title was 386px wide at 1440 (12 or 13 lines of 78px): on these three pages the article sits in
   <div class="container"> (max-width 820px, 20px side padding). editorial.js puts its two-column layout
   (.article-layout: article, 96px gap, 250px contents rail) inside that box, so the article got what was
   left of 780px, 386px. On the TheraFace review the <article> is itself the container, the layout sits at
   body level and gets its own 1120px, so its title column is 760px. The container that holds the layout
   now has no maximum width and no side padding, which is the TheraFace geometry. :has() keeps the rule off
   the old page when JavaScript is off (there is no .article-layout then) and in a browser without :has(). */
body[data-ir-page="/red-light-therapy-masks/inia-glow-review/"] .container:has(> .article-layout),
body[data-ir-page="/red-light-therapy-panels/mito-red-mitopro-review/"] .container:has(> .article-layout),
body[data-ir-page="/sauna-blankets/higherdose-v4-review/"] .container:has(> .article-layout) {
  max-width: none;
  padding-inline: 0;
}

/* Pages: /red-light-therapy-masks/inia-glow-review/, /red-light-therapy-panels/mito-red-mitopro-review/,
   /sauna-blankets/higherdose-v4-review/
   Even in a 760px column the title is five to seven lines of 78px at 1440 (editorial.css: clamp(46px, 5.8vw,
   78px)), and on the longest of the three the buy button ended at 910px of 900. From 1024px up the title is
   capped at 64px (never below 56px: 5.8vw is 59px at 1024px). The words and the markup do not change; the line
   height stays at editorial.css's .94. !important because editorial.css sets the font shorthand with it. */
@media (min-width: 1024px) {
  body[data-ir-page="/red-light-therapy-masks/inia-glow-review/"] .article-header h1,
  body[data-ir-page="/red-light-therapy-panels/mito-red-mitopro-review/"] .article-header h1,
  body[data-ir-page="/sauna-blankets/higherdose-v4-review/"] .article-header h1 {
    font-size: clamp(56px, 5.8vw, 64px) !important;
  }
}
