/*
 * ForestWander Mobile - category pages (category_page.php). Phones only. Loaded after mobile-header.css
 * (which already turns the main layout table into one column with the main cell first).
 * Main cell: h1, the newest-4 row, pager (.sidebar22) and two 200x200 ads.
 * Below: a wrapper div holding .sidebar16-21 (grid columns 16, 18, 19, 21; 150x600 ads in 17 and 20), then .sidebar22 pager and page text.
 * Never select on [style*=...]: the theme's script.js rewrites inline style attributes.
 */
@media (max-width: 767px) {
	/* Inner tables of the main cell stay tables but fit the screen; the two 200x200 ad cells wrap. */
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) td table { width: 100% !important; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) td table td[width="34%"] { display: inline-block; width: auto !important; margin: 6px 4px; }

	/* Pagers: smaller, wrapping, easy to tap. */
	.sidebar22 { width: 100% !important; float: none !important; }
	/* The theme joins pager items with &nbsp;, so a flex row is the only way to let them wrap. */
	.sidebar22 div[align="center"] { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 4px; font-size: 16px !important; padding: 0 6px; box-sizing: border-box; margin-top: 8px !important; }
	.sidebar22 div[align="center"] a { font-size: 16px !important; padding: 6px 7px; }

	/* Photo grid: two columns; the two 150x600 ad columns are dropped. */
	div:has(> .sidebar16) { display: flex; flex-wrap: wrap; float: none !important; width: 100% !important; }
	.sidebar16, .sidebar18, .sidebar19, .sidebar21 { width: 50% !important; float: none !important; padding: 0 6px; box-sizing: border-box; }
	.sidebar17, .sidebar20 { display: none !important; }
	.sidebar16 div[align], .sidebar18 div[align], .sidebar19 div[align], .sidebar21 div[align] { text-align: center !important; font-size: 13px; line-height: 1.3; }
	.sidebar16 img, .sidebar18 img, .sidebar19 img, .sidebar21 img { width: 120px; max-width: 100%; height: auto !important; } /* 80px files */
	.sidebar16 p, .sidebar18 p, .sidebar19 p, .sidebar21 p { margin: 4px 0; }
}
