/* ==========================================================
   Адаптивні стилі для шаблону study (pidruchnyk.com.ua)
   ПК (>1040px) — без змін. Нижче — планшети й телефони.
   ========================================================== */

.m-logo { display: none; }

/* Відео/книги з iframe ніколи не ширші за колонку */
.acontent iframe, .acon-text iframe, .tilo-book iframe { max-width: 100%; }
.acon-text img { max-width: 100%; height: auto; }

@media (max-width: 1040px) {

	html { -webkit-text-size-adjust: 100%; }
	body { font-size: 14px; line-height: 1.45; background-size: auto; }
	.panelx1 { background: none; }

	#wrapper { width: auto !important; max-width: 100%; margin: 0 8px; padding-top: 8px; }

	/* ---------- Шапка ---------- */
	#header {
		height: auto; background: #fff !important;
		border-radius: 12px 12px 0 0; padding: 12px 12px 0;
		display: flex; flex-direction: column;
	}
	#header > div { position: static !important; width: auto !important; height: auto !important; left: auto; top: auto; padding: 0 !important; }

	.m-logo {
		display: block; order: 1; text-decoration: none; margin-bottom: 8px;
		font: 700 22px/1.1 Arial, sans-serif; color: #f46604; text-transform: uppercase; letter-spacing: .5px;
	}
	.m-logo span { display: block; font: 400 13px/1.4 Arial, sans-serif; color: #777; text-transform: none; letter-spacing: 0; }

	.study_2 { display: none; }                 /* соцкнопки */
	.study_3 { order: 2; }                      /* пошук */
	.study_4 { order: 3; margin-top: 10px; }    /* меню класів */
	.study_5 { order: 4; margin-top: 10px; }    /* закладки / замовити */
	.study_1 { order: 5; margin: 12px 0 0; color: #555; font-size: 13px; } /* SEO-текст */
	.study_6 { order: 6; }                      /* блок «дошка» */

	/* пошук */
	.study_3 .searchbar { float: none; }
	#cssmenu > ul > li { margin: 0 !important; }
	#cssmenu span { display: block; }
	.searchbar {
		width: auto; height: 44px; margin: 0; display: flex; align-items: center;
		background: #f2f2f2; border: 1px solid #ddd; border-radius: 22px;
	}
	.searchbar input[type="text"] {
		flex: 1; float: none; width: auto; margin: 0; padding: 0 16px; height: 42px;
		font-size: 16px; color: #333; font-style: normal; min-width: 0;
	}
	.searchbar input[type="image"] { float: none; margin: 0 12px 0 0; }

	/* меню класів — сітка кнопок */
	#cssmenu { width: auto; height: auto; background: none; border-radius: 0; }
	#cssmenu > ul { float: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
	#cssmenu > ul > li { float: none; }
	#cssmenu > ul > li > a,
	#cssmenu > ul > li:first-child > a,
	#cssmenu > ul > li:last-child > a {
		display: block; text-align: center; padding: 0 4px; line-height: 40px; font-size: 14px;
		border-radius: 8px; background: #2b2b31;
	}
	#cssmenu > ul > li:first-child { grid-column: 1 / -1; }
	#cssmenu > ul > li:hover:after { display: none; }

	/* блок «дошка» з випадковими підручниками */
	#header > .study_6 {
		margin: 12px -12px 0; padding: 14px 12px !important;
		background: #2f5d50; color: #fff;
	}
	.study_6 .category-image { float: left; margin: 0 12px 6px 0; }
	.study_6 .category-image img { width: 90px; height: auto; }
	.study_6 .category-links { width: auto !important; float: none; }
	.study_6 .category-links ul { overflow: hidden; }
	.study_6 .main-headline { display: block; font-size: 16px; line-height: 1.3; color: #fff; margin-bottom: 6px; }
	.study_6 li { margin: 0 0 6px; }
	.study_6 .headline-small { font-size: 14px; line-height: 1.35; }
	.study_6 > .home-widget > ul:last-child { clear: both; }

	/* ---------- Контент ---------- */
	#content { padding: 0 12px; }
	#content #content { padding: 0; }
	#content #primary, #content #sidebar { float: none !important; width: auto !important; }
	#primary { overflow: hidden; }
	#sidebar { margin: 16px -12px 0; border-radius: 0; }
	#sidebar-narrow-container { display: none; }

	/* головна: два стовпці карток */
	#category-blocks .category-block { float: none; width: auto; }
	.category-block .post-thumb img { width: 90px; height: auto; }
	.category-block .entry-title, .category-block .entry-title a { font-size: 15px; }

	/* список книг у категорії */
	.post-entry h2 { font-size: 18px; line-height: 1.3; margin-bottom: 10px; }
	.post-image { height: auto; border: 0; float: left; margin: 0 12px 8px 0; }
	.post-image a { width: auto; height: auto; border: 0; }
	.post-image img { width: 110px; height: auto; display: block; }
	.post-details { border: 0; padding: 0 0 6px; }
	.post-details2 { margin: 0; }

	/* сторінка книги */
	article .ahead h1 { font-size: 20px; line-height: 1.3; float: none; }
	.acon-text { font-size: 15px; }
	.tilo-book { margin: 20px 0 10px; }
	.tilo-book iframe {
		width: 100% !important; height: auto !important; aspect-ratio: 11 / 15;
		max-height: 85vh;
	}
	#related-posts { float: none; width: auto; height: auto; }
	#related-posts ul li { float: none; }

	/* меню предметів у сайдбарі */
	.bnavi { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
	.bnavi li a { font-size: 14px; padding: 11px 0 9px 15px; border-top: 1px dotted #ddd; }
	.bnavi li:nth-child(2) a { border-top: 0; }

	/* ---------- Підвал ---------- */
	.container2 { width: auto; padding: 0 12px; }
	.two-thirds.column, .one-third.column { float: none; display: block; width: auto; }
	#footer-menu { margin: 0; }
	#footer-menu li { padding-left: 0; background: none; }

	/* дрібниці */
	img { max-width: 100%; }
	input, select, textarea { max-width: 100%; }
	table { max-width: 100%; }
	/* доповнення після перевірки на живих сторінках */
	.copyrights, .copyrights p { text-align: left !important; }
	#sidebar:empty { display: none; }
	.post-body, .post-info { float: none !important; width: auto !important; }
	.post-body { overflow: hidden; }
	.post-entry { padding-bottom: 12px; margin-bottom: 12px; }
	.post-entry .post-info { display: none; }
	.post-entry h2 { margin-bottom: 8px; }
	.acon-text img { max-width: 42% !important; height: auto !important; margin: 0 0 10px 12px; }
	.tilo-book { clear: both; }
	.tilo-zag { font-size: 17px; letter-spacing: 1px; }
	#mc_signup::before {
		content: "Підручники за предметами"; display: block;
		font: 700 16px/1.3 Arial, sans-serif; color: #333; padding: 4px 3px 8px;
	}
	[id^="admixer_"], ins.adsbygoogle { max-width: 100% !important; overflow: hidden; }
}

@media (min-width: 600px) and (max-width: 1040px) {
	#cssmenu > ul { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 480px) {
	.bnavi { grid-template-columns: 1fr; }
	.bnavi li:nth-child(2) a { border-top: 1px dotted #ddd; }
	#cssmenu > ul { grid-template-columns: repeat(4, 1fr); gap: 5px; }
	#cssmenu > ul > li > a,
	#cssmenu > ul > li:first-child > a,
	#cssmenu > ul > li:last-child > a { font-size: 13px; line-height: 38px; }
}
