/* Responsive layout. Loaded after style.css and ra_style.css.
   The page grows up to 1280px on wide screens and shrinks to phone width
   without scrolling sideways. Keep this file the same in every app. */

/* ---------- All widths ---------- */
#container {
	box-sizing: border-box;
	width: auto;
	max-width: 1280px;
	padding-left: 16px;
	padding-right: 16px;
}

/* Top menu: larger text, and the hover colour fills the whole bar height */
#home_menu {
	display: flex;
	flex-wrap: wrap;
	width: auto;
	height: auto;
	min-height: 40px;
	padding: 0;
}

#home_menu li {margin: 0;}

#home_menu li a {
	float: none;
	height: auto;
	padding: 10px 20px;
	font-size: 15px;
	line-height: 20px;
}

#wrapper {width: auto;}

/* Fills the space next to the 190px sidebar. A table that is still too
   wide scrolls inside this column instead of widening the page. */
#right {
	float: none;
	width: auto;
	overflow-x: auto;
}

#header img {max-width: 100%; object-fit: contain; object-position: left center;} /* keeps the logo shape when it has to shrink */
#footer {width: auto;}
#foot_menu, #foot_menu2 {display: none;} /* empty, and positioned at a fixed 645px */

/* Compose form columns (were inline styles) */
.compose-from {width: 380px; height: 240px; float: left;}
.compose-to {width: 420px; float: left; clear: right;}

/* My Students: fills the column, long emails wrap, and the table scrolls
   on its own when it is still too wide */
.table-scroll {overflow-x: auto;}
.my-students-table {width: 100%;}
.my-students-table .email-cell {overflow-wrap: anywhere;}

/* Librarian profile and contact box */
#right-left p, #librian-contact-block p {margin-left: 0;}
#right-left ul {padding-left: 20px;}
#librian-contact-block a {overflow-wrap: anywhere;}

@media (min-width: 1061px) {
	#right-left {width: calc(100% - 330px);} /* leaves room for the 294px contact box */
}

/* ---------- Tablets and small laptops ---------- */
@media (max-width: 1060px) {
	#right table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
	}

	/* already inside its own scroll box */
	#right .table-scroll > table {
		display: table;
		max-width: none;
	}

	fieldset, #tabs, .checklist, .tag_cat_list, #user_panel, #right-left,
	.long_length, .medium_length {
		box-sizing: border-box;
		max-width: 100%;
	}

	/* TinyMCE 3 draws its toolbar as a fixed-width table */
	#right span.mceEditor {
		display: block;
		max-width: 100%;
		overflow-x: auto;
	}

	.ui-dialog {max-width: calc(100vw - 24px);}
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
	input, select, textarea {font-size: 16px;} /* stops iOS zooming in on focus */

	#container {
		padding-left: 12px;
		padding-right: 12px;
	}

	#wrapper {margin-left: 0;}

	#left, #right {
		float: none;
		width: auto;
	}

	#left {margin-bottom: 20px;}

	/* The title sits next to the logo on wide screens */
	h1.page-title, #wrapper > h2 {
		float: none;
		margin: 10px 0;
	}

	#right h2 {
		margin-left: 0;
		margin-top: 0.83em;
	}

	p {margin-left: 0;}

	#right input[type=text], #right textarea, #right select {
		box-sizing: border-box;
		max-width: 100%;
	}

	.compose-from, .compose-to, #right-left,
	#librian-contact-block, #librian-signature-upload-block {
		float: none;
		width: auto;
		height: auto;
		margin-bottom: 20px;
	}
}
