/*
 * Дизайн 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; }
}

/* ---------- Главная: «Покупки по категориям» ---------- */
.af-v2 .category-branch { padding: 40px 0 56px; }
.af-v2 .category-branch__content {
	display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: dense; gap: 18px; margin-top: 24px;
}
.af-v2 .category-branch__item {
	position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
	padding: 14px 14px 16px; border-radius: 20px; overflow: hidden; align-items: stretch !important;
	background: radial-gradient(120% 90% at 50% 38%, #fde7de 0%, #f8f2ef 58%, #f6f1ef 100%);
	box-shadow: inset 0 0 0 1px rgba(33, 30, 34, .04);
	transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s;
}
.af-v2 .category-branch__item::before {
	content: ''; position: absolute; left: 50%; top: 46%; width: 60%; height: 40%; transform: translate(-50%, -50%);
	background: radial-gradient(closest-side, rgba(255, 120, 60, .35), transparent); filter: blur(10px); opacity: 0;
	transition: opacity .5s; pointer-events: none;
}
.af-v2 .category-branch__item:hover { transform: translateY(-6px); box-shadow: 0 24px 40px -22px rgba(242, 98, 65, .55), inset 0 0 0 1px #fbd9cd; }
.af-v2 .category-branch__item:hover::before { opacity: 1; animation: af-glow 3.2s ease-in-out infinite; }
.af-v2 .category-branch__image { aspect-ratio: 1; border-radius: 14px; background: transparent; overflow: visible; }
.af-v2 .category-branch__image img { object-fit: contain; mix-blend-mode: multiply; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.af-v2 .category-branch__item:hover .category-branch__image img { transform: scale(1.08) translateY(-4px); }
.af-v2 .category-branch__name {
	position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
	font-size: 16px; font-weight: 600; line-height: 1.25; color: #211e22; text-align: left;
}
.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: #fff; box-shadow: 0 2px 8px rgba(33, 30, 34, .08); 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; }
.af-v2 .category-branch__item:hover .category-branch__name { color: #211e22; }

/* две главные категории — крупные плитки */
.af-v2 .category-branch__item._big { grid-column: span 2; grid-row: span 2; padding: 22px 22px 24px; }
.af-v2 .category-branch__item._big .category-branch__name { font-size: 22px; }
.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 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 767.98px) {
	.af-v2 .category-branch { padding: 24px 0 36px; }
	.af-v2 .category-branch__content { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.af-v2 .category-branch__item { padding: 10px 10px 12px; border-radius: 16px; }
	.af-v2 .category-branch__item._big { grid-column: span 1; grid-row: span 1; padding: 10px 10px 12px; }
	.af-v2 .category-branch__item:first-child { grid-column: span 2; }
	.af-v2 .category-branch__item:first-child .category-branch__image { aspect-ratio: 16 / 9; }
	.af-v2 .category-branch__name, .af-v2 .category-branch__item._big .category-branch__name { font-size: 14px; }
	.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; }
}
