/*
 * ForestWander Mobile - shared rules for pages using header.php (homepage, category pages). Phones only.
 * header.php: .Sheet-body > div[align=center] > table (logo_left | Header.jpg | WV logo)
 *             .Sheet-body > div[style*=width] > table (newsletter | compass, text, binoculars | search)
 */
@media (max-width: 767px) {
	html, body { width: auto !important; min-width: 0 !important; overflow-x: hidden; }
	body { font-size: 15px; }
	.Sheet-body { overflow: visible; }
	.Sheet-body img { max-width: 100%; height: auto; }
	.Sheet-body div, .Sheet-body center { max-width: 100% !important; box-sizing: border-box; } /* e.g. the theme's fixed 580px boxes */

	/* Logo row: keep the ForestWander banner, drop the two side logos. */
	.Sheet-body > div[align="center"]:first-child > table,
	.Sheet-body > div[align="center"]:first-child > table > tbody,
	.Sheet-body > div[align="center"]:first-child > table > tbody > tr { display: block; width: 100% !important; }
	.Sheet-body > div[align="center"]:first-child > table td { display: block; width: auto !important; }
	.Sheet-body > div[align="center"]:first-child > table td:first-child,
	.Sheet-body > div[align="center"]:first-child > table td:last-child { display: none; }

	/* Second header row: keep only the search box.
	   Note: the theme's script.js rewrites inline style attributes after load, so never select on [style*=...]. */
	.Sheet-body > div:not(:first-child) > table:first-child,
	.Sheet-body > div:not(:first-child) > table:first-child > tbody,
	.Sheet-body > div:not(:first-child) > table:first-child > tbody > tr { display: block; width: 100% !important; }
	.Sheet-body > div:not(:first-child) > table:first-child > tbody > tr > td { display: block; width: auto !important; height: auto !important; text-align: center; }
	.Sheet-body > div:not(:first-child) > table:first-child td[width="17%"],
	.Sheet-body > div:not(:first-child) > table:first-child td[width="69%"] { display: none; }

	/* Main layout table (second table in the wrapper div): one column, main cell first. */
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2),
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) > tbody { display: block; width: 100% !important; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) > tbody > tr { display: flex; flex-wrap: wrap; width: 100%; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) > tbody > tr > td { display: block; width: 100% !important; min-width: 0; padding: 0 10px; box-sizing: border-box; text-align: center; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) > tbody > tr:first-child > td:nth-child(3) { order: -1; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) h1 { font-size: 19px; margin: 10px 0 4px; }
	.Sheet-body > div:not(:first-child) > table:nth-of-type(2) h2 { font-size: 15px; }
	#cse-search-box { margin: 4px 0 10px; }
	#cse-search-box input[name="q"] { width: 60%; font-size: 16px; padding: 6px; box-sizing: border-box; }
	#cse-search-box input[type="submit"] { font-size: 16px; padding: 6px 12px; }
	#cse-search-box br { display: none; }

	/* Fixed-size ads wider than a phone. Hidden units are not requested. */
	ins.adsbygoogle[style*="width:728px"],
	ins.adsbygoogle[style*="width:468px"] { display: none !important; }

	/* The 12 category links (cells holding the *_header.jpg thumbnails): three per row. */
	td:has(> div img[src*="_header.jpg"]) { display: flex !important; flex-wrap: wrap; justify-content: center; width: 100% !important; padding: 0 !important; box-sizing: border-box; }
	td:has(> div img[src*="_header.jpg"]) > div { flex: 0 0 33.33%; padding-bottom: 12px !important; font-size: 13px; color: #FFFFCC; }
	td:has(> div img[src*="_header.jpg"]) > div img { width: 90px; height: auto; }

	/* Footer. */
	#footer { padding: 0 10px 20px; }
	#footer table { width: 100% !important; }
	#footer td { display: block; padding: 6px 0 !important; }
}
