/*
 * Дизайн v2 (01.12.2026): категории в шапке и «Покупки по категориям» на главной.
 * Всё включается классом af-v2 на <body>. Выключить: в artflame.env написать DESIGN_V2=0
 * — сайт сразу выглядит как раньше. Цвета — фирменные: #f26241 (оранжевый), #211e22 (тёмный).
 */

/* элементы, которых не было в старом дизайне: без af-v2 они скрыты */
.af-ico, .af-arrow, .af-more { display: none; }

/* ---------- Категории в шапке (большой экран, где строка категорий видна) ---------- */
@media (min-width: 1492px) {
	.af-v2 .catalog-header__content { justify-content: center; gap: 6px; padding: 8px 0; flex-wrap: nowrap; }
	.af-v2 .catalog-header__item, .af-v2 .catalog-header__item-empty { position: relative; }
	.af-v2 .catalog-header__name {
		position: relative; min-height: 46px; padding: 5px 16px 5px 5px; gap: 10px; border-radius: 999px;
		font-size: 15px; font-weight: 500; color: #211e22; background: transparent;
		transition: background .35s, color .25s, box-shadow .35s, transform .35s cubic-bezier(.2, .7, .2, 1);
	}
	.af-v2 .catalog-header__name::after { display: none; }
	.af-v2 .catalog-header__item-empty .catalog-header__name, .af-v2 .catalog-header__name:not(:has(.af-ico)) { padding-left: 16px; }
	.af-v2 .af-ico {
		display: inline-flex; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
		background: radial-gradient(circle at 50% 60%, #fde3d9 0%, #f7f1ee 70%);
		box-shadow: 0 0 0 1px #f1e6e2; transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .35s;
	}
	.af-v2 .af-ico img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
	.af-v2 .catalog-header__item:hover > .catalog-header__name,
	.af-v2 .catalog-header__item-empty:hover > .catalog-header__name,
	.af-v2 .af-more:hover > .catalog-header__name {
		background: linear-gradient(135deg, #fff1eb 0%, #fff 100%); color: #f26241;
		box-shadow: 0 6px 18px -8px rgba(242, 98, 65, .45), inset 0 0 0 1px #fbd9cd;
	}
	.af-v2 .catalog-header__item:hover .af-ico { transform: rotate(-8deg) scale(1.12); box-shadow: 0 0 0 2px #f26241, 0 0 16px rgba(242, 98, 65, .45); }
	.af-v2 .catalog-header__name._sale { color: #f26241; background: #fff1eb; }

	/* выпадающая панель */
	.af-v2 .catalog-header__body {
		top: calc(100% + 6px); padding: 26px 28px; gap: 28px; border-radius: 20px; background: #fff;
		border: 1px solid #f0e8e5; box-shadow: 0 30px 60px -24px rgba(33, 30, 34, .28);
		transform: translateY(10px); transition: opacity .3s, visibility .3s, transform .35s cubic-bezier(.2, .7, .2, 1);
	}
	.af-v2 .catalog-header__body::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px; } /* мостик, чтобы панель не закрывалась при переходе мышью */
	.af-v2 .catalog-header__item:hover .catalog-header__body { transform: none; }
	.af-v2 .catalog-header__list { flex: 1 1 auto; min-width: 170px; row-gap: 4px; font-size: 15px; }
	.af-v2 .catalog-header__list li { opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .35s; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li { opacity: 1; transform: none; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li:nth-child(2) { transition-delay: .04s; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li:nth-child(3) { transition-delay: .08s; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li:nth-child(4) { transition-delay: .12s; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li:nth-child(5) { transition-delay: .16s; }
	.af-v2 .catalog-header__item:hover .catalog-header__list li:nth-child(n+6) { transition-delay: .2s; }
	.af-v2 .catalog-header__list a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; transition: background .25s, color .25s, padding .25s; }
	.af-v2 .catalog-header__list a::after { content: '→'; color: #f26241; opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s; }
	.af-v2 .catalog-header__list a:hover { background: #fff4f0; color: #f26241; padding-left: 16px; }
	.af-v2 .catalog-header__list a:hover::after { opacity: 1; transform: none; }
	.af-v2 .catalog-header__main { row-gap: 12px; }
	.af-v2 .catalog-header__image { border-radius: 14px; background: radial-gradient(circle at 50% 62%, #fde3d9 0%, #f7f1ee 64%); }
	.af-v2 .catalog-header__image img { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
	.af-v2 .catalog-header__image:hover img { transform: scale(1.06); }
	.af-v2 .catalog-header__title { font-size: 15px; font-weight: 600; }

	/* «Ещё» — сюда переезжают категории, которые не поместились в строку */
	.af-v2 .af-more { display: block; position: relative; }
	.af-v2 .af-more[hidden] { display: none; }
	.af-v2 .af-more .catalog-header__name { cursor: default; padding-left: 16px; }
	.af-v2 .af-more__dots { display: inline-flex; gap: 3px; }
	.af-v2 .af-more__dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
	.af-v2 .af-more__panel {
		position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: 520px; padding: 14px;
		display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 20px; background: #fff;
		border: 1px solid #f0e8e5; box-shadow: 0 30px 60px -24px rgba(33, 30, 34, .28);
		opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .3s, visibility .3s, transform .35s cubic-bezier(.2, .7, .2, 1);
	}
	.af-v2 .af-more__panel::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
	.af-v2 .af-more:hover .af-more__panel { opacity: 1; visibility: visible; transform: none; }
	.af-v2 .af-more__panel a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: #211e22; font-size: 15px; font-weight: 500; transition: background .25s, color .25s; }
	.af-v2 .af-more__panel a:hover { background: #fff4f0; color: #f26241; }
	.af-v2 .af-more__panel a:hover .af-ico { transform: rotate(-8deg) scale(1.1); }
	.af-v2 .af-more__panel .af-ico { flex-basis: 40px; width: 40px; height: 40px; }
}

/* ---------- Главная: «Покупки по категориям» ----------
   Плитки по форме фото: широкие 2×1, квадраты 1×1 / 2×2, высокие 1×2.
   Места плиток считает сервер (af_bento) и передаёт в --x/--y/--w/--h для 6, 4 и 2 колонок. */
.af-v2 .category-branch { padding: 40px 0 56px; }
.af-v2 .category-branch__container { container-type: inline-size; }
.af-v2 .category-branch__content {
	--g: 18px; --cols: 6;
	display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--g)) / var(--cols));
	grid-auto-flow: dense; gap: var(--g); margin-top: 24px;
}
.af-v2 .category-branch__item {
	position: relative; display: block; overflow: hidden; border-radius: 20px; padding: 0 !important;
	grid-column: var(--x6, auto) / span var(--w6, 1); grid-row: var(--y6, auto) / span var(--h6, 1);
	background: #f6f1ef; isolation: isolate;
	box-shadow: 0 1px 2px rgba(33, 30, 34, .06);
	transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s;
}
.af-v2 .category-branch__image { position: absolute; inset: 0; margin: 0; border-radius: 0; background: transparent; overflow: hidden; aspect-ratio: auto; }
.af-v2 .category-branch__image picture { display: block; width: 100%; height: 100%; }
.af-v2 .category-branch__image img {
	display: block; width: 100%; height: 100%; max-width: none; max-height: none;
	object-fit: cover; object-position: center; mix-blend-mode: normal;
	transition: transform 1.1s cubic-bezier(.2, .7, .2, 1);
}
.af-v2 .category-branch__item::after {
	content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
	background: linear-gradient(180deg, rgba(20, 14, 12, 0) 45%, rgba(20, 14, 12, .62) 100%);
	transition: opacity .45s;
}
.af-v2 .category-branch__item::before {
	content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
	background: radial-gradient(80% 60% at 50% 100%, rgba(242, 98, 65, .45), transparent 70%);
	transition: opacity .5s;
}
.af-v2 .category-branch__item:hover { transform: translateY(-6px); box-shadow: 0 24px 40px -22px rgba(242, 98, 65, .6); }
.af-v2 .category-branch__item:hover::before { opacity: 1; }
.af-v2 .category-branch__item:hover .category-branch__image img { transform: scale(1.07); }
.af-v2 .category-branch__name {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 14px 14px 14px 18px; margin: 0;
	font-size: 16px; font-weight: 600; line-height: 1.2; color: #fff; text-align: left;
	text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}
.af-v2 .category-branch__item:hover .category-branch__name { color: #fff; }
.af-v2 .af-arrow {
	display: inline-flex; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(33, 30, 34, .12); transition: background .3s, transform .35s;
}
.af-v2 .af-arrow svg { width: 16px; height: 16px; fill: none; stroke: #f26241; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s; }
.af-v2 .category-branch__item:hover .af-arrow { background: #f26241; transform: rotate(-45deg); }
.af-v2 .category-branch__item:hover .af-arrow svg { stroke: #fff; }

/* крупные плитки (2×2 и больше) — крупнее подпись */
.af-v2 .category-branch__item._big .category-branch__name { font-size: 22px; padding: 20px 20px 20px 24px; }
.af-v2 .category-branch__item._big .af-arrow { flex-basis: 44px; width: 44px; height: 44px; }

/* плавное появление при прокрутке (включается скриптом, без него всё видно сразу) */
.af-v2 .af-reveal .category-branch__item { opacity: 0; transform: translateY(22px); }
.af-v2 .af-reveal._in .category-branch__item {
	opacity: 1; transform: none;
	transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1), box-shadow .45s;
	transition-delay: calc(min(var(--i, 1), 12) * 45ms);
}
.af-v2 .af-reveal._in .category-branch__item:hover { transform: translateY(-6px); transition-delay: 0s; }

@media (max-width: 1199.98px) {
	.af-v2 .category-branch__content { --cols: 4; --g: 14px; }
	.af-v2 .category-branch__item { grid-column: var(--x4, auto) / span var(--w4, 1); grid-row: var(--y4, auto) / span var(--h4, 1); }
}
@media (max-width: 767.98px) {
	.af-v2 .category-branch { padding: 24px 0 36px; }
	.af-v2 .category-branch__content { --cols: 2; --g: 10px; }
	.af-v2 .category-branch__item { border-radius: 16px; grid-column: var(--x2, auto) / span var(--w2, 1); grid-row: var(--y2, auto) / span var(--h2, 1); }
	.af-v2 .category-branch__name, .af-v2 .category-branch__item._big .category-branch__name { font-size: 14px; padding: 10px 10px 10px 12px; }
	.af-v2 .category-branch__item._big .category-branch__name { font-size: 17px; }
	.af-v2 .af-arrow, .af-v2 .category-branch__item._big .af-arrow { flex-basis: 26px; width: 26px; height: 26px; }
	.af-v2 .af-arrow svg { width: 13px; height: 13px; }
}

@keyframes af-glow { 0%, 100% { opacity: .6; transform: translate(-50%, -50%) scale(.92); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
	.af-v2 *, .af-v2 *::before, .af-v2 *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
	.af-v2 .af-reveal .category-branch__item { opacity: 1; transform: none; }
}
