/* Mobile QA fix wave, builder FB1 (2026-11-23), revised by FB7 after verify-MV2: layout
   between phone and desktop. Loads last. Scoped blocks, nothing else changes:
   1. 560 to 767 (small tablets, unfolded phones): the phone column stops stretching.
      Buttons take their natural width, the hero image is capped, grids of short items go
      two-up (the 768 layout where it fits), long text stays one column. Gutters, type
      sizes and section order are the phone values.
   2. 768 to 1023 (tablet portrait): side-aligned hero visuals reach the content edge;
      odd last items no longer sit alone; related links go two-up where titles squeeze.
   3. 560 to 1023, both bands: chip groups take their column count from their labels,
      odd last items span or center, groups of very unequal length stack.
   4. Short landscape phones (height 480 or less, width 1023 or less): the inner-page hero
      top spacing tightens so the heading and the first button show on load.
   Home (.hm-*), Contact (.ct-*), header and footer are not touched: every rule is scoped
   to .hero or .sec. */

/* ================================================================ 1. 560 to 767 */
@media (min-width: 560px) and (max-width: 767px) {
	/* Buttons: natural width, side by side, as from 768. Search rows keep their stack, and
	   so does the button group under a search form (404), so the two read as one column. */
	:is(.hero, .sec) .btns:not(:has(.hsearch)):not(.btns--after-search) { flex-direction: row; flex-wrap: wrap; gap: 12px; }
	:is(.hero, .sec) .btns:not(:has(.hsearch)):not(.btns--after-search) .btn { width: auto; }
	.hero .hero__btns:not(:has(.hsearch)) { width: auto; }
	.sec .cta--lav .btns, .sec .cta--img .btns { width: auto; justify-content: center; }

	/* Hero image: 560x400 to 560x328 (about a third of a 960 screen, never over half). */
	.hero .imgcard--hero { aspect-ratio: 580 / 340; max-height: 50svh; }

	/* Hero facts strip, three facts: three tiles in a row instead of three stacked rows. */
	.hero .hero__facts .facts:has(> .facts__item:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
	.hero .hero__facts .facts:has(> .facts__item:nth-child(3):last-child) > .facts__item {
		grid-column: auto; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px;
	}
	.hero .hero__facts .facts:has(> .facts__item:nth-child(3):last-child) .facts__l { text-align: left; }

	/* Cards: two-up (the 768 grid); an odd last card spans the row, as at 768 to 1023. */
	.sec .cards:not(.cards--tiles) { grid-template-columns: repeat(min(var(--cols, 2), 2), minmax(0, 1fr)); }
	.sec .cards:not(.cards--tiles) > .cards__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
	/* Tiles stay two-up (phone grid); an odd last tile spans the row like the cards. */
	.sec .cards--tiles > .cards__item:last-child:nth-child(odd) { grid-column: 1 / -1; }

	/* Card tag pill beside the icon tile: in a two-up card the pill column (about 190px)
	   broke "Dynamics and Power Platform" onto two lines (B4-07). The tag row now spans the
	   card: a 38px spacer keeps the pill beside the tile when it fits, and a longer pill
	   drops under the tile on one line. The arrow stays level with the tile. */
	.sec .cards:not(.cards--tiles) > .cards__item:has(> .tile--sm + .cards__top) > .tile { grid-row: 1; }
	.sec .cards:not(.cards--tiles) > .cards__item > .tile--sm + .cards__top {
		grid-column: 1 / -1; grid-row: 1; position: relative;
		flex-wrap: wrap; justify-content: flex-start; column-gap: 12px; row-gap: 10px; padding-right: 28px;
	}
	.sec .cards:not(.cards--tiles) > .cards__item > .tile--sm + .cards__top::before { content: ""; flex: 0 0 38px; height: 38px; }
	.sec .cards:not(.cards--tiles) > .cards__item > .tile--sm + .cards__top .pill { min-width: 0; max-width: 100%; white-space: nowrap; }
	.sec .cards:not(.cards--tiles) > .cards__item > .tile--sm + .cards__top .arrow-ne { position: absolute; right: 0; top: 11px; }

	/* Icons (row and cards): two-up grid; an odd last item spans the row (768 wraps the same way). */
	.sec .icons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
	.sec .icons--cards { gap: 12px; }
	.sec .icons > .icons__item:last-child:nth-child(odd) { grid-column: 1 / -1; }

	/* Icon list card: two columns of rows, as at 768 to 1023. */
	.sec .icons-list__card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
	.sec .icons-list__card > .icons-list__row:last-child:nth-child(odd) { grid-column: 1 / -1; }
	.sec .icons-list__card > .icons-list__row { align-items: flex-start; }
	.sec .icons-list__card > .icons-list__row:nth-child(2) { border-top: 0; }

	/* Feature icons: lead card full width, the four cards two-up (768 layout). */
	.sec .icons-feat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sec .icons-feat__lead { grid-column: 1 / -1; }

	/* Steps as cards: two-up (the odd last card spans, block 3). */
	.sec .steps--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }

	/* Bento: lead tile full width, tiles two-up (768 layout); an odd last tile spans. */
	.sec .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sec .bento__lead { grid-column: 1 / -1; }

	/* Stat bands: the stacked variant goes two-up like the plain band. */
	.sec .statband--stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sec .statband--stack.statband--odd > .statband__fig:last-child { grid-column: 1 / -1; }

	/* Facts rows: label column beside the value (768 layout, phone type). */
	.sec .fcard__row { flex-direction: row; align-items: baseline; gap: 20px; }
	.sec .fcard__k { flex: 0 0 168px; }
	.sec .fcard__v { flex: 1; min-width: 0; }

	/* People cards: two-up. */
	.sec .people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

	/* Related links: two-up (the odd last link spans, block 3). Three in a row squeezed
	   titles such as "Custom Software Development" to one word per line at 560. */
	.sec .related__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

	/* Post cards and link groups: two-up. */
	.sec .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sec .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	/* An odd last post card keeps its size and centers under the pair (gap 10px here). */
	.sec .posts > .post:last-child:nth-child(odd) { width: calc(50% - 5px); }
}

/* ================================================================ 2. 768 to 1023 */
@media (min-width: 768px) and (max-width: 1023px) {
	/* Side-aligned hero visuals ran to 720 of a 724 to 959 row and stopped short of the
	   right gutter that the copy and the facts reach. Centered heroes keep their centered cap. */
	.hero:not(.hero--centered) .hero__visual { max-width: none; }
	/* Split section images had the same 720 cap (split-showcase.css) and the same 36px gap. */
	.sec .split__visual { max-width: none; }

	/* Icon list in two columns (zz-fix-sections.css): the second row kept the divider meant
	   for a stacked list and rows were centered, so the two top rows started at different
	   heights. Top-aligned, no divider on the first row of the second column. */
	.sec .icons-list__card > .icons-list__row { align-items: flex-start; }
	.sec .icons-list__card > .icons-list__row:nth-child(2) { border-top: 0; }

	/* Tiles three-up: one or two tiles left over sit centered under the row (B1-02, 16
	   tiles). Six tracks, each tile spans two, so tile widths are unchanged. */
	.sec .cards--tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.sec .cards--tiles > .cards__item { grid-column: span 2; }
	.sec .cards--tiles > .cards__item:last-child:nth-child(3n+1) { grid-column: 3 / span 2; }
	.sec .cards--tiles > .cards__item:nth-last-child(2):nth-child(3n+1) { grid-column: 2 / span 2; }
	.sec .cards--tiles > .cards__item:last-child:nth-child(3n+2) { grid-column: 4 / span 2; }

	/* Hero scene rows in two columns (zz-fix-heroes.css) with an odd count left the second
	   column a row short (B13-03, five rows). An odd set reads as one column, label beside
	   value as from 481 to 767; even sets keep the two columns. */
	.hero .scene__rows.hl-rows2:has(> .scene__row:last-child:nth-child(odd)) {
		grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row;
	}
	.hero .scene__rows.hl-rows2:has(> .scene__row:last-child:nth-child(odd))::before { content: none; }
	.hero .scene__rows.hl-rows2:has(> .scene__row:last-child:nth-child(odd)) > .scene__row { flex-direction: row; gap: 16px; }
	.hero .scene__rows.hl-rows2:has(> .scene__row:last-child:nth-child(odd)) > .scene__row dd { text-align: right; }
	.hero .scene__rows.hl-rows2:has(> .scene__row:last-child:nth-child(odd)) > .scene__row.is-c2-top { padding-top: 14px; border-top: 1px solid var(--ink-10); }

	/* An odd last post card keeps its size and centers under the pair (gap 20px here). */
	.sec .posts > .post:last-child:nth-child(odd) { width: calc(50% - 10px); }
}

/* Related links, 768 to 899: three in a row left about 170px of text a card, so titles
   such as "PCI Compliant Software Development" took three or four lines (B8-01, B8-04,
   B8-09, B13-09, B14-08). Measured on all 108 pages with related links: from 900 every
   title but one fits two lines at three-up, so the two-up layout stops there. */
@media (min-width: 768px) and (max-width: 899px) {
	.sec .related__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================================================================ 3. 560 to 1023, both bands */
@media (min-width: 560px) and (max-width: 1023px) {
	/* Odd last item spans the row: steps cards, related links, link groups. */
	.sec .steps--cards > .steps__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
	.sec .related__row > .related__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
	.sec .groups > .group:last-child:nth-child(odd) { grid-column: 1 / -1; }
	.sec .groups > .group:last-child:nth-child(odd) .group__links { column-count: 2; column-gap: 32px; }
	.sec .groups > .group:last-child:nth-child(odd) .group__links li { break-inside: avoid; }
	/* Post cards: the odd last card centers under the pair (width set per band above). */
	.sec .posts > .post:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; }

	/* Two link groups of very unequal length (one at least twice the other plus one, B7-02
	   five and eleven rows, B8-03 two and five) left a tall half-empty card. Such a pair
	   stacks, full width, and a group of three or more links lays them in two columns.
	   Larger sets keep the grid. */
	.sec .groups:has(> .group:nth-child(2):last-child):is(
		:has(> .group .group__links li:nth-child(3)):has(> .group .group__links li:last-child:nth-child(-n+1)),
		:has(> .group .group__links li:nth-child(5)):has(> .group .group__links li:last-child:nth-child(-n+2)),
		:has(> .group .group__links li:nth-child(7)):has(> .group .group__links li:last-child:nth-child(-n+3)),
		:has(> .group .group__links li:nth-child(9)):has(> .group .group__links li:last-child:nth-child(-n+4)),
		:has(> .group .group__links li:nth-child(11)):has(> .group .group__links li:last-child:nth-child(-n+5)),
		:has(> .group .group__links li:nth-child(13)):has(> .group .group__links li:last-child:nth-child(-n+6))
	) {
		grid-template-columns: minmax(0, 1fr);
	}
	.sec .groups:has(> .group:nth-child(2):last-child):is(
		:has(> .group .group__links li:nth-child(3)):has(> .group .group__links li:last-child:nth-child(-n+1)),
		:has(> .group .group__links li:nth-child(5)):has(> .group .group__links li:last-child:nth-child(-n+2)),
		:has(> .group .group__links li:nth-child(7)):has(> .group .group__links li:last-child:nth-child(-n+3)),
		:has(> .group .group__links li:nth-child(9)):has(> .group .group__links li:last-child:nth-child(-n+4)),
		:has(> .group .group__links li:nth-child(11)):has(> .group .group__links li:last-child:nth-child(-n+5)),
		:has(> .group .group__links li:nth-child(13)):has(> .group .group__links li:last-child:nth-child(-n+6))
	) > .group:has(.group__links li:nth-child(3)) .group__links { column-count: 2; column-gap: 32px; }
	.sec .groups:has(> .group:nth-child(2):last-child) > .group .group__links li { break-inside: avoid; }

	/* Chip groups: the column count comes from the labels. Pills never break inside; each
	   group asks for half the row but never less than its longest pill, so a group whose
	   longest pill does not fit half the row takes the full row and its pills flow across
	   it (B1-07, B4-05, B5-04, B6-05, B7-04). Groups that fit pair up as in the 768 grid,
	   and an odd last group fills the row (three-group sets, B1-07, B12-07, B2-03). */
	.sec .chips-cols:not(.is-single) { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px 32px; }
	.sec .chips-cols:not(.is-single) > .chipsg { flex: 1 1 calc(50% - 17px); max-width: 100%; }
	.sec .chips-cols .chipsg__chip { white-space: nowrap; }
	/* A long list (seven or more pills in a group) beside a short one made a tall narrow
	   column (B1-08 Topics): such a set sizes groups by their content, so short groups
	   still pair up and a long group takes the full row. */
	.sec .chips-cols:not(.is-single):has(.chipsg__chip:nth-child(7)) > .chipsg { flex: 1 1 auto; }
}
@media (min-width: 768px) and (max-width: 1023px) {
	.sec .chips-cols:not(.is-single) { gap: 28px 32px; }
}
@media (min-width: 560px) and (max-width: 767px) {
	/* Chip sets of six or more pills (NAICS codes, B1-06) flow by content here, as before. */
	.sec .chips-cols:not(.is-single):has(.chipsg__chip:nth-child(6)) { gap: 24px 40px; }
	.sec .chips-cols:not(.is-single):has(.chipsg__chip:nth-child(6)) > .chipsg { flex: 1 1 auto; }
}

/* ================================================================ 4. Short landscape phones
   Height 480 or less in landscape, on screens up to 1023 wide (portrait never matches, and
   a short desktop window keeps the desktop hero). At 844x390 the tablet hero spent 110 to
   150px on padding, crumb and chip before the heading, so the first button started below
   the screen on about 50 pages. Spacing tightens on every hero; from 768 wide (tablet type)
   the heading and lead also use the phone sizes, since a two-line 56px heading alone
   filled a third of a 390px screen. The sticky header is unchanged. */
@media (orientation: landscape) and (max-height: 480px) and (max-width: 1023px) {
	.hero, .hero.on-dark { padding-top: 12px; }
	.hero .hero__copy, .hero .hero__top { gap: 12px; }
}
@media (orientation: landscape) and (max-height: 480px) and (min-width: 768px) and (max-width: 1023px) {
	.hero .h1, .hero .h1.is-long { font-size: 36px; line-height: 41px; letter-spacing: -.8px; }
	.hero .hero__sub { font-size: 16px; line-height: 25px; }
	.hero .hero__inner, .hero.hero--editorial .hero__inner { gap: 18px; }
}
