/*
 * Basic mobile / tablet support.
 *
 * The original design is a fixed 960px layout. Below 980px the layout becomes fluid and the columns stack
 * (main content first, then the side column), the menu becomes two columns of tabs, the header shows the logo
 * above a full-width banner, and text is enlarged to 16px so it stays legible on a phone.
 * Loaded last (PageController), so it overrides layout.css / menu.css / form.css / individualPages.css.
 */

img {max-width: 100%; height: auto;}

@media (max-width: 980px) {

	/* text: 16px body copy */
	div#Wrapper .typography, div#Footer {font-size: 1.6em; line-height: 1.5;}
	.typography h1#PageTitle {font-size: 2em; line-height: 1.1em;}
	.typography h1 {line-height: 1.1em;}
	.typography li li {font-size: 1em;}
	div#Footer h3 {font-size: 2.2em;}

	/* fluid containers */
	div.Container, div#MainMenuHolder, ul#Nav, div#FooterGreyBanner, div#FooterBottom {
		width: auto; max-width: 100%; box-sizing: border-box;
	}
	div#MainSection div.Container {display: flex; flex-direction: column; padding: 10px 12px 20px 12px;}

	/* header: logo on top, then the banner slideshow at full width */
	div#Header, body#BodyHomePage div#Header {height: auto !important; overflow: visible !important;}
	div#TaranakiSlopes {position: static; width: auto; height: auto; background: none; text-align: center; padding: 10px 0;}
	a#Logo img {padding: 0; max-width: 60%;}
	div#AdvertisementsHolder .advertisement img {width: 100%; height: auto; display: block;}

	/* search row */
	div#RowBelowSlides {text-align: left;}
	div#SearchFormHolder {display: block; padding: 10px 12px; box-sizing: border-box;}
	div#SearchFormHolder h3 {display: none;}
	div#SearchFormHolder form {float: none; width: auto; margin: 0;}
	div#SearchFormHolder fieldset {display: flex; align-items: stretch;}
	div#Search, div#SearchForm_SearchForm_Search_Holder {float: none; flex: 1 1 auto; width: auto;}
	div#SearchFormHolder input#SearchForm_SearchForm_Search {width: 100%; height: 44px; font-size: 1.8em;}
	div#SearchFormHolder input#SearchForm_SearchForm_action_results {float: none; height: 44px; width: 64px; flex: 0 0 64px;}

	/* menu: two tabs per row, no hover growth (touch screens) */
	div#MainMenuHolder {height: auto; padding: 0 12px; box-sizing: border-box;}
	ul#Nav {display: flex; flex-wrap: wrap; justify-content: space-between; padding: 10px 0 0 0; background: transparent;}
	#Nav li, #Nav li:hover, #Nav li.current, #Nav li.section {
		box-sizing: border-box; float: none; width: calc(50% - 5px); height: 48px; margin: 0 0 10px 0; padding: 0 6px;
		border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;
	}
	#Nav li a, #Nav li a:hover, #Nav li.current a, #Nav li.section a {font-size: 2.2em; height: auto; line-height: 48px; padding: 0;}

	/* columns stack: content first */
	div#Layout, div#LeftColumn, div#Images {width: auto; float: none; margin: 0;}
	div#Layout {order: 1;}
	div#LeftColumn {order: 2; padding-top: 20px;}
	div#Images {order: 3;}
	div#ContentHolderInner {width: auto;}
	div#LeftColumn h4 {width: auto;}
	ul#HomePageEvents li {width: auto;}
	#Nav2And3 {width: auto;}
	div#Images {margin-left: 0;}

	/* footer */
	/* the footer starts with a 60px pale-blue stripe image, so keep the content below it */
	div#FooterGreyBanner {padding: 75px 12px 30px 12px;}
	div#FooterLeftColumn {width: auto; float: none; border-right: 0; margin-top: 0; padding-bottom: 0;}
	div#FooterRightColumn {float: none; width: auto; margin: 0; padding: 10px 0 20px 0;}
	div#Footer .typography {font-size: 1em;}
	div#SocialNetworkingLinksHeader h5 {font-size: 2.2em;}
	div#Phone, div#Fax, div#EmailUs, address#PhysicalAddress, address#PostalAddress {height: auto; min-height: 35px;}
	div#FooterFeather {display: none;}
	div#CopyrightNotice, div#DesignNotice {float: none; padding: 4px 0;}

	/* forms: fields fill the screen */
	.typography .middleColumn input, .typography .middleColumn textarea, .typography .middleColumn select {
		width: 100%; box-sizing: border-box; font-size: 1em; padding: 8px;
	}
	.typography .middleColumn ul {width: auto;}
	.typography .Actions input, .typography input.action {float: none; margin-right: 0; min-height: 44px; padding: 0 16px;}
	/* the ancestry (family tree) field is absolutely positioned: scroll it sideways inside its own box */
	div.ancestry {width: auto !important; max-width: 100%; overflow-x: auto;}

	/* tables scroll sideways rather than overflowing the page */
	.typography table {display: block; max-width: 100%; overflow-x: auto;}

	/* other pages with fixed widths */
	body#BodyImageGalleryPage div#Layout {width: auto !important;}
	div.galleryIntro, div.boxThoseGalleries, ul#Galleries li, div#ImageGalleryEntriesOuter {width: auto; float: none;}
	ul#Galleries li div.details {width: auto; float: none;}
	div#SideBarWithNextAndPrevious {width: auto; float: none; border-right: 0;}
}

@media (max-width: 480px) {
	#Nav li a, #Nav li a:hover, #Nav li.current a, #Nav li.section a {font-size: 2em;}
	a#Logo img {max-width: 75%;}
}
