/* البطاقة تتبع وضع الموقع تلقائياً (1.1.1): الخلفية والحدود مشتقة من لون
 * النص الموروث (currentColor) بدل ألوان ثابتة — فتطابق الثيم فاتحاً أو داكناً
 * بلا الاعتماد على prefers-color-scheme (الذي كان يتبع نظام التشغيل فيبقى
 * داكناً رغم أن الموقع فاتح). الأسطر الأولى fallback للمتصفحات القديمة.
 * + مظهر "عائم" (ظل مرتفع) — متطلب المالك (مرحلة 4). */
.rpc-recipe-card {
	border: 1px solid #e2e2e2;
	border: 1px solid color-mix( in srgb, currentColor 16%, transparent );
	border-radius: var( --rpc-radius, 8px );
	padding: 22px;
	margin: 28px 0;
	background: #fff;
	background: color-mix( in srgb, currentColor 5%, transparent );
	color: inherit;
	box-shadow: 0 6px 22px rgba( 0, 0, 0, 0.10 );
	font-size: var( --rpc-font-size, 16px );
}

/* --rpc-accent-text وماشي --rpc-primary: اللون هنا نص، فخاصو النسخة
 * المتكيّفة مع الوضع الليلي (راجع RPC_Design::dark_mode_vars). --rpc-primary
 * كيبقى للخلفيات/الحدود فقط. */
.rpc-recipe-title {
	margin-top: 0;
	color: var( --rpc-accent-text, var( --rpc-primary, #c0392b ) );
}

.rpc-recipe-rating {
	font-weight: 600;
	margin-bottom: 12px;
}

/* ---- سطر الميتا (0.10.0): chips ملونة + أوقات Prep/Cook/Total ---- */
.rpc-recipe-meta {
	margin-bottom: 14px;
}

.rpc-chips {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.rpc-chip {
	background: #f7f7f7; /* fallback للمتصفحات القديمة بلا color-mix */
	background: color-mix( in srgb, var( --rpc-primary, #c0392b ) 12%, #fff );
	color: var( --rpc-primary, #c0392b );
	border-radius: 20px;
	padding: 2px 12px;
	font-size: 0.8em;
	font-weight: 600;
}

.rpc-times-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 4px;
	font-size: 0.85em;
}

.rpc-times-table th,
.rpc-times-table td {
	border: 1px solid #eee;
	padding: 5px 10px;
	text-align: center;
}

.rpc-times-table th {
	color: var( --rpc-subheading, var( --rpc-accent-text, #c0392b ) );
	font-weight: 600;
}

.rpc-times-inline {
	margin: 0 0 4px;
	font-size: 0.85em;
	color: #555;
}

/* ---- عناوين الأقسام والأقسام القابلة للطي ---- */
.rpc-section-title {
	margin: 0 0 8px;
	color: var( --rpc-subheading, var( --rpc-accent-text, #c0392b ) );
	font-size: 1.1em;
	font-weight: 700;
}

/* 1.2.2: الكلاس انتقل للـ h3 اللي جوّا summary (راجع RPC_Template::section_open)،
 * فالمحدِّد ولّى على summary نفسه باش يبقى المثلث/المؤشر خدّام. */
details.rpc-collapsible > summary {
	cursor: pointer;
	list-style: revert;
}

/* العنوان داخل summary: inline + بلا هوامش باش المظهر يبقى مطابق تماما لما
 * كان قبل تغيير البنية (المثلث بجنب النص، بلا سطر زائد).
 * color: inherit مقصود ومهم — summary أصلا ملوّن بـ var(--rpc-subheading)،
 * وإلا عاودنا نطبقو نفس المتغير هنا كيتحسب currentColor من جديد فوق اللون
 * المشتق (تراكم مزدوج) فيرجع اللون داكن ويطيح التباين فـ الوضع الليلي —
 * مقيس فعليا: 3.52:1 بدل 5.20:1. */
.rpc-collapsible > summary > .rpc-section-title {
	display: inline;
	margin: 0;
	color: inherit;
}

.rpc-recipe-ingredients,
.rpc-recipe-instructions {
	margin-bottom: 16px;
}

.rpc-group-title {
	margin-bottom: 6px;
	color: var( --rpc-subheading, var( --rpc-accent-text, #c0392b ) );
}

.rpc-ingredients-list,
.rpc-instructions-list {
	padding-inline-start: 20px;
	margin: 0 0 12px;
}

.rpc-ingredient-notes {
	color: #666;
	font-size: 0.9em;
}

.rpc-recipe-equipment ul {
	list-style: disc;
	padding-inline-start: 20px;
}

.rpc-ad-slot {
	margin: 16px 0;
	text-align: center;
}

.rpc-recipe-actions {
	display: flex;
	gap: 10px;
}

/* أزرار البطاقة (0.10.0): ألوان مستقلة قابلة للتخصيص من تبويب Design —
   الافتراضي كيتبع اللون الأساسي فالمواقع القديمة كتاخد مظهرا متناسقا تلقائيا. */
.rpc-btn-print {
	display: inline-block;
	padding: 8px 16px;
	border-radius: 6px;
	border: 1px solid var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) );
	background: var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) );
	color: var( --rpc-btn-text, #fff );
	text-decoration: none;
	cursor: pointer;
}

/* هاد الرابط برّا البطاقة (فوق المقال)، لهذا نطاق الاشتقاق فـ
 * RPC_Design::dark_mode_vars كيشمل .rpc-jump-to-recipe صراحة. */
.rpc-jump-to-recipe a {
	font-weight: 600;
	color: var( --rpc-accent-text, var( --rpc-primary, #c0392b ) );
}

.rpc-servings-controls {
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.rpc-servings-btn {
	padding: 4px 10px;
	border-radius: 4px;
	border: 1px solid #ccc;
	background: #f7f7f7;
	cursor: pointer;
}

.rpc-servings-btn.is-active {
	background: var( --rpc-primary, #c0392b );
	border-color: var( --rpc-primary, #c0392b );
	color: #fff;
}

.rpc-ingredient-amount {
	font-weight: 600;
}

.rpc-unit-metric {
	display: none;
}

.rpc-recipe-card.rpc-unit-system-metric .rpc-unit-us {
	display: none;
}

.rpc-recipe-card.rpc-unit-system-metric .rpc-unit-metric {
	display: inline;
}

.rpc-unit-toggle {
	margin-bottom: 10px;
	display: flex;
	gap: 6px;
}

.rpc-unit-btn {
	padding: 4px 10px;
	border-radius: 4px;
	border: 1px solid #ccc;
	background: #f7f7f7;
	cursor: pointer;
}

.rpc-unit-btn.is-active {
	background: var( --rpc-primary, #c0392b );
	border-color: var( --rpc-primary, #c0392b );
	color: #fff;
}

.rpc-ingredient-link {
	color: var( --rpc-accent-text, var( --rpc-primary, #c0392b ) ); /* نص → النسخة المتكيّفة */
	text-decoration: underline;
}

.rpc-shop-panel {
	display: none;
	margin-top: 10px;
	padding: 10px 16px;
	border: 1px solid #eee;
	border-radius: 6px;
}

.rpc-recipe-card.rpc-shop-open .rpc-shop-panel {
	display: block;
}

.rpc-timer-btn {
	margin-inline-start: 8px;
	padding: 2px 8px;
	font-size: 0.85em;
	border-radius: 4px;
	border: 1px solid #ccc;
	background: #fff;
	cursor: pointer;
}

.rpc-timer-btn.is-running {
	background: var( --rpc-primary, #c0392b );
	color: #fff;
}

.rpc-video-wrapper {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
	margin-bottom: 16px;
}

.rpc-video-wrapper iframe,
.rpc-video-wrapper embed,
.rpc-video-wrapper object {
	position: absolute;
	top: 0;
	inset-inline-start: 0;
	width: 100%;
	height: 100%;
}

.rpc-nutrition {
	border: 1px solid #eee;
	border-radius: 6px;
	padding: 12px 16px;
	margin-bottom: 16px;
	font-size: 0.9em;
}

.rpc-nutrition dl {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 100px, 1fr ) );
	gap: 6px 12px;
	margin: 0;
}

.rpc-nutrition dt {
	font-weight: 600;
}

.rpc-reviews-list {
	margin-top: 16px;
	border-top: 1px solid #eee;
	padding-top: 12px;
}

.rpc-review {
	margin-bottom: 12px;
}

.rpc-review-form label {
	display: block;
	margin-bottom: 6px;
}

.rpc-review-honeypot {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* 1.2.2 — إخفاء بصري فقط (يبقى مقروءا للتقنيات المساعدة عند الحاجة).
 * معرّف داخل البلوجين عمدا بدل الاعتماد على screen-reader-text ديال
 * ووردبريس/القالب — البلوجين خاصو يخدم بنفس الشكل على أي قالب. */
.rpc-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

.rpc-roundup-item {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-bottom: 14px;
}

.rpc-roundup-item img {
	width: 90px;
	height: 90px;
	object-fit: cover;
	border-radius: 6px;
}

.rpc-recipe-card.rpc-cook-mode {
	font-size: 1.3em;
	line-height: 1.6;
}

.rpc-cook-mode-btn.is-active {
	background: var( --rpc-primary, #c0392b );
	border-color: var( --rpc-primary, #c0392b );
	color: #fff;
}

@media print {
	.rpc-ad-slot,
	.rpc-recipe-actions {
		display: none !important;
	}
}

/* ===== 0.11.0 — صورة الوصفة داخل البطاقة ===== */

.rpc-recipe-image img {
	max-width: 100%;
	height: auto;
	border-radius: var( --rpc-radius, 8px );
	display: block;
}

.rpc-image-full {
	margin-bottom: 14px;
}

/* full (1.1.1): كانت تأخذ ارتفاع الصورة الطبيعي فتكبر جداً — نحدّها بارتفاع
 * معقول (بانر) مع قص متمركز، فتبقى بعرض البطاقة وارتفاع مضبوط. */
.rpc-image-full img {
	width: 100%;
	max-height: 320px;
	object-fit: cover;
}

/* المصغرة: كتطفو بجنب العنوان/الميتا وكتتصفى تلقائيا مع باقي المحتوى */
.rpc-image-thumb {
	float: inline-start;
	margin-inline-end: 14px;
	margin-bottom: 10px;
	width: 110px;
}

.rpc-image-thumb img {
	width: 110px;
	height: 110px;
	object-fit: cover;
}

/* الأقسام الكبرى كتقطع الطفو باش المصغرة ما تدخلش فـ المكونات */
.rpc-recipe-ingredients,
.rpc-recipe-instructions {
	clear: both;
}

@media print {
	.rpc-recipe-image {
		display: none !important;
	}
}

/* =====================================================================
 * 1.0.1 — تجاوب الهاتف + متانة الأزرار
 *
 * علة أبلغ عنها المالك: على الهاتف كانت البطاقة ضيقة/تتجاوز عرض الشاشة
 * فتكسر تجاوب المقال كله (تمرير أفقي للصفحة). السبب المعتاد: عنصر داخل
 * البطاقة أعرض من الحاوية (جدول/صورة/كلمة طويلة). الحل: box-sizing موحّد،
 * max-width:100% لكل شيء، كسر الكلمات الطويلة، وجعل الأقسام تنساب رأسياً
 * على الشاشات الصغيرة.
 * ===================================================================== */

.rpc-recipe-card,
.rpc-recipe-card * {
	box-sizing: border-box;
}

.rpc-recipe-card {
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

/* أي صورة داخل البطاقة لا تتجاوز عرض الحاوية أبداً */
.rpc-recipe-card img {
	max-width: 100%;
	height: auto;
}

/* جدول الأوقات: يبقى ضمن العرض بلا فرض تمرير أفقي للصفحة */
.rpc-times-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.rpc-times-table th,
.rpc-times-table td {
	word-break: break-word;
	padding: 4px 6px;
}

/* chips وأزرار الإجراءات تلتفّ بدل أن تتمدد أفقياً */
.rpc-chips,
.rpc-recipe-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* متانة نص زر الطباعة: بعض الثيمات تلوّن روابط المحتوى بلون واحد فيصير
 * نص الزر بلون خلفيته (غير مرئي). نرفع الخصوصية ونثبّت اللون واللا-تسطير. */
.rpc-recipe-card a.rpc-btn-print,
.rpc-recipe-card a.rpc-btn-print:hover,
.rpc-recipe-card a.rpc-btn-print:focus {
	color: var( --rpc-btn-text, #fff );
	text-decoration: none;
}

/* ===== شاشات الهاتف ===== */
@media (max-width: 600px) {
	.rpc-recipe-card {
		padding: 14px;
		margin-inline: 0;
	}

	/* الصورة المصغرة العائمة: على الهاتف تصير بعرض كامل بدل طفو ضيق مزعج */
	.rpc-image-thumb {
		float: none;
		width: 100%;
		margin-inline-end: 0;
	}

	.rpc-image-thumb img {
		width: 100%;
		height: auto;
	}

	/* الأزرار تملأ العرض وتتمركز لسهولة اللمس */
	.rpc-recipe-actions > a,
	.rpc-recipe-actions > button {
		flex: 1 1 auto;
		text-align: center;
		justify-content: center;
	}

	/* التغذية: أعمدة أقل على الشاشة الضيقة */
	.rpc-nutrition dl {
		grid-template-columns: repeat( auto-fit, minmax( 80px, 1fr ) );
	}
}

/* =====================================================================
 * 1.0.2 — معالجة ملاحظات المالك على v8
 * ===================================================================== */

/* --- نص زر الطباعة: بعض الثيمات تفرض لون روابط المحتوى بـ !important،
 *     فنثبّت لون نص الزر بقوة مماثلة (كان يظهر أحمر على أحمر). --- */
.rpc-recipe-card a.rpc-btn-print,
.rpc-recipe-card a.rpc-btn-print:link,
.rpc-recipe-card a.rpc-btn-print:visited,
.rpc-recipe-card a.rpc-btn-print:hover,
.rpc-recipe-card a.rpc-btn-print:focus {
	color: var( --rpc-btn-text, #fff ) !important;
	-webkit-text-fill-color: var( --rpc-btn-text, #fff );
	text-decoration: none !important;
}

/* --- قسم الملاحظات داخل البطاقة (كان يُخزَّن ولا يُعرض) --- */
.rpc-recipe-notes {
	margin: 12px 0 16px;
}

.rpc-recipe-notes p {
	margin: 0;
	font-size: 0.95em;
	line-height: 1.6;
}

/* --- الصورة المصغرة (1.1.1): كانت 160px ومازالت صغيرة → 220px أوضح --- */
.rpc-image-thumb {
	width: 220px;
}

.rpc-image-thumb img {
	width: 220px;
	height: 220px;
}

/* --- "اقفز للوصفة" (1.1.1): زر محدَّد (outline) بأيقونة شوكة وسكين، وعند
 *     المرور يمتلئ باللون مع حركة بسيطة للأيقونة — كما طلب المالك. --- */
.rpc-jump-to-recipe {
	margin: 0 0 18px;
}

.rpc-jump-to-recipe a {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 11px 26px;
	border-radius: 999px;
	border: 2px solid var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) );
	background: transparent;
	color: var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) ) !important;
	-webkit-text-fill-color: var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) );
	font-weight: 700;
	text-decoration: none !important;
	transition: background 0.2s ease, color 0.2s ease;
}

.rpc-jump-to-recipe a:hover,
.rpc-jump-to-recipe a:focus {
	background: var( --rpc-btn-bg, var( --rpc-primary, #c0392b ) );
	color: var( --rpc-btn-text, #fff ) !important;
	-webkit-text-fill-color: var( --rpc-btn-text, #fff );
}

/* الأيقونة ترث لون النص (تنقلب للأبيض عند الامتلاء) + حركة لطيفة عند المرور */
.rpc-jump-icon {
	width: 1.1em;
	height: 1.1em;
	flex: 0 0 auto;
	fill: currentColor;
	transition: transform 0.3s ease;
}

.rpc-jump-to-recipe a:hover .rpc-jump-icon,
.rpc-jump-to-recipe a:focus .rpc-jump-icon {
	transform: rotate( -18deg ) scale( 1.12 );
}

/* الوضع العائم: زر ثابت أسفل الشاشة يبقى ظاهراً أثناء التمرير */
.rpc-jump-to-recipe.rpc-jump-float {
	position: fixed;
	inset-block-end: 18px;
	inset-inline-end: 18px;
	margin: 0;
	z-index: 9990;
}

.rpc-jump-to-recipe.rpc-jump-float a {
	box-shadow: 0 3px 12px rgba( 0, 0, 0, 0.3 );
}

@media print {
	.rpc-jump-to-recipe { display: none !important; }
}

/* =====================================================================
 * 1.1.1 — عناصر البطاقة تتبع وضع الموقع تلقائياً (بدل prefers-color-scheme
 * لنظام التشغيل). كل لون محايد مشتق من currentColor، فيطابق الثيم فاتحاً
 * وداكناً. أزرار الحصص/الوحدات/المؤقت والحدود تصبح متكيّفة، ونص الطباعة
 * يبقى على لون زره الخاص (--rpc-btn-*). fallback أولاً للمتصفحات القديمة.
 * ===================================================================== */
.rpc-servings-btn,
.rpc-unit-btn,
.rpc-timer-btn {
	background: #f7f7f7;
	background: color-mix( in srgb, currentColor 7%, transparent );
	border-color: #ccc;
	border-color: color-mix( in srgb, currentColor 24%, transparent );
	color: inherit;
}

.rpc-nutrition,
.rpc-shop-panel,
.rpc-reviews-list,
.rpc-ingredient-link {
	border-color: color-mix( in srgb, currentColor 16%, transparent );
}

.rpc-recipe-card .rpc-ingredient-notes {
	color: inherit;
	opacity: 0.68;
}

.rpc-collapsible summary,
.rpc-group-title {
	color: var( --rpc-subheading, var( --rpc-accent-text, #c0392b ) );
}

/* =====================================================================
 * 1.0.2 — تنسيق أساسي لسطر الميتا (chips + جدول الأوقات) — كان يُعرض بلا
 * أنماط منذ 0.10.0، فبدا نصاً خاماً. الآن chips ملوّنة وجدول أنيق فعلاً.
 * ===================================================================== */
.rpc-recipe-meta {
	margin: 4px 0 16px;
}

.rpc-chip {
	display: inline-block;
	padding: 3px 12px;
	border-radius: 999px;
	background: #f0f2f5;
	background: color-mix( in srgb, currentColor 9%, transparent );
	color: inherit;
	font-size: 0.85em;
	font-weight: 600;
}

.rpc-times-table {
	margin-top: 10px;
}

.rpc-times-table th {
	background: #f7f8fa;
	background: color-mix( in srgb, currentColor 6%, transparent );
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: inherit;
	opacity: 0.85;
	font-weight: 700;
	border: 1px solid #eceff3;
	border: 1px solid color-mix( in srgb, currentColor 14%, transparent );
}

.rpc-times-table td {
	border: 1px solid #eceff3;
	border: 1px solid color-mix( in srgb, currentColor 14%, transparent );
	font-weight: 600;
	text-align: center;
}

.rpc-times-inline {
	margin: 8px 0 0;
	font-size: 0.9em;
	color: inherit;
	opacity: 0.75;
}

/* نص الملاحظات يتبع لون الثيم (كان رمادياً ثابتاً) */
.rpc-recipe-notes p {
	color: inherit;
	opacity: 0.85;
}

.rpc-section-title {
	color: var( --rpc-subheading, var( --rpc-accent-text, #c0392b ) );
}

/* ===== 1.2.0 — زر Pin Recipe (موديول Pinterest) ===== */
.rpc-recipe-card a.rpc-btn-pin,
.rpc-recipe-card a.rpc-btn-pin:hover,
.rpc-recipe-card a.rpc-btn-pin:focus {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border-radius: 6px;
	border: 1px solid #bd081c; /* أحمر بينتيريست المعروف */
	background: #bd081c;
	color: #fff !important;
	-webkit-text-fill-color: #fff;
	text-decoration: none !important;
	cursor: pointer;
	font-weight: 600;
}

@media print {
	.rpc-btn-pin { display: none !important; }
}

/* =====================================================================
 * 1.2.1 — Check-off للمكونات (شطب بصري عند التحديد) — صرف CSS بلا JS.
 * النقر على المربع يشطب السطر ويخفّت لونه، فيتمايز عمّا لم يُحدَّد.
 * ===================================================================== */
.rpc-ingredients-list {
	list-style: none;
	padding-inline-start: 0;
}

.rpc-ing-item {
	display: flex;
	align-items: baseline;
	gap: 9px;
	margin-bottom: 6px;
}

.rpc-ing-item .rpc-check {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	margin: 0;
	cursor: pointer;
	accent-color: var( --rpc-primary, #c0392b );
	transform: translateY( 2px );
}

.rpc-ing-item .rpc-ing-body {
	flex: 1 1 auto;
	transition: opacity 0.15s ease;
}

/* الحالة المحدَّدة: شطب + تخفيت واضح للتمايز البصري */
.rpc-ing-item .rpc-check:checked ~ .rpc-ing-body {
	text-decoration: line-through;
	text-decoration-thickness: 2px;
	opacity: 0.45;
}
