/* =========================================================================
   TOHFE V3 DESIGN LAYER — luxury polish (Royal-inspired, independent identity)
   Loads after tohfe-ui-v2-109 / tohfe-premium-1 / tohfe-mission-1.
   Palette: warm cream bg, deep green primary, muted gold accent (--th-* tokens).
   ========================================================================= */

/* ---------- 1. Design tokens extension ---------- */
body.tohfe-ui-v2 {
	--color-brand-primary: #1d4a2e;   /* deep pistachio green */
	--color-brand-secondary: #2f6b45;
	--color-brand-accent: #c59a3a;    /* muted gold — accent only */
	--color-text-primary: #241f1a;
	--color-text-secondary: #6b6258;
	--color-bg: #faf7f0;
	--color-surface: #ffffff;
	--color-border: #e7ded0;
	--color-success: #2f6b45;
	--color-warning: #b7791f;
	--color-error: #b7442e;
	--color-sale: #b7442e;
	--th-font-display: 'Vazirmatn', system-ui, sans-serif;
	--th-radius-card: 16px;
	--th-shadow-card: 0 1px 2px rgba(36,31,26,.05), 0 10px 28px rgba(36,31,26,.07);
	--th-shadow-card-hover: 0 4px 10px rgba(36,31,26,.06), 0 22px 44px rgba(29,74,46,.13);
}

/* Signature motif: 46x3px gold rule under section titles (kept from premium) */
body.tohfe-ui-v2 .tohfe-section-title {
	position: relative;
	padding-bottom: 14px;
	margin-bottom: 26px;
	font-weight: 800;
}
body.tohfe-ui-v2 .tohfe-section-title::after {
	content: "";
	position: absolute;
	bottom: 0;
	inset-inline-start: 0;
	width: 52px;
	height: 3px;
	border-radius: 2px;
	background: var(--th-accent);
}

/* ---------- 2. Utility topbar ---------- */
body.tohfe-ui-v2 .th-topbar {
	background: linear-gradient(90deg, #14301f, #1d4a2e 55%, #163823);
	color: #f3efe4;
	font-size: 12.5px;
	font-weight: 500;
}
body.tohfe-ui-v2 .th-topbar__inner {
	max-width: var(--th-container, 1280px);
	margin-inline: auto;
	padding-inline: var(--th-gutter, clamp(16px, 3vw, 32px));
	min-height: 34px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
body.tohfe-ui-v2 .th-topbar a { color: #f3efe4; text-decoration: none; }
body.tohfe-ui-v2 .th-topbar a:hover { color: #e8d9a8; }
body.tohfe-ui-v2 .th-topbar__contact { display: inline-flex; align-items: center; gap: 8px; }
body.tohfe-ui-v2 .th-topbar__sep { opacity: .55; }
@media (max-width: 767px) {
	body.tohfe-ui-v2 .th-topbar { display: none; }
}

/* ---------- 3. Header: bigger logo, taller main row ---------- */
body.tohfe-ui-v2 .th-header__main {
	height: 88px;
	gap: 22px;
	background: var(--th-bg, #faf7f0);
}
body.tohfe-ui-v2 .th-logo__img {
	height: 84px;               /* up from 52px — owner request (fits 88px row) */
	width: auto;
	aspect-ratio: 1/1;
}
body.tohfe-ui-v2 .th-logo { padding-block: 2px; }

/* Nav links: refined typography */
body.tohfe-ui-v2 .th-nav__link {
	font-size: 14.5px;
	font-weight: 600;
	color: var(--th-text, #241f1a);
	padding: 10px 13px;
	border-radius: 10px;
	transition: color .15s ease, background .15s ease;
}
body.tohfe-ui-v2 .th-nav__link:hover {
	color: var(--th-primary, #1d4a2e);
	background: var(--th-primary-soft, #e7efe8);
}
body.tohfe-ui-v2 .th-nav__list > .menu-item > a.th-nav__link[aria-current="page"],
body.tohfe-ui-v2 .th-nav__list > .menu-item.current-menu-item > a.th-nav__link {
	color: var(--th-primary, #1d4a2e);
	position: relative;
}
body.tohfe-ui-v2 .th-nav__list > .menu-item.current-menu-item > a.th-nav__link::after {
	content: "";
	position: absolute;
	inset-inline: 13px;
	bottom: 4px;
	height: 2px;
	border-radius: 1px;
	background: var(--th-accent, #c59a3a);
}

/* ---------- 4. Mega menu («محصولات») ---------- */
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children { position: relative; }
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu {
	position: absolute;
	top: calc(100% + 10px);
	inset-inline-start: 0;
	min-width: 620px;
	background: #fffdf8;
	border: 1px solid var(--th-border, #e7ded0);
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(29,74,46,.14);
	padding: 18px;
	display: grid;
	grid-template-columns: repeat(2, minmax(0,1fr));
	gap: 4px 14px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .16s ease, transform .16s ease, visibility .16s;
	z-index: 60;
}
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children:hover > .sub-menu,
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu > .menu-item { position: relative; }
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu > .menu-item > .th-nav__link {
	font-weight: 700;
	color: var(--th-primary, #1d4a2e);
	font-size: 13.5px;
	padding: 8px 10px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	gap: 6px;
}
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu > .menu-item > .th-nav__link:hover {
	background: var(--th-primary-soft, #e7efe8);
}
/* Nested level-3 (خشکبار و آجیل subcats) — regular list under the parent */
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu .sub-menu {
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	box-shadow: none;
	border: 0;
	border-radius: 0;
	padding: 0;
	margin: 0 0 4px;
	display: block;
	min-width: 0;
}
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu .sub-menu .th-nav__link {
	font-weight: 500;
	font-size: 13px;
	color: var(--th-text-secondary, #6b6258);
	padding: 5px 10px 5px 22px;
}
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > .sub-menu .sub-menu .th-nav__link:hover {
	color: var(--th-primary, #1d4a2e);
	background: transparent;
}
/* Submenu caret for parents */
body.tohfe-ui-v2 .th-nav__list > li.menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-inline-start: 7px;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	opacity: .55;
	vertical-align: 2px;
}

/* ---------- 5. Inline search (desktop) ---------- */
body.tohfe-ui-v2 .th-search-inline {
	flex: 1 1 300px;
	max-width: 340px;
	margin-inline-start: auto;
}
body.tohfe-ui-v2 .th-search-inline__form {
	display: flex;
	align-items: center;
	background: #fffdf8;
	border: 1px solid var(--th-border, #e7ded0);
	border-radius: 999px;
	padding: 3px 4px 3px 14px;
	transition: border-color .15s ease, box-shadow .15s ease;
	position: relative;
}
body.tohfe-ui-v2 .th-search-inline__form:focus-within {
	border-color: var(--th-primary, #1d4a2e);
	box-shadow: 0 0 0 3px rgba(29,74,46,.12);
}
body.tohfe-ui-v2 .th-search-inline__input {
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	min-height: 38px;
	font-size: 14px;
	width: 100%;
}
body.tohfe-ui-v2 .th-search-inline__submit {
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	background: var(--th-primary, #1d4a2e);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: 0;
	transition: background .15s ease;
}
body.tohfe-ui-v2 .th-search-inline__submit:hover { background: #163823; }
body.tohfe-ui-v2 .th-search-inline .th-livesearch {
	position: absolute;
	top: calc(100% + 8px);
	inset-inline: 0;
	background: #fff;
	border: 1px solid var(--th-border);
	border-radius: 14px;
	box-shadow: var(--th-shadow-card);
	z-index: 70;
	overflow: hidden;
}
body.tohfe-ui-v2 .th-search-inline .th-livesearch-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 14px;
	font-size: 13.5px;
	color: var(--th-text);
	text-decoration: none;
}
body.tohfe-ui-v2 .th-search-inline .th-livesearch-item:hover { background: var(--th-bg); }
body.tohfe-ui-v2 .th-search-inline .th-livesearch-item img {
	width: 38px;
	height: 38px;
	border-radius: 9px;
	object-fit: cover;
	flex: none;
}
@media (max-width: 1279px) {
	body.tohfe-ui-v2 .th-search-inline { display: none; }
}

/* ---------- 6. Product cards ---------- */
body.tohfe-ui-v2 .woocommerce ul.products li.product {
	background: var(--th-surface, #fff);
	border: 1px solid var(--th-border, #e7ded0);
	border-radius: var(--th-radius-card, 16px);
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease;
	padding: 10px;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product:hover {
	transform: translateY(-4px);
	box-shadow: var(--th-shadow-card-hover, 0 22px 44px rgba(29,74,46,.13));
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .astra-shop-thumbnail-wrap,
body.tohfe-ui-v2 .woocommerce ul.products li.product a img {
	border-radius: 12px;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .astra-shop-thumbnail-wrap img {
	transition: transform .25s ease;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product:hover .astra-shop-thumbnail-wrap img {
	transform: scale(1.03);
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.6;
	color: var(--th-text, #241f1a);
	min-height: 2.9em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 10px 4px 4px;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .price {
	font-size: 15px;
	font-weight: 800;
	color: var(--th-primary, #1d4a2e);
	margin: 4px 4px 8px;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .price del {
	font-weight: 500;
	font-size: 12.5px;
	color: var(--th-muted, #6b6258);
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .button {
	width: 100%;
	justify-content: center;
	background: var(--th-primary, #1d4a2e);
	color: #fff;
	border-radius: 999px;
	font-size: 13.5px;
	font-weight: 700;
	min-height: 42px;
	margin: 0;
	transition: background .15s ease, transform .15s ease;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .button:hover {
	background: #163823;
}
body.tohfe-ui-v2 .woocommerce ul.products li.product .twe-loop-weight { display: inline-flex; }
/* Sale badge: single red pill */
body.tohfe-ui-v2 .woocommerce ul.products li.product .onsale {
	background: var(--th-danger, #b7442e);
	border-radius: 999px;
	min-width: 44px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 800;
	line-height: 1.6;
}
/* Out-of-stock */
body.tohfe-ui-v2 .woocommerce ul.products li.product .ast-out-of-stock,
body.tohfe-ui-v2 .woocommerce ul.products li.product .stock.out-of-stock {
	background: #f3ece2;
	color: var(--th-muted, #6b6258);
	border-radius: 999px;
	font-size: 12px;
	padding: 4px 12px;
}

/* ---------- 7. Homepage rhythm ---------- */
body.tohfe-ui-v2 .tohfe-hero { margin-top: 0; }
body.tohfe-ui-v2 .home .entry-content > .wp-block-group { margin-block: 8px 44px; }
body.tohfe-ui-v2 .tohfe-cats-grid { gap: 18px; }
body.tohfe-ui-v2 .tohfe-cat-card {
	border-radius: var(--th-radius-card, 16px);
	overflow: hidden;
	background: var(--th-surface, #fff);
	border: 1px solid var(--th-border, #e7ded0);
	transition: transform .18s ease, box-shadow .18s ease;
}
body.tohfe-ui-v2 .tohfe-cat-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--th-shadow-card-hover);
}
body.tohfe-ui-v2 .tohfe-cat-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }

/* Trust strip: slim premium bar */
body.tohfe-ui-v2 .tohfe-trust-section {
	border-block: 1px solid var(--th-border, #e7ded0);
	background: var(--th-surface, #fff);
}
body.tohfe-ui-v2 .tohfe-trust-grid { gap: 12px; }
body.tohfe-ui-v2 .tohfe-trust-item {
	padding: 12px 14px;
	border-radius: 14px;
	transition: background .15s ease;
}
body.tohfe-ui-v2 .tohfe-trust-item:hover { background: var(--th-surface-soft, #f5f0e6); }

/* FAQ + CTA + quality spacing */
body.tohfe-ui-v2 .tohfe-quality-inner,
body.tohfe-ui-v2 .tohfe-royal-faq,
body.tohfe-ui-v2 .tohfe-cta { margin-block: 34px; }

/* Blog strip cards */
body.tohfe-ui-v2 .tohfe-blog-card,
body.tohfe-ui-v2 [class*="blog"] article {
	border-radius: var(--th-radius-card, 16px);
	overflow: hidden;
	background: var(--th-surface, #fff);
	border: 1px solid var(--th-border, #e7ded0);
	transition: transform .18s ease, box-shadow .18s ease;
}
body.tohfe-ui-v2 .tohfe-blog-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--th-shadow-card-hover);
}

/* ---------- 8. Footer ---------- */
body.tohfe-ui-v2 .th-footer {
	background: linear-gradient(180deg, #14301f, #0f2518);
	color: #e8e2d4;
}
body.tohfe-ui-v2 .th-footer a { color: #d8d2c2; }
body.tohfe-ui-v2 .th-footer a:hover { color: #e8d9a8; }
body.tohfe-ui-v2 .th-footer__title {
	color: #f5f0e4;
	font-weight: 800;
	font-size: 15.5px;
	margin-bottom: 14px;
	position: relative;
	padding-bottom: 8px;
}
body.tohfe-ui-v2 .th-footer__title::after {
	content: "";
	position: absolute;
	bottom: 0;
	inset-inline-start: 0;
	width: 30px;
	height: 2px;
	background: var(--th-accent, #c59a3a);
	border-radius: 1px;
}
body.tohfe-ui-v2 .th-footer__logo-img { height: 72px; width: auto; aspect-ratio: 1/1; }

/* ---------- 9. PDP polish ---------- */
body.tohfe-ui-v2 .woocommerce div.product div.images img {
	border-radius: 18px;
	border: 1px solid var(--th-border, #e7ded0);
}
body.tohfe-ui-v2 .woocommerce div.product .product_title {
	font-size: clamp(21px, 2.6vw, 28px);
	font-weight: 800;
	line-height: 1.5;
}
body.tohfe-ui-v2 .woocommerce div.product p.price {
	font-size: 22px;
	font-weight: 800;
	color: var(--th-primary, #1d4a2e);
}
body.tohfe-ui-v2 .woocommerce div.product form.cart .button {
	background: var(--th-primary, #1d4a2e);
	border-radius: 999px;
	font-weight: 800;
	min-height: 52px;
	padding-inline: 34px;
}
body.tohfe-ui-v2 .woocommerce div.product form.cart .button:hover { background: #163823; }
body.tohfe-ui-v2 .woocommerce div.product form.cart .quantity .qty {
	min-height: 52px;
	border-radius: 12px;
	border: 1px solid var(--th-border);
	font-size: 15px;
	width: 70px;
}
body.tohfe-ui-v2 .woocommerce div.product .twe-form .twe-submit {
	background: var(--th-primary, #1d4a2e);
	color: #fff;
}

/* Breadcrumbs */
body.tohfe-ui-v2 .rank-math-breadcrumb,
body.tohfe-ui-v2 .woocommerce-breadcrumb {
	font-size: 12.5px;
	color: var(--th-muted, #6b6258);
	margin-bottom: 12px;
}
body.tohfe-ui-v2 .rank-math-breadcrumb a,
body.tohfe-ui-v2 .woocommerce-breadcrumb a { color: var(--th-primary, #1d4a2e); }

/* ---------- 10. Cart / Checkout / Account ---------- */
body.tohfe-ui-v2 .wc-block-cart .wc-block-components-panel__button,
body.tohfe-ui-v2 .wc-block-checkout .wc-block-components-panel__button {
	font-weight: 700;
}
body.tohfe-ui-v2 .wc-block-components-text-input input,
body.tohfe-ui-v2 .wc-block-components-combobox .wc-block-components-combobox-control__input,
body.tohfe-ui-v2 .wc-block-components-select select,
body.tohfe-ui-v2 .wc-block-checkout input[type="text"],
body.tohfe-ui-v2 .wc-block-checkout input[type="tel"],
body.tohfe-ui-v2 .wc-block-checkout input[type="email"] {
	border-radius: 12px !important;
	border-color: var(--th-border, #e7ded0) !important;
	min-height: 48px;
}
body.tohfe-ui-v2 .wc-block-components-button.wc-block-components-checkout-place-order-button,
body.tohfe-ui-v2 .wc-block-cart__submit-button {
	background: var(--th-primary, #1d4a2e) !important;
	border-radius: 999px !important;
	font-weight: 800;
	min-height: 50px;
}
body.tohfe-ui-v2 .wc-block-components-button.wc-block-components-checkout-place-order-button:hover {
	background: #163823 !important;
}
body.tohfe-ui-v2 .woocommerce-account .woocommerce-MyAccount-navigation a {
	border-radius: 10px;
	padding: 10px 14px;
}
body.tohfe-ui-v2 .woocommerce-account .woocommerce-MyAccount-navigation li.is-active a {
	background: var(--th-primary-soft, #e7efe8);
	color: var(--th-primary, #1d4a2e);
	font-weight: 700;
}
body.tohfe-ui-v2 .woocommerce form .form-row input.input-text,
body.tohfe-ui-v2 .woocommerce form .form-row textarea {
	border-radius: 12px;
	border-color: var(--th-border, #e7ded0);
	min-height: 46px;
}

/* ---------- 11. Branch / Wholesale / Contact pages ---------- */
body.tohfe-ui-v2 .th-branch-hero,
body.tohfe-ui-v2 .th-org-hero {
	border-radius: 22px;
	overflow: hidden;
}
body.tohfe-ui-v2 .th-branch-card,
body.tohfe-ui-v2 .th-org-card {
	border-radius: var(--th-radius-card, 16px);
	border: 1px solid var(--th-border, #e7ded0);
	background: var(--th-surface, #fff);
}
body.tohfe-ui-v2 .tohfe-contact-form {
	border: 1px solid var(--th-border, #e7ded0);
	border-radius: 20px;
	background: var(--th-surface, #fff);
	padding: 24px;
}
body.tohfe-ui-v2 .tohfe-contact-form input,
body.tohfe-ui-v2 .tohfe-contact-form textarea {
	border-radius: 12px !important;
	border-color: var(--th-border, #e7ded0) !important;
}
body.tohfe-ui-v2 .tohfe-contact-form .tohfe-cf-submit button {
	background: var(--th-primary, #1d4a2e);
	border-radius: 999px;
	min-height: 48px;
	font-weight: 800;
}

/* ---------- 12. Search overlay polish ---------- */
body.tohfe-ui-v2 .th-search {
	background: #fffdf8;
	border-bottom: 1px solid var(--th-border, #e7ded0);
	box-shadow: 0 18px 40px rgba(36,31,26,.08);
}
body.tohfe-ui-v2 .th-search__input {
	border-radius: 12px;
	border: 1px solid var(--th-border, #e7ded0);
	min-height: 46px;
	background: #fff;
}
body.tohfe-ui-v2 .th-search .th-livesearch {
	background: #fff;
	border: 1px solid var(--th-border);
	border-radius: 14px;
	box-shadow: var(--th-shadow-card);
}
body.tohfe-ui-v2 .th-search .th-livesearch-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 14px;
	font-size: 13.5px;
	text-decoration: none;
	color: var(--th-text);
}
body.tohfe-ui-v2 .th-search .th-livesearch-item:hover { background: var(--th-bg, #faf7f0); }
body.tohfe-ui-v2 .th-search .th-livesearch-item img {
	width: 40px;
	height: 40px;
	border-radius: 9px;
	object-fit: cover;
	flex: none;
}

/* ---------- 13. Responsive refinements ---------- */
@media (max-width: 1023px) {
	body.tohfe-ui-v2 .th-header__main { height: 72px; gap: 12px; }
	body.tohfe-ui-v2 .th-logo__img { height: 66px; }
}
@media (max-width: 767px) {
	body.tohfe-ui-v2 .th-header__main { height: 66px; gap: 8px; padding-inline: 12px; }
	body.tohfe-ui-v2 .th-logo__img { height: 60px; }
	body.tohfe-ui-v2 .th-nav { display: none; }
	body.tohfe-ui-v2 .th-action { width: 42px; height: 42px; }
	body.tohfe-ui-v2 .tohfe-hero-title { font-size: clamp(22px, 6.4vw, 30px); }
	body.tohfe-ui-v2 .woocommerce ul.products li.product .button { min-height: 40px; font-size: 12.5px; }
	body.tohfe-ui-v2 .tohfe-section-title { font-size: 19px; }
}

/* Drawer: bigger brand image + smooth */
body.tohfe-ui-v2 .th-drawer__brand-img { height: 84px; width: auto; aspect-ratio: 1/1; }
body.tohfe-ui-v2 .th-drawer__nav .th-nav__link { font-size: 15px; padding: 12px 14px; border-radius: 12px; }
body.tohfe-ui-v2 .th-drawer__nav .sub-menu .th-nav__link { font-size: 13.5px; color: var(--th-muted, #6b6258); }

/* ---------- 14. Focus visibility (WCAG 2.4.7) ---------- */
body.tohfe-ui-v2 a:focus-visible,
body.tohfe-ui-v2 button:focus-visible,
body.tohfe-ui-v2 input:focus-visible,
body.tohfe-ui-v2 select:focus-visible,
body.tohfe-ui-v2 textarea:focus-visible {
	outline: 3px solid var(--th-accent, #c59a3a) !important;
	outline-offset: 2px;
	border-radius: 6px;
}

/* ---------- 15. Motion guard ---------- */
@media (prefers-reduced-motion: reduce) {
	body.tohfe-ui-v2 *,
	body.tohfe-ui-v2 *::before,
	body.tohfe-ui-v2 *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
	body.tohfe-ui-v2 .woocommerce ul.products li.product,
	body.tohfe-ui-v2 .tohfe-cat-card { transform: none !important; }
}
