/* Responsive layer for the fixed 980px layout in style.css.
   Desktop (>1000px) is untouched; everything below is scoped to narrower viewports.
   Loaded after style.css from includes/head.php. */

#mobileNavBtn {
	display: none;
}

/* ---------- <= 1000px: fluid container ---------- */
@media screen and (max-width: 1000px) {
	.pageAlign {
		width: auto;
		max-width: 980px;
		padding: 0 10px;
		box-sizing: border-box;
	}

	/* containers that used to be floated: contain their floats (::after is the iOS < 13 fallback) */
	#customBox_01 .content,
	#mainContent .content,
	#mainContent .topBar,
	#mainContent .block .block,
	.profileContent .profileListData,
	#sendBox,
	.contentSendBox {
		display: flow-root;
	}

	#customBox_01 .content::after,
	#mainContent .content::after,
	#mainContent .topBar::after,
	#mainContent .block .block::after,
	.profileContent .profileListData::after,
	#sendBox::after,
	.contentSendBox::after {
		content: "";
		display: table;
		clear: both;
	}

	/* header + nav (compact, still horizontal) */
	header {
		position: relative;
	}

	#mainNav {
		height: auto;
		min-height: 72px;
		background-color: #3a0716;
	}

	#mainNav ul li {
		padding: 22px 16px 26px 16px;
		font-size: 16px;
	}

	/* search teaser (home + search) */
	#customBox_01 {
		height: auto;
		background-position: right top;
		background-color: #2a0712;
	}

	#customBox_01 .content {
		float: none;
		margin: 30px 20px;
	}

	#customBox_01 .left {
		float: none;
		width: auto;
		max-width: 467px;
	}

	#customBox_01 .right {
		display: none;
	}

	/* main content panel */
	#mainContent .content,
	#profile #mainContent .content {
		float: none;
		width: auto;
		margin: 0 10px 20px 10px;
	}

	#profile #mainContent .content {
		margin-top: 20px;
	}

	#mainContent .topBar,
	#profile #mainContent .topBar {
		float: none;
		width: auto;
		height: auto;
		min-height: 50px;
		background-size: cover;
	}

	#profile #mainContent .topBar {
		margin: -20px 0 20px 0;
		padding: 9px 20px;
	}

	#profile #mainContent .topBar h3 {
		margin-top: 0;
	}

	#mainContent .block .block {
		float: none;
		width: auto;
		margin: 20px 20px 0 20px;
	}

	/* search results nest a second .block inside .profileList: don't indent twice */
	#mainContent .profileList .mod_cataloglistcustomstatic {
		margin: 0;
	}

	/* profile card grid (listings use .list, search results .mod_cataloglistcustomstatic) */
	.profileList .list,
	#mainContent .profileList .mod_cataloglistcustomstatic {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		grid-gap: 20px;
		gap: 20px;
		margin-bottom: 20px;
	}

	/* the clearfix pseudo-element would become an empty grid cell */
	#mainContent .profileList .mod_cataloglistcustomstatic::after {
		content: none;
	}

	.profileList .profileBox {
		float: none;
		width: auto;
		margin: 0;
	}

	.profileList .profileBox figure,
	.profileList .profileListData {
		float: none;
	}

	.profileList .profileBox figure img {
		float: none;
		display: block;
		width: 100%;
		height: auto;
		box-sizing: border-box;
	}

	/* pagination is rendered inside the grid: give it the whole row */
	.profileList .pagination {
		grid-column: 1 / -1;
		height: auto;
		min-height: 62px;
		padding-bottom: 8px;
		background-size: cover;
	}

	/* style.css hides next/previous/last (equal specificity), so leave those alone */
	.profileList .pagination li:not(.next):not(.previous):not(.last) {
		display: inline-block;
		margin: 0 4px 8px 4px;
	}

	/* profile page: image and details side by side */
	.profileImageContent {
		width: 48%;
	}

	.profileImageContent .img {
		float: none;
		display: inline-block;
		width: auto;
		height: auto;
		max-width: 100%;
		box-sizing: border-box;
	}

	.profileImageContent .img img {
		display: block;
		max-width: 100%;
		height: auto;
	}

	.profileContent {
		float: right;
		width: 48%;
	}

	.profileContent .profileListData {
		float: none;
		padding-bottom: 15px;
	}

	#sendBox {
		float: none;
		width: auto;
		box-sizing: border-box;
	}

	.contentSendBox {
		float: none;
		width: auto;
		padding: 15px 15px 20px 15px;
	}

	.contentSendBox h3 {
		float: none;
		max-width: 100%;
		background-size: contain;
	}

	#sendSMS input[type="text"],
	#sendSMS textarea {
		width: 100%;
		box-sizing: border-box;
	}

	#sendSMS input[type="text"] {
		padding: 0 10px;
		font-size: 16px;
	}

	/* footer is floated, so only padding (not margin) keeps its last lines clear of the fixed cookie bar */
	footer {
		box-sizing: border-box;
		margin-bottom: 0;
		padding: 0 10px 50px 10px;
	}

	/* the form now sits on the teaser photo, darken it */
	#customBox_01 {
		background-image: linear-gradient(rgba(26, 3, 10, 0.78), rgba(26, 3, 10, 0.78)), url(../img/bg-1.jpg);
	}
}

/* ---------- <= 767px: phones / small tablets ---------- */
@media screen and (max-width: 767px) {
	header {
		margin-top: 15px;
	}

	#logo {
		width: auto;
		max-width: calc(100% - 60px);
		margin-left: 0;
	}

	#logo a {
		width: 237px;
		max-width: 100%;
		height: 43px;
		background-size: contain;
	}

	#logo h1 {
		float: none;
		clear: both;
		padding-top: 4px;
		font-size: 12px;
	}

	header .fb-like {
		display: none;
	}

	/* off-canvas navigation, toggled by js/main.js */
	#mobileNavBtn {
		display: block;
		position: absolute;
		top: 4px;
		right: 0;
		cursor: pointer;
		padding: 13px 14px;
		background: #4a0b1f;
		border: 1px solid #861e39;
		border-radius: 3px;
	}

	#mobileNavBtn span {
		display: block;
		width: 16px;
		height: 16px;
		background: url(../img/menu.png) 0 0 no-repeat;
	}

	#mainNav {
		display: none;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999999;
		width: 85%;
		max-width: 280px;
		height: 100%;
		min-height: 0;
		margin-top: 0;
		padding-top: 50px;
		overflow-y: auto;
		box-sizing: border-box;
		background: #2a0712;
		box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
	}

	#mainNav.open {
		display: block;
	}

	#mainNav .close {
		display: block;
		position: absolute;
		top: 0;
		right: 0;
		width: 48px;
		height: 48px;
		cursor: pointer;
		background: url(../img/close.png) center no-repeat;
	}

	#mainNav ul li {
		float: none;
		width: 100%;
		padding: 0;
		font-size: 17px;
		background: none;
	}

	#mainNav ul li a {
		display: block;
		padding: 14px 20px;
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	}

	/* search teaser: pattern instead of the 980px photo */
	#customBox_01 {
		margin-top: 15px;
		background: url(../img/bg-2.png) repeat;
	}

	#customBox_01 .content {
		margin: 20px 15px;
	}

	/* content panel */
	#mainContent .content,
	#profile #mainContent .content {
		margin-left: 0;
		margin-right: 0;
	}

	#mainContent .topBar {
		padding: 10px 15px;
	}

	#mainContent .topBar h3 {
		float: none;
		margin-top: 0;
	}

	#mainContent .topBar .topRight {
		float: none;
		margin-top: 6px;
	}

	#mainContent .topBar a {
		display: inline-block;
		padding: 4px 0;
	}

	#mainContent .block .block {
		margin: 15px 15px 0 15px;
	}

	#mainContent .profileList .mod_cataloglistcustomstatic {
		margin: 0 0 20px 0;
	}

	.profileList .list,
	#mainContent .profileList .mod_cataloglistcustomstatic {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		grid-gap: 15px;
		gap: 15px;
	}

	.profileList .profileListData a {
		font-size: 16px;
	}

	/* profile page: stack image, details and SMS form */
	.profileImageContent,
	.profileContent {
		float: none;
		width: auto;
	}

	.profileImageContent {
		text-align: center;
	}

	.profileContent .profileListData {
		padding: 15px 0;
	}

	#profile #mainContent .topBar h3 {
		font-size: 20px;
	}

	footer {
		margin-top: 30px;
		font-size: 12px;
		text-align: left;
	}

	footer .terms {
		color: #a34a64;
	}
}

/* ---------- <= 540px: phones ---------- */
@media screen and (max-width: 540px) {
	.profileList .list,
	#mainContent .profileList .mod_cataloglistcustomstatic {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-gap: 12px;
		gap: 12px;
	}

	#mainContent .block .block {
		margin: 12px 10px 0 10px;
	}

	#mainContent .profileList .mod_cataloglistcustomstatic {
		margin: 0 0 20px 0;
	}

	.profileList .profileListData {
		font-size: 13px;
	}

	.profileList .profileListData a {
		font-size: 15px;
	}

	#customBox_01 .left h2 {
		font-size: 22px;
	}

	/* search form: label above field; select keeps its 257px sprite (arrow is baked into the image) */
	#searchForm table,
	#searchForm tbody,
	#searchForm tr,
	#searchForm td {
		display: block;
	}

	#searchForm tr {
		display: flow-root;
	}

	#searchForm tr::after {
		content: "";
		display: table;
		clear: both;
	}

	#searchForm .col_0,
	#searchForm .col_1 {
		float: none;
		width: auto;
	}

	#searchForm .col_0 label {
		float: none;
		display: block;
		margin: 6px 0 4px 0;
	}

	#searchForm div.selector,
	#searchForm div.selector span {
		width: 100% !important;
		max-width: 257px;
		box-sizing: border-box;
	}

	#searchForm div.selector select {
		left: 0;
		width: 100%;
	}

	#searchForm .row_2 .col_1 span {
		display: inline-block;
		margin-bottom: 6px;
	}

	.contentSendBox {
		padding: 12px 10px 20px 10px;
	}

	/* the cookie bar wraps to 3-4 lines here; keep the footer text clear of it */
	footer {
		padding-bottom: 85px;
	}
}

/* ---------- landscape phones: keep the header short ---------- */
@media screen and (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
	header {
		margin-top: 8px;
	}
}

@media screen and (min-width: 768px) and (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
	#mainNav {
		margin-top: 20px;
	}
}
