/**
 * NUSU Portal — لایهٔ polish UI (نسخه ۱.۳.۱)
 *
 * انیمیشن‌های ورود، نوار ابزار چسبان شیشه‌ای، درخشش کارت‌ها،
 * و جزئیات میکرو-اینتراکشن بدون تغییر منطق یا قراردادهای موجود.
 */

/* ==========================================================================
   ۱) ورود تدریجی کارت‌های محصول (stagger)
   ========================================================================== */
@keyframes nusu-card-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(.985);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.nusu-grid > .nusu-card {
	animation: nusu-card-in .55s var(--nusu-ease-out) both;
}

.nusu-grid > .nusu-card:nth-child(1)  { animation-delay: .02s; }
.nusu-grid > .nusu-card:nth-child(2)  { animation-delay: .05s; }
.nusu-grid > .nusu-card:nth-child(3)  { animation-delay: .08s; }
.nusu-grid > .nusu-card:nth-child(4)  { animation-delay: .11s; }
.nusu-grid > .nusu-card:nth-child(5)  { animation-delay: .14s; }
.nusu-grid > .nusu-card:nth-child(6)  { animation-delay: .17s; }
.nusu-grid > .nusu-card:nth-child(7)  { animation-delay: .2s; }
.nusu-grid > .nusu-card:nth-child(8)  { animation-delay: .23s; }
.nusu-grid > .nusu-card:nth-child(9)  { animation-delay: .26s; }
.nusu-grid > .nusu-card:nth-child(10) { animation-delay: .29s; }
.nusu-grid > .nusu-card:nth-child(11) { animation-delay: .32s; }
.nusu-grid > .nusu-card:nth-child(12) { animation-delay: .35s; }

/* ==========================================================================
   ۲) نوار ابزار چسبان با بلور
   ========================================================================== */
.nusu-toolbar {
	position: sticky;
	top: calc(var(--nusu-header-h) + 4px);
	z-index: 25;
	padding: 12px 14px;
	margin-inline: -14px;
	margin-bottom: 22px;
	border-radius: var(--nusu-radius);
	background: color-mix(in srgb, var(--nusu-surface) 78%, transparent);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	backdrop-filter: saturate(160%) blur(12px);
	border: 1px solid transparent;
	transition: border-color var(--nusu-dur) var(--nusu-ease),
		box-shadow var(--nusu-dur) var(--nusu-ease),
		background var(--nusu-dur) var(--nusu-ease);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.nusu-toolbar { background: rgba(255, 255, 255, .88); }
}

.nusu-toolbar.is-stuck,
.nusu-toolbar:focus-within {
	border-color: var(--nusu-bronze-line);
	box-shadow: var(--nusu-shadow-2);
}

/* ==========================================================================
   ۳) درخشش نرم کارت هنگام هاور
   ========================================================================== */
.nusu-card {
	overflow: hidden;
}

.nusu-card::before {
	content: "";
	position: absolute;
	inset: -40% auto auto -30%;
	width: 70%;
	height: 70%;
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(184, 132, 63, .12), transparent 70%);
	opacity: 0;
	pointer-events: none;
	transition: opacity .5s var(--nusu-ease-out);
	z-index: 0;
}

.nusu-card:hover::before { opacity: 1; }

.nusu-card__body,
.nusu-card__media,
.nusu-card__foot {
	position: relative;
	z-index: 1;
}

/* دکمهٔ افزودن به سبد — حس premium */
.nusu-card__foot .nusu-btn--primary {
	letter-spacing: .01em;
}

.nusu-card:hover .nusu-card__foot .nusu-btn--primary {
	box-shadow: 0 14px 28px -14px rgba(28, 25, 23, .55);
}

/* ==========================================================================
   ۴) هیرو — ورود نرم آمار
   ========================================================================== */
@keyframes nusu-stat-in {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

.nusu-hero__stats .nusu-stat {
	animation: nusu-stat-in .5s var(--nusu-ease-out) both;
}

.nusu-hero__stats .nusu-stat:nth-child(1) { animation-delay: .08s; }
.nusu-hero__stats .nusu-stat:nth-child(2) { animation-delay: .14s; }
.nusu-hero__stats .nusu-stat:nth-child(3) { animation-delay: .2s; }

.nusu-hero__eyebrow {
	box-shadow: 0 4px 14px -8px rgba(138, 90, 34, .35);
}

/* ==========================================================================
   ۵) بَج موجودی — پالس ملایم برای روبه‌اتمام
   ========================================================================== */
@keyframes nusu-soft-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(150, 98, 10, .25); }
	50%      { box-shadow: 0 0 0 6px rgba(150, 98, 10, 0); }
}

.nusu-card__badge--low {
	animation: nusu-soft-pulse 2.4s ease-in-out infinite;
}

/* ==========================================================================
   ۶) دراور و مودال — حس لوکس‌تر
   ========================================================================== */
.nusu-drawer.is-open {
	box-shadow:
		-24px 0 60px -28px rgba(28, 25, 23, .28),
		var(--nusu-shadow-3);
}

html[dir="ltr"] .nusu-drawer.is-open {
	box-shadow:
		24px 0 60px -28px rgba(28, 25, 23, .28),
		var(--nusu-shadow-3);
}

.nusu-modal.is-open .nusu-modal__dialog {
	box-shadow:
		0 40px 80px -28px rgba(28, 25, 23, .42),
		0 0 0 1px rgba(168, 116, 47, .08);
}

/* خلاصهٔ سبد — تأکید روی مبلغ نهایی */
.nusu-summary__row--total strong {
	background: linear-gradient(135deg, var(--nusu-bronze-strong), var(--nusu-bronze));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

html.nusu-theme-dark .nusu-summary__row--total strong,
@media (prefers-color-scheme: dark) {
	html:not(.nusu-theme-light) .nusu-summary__row--total strong {
		background: linear-gradient(135deg, #e8cb9e, #d8b27c);
		-webkit-background-clip: text;
		background-clip: text;
	}
}

/* ==========================================================================
   ۷) حالت خالی و صفحه‌بندی
   ========================================================================== */
.nusu-empty {
	position: relative;
	overflow: hidden;
}

.nusu-empty::before {
	content: "";
	position: absolute;
	inset-block-start: -30%;
	inset-inline: 20%;
	height: 180px;
	background: radial-gradient(closest-side, var(--nusu-glow), transparent 70%);
	pointer-events: none;
	oacity: .7;
}

.nusu-pagination .page-numbers.current {
	position: relative;
}

.nusu-pagination .page-numbers.current::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: inherit;
	border: 1px solid rgba(168, 116, 47, .25);
	pointer-events: none;
}

/* ==========================================================================
   ۸) فوکوس و دسترسی‌پذیری
   ========================================================================== */
.nusu-btn:focus-visible,
.nusu-icon-btn:focus-visible,
.nusu-cart-btn:focus-visible {
	outline: 2px solid var(--nusu-bronze);
	outline-offset: 3px;
}

.nusu-input:focus-visible,
.nusu-select:focus-visible,
.nusu-textarea:focus-visible {
	outline: none;
}

/* ==========================================================================
   ۹) دارک‌مود — تنظیمات polish
   ========================================================================== */
html.nusu-theme-dark .nusu-toolbar {
	background: rgba(27, 23, 19, .82);
}

@media (prefers-color-scheme: dark) {
	html:not(.nusu-theme-light) .nusu-toolbar {
		background: rgba(27, 23, 19, .82);
	}
}

html.nusu-theme-dark .nusu-card::before {
	background: radial-gradient(closest-side, rgba(216, 178, 124, .1), transparent 70%);
}

/* ==========================================================================
   ۱۰) احترام به prefers-reduced-motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.nusu-grid > .nusu-card,
	.nusu-hero__stats .nusu-stat,
	.nusu-card__badge--low {
		animation: none !important;
	}
}

/* موبایل: toolbar بدون حاشیه منفی زیاد */
@media (max-width: 782px) {
	.nusu-toolbar {
		margin-inline: -8px;
		padding: 10px 10px;
		top: calc(var(--nusu-header-h) + 2px);
	}
}
