/**
 * استایل جایگاه تبلیغاتی — فاز ۹ (بند ۲۱ سند معماری).
 *
 * پورت وفادار کامپوننت AdSlot.tsx پروتوتایپ (aside + برچسب «تبلیغ» +
 * آیکن + عنوان/متن + دکمه CTA؛ سه تُن gold/dark/neutral).
 * پشتوانه مستقل از تم (الگوی market.css): هر مصرف توکن به‌صورت
 * var(--rsd-X, fallback) — با تم فعال، توکن تم (و دارک‌مودش) برنده
 * می‌شود؛ بدون تم، مقادیر پیوست B سند معماری.
 *
 * مقادیر ثابتِ طراحی (سلیت تیره، گرادیان برند) عیناً از پروتوتایپ
 * تازسازی شده‌اند — توکن سیستمی ندارند و نباید داشته باشند.
 */

/* ── قاب جایگاه ── */
.rsd-ad {
	position: relative;
	overflow: hidden;
	border-radius: var(--rsd-radius-xl, 1rem);
	border: 1px solid transparent;
	padding: 1rem;
	margin-block: 0.25rem;
}
@media (min-width: 640px) {
	.rsd-ad {
		padding: 1.25rem;
	}
}

/* برچسب شفاف «تبلیغ» — گوشه چپِ بالا (فیزیکی؛ عین left-3/top-3). */
.rsd-ad-badge {
	position: absolute;
	left: 0.75rem;
	top: 0.75rem;
	border-radius: 6px;
	padding: 2px 6px;
	font-size: 9px;
	font-weight: 700;
	line-height: 1.6;
	background: var(--rsd-muted-bg, #f3f2ee);
	color: var(--rsd-muted-fg, #6e6a5e);
}

/* ── تُن‌ها ── */
.rsd-ad.rsd-tone-gold {
	border-color: var(--rsd-brand-200, #ebdcaa);
	/* from-brand-50 via-white to-brand-100/60 (جهت RTL: to left) */
	background: linear-gradient(
		to left,
		#fbf8ef,
		#ffffff,
		rgb(245 237 213 / 0.6)
	);
}
html.dark .rsd-ad.rsd-tone-gold {
	border-color: rgb(185 140 51 / 0.3);
	/* from-brand-500/10 via-card to-brand-500/5 */
	background: linear-gradient(
		to left,
		rgb(185 140 51 / 0.1),
		var(--rsd-card, #1a1915),
		rgb(185 140 51 / 0.05)
	);
}

.rsd-ad.rsd-tone-dark {
	border-color: #1e293b; /* slate-800 — ثابت طراحی */
	background: #020617; /* slate-950 */
	color: #ffffff;
}
.rsd-ad.rsd-tone-dark .rsd-ad-badge {
	background: rgb(255 255 255 / 0.1);
	color: rgb(255 255 255 / 0.7);
}

.rsd-ad.rsd-tone-neutral {
	border-color: var(--rsd-border, #e8e5dd);
	background: var(--rsd-muted-bg, #f3f2ee);
}

/* ── چیدمان داخلی ── */
.rsd-ad-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
}
@media (min-width: 640px) {
	.rsd-ad-inner {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 1.5rem;
	}
}

.rsd-ad-main {
	display: flex;
	min-width: 0;
	align-items: flex-start;
	gap: 0.75rem;
}

.rsd-ad-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 2.5rem; /* size-10 */
	height: 2.5rem;
	border-radius: 8px; /* rounded-lg */
	margin-top: 2px; /* mt-0.5 */
}
.rsd-ad-icon svg {
	width: 1.25rem; /* size-5 */
	height: 1.25rem;
}

.rsd-ad-icon--gold {
	background: var(--rsd-brand-600, #9a7225);
	color: #ffffff;
}
.rsd-ad-icon--dark {
	background: rgb(185 140 51 / 0.9); /* brand-500/90 */
	color: #ffffff;
}
.rsd-ad-icon--neutral {
	background: var(--rsd-bg, #fafaf8);
	color: var(--rsd-brand-600, #9a7225);
}
html.dark .rsd-ad-icon--neutral {
	background: var(--rsd-card, #1a1915);
	color: var(--rsd-brand-400, #cfa954);
}

.rsd-ad-text {
	min-width: 0;
}

.rsd-ad-title {
	margin-bottom: 2px;
	font-size: 15px;
	font-weight: 800;
	line-height: 24px;
	color: var(--rsd-fg, #101828);
}
.rsd-ad.rsd-tone-dark .rsd-ad-title {
	color: #ffffff;
}

.rsd-ad-body {
	font-size: 12px;
	line-height: 24px;
	color: var(--rsd-muted-fg, #6e6a5e);
}
.rsd-ad.rsd-tone-dark .rsd-ad-body {
	color: rgb(255 255 255 / 0.7);
}

/* ── دکمه CTA (پورت Button size=sm) ── */
.rsd-ad-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	height: 2rem; /* h-8 */
	padding: 0 0.75rem; /* px-3 */
	border-radius: var(--rsd-radius-md, 10px);
	border: 1px solid transparent;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* تُن تیره → variant پیش‌فرض برند */
.rsd-ad.rsd-tone-dark .rsd-ad-cta {
	background: var(--rsd-brand-500, #b98c33);
	color: #ffffff;
}
.rsd-ad.rsd-tone-dark .rsd-ad-cta:hover,
.rsd-ad.rsd-tone-dark .rsd-ad-cta:focus-visible {
	background: var(--rsd-brand-600, #9a7225);
	color: #ffffff;
}

/* تُن طلایی/خنثی → variant outline برند */
.rsd-ad.rsd-tone-gold .rsd-ad-cta,
.rsd-ad.rsd-tone-neutral .rsd-ad-cta {
	background: transparent;
	border-color: var(--rsd-brand-300, #dfc57e);
	color: var(--rsd-brand-700, #7c5b1d);
}
.rsd-ad.rsd-tone-gold .rsd-ad-cta:hover,
.rsd-ad.rsd-tone-neutral .rsd-ad-cta:hover,
.rsd-ad.rsd-tone-gold .rsd-ad-cta:focus-visible,
.rsd-ad.rsd-tone-neutral .rsd-ad-cta:focus-visible {
	background: var(--rsd-brand-50, #fbf8ef);
	color: var(--rsd-brand-800, #5f4616);
}
html.dark .rsd-ad.rsd-tone-gold .rsd-ad-cta,
html.dark .rsd-ad.rsd-tone-neutral .rsd-ad-cta {
	color: var(--rsd-brand-300, #dfc57e);
}
html.dark .rsd-ad.rsd-tone-gold .rsd-ad-cta:hover,
html.dark .rsd-ad.rsd-tone-neutral .rsd-ad-cta:hover,
html.dark .rsd-ad.rsd-tone-gold .rsd-ad-cta:focus-visible,
html.dark .rsd-ad.rsd-tone-neutral .rsd-ad-cta:focus-visible {
	background: rgb(185 140 51 / 0.1);
	color: var(--rsd-brand-300, #dfc57e);
}

/* فوکوس‌رینگ ملایم (a11y) */
.rsd-ad-cta:focus-visible {
	outline: 2px solid var(--rsd-ring, #cfa954);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.rsd-ad-cta {
		transition: none;
	}
}
