/* 48-mobile-polish.css
   Mobile-only corrections. Loads last in the deferred list. Every rule sits
   inside a media query, so desktop is untouched.

   Selectors and breakpoints were checked against the rendered pages rather
   than assumed. Two notes on why some selectors look verbose:

   - The image rules repeat the full descendant selector used in
     37-service-enhance.css (.svc-explain__media--sticky .svc-explain__img).
     A single-class selector loses to it on specificity no matter how late
     this file loads.
   - The stats separator element is .svc-stat__sep, not __divider.
*/

/* ============================================================
   1. CTA BUTTON ALIGNMENT
   .svc-hero__actions is the shared container across residential service,
   commercial service, and both landing pages. Its children are
   .btn-primary / .btn-ghost / .btn-callback, which size to their own text
   and so wrap at three different widths on a narrow screen.

   2. PERFORMANCE DATA TABLE
   The label cell is pinned to 220px with white-space:nowrap. On a 328px
   viewport that leaves roughly a hundred pixels for the value and wraps the
   data into a narrow ribbon. Stacking each row gives the value the full
   width and turns the label into a quiet caption above it.

   3. STATS STRIP
   .svc-stats is a centred flex row with .svc-stat items separated by
   .svc-stat__sep. Wrapping leaves a trailing stat centred on its own line.
   ============================================================ */
@media (max-width: 700px) {

  .svc-hero__actions,
  .cta-center__actions,
  .cta-section__actions,
  .hero__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .svc-hero__actions > *,
  .cta-center__actions > *,
  .cta-section__actions > *,
  .hero__actions > * {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .specs-table,
  .specs-table tbody,
  .specs-table tr,
  .specs-table td {
    display: block;
    width: 100%;
  }

  .specs-table tr {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0;
  }
  .specs-table tr:last-child { border-bottom: none; }

  .specs-table td {
    border-bottom: none;
    padding: 0 var(--space-4);
  }

  .specs-table td:first-child {
    width: 100%;
    white-space: normal;
    background: transparent;
    margin-bottom: var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
  }

  .specs-table td:last-child {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
  }

  .specs-table-wrap { overflow-x: visible; }

  .svc-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5) var(--space-4);
    align-items: start;
    justify-content: stretch;
    text-align: center;
  }

  .svc-stats .svc-stat__sep { display: none; }

  .svc-stats .svc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
  }

  /* No orphan-spanning rule here on purpose. The separators remain DOM
     children even when hidden, so the stats always sit on odd nth-child
     positions and any :nth-child(odd) test matches the last one every time,
     which pushed it onto a row of its own. Four stats fill a 2x2 grid
     cleanly; an odd count simply leaves the last cell empty. */
}

/* ============================================================
   4. INLINE IMAGES
   Breakpoint matches the 860px at which both grids collapse to one column.

   Root cause of the over-tall images: at mobile the existing rules reset
   aspect-ratio to auto. Because these images are lazy-loaded, the browser
   has no intrinsic size at layout time and reserves a box far taller than
   the picture needs (measured at 1500px tall in a 308px-wide column).
   Pinning an explicit landscape ratio gives the browser a correct box before
   the file arrives, which also removes the layout shift when it does.
   ============================================================ */
@media (max-width: 860px) {

  .svc-explain__media--sticky .svc-explain__img,
  .svc-explain__img,
  .comm-split__img,
  .benefit-row__img {
    aspect-ratio: 16 / 10;
    object-fit: cover;
    width: 100%;
    height: auto;
    max-height: 260px;
  }

  .svc-explain__media,
  .svc-explain__media--sticky,
  .comm-split__media {
    display: block;
    height: auto;
  }
}