/*
 * nk-catalog-fit.css — v1.0.0 (23.11.2026)
 * «Наша Кухня»: use of the screen width on the catalogue pages (/zakazat-obed*, banquet menu).
 * Scope: body.nk_new_menu only (set by rsv/modules/menu/views/frontend/menu/menu.php). Other pages are not affected.
 * Rules: no zoom / transform: scale; brand colours, fonts and real photos are kept; nothing is removed.
 * Rollback: remove the one registerCssFile() line in menu.php (or this file) — the theme CSS is untouched.
 *
 *  1. Width — the catalogue container grows up to 1600px instead of Bootstrap's fixed 1170px.
 *  2. Columns — fixed side panels (categories / cart) and a flexible centre instead of 25% / 50% / 25%.
 *  3. Cards (list view) — grid of cards, larger photo (thumbs are 260x173, never upscaled past that),
 *     no fixed heights that clip names and descriptions; complex lunches span the row.
 *  4. Cards (block view) — denser grid, 3:2 photos that follow the card width.
 *  5. Phones — the expanded complex fills the width (2 equal columns instead of 2 x 150px),
 *     larger photo in an expanded dish, the «back to top» button no longer covers prices and counters.
 *  6. Floating WhatsApp / Telegram no longer cover the cart (moved to the edge, a gutter is reserved).
 */

/* ---------- 1. Width + 6. messengers gutter (tablet and desktop) ---------- */
@media (min-width: 768px) {
	body.nk_new_menu .container {
		width: auto;
		margin-left: 8px;
		margin-right: 32px;
	}
	body.nk_new_menu .container .container {
		margin-left: 0;
		margin-right: 0;
	}
	body.nk_new_menu .sc_wrap {
		right: 4px;
		width: 36px;
	}
	body.nk_new_menu .sc_wrap .sc_item {
		margin-bottom: 10px;
	}
	body.nk_new_menu .sc_wrap .sc_item img {
		display: block;
		width: 100%;
		height: auto;
	}
}
@media (min-width: 992px) {
	body.nk_new_menu .container {
		margin-left: 12px;
		margin-right: 40px;
	}
	body.nk_new_menu .sc_wrap {
		right: 6px;
		width: 40px;
	}
}
@media (min-width: 1200px) {
	body.nk_new_menu .container {
		max-width: 1600px;
		margin-left: 16px;
		margin-right: 52px;
	}
	body.nk_new_menu .sc_wrap {
		right: 8px;
		width: 44px;
	}
}
@media (min-width: 1704px) {
	/* 1600 + 2 x 52: symmetric from here on */
	body.nk_new_menu .container {
		margin-left: auto;
		margin-right: auto;
	}
}
body.nk_new_menu .container .container {
	max-width: none;
}

/* ---------- 2. Columns: categories | items | date + cart ---------- */
@media (min-width: 992px) {
	body.nk_new_menu .menu-wrap > .menu__items_row {
		display: flex;
		align-items: flex-start;
	}
	body.nk_new_menu .menu-wrap > .menu__items_row:before,
	body.nk_new_menu .menu-wrap > .menu__items_row:after {
		display: none;
	}
	body.nk_new_menu .menu-wrap .col-left {
		flex: 0 0 210px;
		width: 210px;
		float: none;
	}
	body.nk_new_menu .menu-wrap .col-right {
		flex: 0 0 260px;
		width: 260px;
		float: none;
	}
	body.nk_new_menu .menu-wrap .col-center {
		flex: 1 1 auto;
		width: auto;
		min-width: 0;
		float: none;
	}
}
@media (min-width: 1200px) {
	body.nk_new_menu .menu-wrap .col-left {
		flex-basis: 256px;
		width: 256px;
	}
	body.nk_new_menu .menu-wrap .col-right {
		flex-basis: 290px;
		width: 290px;
	}
}

/* ---------- 3/4. Item grid (tablet and desktop; phones keep their own list) ---------- */
@media (min-width: 768px) {
	body.nk_new_menu .menu-wrap .category_items_list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
		gap: 16px;
		margin: 10px 0;
	}
	body.nk_new_menu .menu-wrap .category_items_list:before,
	body.nk_new_menu .menu-wrap .category_items_list:after {
		display: none;
		content: none;
	}
	body.nk_new_menu .menu-wrap .category_items_list > .menu_item {
		margin: 0;
		width: auto;
		min-width: 0;
		float: none;
	}
	/* a complex lunch shows its whole composition: it takes the full row */
	body.nk_new_menu .menu-wrap.list-view .category_items_list > .menu_item_complex {
		grid-column: 1 / -1;
	}
	/* block view («Блоками») */
	body.nk_new_menu .menu-wrap.block-view .category_items_list {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
		gap: 14px;
	}
	body.nk_new_menu .menu-wrap.block-view .category_items_list > .menu_item {
		padding: 0;
	}
	body.nk_new_menu .menu-wrap.block-view .menu_item .menu_item_inner {
		height: 100%;
	}
}
/* narrow centre column (tablet portrait): one card per row */
@media (min-width: 768px) and (max-width: 991px) {
	body.nk_new_menu .menu-wrap .category_items_list {
		grid-template-columns: minmax(0, 1fr);
	}
	body.nk_new_menu .menu-wrap.block-view .category_items_list {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
}

/* names and descriptions are no longer clipped by fixed heights */
@media (min-width: 768px) {
	body.nk_new_menu .menu-wrap .menu_item .menu_item_name,
	body.nk_new_menu .menu-wrap .menu_item_complex .menu_item_name {
		height: auto;
		min-height: 0;
	}
	body.nk_new_menu .menu-wrap .menu_item_complex .menu_item_name {
		width: auto;
		float: none;
		padding-right: 40px; /* room for the «favourite» star */
	}
	body.nk_new_menu .menu-wrap .menu_item .menu_item_description {
		height: auto;
	}
	/* long category names wrap instead of running under the arrow */
	body.nk_new_menu .nav-categories ul li a {
		white-space: normal;
	}
	/* the complex card content uses the whole card (it was a shrink-to-fit table cell) */
	body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .menu_item_info {
		display: block;
		width: 100%;
	}
}

/* list view, dish card: photo | text, nutrition + price under both (modern browsers; older ones keep the theme layout) */
@supports (display: grid) and (aspect-ratio: 1 / 1) {
	@media (min-width: 768px) {
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_inner {
			display: block;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_info {
			display: grid;
			grid-template-columns: clamp(120px, 40%, 210px) minmax(0, 1fr);
			grid-template-areas:
				"img top"
				"img mid"
				"img vote"
				"bot bot";
			grid-template-rows: auto auto 1fr auto;
			column-gap: 18px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_top {
			grid-area: top;
			padding-left: 0;
			display: flex;
			align-items: flex-start;
			gap: 8px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_top:before,
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_top:after,
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_info:before,
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_info:after {
			display: none;
			content: none;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_name {
			flex: 1 1 auto;
			width: auto;
			float: none;
			padding-left: 0;
			margin-left: 0;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_tags {
			flex: 0 0 auto;
			top: 0;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_middle {
			display: contents;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_img {
			grid-area: img;
			position: relative;
			left: auto;
			top: auto;
			width: 100%;
			min-width: 0;
			height: auto;
			aspect-ratio: 3 / 2;
			align-self: start;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_img .thumbnail {
			display: block;
			width: 100%;
			height: 100%;
			margin: 0;
			padding: 0;
			border: 0;
			overflow: hidden;
			border-radius: 10px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_img .open-image img.lazy,
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_img img {
			display: block;
			width: 100%;
			height: 100%;
			max-width: 100%;
			margin: 0;
			object-fit: cover;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_description {
			grid-area: mid;
			padding-left: 0;
			overflow: hidden;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 5;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_vote {
			grid-area: vote;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_dish .menu_item_bottom {
			grid-area: bot;
			margin-top: 14px;
		}
		/* the nutrition row and the price/cart: the theme splits them 62% / 30% and they overlapped in narrow cards;
		   now they share the line when they fit and the price/cart moves under the nutrition row when they do not */
		body.nk_new_menu .menu-wrap.list-view .menu_item_bottom_inner {
			flex-wrap: wrap;
			column-gap: 12px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_bottom_inner .menu_item_params {
			flex: 0 1 auto;
			width: auto;
			max-width: none;
			float: none;
			justify-content: flex-start;
			column-gap: 18px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_bottom_inner .menu_item_gramm {
			max-width: 150px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_bottom_inner .menu_item_gramm b {
			white-space: nowrap;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_bottom_inner .menu_item_cart {
			flex: 0 0 auto;
			width: auto;
			float: none;
			margin-left: auto;
			gap: 14px;
		}
	}
	/* cards in a two-column grid get a slightly tighter padding */
	@media (min-width: 1200px) {
		body.nk_new_menu .menu-wrap.list-view .category_items_list > .menu_item_dish {
			padding: 24px 24px 18px;
		}
		body.nk_new_menu .menu-wrap.list-view .category_items_list > .menu_item_dish .menu_item_bottom {
			margin-left: -24px;
			margin-right: -24px;
		}
		body.nk_new_menu .menu-wrap.list-view .category_items_list > .menu_item_dish .menu_item_bottom_inner {
			padding-left: 24px;
			padding-right: 24px;
		}
	}

	/* list view, complex lunch: the dishes of the set fill the row */
	@media (min-width: 768px) {
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal_info {
			display: grid !important;
			grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
			gap: 12px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal-info-item {
			display: block;
			width: auto;
			padding: 0;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal-info-item .modal-info-img {
			width: 100%;
			height: auto;
			aspect-ratio: 3 / 2;
			border-radius: 8px;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal-info-item .modal-info-img img {
			display: block;
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal-info-item .modal-info-text {
			height: auto;
			padding-top: 6px;
			overflow: hidden;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 4;
		}
	}

	/* block view: the photo follows the card width (3:2) instead of a fixed 90px */
	@media (min-width: 768px) {
		body.nk_new_menu .menu-wrap.block-view .menu_item_inner > .img-placeholder {
			height: auto;
			aspect-ratio: 3 / 2;
		}
		body.nk_new_menu .menu-wrap.block-view .menu_item_img {
			height: auto;
			aspect-ratio: 3 / 2;
			overflow: hidden;
			border-radius: 10px;
		}
		body.nk_new_menu .menu-wrap.block-view .menu_item_img .thumbnail {
			display: block;
			height: 100%;
			margin: 0;
			padding: 0;
			border: 0;
		}
		body.nk_new_menu .menu-wrap.block-view .menu_item_img .thumbnail img {
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
	}

	/* ---------- 5. Phones ---------- */
	@media (max-width: 767px) {
		/* expanded complex: two equal columns over the full width (was 2 x 150px + an empty strip) */
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal_info {
			display: grid !important;
			grid-template-columns: repeat(2, minmax(0, 1fr));
			gap: 12px 10px;
		}
		body.nk_new_menu .menu-wrap .menu_item_complex_new .modal-info-item {
			display: block;
			width: auto;
			padding: 0;
		}
		body.nk_new_menu .menu-wrap .menu_item_complex_new .modal-info-item .modal-info-img {
			width: 100%;
			height: auto;
			aspect-ratio: 3 / 2;
			border-radius: 8px;
		}
		body.nk_new_menu .menu-wrap .menu_item_complex_new .modal-info-item .modal-info-img img {
			display: block;
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
		body.nk_new_menu .menu-wrap .menu_item_complex_new .modal-info-item .modal-info-text {
			height: auto;
			padding-top: 4px;
		}
		/* expanded dish: a larger photo next to the description */
		body.nk_new_menu .menu-wrap .menu_item_dish .menu_item_img {
			flex: 0 0 42%;
			max-width: 180px;
			min-width: 0;
			aspect-ratio: 3 / 2;
			overflow: hidden;
			border-radius: 8px;
		}
		body.nk_new_menu .menu-wrap .menu_item_dish .menu_item_img .thumbnail {
			display: block;
			width: 100%;
			height: 100%;
			margin: 0;
			padding: 0;
			border: 0;
		}
		body.nk_new_menu .menu-wrap .menu_item_dish .menu_item_img .open-image img.lazy {
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
	}
	@media (min-width: 480px) and (max-width: 767px) {
		body.nk_new_menu .menu-wrap.list-view .menu_item_complex_new .modal_info {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}
	}
}

/* phones: «back to top» sits centred above the bottom bar, not over the price and +/- controls */
@media (max-width: 767px) {
	body.nk_new_menu .back-to-top {
		right: auto;
		left: 50%;
		bottom: 56px;
		margin-left: -20px;
	}
}
