/*
 * عابرين — pages/single.css
 * Single post additions of SPEC §18.5, loaded after pages/blog.css on single posts
 * (handle stv-page-single): spacing of the blocks under the article footer, the
 * "products mentioned in the article" row (template-parts/components/post-products.php,
 * product cards come from woocommerce.css), the newsletter box
 * (template-parts/components/newsletter-box.php, form base styles in footer.css) and the
 * previous / next navigation (template-parts/components/post-nav.php).
 * Mobile-first, tokens only (the light mode re-maps them), logical properties only.
 */

/* ===== Rhythm of the blocks after the article footer ===== */
.stv-article > .stv-post-products,
.stv-article > .stv-newsletter-box,
.stv-article > .stv-author-box,
.stv-article > .stv-post-nav,
.stv-article > .stv-related {
	margin-block-start: var(--stv-space-6);
}

/* ===== Shared section head ===== */
.stv-post-products__head {
	display: flex;
	align-items: center;
	gap: var(--stv-space-3);
	margin-block-end: var(--stv-space-4);
}

.stv-post-products__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: var(--stv-radius-md);
	background: var(--stv-color-primary-soft);
	color: var(--stv-color-primary);
}

.stv-post-products__title {
	font-size: var(--stv-font-size-xl);
	font-weight: var(--stv-weight-heading);
	line-height: var(--stv-lh-heading);
}

/* ===== Products mentioned in the article ===== */
.stv-post-products {
	padding: var(--stv-space-4);
	border: 1px solid var(--stv-color-border);
	border-radius: var(--stv-radius-lg);
	background: linear-gradient(180deg, var(--stv-color-surface) 0%, transparent 100%);
}

.stv-post-products__grid { --stv-grid-gap: var(--stv-space-3); }

.stv-post-products__card { height: 100%; }

/* ===== Newsletter box ===== */
.stv-newsletter-box {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--stv-space-4);
	padding: var(--stv-space-5);
	overflow: hidden;
	border: 1px solid var(--stv-color-border-strong);
	border-radius: var(--stv-radius-xl);
	background:
		radial-gradient(120% 140% at 100% 0%, var(--stv-color-primary-soft) 0%, transparent 60%),
		radial-gradient(90% 120% at 0% 100%, var(--stv-color-secondary-soft) 0%, transparent 55%),
		var(--stv-color-surface);
}

[dir="ltr"] .stv-newsletter-box {
	background:
		radial-gradient(120% 140% at 0% 0%, var(--stv-color-primary-soft) 0%, transparent 60%),
		radial-gradient(90% 120% at 100% 100%, var(--stv-color-secondary-soft) 0%, transparent 55%),
		var(--stv-color-surface);
}

.stv-newsletter-box__intro {
	display: flex;
	align-items: flex-start;
	gap: var(--stv-space-3);
}

.stv-newsletter-box__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: var(--stv-radius-md);
	background: var(--stv-gradient-brand);
	color: var(--stv-color-on-primary);
	box-shadow: var(--stv-shadow-glow);
}

.stv-newsletter-box__copy {
	display: flex;
	flex-direction: column;
	gap: var(--stv-space-1);
	min-width: 0;
}

.stv-newsletter-box__title {
	font-size: var(--stv-font-size-xl);
	font-weight: var(--stv-weight-heading);
	line-height: var(--stv-lh-heading);
}

.stv-newsletter-box__text {
	margin: 0;
	font-size: var(--stv-font-size-sm);
	color: var(--stv-color-text-muted);
}

.stv-newsletter-box__form {
	display: flex;
	flex-direction: column;
	gap: var(--stv-space-2);
	min-width: 0;
}

.stv-newsletter--box .stv-newsletter__row { flex-direction: column; }

.stv-newsletter--box .stv-newsletter__input {
	min-height: var(--stv-control-height);
	background: var(--stv-color-surface-2);
}

.stv-newsletter--box .stv-newsletter__btn { min-height: var(--stv-control-height); }

.stv-newsletter--box.is-subscribed .stv-newsletter__input { border-color: var(--stv-color-success); }

.stv-newsletter-box__note {
	display: inline-flex;
	align-items: center;
	gap: var(--stv-space-1);
	margin: 0;
	font-size: var(--stv-font-size-xs);
	color: var(--stv-color-text-muted);
}

/* ===== Previous / next navigation ===== */
.stv-post-nav__list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--stv-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.stv-post-nav__item {
	display: flex;
	min-width: 0;
}

.stv-post-nav__link {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	gap: var(--stv-space-3);
	min-width: 0;
	padding: var(--stv-space-3);
	border: 1px solid var(--stv-color-border);
	border-radius: var(--stv-radius-lg);
	background: var(--stv-color-surface);
	color: var(--stv-color-text);
	text-decoration: none;
	transition: transform var(--stv-transition), border-color var(--stv-transition), box-shadow var(--stv-transition);
}

.stv-post-nav__item--next .stv-post-nav__link {
	flex-direction: row-reverse;
	text-align: end;
}

.stv-post-nav__media {
	flex: 0 0 auto;
	width: 72px;
	height: 72px;
	overflow: hidden;
	border-radius: var(--stv-radius-md);
	background: var(--stv-color-surface-2);
}

.stv-post-nav__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.stv-post-nav__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.stv-post-nav__item--next .stv-post-nav__body { align-items: flex-end; }

.stv-post-nav__label {
	display: inline-flex;
	align-items: center;
	gap: var(--stv-space-1);
	font-size: var(--stv-font-size-xs);
	font-weight: var(--stv-weight-ui);
	color: var(--stv-color-primary);
}

.stv-post-nav__arrow { transition: transform var(--stv-transition); }

.stv-post-nav__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	font-size: var(--stv-font-size-base);
	font-weight: var(--stv-weight-heading);
	line-height: var(--stv-lh-heading);
}

.stv-post-nav__date {
	font-size: var(--stv-font-size-xs);
	color: var(--stv-color-text-muted);
}

.stv-post-nav__link:focus-visible {
	border-color: var(--stv-color-primary);
	box-shadow: var(--stv-focus-ring);
	outline: none;
}

@media (hover: hover) {
	.stv-post-nav__link:hover {
		border-color: var(--stv-color-primary);
		box-shadow: var(--stv-shadow-glow);
		text-decoration: none;
	}
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.stv-post-nav__link:hover { transform: var(--stv-lift); }

	/*
	 * The arrow nudges toward the side the link leads to: the start side for the
	 * previous article, the end side for the next one. The arrows are logical icons,
	 * mirrored with scaleX(-1) under [dir="ltr"] (base.css), so the LTR rules keep the
	 * mirror and translate inside it.
	 */
	[dir="rtl"] .stv-post-nav__item--prev .stv-post-nav__link:hover .stv-post-nav__arrow { transform: translateX(3px); }

	[dir="rtl"] .stv-post-nav__item--next .stv-post-nav__link:hover .stv-post-nav__arrow { transform: translateX(-3px); }

	[dir="ltr"] .stv-post-nav__item--prev .stv-post-nav__link:hover .stv-post-nav__arrow { transform: scaleX(-1) translateX(3px); }

	[dir="ltr"] .stv-post-nav__item--next .stv-post-nav__link:hover .stv-post-nav__arrow { transform: scaleX(-1) translateX(-3px); }
}

/* ===== Breakpoints ===== */
@media (min-width: 600px) {
	.stv-article > .stv-post-products,
	.stv-article > .stv-newsletter-box,
	.stv-article > .stv-author-box,
	.stv-article > .stv-post-nav,
	.stv-article > .stv-related {
		margin-block-start: var(--stv-space-7);
	}

	.stv-post-products { padding: var(--stv-space-5); }

	.stv-post-products__grid { --stv-grid-gap: var(--stv-space-4); }

	.stv-newsletter-box { padding: var(--stv-space-6); }

	.stv-newsletter--box .stv-newsletter__row { flex-direction: row; }

	.stv-newsletter--box .stv-newsletter__btn { padding-inline: var(--stv-space-5); }

	.stv-post-nav__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

	/* A lone "next" card stays on the end side */
	.stv-post-nav__item--next { grid-column: 2; }
}

@media (min-width: 900px) {
	.stv-newsletter-box {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
		align-items: center;
		gap: var(--stv-space-6);
		padding: var(--stv-space-7);
	}

	.stv-newsletter-box__title { font-size: var(--stv-font-size-2xl); }
}

@media (min-width: 1200px) {
	/* Main column next to the sidebar: three product cards per row */
	.stv-single .stv-post-products__grid { --stv-grid-cols: 3; }
}

/* ===== Print ===== */
@media print {
	.stv-post-products,
	.stv-newsletter-box,
	.stv-post-nav {
		display: none !important;
	}
}

/* ===== Reduced motion (the lift and arrow nudge above only run without this preference) ===== */
@media (prefers-reduced-motion: reduce) {
	.stv-post-nav__link,
	.stv-post-nav__arrow {
		transition: none;
	}
}

/* Cards inside the padded box: keep «أضف للسلة» inside its button on phones. */
.stv-post-products .stv-product-card__btn {
	padding-inline: var(--stv-space-2);
}

@media (max-width: 599.98px) {
	.stv-post-products {
		padding-inline: var(--stv-space-2);
	}
}
