/*
 * Responsive layout of the public pages (templates/layout_head.php, layout_foot.php).
 * Loaded after main.css. Every rule is under body.lay, so the admin pages are not affected.
 * Phone = narrower than 760px.
 */

/* ---------- page ---------- */
body.lay {
	margin: 0;
	background: #000;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
.lay .m-only, .lay .m-inline { display: none; }

.lay-grid {
	width: 100%;
	max-width: 1022px;
	margin: 0 auto;
	table-layout: fixed;
}
.lay-grid > tbody > tr > td { vertical-align: top; }
.lay-grid > tbody > tr > td:nth-child(2) { width: auto; overflow-wrap: anywhere; }
.lay-left, .lay-right { width: 200px; }
.lay img { max-width: 100%; }

/* ---------- desktop header ---------- */
.dhead { max-width: 1002px; margin: 0 auto; }
.dhead-bans { display: flex; justify-content: space-between; gap: 2px; padding-bottom: 6px; }
.dhead-bans img { display: block; border: 0; }
.dnav {
	display: flex;
	align-items: center;
	height: 44px;
	border-top: 1px solid #5133FF;
	border-bottom: 1px solid #FF0000;
	background: #050505;
	margin-bottom: 4px;
}
.dnav img { display: block; border: 0; }
.dnav a {
	flex: 1 1 auto;
	text-align: center;
	font: bold 11px Verdana, Arial, Helvetica, sans-serif;
	color: #C0C0C0;
	text-decoration: none;
	padding: 14px 2px;
	transition: color .15s;
}
.dnav a:hover, .dnav a.is-current { color: #FF0000; }
.dnav a.dnav-logo, .dnav a.dnav-logo:hover { flex: 0 0 auto; padding: 0; }
.dnav-end { flex: 0 0 auto; }

/* ---------- side columns ---------- */
.lay .box {
	border: 1px solid #333;
	border-radius: 4px;
	background: #0a0a0a;
	padding: 10px;
	margin-bottom: 10px;
	font: 12px Verdana, Arial, Helvetica, sans-serif;
	color: #C0C0C0;
}
.lay .box-title { margin-bottom: 8px; color: #C0C0C0; }
.lay .box-ban { padding: 0; border-color: #510000; text-align: center; background: none; }
.lay .box-ban img { display: block; margin: 0 auto; border: 0; }
.lay .box-handbook { text-align: center; background: #0a0a0a url(https://regions.bluesystem.org/images/today/forum_bg.jpg); }
.lay .box form { margin: 0; text-align: center; }
.lay .box select { max-width: 100%; }
.side-links { list-style: none; margin: 0; padding: 0; }
.side-links li { margin: 0 0 5px; }
.side-links a {
	font: bold 12px Arial, Verdana, Helvetica, sans-serif;
	color: #FF0000;
	text-decoration: none;
}
.side-links a::before { content: "- "; }
.side-links a:hover { color: #5133FF; }
.bx-pair { display: flex; justify-content: space-around; }
.bx-pair img { border: 0; }

/* ---------- content ---------- */
.lay .foot-ban { text-align: center; margin-top: 30px; }   /* banner under the board (PrintFoot() in common.php), desktop only */
.lay .foot-ban img { display: inline-block; }
.lay .bx-ads {
	max-width: 500px;
	margin: 20px auto 0;
	border: 1px solid #510000;
	border-radius: 4px;
	padding: 8px;
}
.lay .bx-row { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
.lay .bx-row img { display: block; border: 0; }

/* ---------- footer ---------- */
.lfoot {
	max-width: 1002px;
	margin: 10px auto 0;
	padding: 14px 16px 18px;
	border-top: 1px solid #333;
	font: 10px Verdana, Arial, Helvetica, sans-serif;
	color: #C0C0C0;
	box-sizing: border-box;
}
.lfoot p { margin: 0 0 10px; }
.lfoot-18 { font-size: 12px; }
.lfoot-copy { font-size: 12px; }
.lfoot-copy span { font-size: 11px; }
.lfoot-links { font-size: 12px; }
.lfoot-links a { display: inline-block; margin: 0 18px 6px 0; text-decoration: underline; }
/* copyright + links on the left, LiveInternet counter on the right */
.lfoot-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.lfoot-text { flex: 1 1 auto; min-width: 0; }
.lfoot-text p:last-child { margin-bottom: 0; }
.lfoot-cnt { flex: 0 0 auto; opacity: .4; }

/* ======================= phone ======================= */
@media (max-width: 760px) {
	.lay .d-only { display: none !important; }
	.lay .m-only { display: block; }
	.lay .m-inline { display: inline-block; }

	/* banner above the top bar (config-org/mobile_banners.php, see layout_head.php) */
	.lay .mob-banner {
		text-align: center;
		line-height: 0;             /* no gap under the image */
		padding: 4px 0;
		background: #000;
	}
	.lay .mob-banner a { display: inline-block; max-width: 100%; }
	.lay .mob-banner img {
		display: block;
		max-width: 100%;            /* 500px banners shrink to the screen width */
		height: auto;
		border: 0;
	}

	/* two banners side by side in the middle of a board (config-org/mobile_banners.php, index.php) */
	.lay li.mob-mid {
		display: flex;
		justify-content: center;
		gap: 8px;
		list-style: none;
		margin: 14px 0 14px -12px;  /* the message list is indented 12px: centre on the page */
		line-height: 0;
	}
	.lay li.mob-mid a { flex: 0 1 auto; max-width: calc(50% - 4px); }
	.lay li.mob-mid img { display: block; max-width: 100%; height: auto; border: 0; }

	/* top bar instead of the desktop header */
	.lay .mbar {
		display: flex;
		align-items: center;
		gap: 4px;
		height: 48px;
		padding: 0 6px 0 0;
		background: #050505;
		border-top: 1px solid #5133FF;
		border-bottom: 1px solid #FF0000;
	}
	.mbar-logo img { display: block; width: 54px; height: 44px; border: 0; }
	.lay a.mbar-title {
		flex: 1 1 auto;
		font: bold 16px Arial, Helvetica, sans-serif;
		color: #FFFFFF;
		padding: 12px 4px;
	}
	.lay a.mbar-link {
		font: bold 13px Arial, Helvetica, sans-serif;
		color: #C0C0C0;
		padding: 14px 8px;
	}

	/* one column: content only */
	.lay-grid, .lay-grid > tbody, .lay-grid > tbody > tr { display: block; width: auto; max-width: none; }
	.lay-grid > tbody > tr > td { display: none; }
	.lay-grid > tbody > tr > td:nth-child(2) { display: block; width: auto; padding: 4px 12px 0; }
	.lay-grid table { width: 100% !important; }
	.lay-grid img { height: auto; }
	.lay-grid img[align="right"] { width: 64px; height: 64px; margin: 0 0 6px 8px; }

	/* no red line under the breadcrumb (enter_bbs, enter_rules, enter_ctrl, enter_advertisement, advertisement_order) */
	.lay-grid table[width="70%"][height="1"] { display: none; }

	/* bigger text */
	.lay-grid, .lay-grid td, .lay-grid p, .lay-grid li,
	.lay-grid .regt, .lay-grid .text1, .lay-grid .text5, .lay-grid .text7, .lay-grid .text8,
	.lay-grid .text18, .lay-grid .text27 { font-size: 15px; line-height: 1.45; }
	.lay-grid .text19, .lay-grid .text20, .lay-grid .text21 { font-size: 13px; line-height: 1.4; }
	.lay-grid .text3 { font-size: 15px; }
	.lay-grid font[size="3"] { font-size: 17px; }
	.lay-grid font[size="4"] { font-size: 19px; }

	/* message tree: less indentation, links easier to tap */
	.lay-grid ul { margin: 0; padding-left: 12px; }
	.lay-grid ul ul { padding-left: 10px; border-left: 1px solid #222; }
	.lay-grid li { margin: 7px 0; }

	/* forms (reply form, ctrl.php, advertisement_order.php): one field under the other, full width */
	.lay-grid form td { display: block; width: auto !important; text-align: left !important; }
	.lay-grid form input[type="text"], .lay-grid form input[type="email"], .lay-grid form input:not([type]),
	.lay-grid form textarea, .lay-grid form select {
		width: 100% !important;
		box-sizing: border-box;
		font-size: 16px;            /* 16px: iPhone does not zoom in on the field */
		padding: 8px;
		border: 1px solid #555;
		border-radius: 3px;
	}
	.lay-grid form input[type="submit"] {
		font-size: 16px;
		padding: 11px 18px;
		width: auto;
		border-radius: 3px;
	}
	/* reply form (PrintReplyForm() in common.php): no yellow "Разместить платное?" next to "Послать сообщение" */
	.lay-grid form a[title="Разместить платное объявление?"] { display: none; }

	/* footer */
	.lfoot { padding: 14px 12px 22px; font-size: 13px; line-height: 1.45; }
	.lfoot-18 { font-size: 14px; }
	.lfoot-copy, .lfoot-copy span { font-size: 13px; }
	.lfoot-links { font-size: 14px; }
	.lfoot-links a { margin: 0 14px 10px 0; }
	/* copyright across the full width; only the links share the row with the counter */
	.lfoot-row { flex-wrap: wrap; column-gap: 10px; row-gap: 0; }
	.lfoot-text { display: contents; }
	.lfoot-copy { flex: 0 0 100%; }
	.lfoot-links { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
}
