/* Стандартные материалы: карточки-кнопки и окно с образцами (inc/materials/materials.php) */

/* ---------- Карточки в блоке «Данный проект можно доработать» ---------- */
.improvements__item[data-materials] { cursor: pointer; }
.improvements__item[data-materials] .improvements__item-img { transition: transform .6s ease; }
.improvements__item[data-materials]:hover .improvements__item-img { transform: scale(1.04); }
.improvements__item[data-materials]:focus-visible { outline: 3px solid #3A3A39; outline-offset: 3px; }

.improvements__item-more {
	margin-top: 14px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 8px;
	background: rgba(255, 255, 255, .94);
	color: #2C2C2B;
	font-size: 15px;
	line-height: 1.2;
	transition: background-color .25s ease, color .25s ease;
}
.improvements__item-more svg { flex: none; transition: transform .25s ease; }
.improvements__item[data-materials]:hover .improvements__item-more { background: #E7E7E7; }
.improvements__item[data-materials]:hover .improvements__item-more svg { transform: translateX(3px); }
.improvements__item[data-materials]:active .improvements__item-more { background: #DCDCDC; transform: translateY(1px); }

/* ---------- Окно ---------- */
html.im-lock, html.im-lock body { overflow: hidden; }

.im-overlay {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(28, 28, 27, .62);
	opacity: 0;
	transition: opacity .25s ease;
	font-family: var(--font-default), system-ui, sans-serif;
	color: #2C2C2B;
}
.im-overlay[hidden] { display: none; }
.im-overlay.is-open { opacity: 1; }

.im-modal {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1180px, 100%);
	height: min(860px, calc(100vh - 48px));
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
	transform: translateY(16px);
	transition: transform .3s ease;
}
.im-overlay.is-open .im-modal { transform: none; }

.im-head {
	flex: none;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 32px 40px 0;
}
.im-title { margin: 0; font-size: 32px; line-height: 1.2; font-weight: 400; }
.im-sub { margin: 6px 0 0; font-size: 15px; color: #8B8A86; }

.im-close {
	flex: none;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: #F2F1EE;
	color: #2C2C2B;
	cursor: pointer;
	transition: background-color .2s ease;
}
.im-close:hover { background: #E6E4DF; }

.im-tabs { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 20px 40px 0; }
.im-tabs:empty { display: none; }
.im-tab {
	padding: 11px 20px;
	border: 1px solid #DAD8D3;
	border-radius: 8px;
	background: #fff;
	color: #2C2C2B;
	font: inherit;
	font-size: 15px;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.im-tab:hover { border-color: #3A3A39; }
.im-tab.is-active { background: #3A3A39; border-color: #3A3A39; color: #fff; }

.im-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 40px; }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 18px; }

.im-sw { display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: zoom-in; }
.im-sw-pic { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px; background: #F2F1EE; }
.im-sw-pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07); pointer-events: none; }
.im-sw-pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.im-sw:hover .im-sw-pic img { transform: scale(1.06); }
.im-sw-name { display: block; margin-top: 10px; font-size: 15px; line-height: 1.3; transition: color .2s ease; }
.im-sw:hover .im-sw-name { color: #000; }
.im-sw-art { display: block; margin-top: 3px; font-size: 13px; line-height: 1.3; color: #8B8A86; }
.im-sw:focus-visible { outline: 3px solid #3A3A39; outline-offset: 4px; border-radius: 6px; }

.im-foot {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 18px 40px 26px;
	border-top: 1px solid #EFEDE9;
}
.im-note { margin: 0; max-width: 620px; font-size: 14px; line-height: 1.5; color: #8B8A86; }
.im-cta {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	padding: 0 32px;
	border: 0;
	border-radius: 8px;
	background: #3A3A39;
	color: #fff;
	font: inherit;
	font-size: 16px;
	cursor: pointer;
	transition: background-color .2s ease;
}
.im-cta:hover { background: #2F2F2E; }
.im-cta:active { background: #262625; transform: translateY(1px); }

/* ---------- Просмотр образца крупно ---------- */
.im-view { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; background: #fff; }
.im-view[hidden] { display: none; }
.im-view-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 40px 12px; }
.im-back { display: inline-flex; align-items: center; gap: 8px; padding: 10px 0; border: 0; background: none; color: #2C2C2B; font: inherit; font-size: 15px; cursor: pointer; }
.im-back:hover { color: #000; }
.im-count { font-size: 14px; color: #8B8A86; }
.im-view-top .im-count { margin-left: auto; }

.im-view-main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 0 40px; }
.im-view-frame { height: 100%; max-height: 620px; aspect-ratio: 1 / 1; max-width: 100%; border-radius: 8px; overflow: hidden; background: #F2F1EE; }
.im-view-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.im-arrow {
	flex: none;
	display: grid;
	place-items: center;
	width: 54px;
	height: 54px;
	border: 1px solid #DAD8D3;
	border-radius: 50%;
	background: #fff;
	color: #2C2C2B;
	cursor: pointer;
	transition: border-color .2s ease, color .2s ease;
}
.im-arrow:hover { background: #F2F1EE; border-color: #C9C6C0; }
.im-arrow:active { background: #E7E7E7; }
.im-view-cap { flex: none; padding: 18px 40px 28px; text-align: center; }
.im-view-name { font-size: 24px; line-height: 1.3; }
.im-view-art { margin-top: 4px; font-size: 15px; color: #8B8A86; }
.im-view-art:empty { display: none; }

@media (max-width: 991.98px) {
	.im-title { font-size: 26px; }
	.im-foot { flex-direction: column; align-items: stretch; gap: 14px; }
	.im-cta { width: 100%; }
}

@media (max-width: 680px) {
	.im-overlay { padding: 0; align-items: stretch; }
	.im-modal { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
	.im-head { padding: 18px 16px 0; }
	.im-title { font-size: 22px; }
	.im-sub { font-size: 14px; }
	.im-close { width: 42px; height: 42px; }
	.im-tabs { padding: 14px 16px 0; }
	.im-tab { flex: 1; padding: 11px 10px; font-size: 14px; }
	.im-body { padding: 16px; }
	.im-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
	.im-sw-name { font-size: 14px; margin-top: 8px; }
	.im-sw-art { font-size: 12px; }
	.im-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
	.im-note { font-size: 12.5px; }
	.im-cta { height: 52px; }

	.im-view-top { padding: 14px 16px 8px; }
	.im-view-main { position: relative; flex: none; margin-top: auto; padding: 0 16px; }
	.im-view-frame { height: auto; width: 100%; }
	.im-arrow { position: absolute; top: 50%; z-index: 1; width: 44px; height: 44px; margin-top: -22px; background: rgba(255, 255, 255, .92); border-color: transparent; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
	.im-prev { left: 24px; }
	.im-next { right: 24px; }
	.im-view-cap { margin-bottom: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
	.im-view-name { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.im-overlay, .im-modal, .im-sw-pic img, .improvements__item[data-materials] .improvements__item-img { transition: none; }
}
