/*
 * ForestWander Mobile - photo pages (single.php + single-header.php), phones only.
 * Desktop is untouched: every rule is inside the max-width query.
 * Page structure: .Sheet-body > div > [p HOME PAGE] [header table] [table width=780px: thumbs | ad | MAIN | ad | thumbs] ; #footer
 */
@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; }

	/* Header: keep HOME PAGE and search, drop the empty newsletter cell and the compass / 468px ad / binoculars row. */
	.Sheet-body > div > p:first-child { margin: 10px 0 6px; }
	.Sheet-body > div > table:not([width]),
	.Sheet-body > div > table:not([width]) > tbody,
	.Sheet-body > div > table:not([width]) > tbody > tr { display: block; width: 100% !important; }
	.Sheet-body > div > table:not([width]) > tbody > tr > td { display: block; width: auto !important; height: auto !important; text-align: center; }
	.Sheet-body > div > table:not([width]) td[width="17%"],
	.Sheet-body > div > table:not([width]) td[width="69%"] { display: none; }
	#cse-search-box { margin: 4px 0 8px; }
	#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; }

	/* Main table becomes one column: photo first, then one ad, then the category thumbnails. */
	table[width="780px"], table[width="780px"] > tbody { display: block; width: 100% !important; }
	table[width="780px"] > tbody > tr { display: flex; flex-direction: column; width: 100%; }
	table[width="780px"] > tbody > tr > td { display: block; width: auto !important; min-width: 0; padding: 0 10px; box-sizing: border-box; text-align: center; }
	table[width="780px"] > tbody > tr > td:nth-child(3) { order: 1; }
	table[width="780px"] > tbody > tr > td:nth-child(2) { order: 2; margin: 16px 0; }
	table[width="780px"] > tbody > tr > td:nth-child(2) br { display: none; }
	table[width="780px"] > tbody > tr > td:nth-child(1) { order: 3; }
	table[width="780px"] > tbody > tr > td:nth-child(5) { order: 4; }
	table[width="780px"] > tbody > tr > td:nth-child(4) { display: none; } /* second 160x600 ad */

	/* Category thumbnails: three per row. */
	table[width="780px"] > tbody > tr > td:nth-child(1),
	table[width="780px"] > tbody > tr > td:nth-child(5) { display: flex; flex-wrap: wrap; justify-content: center; }
	table[width="780px"] > tbody > tr > td:nth-child(1) > div,
	table[width="780px"] > tbody > tr > td:nth-child(5) > div { flex: 0 0 33.33%; padding-bottom: 12px !important; font-size: 13px; color: #FFFFCC; }
	table[width="780px"] > tbody > tr > td:nth-child(1) > div img,
	table[width="780px"] > tbody > tr > td:nth-child(5) > div img { width: 90px; height: auto; }

	/* The photo, navigation and text. */
	table[width="780px"] > tbody > tr > td:nth-child(3) { line-height: 1.45; }
	table[width="780px"] > tbody > tr > td:nth-child(3) .navigation,
	table[width="780px"] > tbody > tr > td:nth-child(3) .navigation .aligncenter { width: auto !important; max-width: 100%; margin: 6px 0 8px; }
	table[width="780px"] > tbody > tr > td:nth-child(3) .navigation span,
	table[width="780px"] > tbody > tr > td:nth-child(3) .navigation a { display: inline-block; padding: 8px 4px; font-size: 14px; }
	img.photoQLinkImg, img.photoQcontent { width: 100%; max-width: 100%; height: auto; }
	.photoQDescr { font-size: 16px; font-weight: normal; margin: 10px 0; }
	ul.photoQExifInfo { padding: 0; margin: 8px 0; font-size: 13px; font-weight: normal; }
	table[width="780px"] div[style*="width:580px"] { width: auto !important; max-width: 100%; }
	table[width="780px"] h2 { font-size: 17px; }
	table[width="780px"] h3 { font-size: 15px; }
	table[width="780px"] a { font-size: inherit; }

	/* Comment form. */
	#commentform input[type="text"], #commentform textarea { width: 100% !important; max-width: 100%; font-size: 16px; box-sizing: border-box; }
	#commentform input[type="submit"] { font-size: 16px; padding: 8px 16px; }

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