/**
 * سلايدر الرئيسية في ثيم هدي: «الكتاب المفتوح» على مكتب أخضر (template-parts/home/home-sliders.php).
 */

/* ==========================================================================
   1) المكتب: أخضر الحبر بلون واحد، وكتاب الشعار خافتاً في زاويته
   ========================================================================== */

.hd-hero {
	position: relative;
	isolation: isolate;
	padding: 48px 0 40px;
	/* خلفية بلون واحد: أخضر الحبر (طلب المالك) */
	background: var(--hd-ink);
	overflow: hidden;
}

/* هالة ذهبية خافتة خلف الكتاب، وكتاب الشعار خافتاً في زاوية المكتب الأخضر */
.hd-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(60% 70% at 50% 0, rgba(var(--hd-gold-rgb), 0.24), transparent 70%),
		radial-gradient(30% 50% at 100% 100%, rgba(255, 255, 255, 0.06), transparent 70%);
	pointer-events: none;
}

.hd-hero::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: -1;
	bottom: 0;
	background: var(--hd-gold-grad);
	opacity: 0.1;
	-webkit-mask: var(--hd-flow) left -120px bottom -70px / 640px auto no-repeat;
	mask: var(--hd-flow) left -120px bottom -70px / 640px auto no-repeat;
	pointer-events: none;
}

.hd-hero__container {
	position: relative;
}

/* ==========================================================================
   2) الكتاب: صفحتان متقابلتان، وظل الكعب بينهما، وحافة صفحات أسفلهما
   ========================================================================== */

.hd-hero__book {
	position: relative;
	padding: 10px;
	border-radius: 10px;
	/* الغلاف باللون الثانوي من الإعدادات يظهر حول الصفحات، أفتح في وسطه كلمعة الجلد */
	background: linear-gradient(90deg, color-mix(in srgb, var(--theme-secondary) 82%, #3a2a10), var(--theme-secondary) 50%, color-mix(in srgb, var(--theme-secondary) 82%, #3a2a10));
	box-shadow: 0 40px 70px -36px rgba(0, 0, 0, 0.7);
}

/* أزرار السلايدر باللون الثانوي: الأساسي ممتلئ بنص أخضر داكن، والثاني بحد ثانوي */
.hd-hero .hd-btn {
	border-color: var(--theme-secondary);
	background: var(--theme-secondary);
	color: var(--hd-ink);
}

.hd-hero .hd-btn:hover,
.hd-hero .hd-btn:focus-visible {
	border-color: var(--hd-ink);
	background: var(--hd-ink);
	color: #ffffff;
	box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.45);
}

.hd-hero .hd-btn--ghost {
	background: transparent;
	color: var(--hd-ink);
}

/* شريط العلامة أخضر فوق الغلاف الثانوي */
.hd-hero__ribbon {
	background: linear-gradient(90deg, var(--theme-primary), var(--hd-ink-soft));
}

.hd-hero__slider {
	overflow: hidden;
	border-radius: 4px;
	/* حافة الصفحات أسفل الكتاب */
	box-shadow: 0 2px 0 var(--hd-page-edge), 0 4px 0 var(--hd-page), 0 5px 0 var(--hd-page-edge);
}

.hd-hero__spread {
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: clamp(420px, 44vw, 520px);
	background: var(--hd-page);
}

.hd-hero__page {
	position: relative;
	min-width: 0;
}

/* صفحة النص: ورق مسطّر بخط هامش ذهبي، وظل الكعب على حافتها اليسرى */
.hd-hero__page--text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	padding: 56px 64px 64px 56px;
	/* ورق دافئ يزداد دفئاً نحو الكعب */
	background: linear-gradient(to left, var(--hd-page) 55%, color-mix(in srgb, var(--hd-page) 70%, var(--hd-paper-deep)));
}

/* جناحا الكتاب (من الشعار) علامةً مائية ذهبية كبيرة في زاوية الصفحة */
.hd-hero__page--text::before {
	content: '';
	position: absolute;
	bottom: 58px;
	left: 44px;
	width: min(230px, 36%);
	aspect-ratio: 3 / 1;
	background: var(--hd-gold-grad);
	opacity: 0.25;
	-webkit-mask: var(--hd-wings) center / contain no-repeat;
	mask: var(--hd-wings) center / contain no-repeat;
	pointer-events: none;
}

.hd-hero__page--text > *:not(.hd-hero__folio) {
	position: relative;
}

/* ظل الكعب على صفحة النص: الطرف الملاصق للصورة (يسار) يغمق نحو المنتصف */
.hd-hero__page--text::after {
	content: '';
	position: absolute;
	inset: 0 auto 0 0;
	width: 48px;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.16), transparent);
	pointer-events: none;
}

/* صفحة الصورة: الصورة تملأ الصفحة، وظل الكعب على حافتها اليمنى */
.hd-hero__page--media {
	overflow: hidden;
	background: var(--hd-paper-deep);
}

.hd-hero__page--media::after {
	content: '';
	position: absolute;
	inset: 0 0 0 auto;
	width: 56px;
	background: linear-gradient(to left, rgba(0, 0, 0, 0.32), transparent);
	pointer-events: none;
}

.hd-hero__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* شريحة بلا صورة: صفحة نص واحدة بعرض الكتاب */
.hd-hero__spread--text-only {
	grid-template-columns: 1fr;
}

.hd-hero__spread--text-only .hd-hero__page--text {
	align-items: center;
	text-align: center;
}

.hd-hero__spread--text-only .hd-hero__page--text::after {
	display: none;
}

/* شريط العلامة الذهبي يتدلّى من أعلى الكعب فوق الصفحتين */
.hd-hero__ribbon {
	position: absolute;
	top: 0;
	left: calc(50% - 13px);
	z-index: 3;
	width: 26px;
	height: 86px;
	pointer-events: none;
}

/* ==========================================================================
   3) محتوى صفحة النص
   ========================================================================== */

.hd-hero__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	color: var(--theme-primary);
	font-size: 0.95rem;
	font-weight: 700;
}

.hd-hero__eyebrow::before {
	content: '';
	width: 26px;
	height: 2px;
	background: var(--hd-gold);
}

.hd-hero__title {
	margin: 0;
	color: var(--hd-ink);
	font-family: var(--hd-display);
	font-weight: 800;
	line-height: 1.4;
}

.hd-hero__title-accent {
	display: block;
	margin-bottom: 4px;
	color: var(--hd-gold);
	font-size: clamp(1.25rem, 1rem + 0.8vw, 1.6rem);
}

.hd-hero__title-main {
	display: block;
	font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.4rem);
}

.hd-hero__stroke {
	width: 130px;
	height: 12px;
	margin: 12px 0 0 14px;
}

.hd-hero__desc {
	max-width: 46ch;
	margin-top: 16px;
	color: var(--theme-text-light, #5b6b60);
	font-size: 1.08rem;
	line-height: 1.95;
}

.hd-hero__desc p {
	margin: 0;
}

.hd-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 28px;
}

/* رقم الصفحة أسفل الصفحة بين خطين قصيرين */
.hd-hero__folio {
	position: absolute;
	bottom: 20px;
	left: 50%;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--hd-gold);
	font-family: var(--hd-display);
	font-size: 1.05rem;
	transform: translateX(-50%);
}

.hd-hero__folio::before,
.hd-hero__folio::after {
	content: '';
	width: 16px;
	height: 1px;
	background: currentColor;
}

/* ==========================================================================
   4) التقليب: زرّان وعلامات الشرائح تحت الكتاب
   ========================================================================== */

.hd-hero__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	margin-top: 22px;
}

.hd-hero__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid var(--theme-secondary);
	border-radius: 50%;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.hd-hero__arrow:hover,
.hd-hero__arrow:focus-visible {
	background: var(--theme-secondary);
	color: var(--hd-ink);
}

.hd-hero__dots {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* العلامة: شريط قصير، والنشطة شريط ذهبي أطول */
.hd-hero__dot {
	display: block;
	width: 14px;
	height: 6px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.3);
	cursor: pointer;
	transition: width 0.3s ease, background-color 0.3s ease;
}

.hd-hero__dot.is-active {
	width: 34px;
	background: var(--theme-secondary);
}

/* ==========================================================================
   5) الجوال والأجهزة اللوحية: الصورة فوق النص، والكعب خط أفقي
   ========================================================================== */

@media (max-width: 900px) {
	.hd-hero {
		padding: 24px 0 32px;
	}

	.hd-hero__book {
		padding: 6px;
	}

	.hd-hero__spread {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
		min-height: 0;
	}

	.hd-hero__page--media {
		grid-row: 1;
		aspect-ratio: 16 / 10;
	}

	.hd-hero__page--media::after {
		inset: auto 0 0 0;
		width: auto;
		height: 34px;
		background: linear-gradient(to top, rgba(0, 0, 0, 0.26), transparent);
	}

	.hd-hero__page--text {
		padding: 30px 24px 52px;
		background: linear-gradient(to bottom, rgba(0, 0, 0, 0.08), transparent 30px), var(--hd-page);
	}

	.hd-hero__page--text::before {
		bottom: 40px;
		left: 18px;
		width: 30%;
		opacity: 0.35;
	}

	.hd-hero__page--text::after {
		display: none;
	}

	.hd-hero__ribbon {
		left: 20px;
		width: 20px;
		height: 60px;
	}

	/* الوصف الطويل يطيل الكتاب على الجوال، فيُكتفى بخمسة أسطر */
	.hd-hero__desc {
		display: -webkit-box;
		overflow: hidden;
		font-size: 1rem;
		-webkit-line-clamp: 5;
		-webkit-box-orient: vertical;
	}

	.hd-hero__folio {
		bottom: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hd-hero__dot,
	.hd-hero__arrow {
		transition: none;
	}
}
