/*
 * Mobile repairs for the mirrored pages.
 *
 * 23 of the 61 built pages scrolled sideways at 390px. Two faults account for
 * all 23, and this file takes the count to 0 — measured on the built output
 * with no styles forced, which is the only measurement a thumb agrees with.
 *
 * A third candidate was dropped after measuring it. The header row really is
 * 12px wider than the screen, but `.header__bar` is `position: fixed`, and a
 * fixed element contributes nothing to the document's scroll width. Padding
 * it would have shifted the logo 4px to fix a scroll that was never there.
 */

/* ------------------------------------------------------------------
 * 1. Full-bleed containers leak their row's negative margin.
 *
 * `.grid-container.full-size--mobile` carries no padding
 * on purpose — it is the container that lets a section run edge to edge on a
 * phone — and the row inside runs -20..410 so that its cells, which carry
 * +20px margins of their own, land on exactly 0..390. The row being wider
 * than the screen is how the full bleed is built.
 *
 * So the margins have to stay. Zeroing them was tried and measured: the
 * carousels inside shrank from 20..370 to 20..330, because everything nested
 * below sizes off that 430px row. Clipping the container instead throws away
 * the empty 20px that sticks out of each side and leaves every width inside
 * untouched.
 *
 * `.grid-container.full` on /how-it-works/ is the same container under a
 * different name, leaking 5px.
 *
 * `.footer__container` is the third: 24px of padding against the row's -30px
 * margins. It only shows at tablet widths, where it put a 6px sideways scroll
 * on all 40 mirrored pages at once.
 * ------------------------------------------------------------------ */
@media (max-width: 1023px) {
  .grid-container.full-size--mobile,
  .grid-container.full,
  .grid-container.footer__container {
    overflow-x: clip;
  }
}

/* ------------------------------------------------------------------
 * 2. Single unbreakable words push a page wider than the phone.
 *
 * /model-release/ ran 281px past the viewport, /cookies/ 102px and
 * /privacy/ 46px: in each, one token — an email address or a URL pasted
 * into the body copy — is longer than the column, and a block that
 * cannot break grows to its longest line. At 360px two headings do the
 * same, the centre name on /locations/south-windsor/ (3px) and a
 * treatment link on /area/new-york-city/ (7px).
 *
 * `anywhere` rather than `break-word`: both let the token break at the
 * edge, but only `anywhere` lets the browser count the break when it
 * works out the element's minimum width, and that is the half that stops
 * the page from growing in the first place.
 *
 * It only ever breaks a word that has nowhere else to go, so ordinary
 * copy is untouched.
 * ------------------------------------------------------------------ */
@media (max-width: 1023px) {
  .everbody-lead,
  .entry-content p,
  .entry-content li,
  [class*='col-lg-'] p,
  [class*='col-lg-'] li,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .preview__title a {
    overflow-wrap: anywhere;
  }
}

/* ------------------------------------------------------------------
 * 3. Two titles are held on one line that will not fit a phone.
 *
 * `.location-info__title` and `.preview__title` are `white-space:
 * nowrap`, which is why rule 2 could not touch them — nothing wraps
 * when nothing is allowed to wrap. At 360px "Ever/Body South Windsor"
 * needs 343px of a 320px column and "Greenwich Village – Now Open"
 * needs 347px, which was the last sideways scroll left on the site.
 *
 * Letting them wrap costs a second line on the narrowest phones and
 * changes nothing at any width where they already fit.
 * ------------------------------------------------------------------ */
@media (max-width: 1023px) {
  /* `body` is here for weight, not for scope: motion.css holds the South
     Windsor title on one line with `body.everbody-south-windsor
     .location-info__title`, to keep the local build's line breaks matching
     live for the visual gate. That selector scores (0,2,1), so the class is
     repeated here to clear it — the same trick steps.css uses against the
     theme's two-class rules. Phones only. */
  body .location-info__title.location-info__title,
  body .preview__title.preview__title,
  body .preview__title.preview__title a {
    white-space: normal;
  }
}

/* ------------------------------------------------------------------
 * 4. Two empty animation slots leave 600px of blank page.
 *
 * `<div class="step__animation"></div>` is a placeholder the theme's
 * script fills. No script in the capture touches it — `main.js` never
 * mentions lottie and no animation asset was mirrored — so on
 * /how-it-works/ two of them render 360x302 with nothing inside. Side
 * by side with their text on a desktop that reads as whitespace; once
 * the columns stack it is two screens of nothing between Step One and
 * Step Three.
 *
 * `:empty` is doing real work here: the moment anything fills the slot,
 * the rule stops applying on its own.
 * ------------------------------------------------------------------ */
@media (max-width: 1023px) {
  .step__animation:empty {
    display: none;
  }
}
