/*
 * Karm Awja storefront identity layer.
 * Loaded after the generated WVC styles so the compiled application remains
 * upgradeable while the client's palette and responsive rhythm stay stable.
 */

:root,
.light,
.dark {
	color-scheme: dark;
	--background: #1e1610;
	--foreground: #f8f2e7;
	--card: #291d14;
	--card-foreground: #f8f2e7;
	--popover: #241911;
	--popover-foreground: #f8f2e7;
	--primary: #daa12f;
	--primary-foreground: #1e1610;
	--secondary: #eedaaf;
	--secondary-foreground: #1e1610;
	--muted: #38281c;
	--muted-foreground: #d4c2a6;
	--accent: #46321f;
	--accent-foreground: #f8f2e7;
	--destructive: #c75b52;
	--destructive-foreground: #fffaf1;
	--border: #56402b;
	--input: #3b2a1d;
	--ring: #eedaaf;
	--sidebar: #241911;
	--sidebar-foreground: #f8f2e7;
	--sidebar-primary: #daa12f;
	--sidebar-primary-foreground: #1e1610;
	--sidebar-accent: #46321f;
	--sidebar-accent-foreground: #f8f2e7;
	--sidebar-border: #56402b;
	--sidebar-ring: #eedaaf;
	--font-sans: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
	--font-serif: "Amiri", Georgia, serif;
	--font-default: var(--font-sans);
	--radius: 0.75rem;
	--karm-espresso: #1e1610;
	--karm-gold: #daa12f;
	--karm-ivory: #f8f2e7;
	--karm-sand: #eedaaf;
	--karm-header-height: 5rem;
}

html {
	background: var(--karm-espresso);
	direction: rtl;
	scroll-padding-top: calc(var(--karm-header-height) + 5.5rem);
}

body {
	background:
		radial-gradient(circle at 85% 4%, rgb(218 161 47 / 0.08), transparent 24rem),
		var(--karm-espresso);
	color: var(--karm-ivory);
	direction: rtl;
	font-family: var(--font-sans);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

::selection {
	background: var(--karm-gold);
	color: var(--karm-espresso);
}

h1,
h2,
h3,
h4,
h5,
h6,
[class~="font-serif"] {
	font-family: var(--font-serif) !important;
	letter-spacing: 0 !important;
}

p,
li,
label,
input,
select,
textarea,
button,
[class~="font-sans"],
[class~="font-default"] {
	font-family: var(--font-sans) !important;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--karm-sand) !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 5px rgb(30 22 16 / 0.82) !important;
}

/* Warm, elevated navigation that stays legible over every section. */
#الهيدر {
	min-height: var(--karm-header-height);
	background: rgb(30 22 16 / 0.9) !important;
	border-bottom-color: rgb(218 161 47 / 0.24) !important;
	box-shadow: 0 10px 32px rgb(0 0 0 / 0.18);
	-webkit-backdrop-filter: blur(18px) saturate(125%);
	backdrop-filter: blur(18px) saturate(125%);
}

#الهيدر > div > div:first-child img {
	display: block;
	width: auto;
	height: clamp(2.9rem, 5vw, 3.75rem);
	max-width: clamp(8rem, 17vw, 12rem);
	object-fit: contain;
}

#الهيدر a,
#الهيدر button,
#الفوتر a,
#الفوتر button {
	-webkit-tap-highlight-color: transparent;
}

#الفوتر {
	background:
		linear-gradient(180deg, rgb(218 161 47 / 0.04), transparent 10rem),
		#18110c !important;
	border-top-color: rgb(218 161 47 / 0.28) !important;
}

#الفوتر img {
	width: auto;
	max-width: min(15rem, 70vw);
	max-height: 8rem;
	object-fit: contain;
}

/* Restrained heritage detail without competing with the menu photography. */
#منتجات-مميزة,
#product-listings,
#product-detail,
#أصول-القهوة,
#لماذا-كرم-عوجا,
#آراء-العملاء,
#تواصل-كرم-عوجا {
	background-color: var(--karm-espresso) !important;
	background-image:
		linear-gradient(115deg, transparent 0 48%, rgb(218 161 47 / 0.025) 48% 49%, transparent 49% 100%),
		radial-gradient(circle at 10% 8%, rgb(238 218 175 / 0.035), transparent 22rem);
}

#البطل,
#shop-hero {
	isolation: isolate;
	background-color: var(--karm-espresso) !important;
}

#البطل h1,
#shop-hero h1 {
	text-wrap: balance;
	text-shadow: 0 3px 28px rgb(0 0 0 / 0.45);
}

#البطل p,
#shop-hero p {
	text-wrap: pretty;
}

/* Product filters remain close at hand while browsing a long menu. */
#product-listings > div > div:nth-child(2) {
	position: sticky;
	top: var(--karm-header-height);
	z-index: 35;
	margin-inline: -0.45rem;
	padding: 0.85rem 0.45rem 1rem !important;
	background: linear-gradient(180deg, rgb(30 22 16 / 0.98) 72%, rgb(30 22 16 / 0.92));
	border-bottom: 1px solid rgb(218 161 47 / 0.18);
	-webkit-backdrop-filter: blur(14px) saturate(120%);
	backdrop-filter: blur(14px) saturate(120%);
}

#product-listings > div > div:nth-child(2) > div {
	display: flex !important;
	flex-wrap: nowrap !important;
	gap: 0.55rem !important;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 0.15rem 0.1rem 0.45rem;
	overscroll-behavior-inline: contain;
	scroll-snap-type: inline proximity;
	scrollbar-color: rgb(218 161 47 / 0.65) transparent;
	scrollbar-width: thin;
}

#product-listings > div > div:nth-child(2) button {
	flex: 0 0 auto;
	scroll-snap-align: start;
	border-radius: 999px;
}

body.admin-bar #product-listings > div > div:nth-child(2) {
	top: calc(var(--karm-header-height) + 32px);
}

/* A consistent menu rhythm: two columns on phones, three on tablets, four wide. */
#product-listings > div > div.grid,
#منتجات-مميزة > div:nth-child(2) > div.grid {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 0.8rem !important;
}

#product-listings > div > div.grid > div,
#منتجات-مميزة > div:nth-child(2) > div.grid [data-slot="card"] {
	min-width: 0;
	border-color: rgb(218 161 47 / 0.2) !important;
	border-radius: 1rem !important;
	background:
		linear-gradient(155deg, rgb(238 218 175 / 0.035), transparent 42%),
		var(--card) !important;
	box-shadow: 0 14px 32px rgb(0 0 0 / 0.17);
}

#product-listings .aspect-square,
#منتجات-مميزة .aspect-square {
	aspect-ratio: 1 / 1 !important;
}

#product-listings .aspect-square img,
#منتجات-مميزة .aspect-square img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	object-position: center !important;
}

#product-listings h3,
#منتجات-مميزة h3 {
	line-height: 1.45;
}

#product-listings [class~="text-primary"],
#منتجات-مميزة [class~="text-primary"] {
	text-shadow: 0 0 22px rgb(218 161 47 / 0.08);
}

@media (hover: hover) and (pointer: fine) {
	#product-listings > div > div.grid > div:hover,
	#منتجات-مميزة > div:nth-child(2) > div.grid [data-slot="card"]:hover {
		border-color: rgb(218 161 47 / 0.58) !important;
		box-shadow: 0 18px 44px rgb(0 0 0 / 0.3), 0 0 0 1px rgb(218 161 47 / 0.08);
	}
}

@media (min-width: 768px) {
	#product-listings > div > div.grid,
	#منتجات-مميزة > div:nth-child(2) > div.grid {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 1.1rem !important;
	}
}

@media (min-width: 1024px) {
	#product-listings > div > div.grid,
	#منتجات-مميزة > div:nth-child(2) > div.grid {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		gap: 1.5rem !important;
	}
}

@media (max-width: 782px) {
	body.admin-bar #product-listings > div > div:nth-child(2) {
		top: calc(var(--karm-header-height) + 46px);
	}
}

@media (max-width: 559px) {
	#product-listings > div,
	#منتجات-مميزة > div:nth-child(2) {
		padding-inline: 0.75rem !important;
	}

	#product-listings > div > div.grid,
	#منتجات-مميزة > div:nth-child(2) > div.grid {
		gap: 0.65rem !important;
	}

	#product-listings > div > div.grid > div > [class~="p-5"],
	#منتجات-مميزة [data-slot="card-header"],
	#منتجات-مميزة [data-slot="card-content"],
	#منتجات-مميزة [data-slot="card-footer"] {
		padding-inline: 0.75rem !important;
	}

	#product-listings > div > div.grid > div > div > [class~="pt-4"][class~="mt-4"] {
		align-items: stretch !important;
		flex-direction: column !important;
		gap: 0.65rem !important;
	}

	#product-listings > div > div.grid > div > div > [class~="pt-4"][class~="mt-4"] a,
	#product-listings > div > div.grid > div > div > [class~="pt-4"][class~="mt-4"] button {
		width: 100%;
	}

	#product-listings h3,
	#منتجات-مميزة h3 {
		font-size: 1rem !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	html:focus-within {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}

	#product-listings img,
	#منتجات-مميزة img,
	#البطل img {
		transform: none !important;
	}
}
