/*
Theme Name: Diyanat Pro Child
Theme URI: https://diyanattech.com/
Author: Diyanat Tech
Description: Phase 2 audit fixes for Diyanat Pro 4.6.1. Card system, fixed-chrome reserves, mobile filters, category coverage, SEO and accessibility fixes. Parent theme and WooCommerce core are never edited.
Version: 1.0.3
Template: diyanat-pro
Requires at least: 6.3
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: diyanat-pro-child
Tags: e-commerce, woocommerce, child-theme, accessibility-ready
*/

/* ============ Tokens (one system) ============ */
:root {
	--dtc-ink: #101828;
	--dtc-muted: #475467;
	--dtc-brand: #220088;
	--dtc-sale: #b42318;
	--dtc-green: #0a7a4a;
	--dtc-bg: #f8f8fc;
	--dtc-line: #d0d5dd;
	--dtc-card: #ffffff;
	--dtc-sp-1: 8px;
	--dtc-sp-2: 16px;
	--dtc-sp-3: 24px;
	--dtc-sp-4: 32px;
	--dtc-fs-title: 15px;
	--dtc-fs-price: 18px;
	--dtc-fs-old: 13px;
	--dtc-fs-meta: 12px;
	--dtc-fs-cta: 14px;
	--dtc-float-reserve: 96px;
	--dtc-sticky-reserve: 128px;
}

/* ============ P0: fixed chrome never covers buying controls ============ */
html { scroll-padding-bottom: calc(var(--dtc-float-reserve) + env(safe-area-inset-bottom, 0px)); }
body .di-footer { padding-bottom: calc(var(--dtc-float-reserve) + env(safe-area-inset-bottom, 0px)); }
body.woocommerce-cart .di-float-wa,
body.woocommerce-checkout .di-float-wa { display: none; }
body.woocommerce-cart .site-main,
body.woocommerce-checkout .site-main { padding-bottom: var(--dtc-sp-4); }
body .di-scrolltop { bottom: calc(var(--dtc-float-reserve) + env(safe-area-inset-bottom, 0px)); }
body.single-product { --stickybar-reserve: var(--dtc-sticky-reserve); }
body.single-product .di-pd { padding-bottom: calc(var(--dtc-sticky-reserve) + env(safe-area-inset-bottom, 0px)); }
body.single-product .di-scrolltop { bottom: calc(var(--dtc-sticky-reserve) + var(--dtc-sp-2) + env(safe-area-inset-bottom, 0px)); }
body.single-product .di-footer { padding-bottom: calc(var(--dtc-sticky-reserve) + var(--dtc-sp-3) + env(safe-area-inset-bottom, 0px)); }
.di-shop-main, .di-grid, ul.products { scroll-margin-bottom: var(--dtc-float-reserve); }

/* ============ P1: header stack (mobile) ============ */
@media (max-width: 768px) {
	.di-announce-in, .dt-sale-bar { padding-top: 6px; padding-bottom: 6px; font-size: 0.78rem; }
	body .di-header-in { padding-top: 8px; padding-bottom: 8px; gap: 8px 10px; }
	body .di-search-input { padding: 8px 12px; font-size: 0.9rem; }
	body .di-search-btn { width: 44px; min-height: 44px; }
	body .di-header-actions .di-icon-btn { min-width: 44px; min-height: 44px; }
}

/* ============ P1: one card system ============ */
.woocommerce ul.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; align-items: stretch; }
.woocommerce ul.products li.product { width: auto; float: none; margin: 0; display: flex; }
.woocommerce ul.products li.product .di-card { flex: 1 1 auto; width: 100%; }
body .di-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) {
	.woocommerce ul.products { grid-template-columns: repeat(3, 1fr); }
	body .di-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
	.woocommerce ul.products { grid-template-columns: repeat(2, 1fr); gap: 16px; }
	body .di-grid-4, body .di-grid-3 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
body .di-card-media { aspect-ratio: 4 / 3; }
body .di-card .di-card-title {
	display: -webkit-box;
	-webkit-line-clamp: 2 !important;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: var(--dtc-fs-title);
	line-height: 1.35;
	min-height: calc(var(--dtc-fs-title) * 1.35 * 2);
	max-height: calc(var(--dtc-fs-title) * 1.35 * 2);
}
@media (max-width: 380px) {
	body .di-card .di-card-title { font-size: 14px; min-height: calc(14px * 1.35 * 2); max-height: calc(14px * 1.35 * 2); }
}
body .di-card .di-chips { display: flex; flex-wrap: nowrap; overflow: hidden; min-height: 24px; }
body .di-card .di-chips li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body .di-card .di-card-meta { min-height: 44px; }
body .di-card .di-card-trust { min-height: 18px; }
body .di-card .di-card-price { margin-top: auto; align-items: baseline; }
body .di-card .di-card-price del,
body .di-card .dt-was,
body .di-card .dt-was del,
body .di-pd-price del,
body .di-stickybuy-price del { color: var(--dtc-muted) !important; font-size: var(--dtc-fs-old); font-weight: 500; }
body .di-card .dt-now .woocommerce-Price-amount { font-size: var(--dtc-fs-price); font-weight: 800; color: var(--dtc-brand); }
body .di-card .dt-save {
	background: transparent !important;
	color: var(--dtc-green) !important;
	font-size: var(--dtc-fs-meta);
	font-weight: 700;
	padding: 0 !important;
	white-space: nowrap;
}
body .di-card-wrap.sale .di-card-media::before { content: none !important; display: none !important; }
body .di-card .di-badge-off { background: var(--dtc-sale); color: #ffffff; }
body .di-card .di-card-cta-row { display: flex; gap: var(--dtc-sp-1); align-items: stretch; }
body .di-card .di-card-wa { flex: 1 1 auto; min-width: 0; min-height: 44px; }
body .di-card .di-card-wa-label, body .di-card .di-card-wa-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .di-card .di-card-add {
	flex: none;
	width: auto;
	min-width: 64px;
	height: 44px;
	min-height: 44px;
	padding: 0 14px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	font-weight: 700;
	font-size: var(--dtc-fs-cta);
}
@media (max-width: 768px) {
	body .di-card .di-wishlist-btn,
	body .di-card .di-quickview-btn { display: none !important; }
}
body .di-card .di-wishlist-btn,
body .di-card .di-quickview-btn { min-width: 44px; min-height: 44px; }

/* ============ P1: filters before the grid on mobile ============ */
.di-filter-toggle { display: none; }
@media (max-width: 1100px) {
	body .di-shop-layout { display: flex; flex-direction: column; gap: var(--dtc-sp-2); }
	.di-filter-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: var(--dtc-sp-1);
		min-height: 44px;
		padding: 10px 20px;
		border: 1.5px solid var(--dtc-brand);
		border-radius: 999px;
		background: var(--dtc-card);
		color: var(--dtc-brand);
		font-weight: 700;
		font-size: var(--dtc-fs-cta);
		align-self: flex-start;
	}
	body .di-shop-layout .di-shop-sidebar { order: -1; display: none; position: static; width: 100%; }
	body .di-shop-layout.filters-open .di-shop-sidebar { display: grid; grid-template-columns: 1fr; }
	body .di-shop-layout .di-shop-main { order: 1; width: 100%; }
}
body .di-side-cats a,
body .di-cat-pill,
body .woocommerce-breadcrumb a,
body .di-card-cats a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding-top: 6px;
	padding-bottom: 6px;
}
body .di-cat-pill { padding-left: 16px; padding-right: 16px; }

/* ============ P1: buy box ============ */
body.dt-single-unit .di-pd-buyrow button.single_add_to_cart_button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-height: 52px;
}
body.dt-single-unit .di-pd-buyrow .quantity { display: inline-flex !important; }
.di-child-condition {
	display: inline-flex;
	align-items: center;
	gap: var(--dtc-sp-1);
	background: var(--dtc-bg);
	border: 1px solid var(--dtc-line);
	border-radius: 999px;
	padding: 6px 14px;
	font-size: var(--dtc-fs-meta);
	font-weight: 700;
	color: var(--dtc-ink);
	margin: 0 0 var(--dtc-sp-1);
}
.di-child-delivery-line { margin: 0 0 var(--dtc-sp-2); font-size: var(--dtc-fs-cta); line-height: 1.5; color: var(--dtc-muted); }
body.single-product .dt-delivery-line { display: none; }

/* ============ P1: accessibility ============ */
body :focus-visible { outline: 3px solid var(--dtc-brand); outline-offset: 2px; }
body .di-card-price del .woocommerce-Price-amount,
body .dt-was .woocommerce-Price-amount { color: var(--dtc-muted) !important; }

/* Quick-view modal must stay hidden until opened (parent CSS lacks a [hidden] guard). */
.di-quickview-modal[hidden] { display: none !important; }

/* Product page fixed chrome must never cover the trust card (Phase 3 P1). */
body.single-product .di-stickybuy-in { padding-inline: 16px; }
body.single-product .di-stickybuy-btns .di-btn { min-height: 44px; }
body.single-product .di-guarantee { margin-bottom: calc(var(--dtc-sticky-reserve) + var(--dtc-sp-2)); }
body.single-product .di-guarantee a { display: inline-flex; align-items: center; min-height: 44px; }
body.single-product .di-scrolltop { width: 48px; height: 48px; }
body.single-product:has(.di-stickybuy:not([hidden])) .di-scrolltop { display: none !important; }
@media (max-width: 768px) {
	body.single-product { --dtc-sticky-reserve: 144px; }
}
