/* Mobile / responsive layer for cnfp.ru.
   Desktop styles are NOT touched: all overrides live in max-width media queries. */

.mobile-menu-toggle { display: none; }
.mobile-menu-overlay,
.mobile-menu-close { display: none; }

@media (max-width: 1023px) {

	html, body { overflow-x: hidden; }
	body { background: #e4f1ff; }
	.main {
		width: auto;
		max-width: 100%;
		min-height: 0;
		margin: 0 auto;
		padding: 12px;
		box-sizing: border-box;
	}

	.main img,
	.footer img { max-width: 100%; height: auto; }

	/* ---------- header ---------- */
	.header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
	}
	.header .logo {
		order: 1;
		width: auto;
		float: none;
		max-width: 190px;
	}
	.header .logo img { display: block; width: auto; height: auto; max-width: 100%; }
	.header .company-discription {
		order: 3;
		display: block;
		width: 100%;
		float: none;
		margin: 0;
		font-size: 12px;
		line-height: 1.25;
		text-transform: uppercase;
		color: #919fa7;
	}
	.header .search { display: none; }
	.header .vcard {
		order: 4;
		width: 100%;
		padding: 0;
		float: none;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 2px 4px;
	}
	.header .vcard .tel {
		order: 1;
		float: none;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		min-width: 0;
		gap: 2px 4px;
		font-size: 11px;
	}
	.header .vcard .tel .value { margin: 0; white-space: nowrap; }
	.header .vcard .tel a { color: inherit; text-decoration: none; }
	.header .vcard .contact-link {
		order: 2;
		display: inline-flex;
		align-items: center;
		width: auto;
		float: none;
		min-height: 44px;
		margin: 0;
		padding: 0;
		box-sizing: border-box;
		background: none;
		border-radius: 0;
		white-space: nowrap;
                font-size: 11px;
	}
	.header .vcard .contact-link a {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		color: #0f3b6e;
		text-decoration: underline;
                font-size: 11px;
	}
	.header .vcard .contact-link h3 {
		margin: 0;
		font-size: 11px;
		font-style: normal;
		line-height: 1;
		color: #0f3b6e;
	}


	.mobile-menu-toggle {
		order: 2;
		display: inline-flex;
		flex-direction: column;
		justify-content: center;
		gap: 4px;
		width: 44px;
		height: 44px;
		margin-left: auto;
		padding: 11px 10px;
		box-sizing: border-box;
		border: 0;
		border-radius: 4px;
		background: #0f3b6e;
		cursor: pointer;
	}
	.mobile-menu-toggle span { display: block; width: 100%; height: 2px; background: #fff; }

	/* ---------- menu drawer ---------- */
	body.menu-open { overflow: hidden; }
	body.menu-open .mobile-menu-overlay {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 1001;
		background: rgba(0, 0, 0, .45);
	}
	.nav {
		position: fixed;
		top: 0;
		right: 0;
		z-index: 1002;
		display: block;
		width: min(86vw, 360px);
		max-width: 100%;
		height: 100%;
		margin: 0;
		padding: 52px 0 24px;
		box-sizing: border-box;
		background: #0f3b6e;
		box-shadow: -6px 0 18px rgba(0, 0, 0, .25);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		transform: translateX(105%);
		transition: transform .25s ease;
		visibility: hidden;
		pointer-events: none;
	}
	body.menu-open .nav { transform: translateX(0); visibility: visible; pointer-events: auto; }

	.mobile-menu-close {
		display: block;
		position: absolute;
		top: 6px;
		right: 8px;
		z-index: 3;
		width: 40px;
		height: 40px;
		padding: 0;
		border: 0;
		background: transparent;
		color: #fff;
		font-size: 30px;
		line-height: 1;
		cursor: pointer;
	}

	.nav > ul { display: block; }
	.nav ul li {
		position: relative;
		display: block;
		width: auto;
		height: auto;
		padding: 0;
		text-align: left;
		line-height: normal;
		border-bottom: 1px solid rgba(255, 255, 255, .12);
		cursor: default;
	}
	.nav > ul > li > a {
		display: block;
		padding: 12px 52px 12px 16px;
		font-size: 15px;
		line-height: 1.3;
		color: #fff;
	}
	.nav > ul > li:hover,
	.nav > ul > li.click { background: none; }
	.nav > ul > li > a:hover { background: none; }

	.nav .wr { position: static; }
	.nav .wr > ul,
	.nav li > ul {
		position: static !important;
		display: none !important;
		min-width: 0;
		background: #16487f;
		border: 0;
		padding: 0;
	}
	.nav .wr.open > ul,
	.nav li.open > ul { display: block !important; }
	.nav ul ul li { border-bottom: 1px solid rgba(255, 255, 255, .08); }
	.nav ul ul li a {
		display: block;
		padding: 10px 16px 10px 28px;
		font-style: normal;
		font-size: 14px;
		text-shadow: none;
	}
	.nav ul ul ul li { padding-left: 0; }
	.nav ul ul ul li:before { display: none; }
	.nav ul ul ul li a { padding-left: 44px; }

	.submenu-toggle {
		position: absolute;
		top: 0;
		right: 2px;
		z-index: 2;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		background: transparent;
		cursor: pointer;
	}
	.submenu-toggle span {
		display: block;
		width: 9px;
		height: 9px;
		margin: 0 auto;
		border-right: 2px solid #fff;
		border-bottom: 2px solid #fff;
		transform: rotate(45deg);
		transition: transform .2s;
	}
	.submenu-toggle[aria-expanded="true"] span { transform: rotate(-135deg); }

	.nav .search {
		display: block;
		position: relative;
		float: none;
		width: auto;
		padding: 8px 16px 12px;
	}
	.nav .search input[type="text"] {
		width: 100%;
		height: 34px;
		margin: 0;
		padding: 5px 40px 5px 8px;
		box-sizing: border-box;
		border: 1px solid #cccccc;
		border-radius: 3px;
		background: #fff;
	}
	.nav .search .send { top: 12px; right: 20px; }

	/* ---------- layout columns ---------- */
	.page-wrapper { margin-top: 12px; }
	.page-wrapper .left-col,
	.page-wrapper .right-col { float: none; width: auto; margin: 0; }
	.page-wrapper .right-col {
		border-left: 0;
		border-top: 1px solid #99acc1;
		margin-top: 18px;
		padding-top: 18px;
	}

	.content h1 { font-size: 26px; }
	.content h2 { font-size: 20px; }
	.content h3 { font-size: 18px; }
	.bread { margin: 0 0 12px; }
	.single-news { padding: 0; }
	.news-index { margin: 0; padding: 12px 0; }

	.push-left-10, .push-left-20, .push-left-30, .push-left-40, .push-left-50 { padding-left: 0 !important; }

	/* ---------- news ---------- */
	.news-list .date { float: none; width: auto; margin-bottom: 4px; }
	.news-list .article { float: none; width: auto; margin-left: 0; }
	.news-list .preview { float: none; margin-bottom: 8px; }

	/* ---------- specialists / books ---------- */
	.spec-list .item { float: none; width: auto; margin: 0 0 16px; }
	.spec-list .item .image { float: none; margin: 0 0 8px; }
	.pub-list .item .image { float: none; margin: 0 0 8px; }
	.pub-list .item .desc { margin: 0; }

	/* ---------- catalog ---------- */
	.catalog .item,
	.catalog-item { float: none !important; width: auto !important; margin: 0 0 18px !important; }
	.catalog .item .image img,
	.catalog-item .image img { max-width: 100%; height: auto; }
	.catalog-stroke { margin-bottom: 24px; }
	.button-price { display: inline-block; }

	/* ---------- slider ---------- */
	.slider { height: auto; background-size: cover; padding-bottom: 14px; }
	.slider .item .article { float: none; width: auto; }
	.slider .item .image { margin-left: 0; }
	.slider .item .image img { width: 100%; height: auto; }
	.slider .item .read-more { position: static; margin: 10px 0 0; }

	/* ---------- galleries ---------- */
	.albums { width: auto; margin: 0; }
	.albums li { width: calc(50% - 20px); margin: 0 0 18px 20px; }
	.albums li:nth-child(2n+1) { margin-left: 0; }
	.albums .album-cover { margin-left: auto; margin-right: auto; }

	.video-gallery { width: auto; margin: 0; }
	.video-gallery li { width: 100%; margin: 0 0 24px; }
	.video-gallery .preview { width: 100%; height: auto; }
	.video-gallery .preview img { width: 100%; height: auto; }

	.audio-gallery { width: auto; }
	.audio-gallery li { width: 100%; margin: 0 0 20px; }
	.audio-gallery .name { float: none; height: auto; margin: 6px 0 0 36px; overflow: visible; }
	.audio-gallery .time { float: none; margin: 2px 0 0 36px; }

	.album-one .fancy { float: none; width: auto; height: auto; margin: 0 0 16px; }
	.album-one .fancy img { max-width: 100%; height: auto; }

	.before-after { max-width: 100%; }
	.before-after img { max-width: 100%; }

	/* ---------- forms ---------- */
	.form-wrapper { width: auto; margin: 0; padding: 12px 0 0; background-size: cover; }
	.form-wrapper h3 { margin-left: 0; }
	form .form-row { width: auto; }
	form .form-row .span2 { float: none; width: 100%; margin: 0 0 8px; }
	form .form-row .center { width: auto; }
	form .form-row input[type="text"],
	form .form-row input[type="password"],
	form .form-row input[type="email"],
	form .form-row select,
	form .form-row textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
	.form-footer { padding: 20px 0; }

	.popup-block.simple-popup-block { width: auto; max-width: 92vw; padding: 18px; }
	.popup-block .name { font-size: 1.4em; margin-bottom: 18px; }

	/* ---------- right column ---------- */
	.login-panel { width: auto; left: 0; }
	.sidebar-box { padding: 0 4px; }
	.sidebar-image-wrapper { max-width: 100%; }
	.sidebar-slider-wrapper .sidebar-slider { max-width: none; }
	.total-price { width: auto; float: none; }

	/* ---------- footer ---------- */
	.footer-wrapper .footer { width: auto; padding: 28px 14px 80px; }
	.footer-wrapper .footer .center-box { width: auto; }
	.footer-wrapper .footer .center-box .sub-nav li { float: none; width: 100%; margin: 0 0 12px; }
	.footer-wrapper .footer .copyright {
		position: static;
		width: auto;
		height: auto;
		padding: 16px 0 0;
		background: transparent;
	}

	/* ---------- misc ---------- */
	iframe { width: 100% !important; min-height: 300px; }
	.print-but { position: static; display: inline-block; margin-bottom: 8px; }
	.event-button { left: 0; margin-left: 0; }
	.tags ul { left: 0 !important; top: 0; display: block; }
	.tags ul li { float: none; display: inline-block; margin: 0 6px 6px 0; }

	.table-scroll {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		max-width: 100%;
	}
	.table-scroll > table { min-width: 640px; margin: 12px 0; }
}

@media (min-width: 560px) and (max-width: 1023px) {
	.header .company-discription {
		order: 2;
		flex: 1 1 0;
		width: auto;
		max-width: none;
		min-width: 0;
		margin: 0 8px;
		padding: 0;
		font-size: 11px;
		line-height: 1.25;
		text-align: left;
	}
	.header .mobile-menu-toggle {
		order: 3;
		margin-left: 0;
	}
	.header .vcard { order: 4; }
}

@media (max-width: 640px) {

	.main { padding: 10px; }
	.header .logo { max-width: 160px; }
	.content h1 { font-size: 23px; }
	.content h2 { font-size: 19px; }

	.albums li { width: 100%; margin-left: 0; }
	.video-gallery li { width: 100%; }

	.footer-wrapper .footer .center-box .sub-nav li { width: 100%; }
	.footer-wrapper .footer { padding: 24px 12px 70px; }
}

@media (max-width: 340px) {
	.header .vcard .contact-link { margin-left: auto; }
}

@media (max-width: 380px) {

	.main { padding: 8px; }
	.header .logo { max-width: 140px; }
	.content h1 { font-size: 21px; }
	.content h2 { font-size: 18px; }
}

/* ---------- touch devices ---------- */

@media (hover: none) and (pointer: coarse) {
	.nav > ul > li > a { min-height: 44px; }

	.button,
	.grey-button,
	.button-price,
	.toBasket,
	input[type="submit"],
	button {
		min-height: 44px;
		box-sizing: border-box;
	}
}

/* Tablets that keep the desktop layout (>=1024px): tap-to-open submenu */
@media (hover: none) and (pointer: coarse) and (min-width: 1024px) {
	.nav > ul > li { height: 44px; }
	.nav > ul > li > a {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 44px;
		padding: 0 4px;
	}

	.nav > ul > li:hover { background: url('/img/head-nav-bg.jpg') repeat-x; }
	.nav > ul > li.touch-open { background: url('/img/head-nav-bg-hover.jpg') repeat-x; }

	.nav li.touch-open > .wr > ul,
	.nav li.touch-open > ul { display: block !important; }

	.nav ul ul li a:hover { background: none; }
	.nav ul ul li a:active { background: #78a5dd; }
}
